static void
_show_challenge (mnemon_t *mnemon,
- challenge_type_t challenge_type,
+ const char *challenge_type,
const char *challenge)
{
const char *program;
char *command;
- if (challenge_type == CHALLENGE_TYPE_TEXT) {
+ if (strcmp (challenge_type, "text") == 0) {
printf ("%s\n", challenge);
return;
}
* 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:
+ if (strcmp (challenge_type, "image") == 0) {
program = "xli -gamma 2.2";
- break;
- case CHALLENGE_TYPE_AUDIO:
+ } else if (strcmp (challenge_type, "audio") == 0) {
program = "play";
- break;
- case CHALLENGE_TYPE_MIDI:
+ } else if (strcmp (challenge_type, "midi") == 0) {
program = "timidity -Os";
- break;
- case CHALLENGE_TYPE_TEXT_TO_SPEECH:
+ } else if (strcmp (challenge_type, "text-to-speech") == 0) {
program = "mnemon-tts";
- break;
+ } else {
+ fprintf (stderr, "Error: unsupported challenge type: %s\n",
+ challenge_type);
+ exit (1);
}
xasprintf (&command, "%s %s/%s >/dev/null 2>&1 &",
static void
_hide_challenge (unused (mnemon_t *mnemon),
- challenge_type_t challenge_type)
+ const char *challenge_type)
{
char * command;
- if (challenge_type != CHALLENGE_TYPE_IMAGE)
+ if (strcmp (challenge_type, "image"))
return;
/* XXX: And this is just embarrassing (obviously wrong in several