+mnemon_show_challenge (mnemon_t *mnemon,
+ challenge_type_t challenge_type,
+ const char *challenge)
+{
+ const char *program;
+ char *command;
+
+ if (challenge_type == CHALLENGE_TYPE_TEXT) {
+ printf ("%s\n", challenge);
+ return;
+ }
+
+ /* XXX: Yes, shelling out to system is total cheese. The planned
+ * fix here is to bring graphical display in process, (or at least
+ * have a custom external program that accepts image filenames on
+ * stdin.
+ */
+ switch (challenge_type) {
+ case CHALLENGE_TYPE_TEXT:
+ ASSERT_NOT_REACHED;
+ break;
+ case CHALLENGE_TYPE_IMAGE:
+ program = "xli -gamma 2.2";
+ break;
+ case CHALLENGE_TYPE_AUDIO:
+ program = "play";
+ break;
+ case CHALLENGE_TYPE_MIDI:
+ program = "timidity -Os";
+ break;
+ case CHALLENGE_TYPE_TEXT_TO_SPEECH:
+ program = "mnemon-tts";
+ break;
+ }
+
+ xasprintf (&command, "%s %s/%s >/dev/null 2>&1 &",
+ program,
+ mnemon->dir_name,
+ challenge);
+ system (command);
+ free (command);
+}
+
+static void
+mnemon_hide_challenge (unused (mnemon_t *mnemon),
+ challenge_type_t challenge_type)
+{
+ char * command;
+
+ if (challenge_type != CHALLENGE_TYPE_IMAGE)
+ return;
+
+ /* XXX: And this is just embarrassing (obviously wrong in several
+ * ways). Hopefully I'll amend away any commit that includes this.
+ */
+ xasprintf (&command, "killall xli");
+ system (command);
+ free (command);
+}
+
+void