* logfiles for testing purposes.
*/
/* Normal case - no script arguments */
- if (settings.argc == 0)
- return readline(prompt);
+ if (settings.argc == 0) {
+ char *ln = readline(prompt);
+ if (ln == NULL) {
+ fputs(prompt, stdout);
+ }
+ return ln;
+ }
char *buf = malloc(LINESIZE + 1);
for (;;) {
} else {
char *ln = fgets(buf, LINESIZE, settings.scriptfp);
if (ln != NULL) {
- fputs(PROMPT, stdout);
+ fputs(prompt, stdout);
fputs(ln, stdout);
- return ln;
+ return ln;
}
}
}
return true;
}
-static bool do_command()
+static bool do_command(void)
/* Get and execute a command */
{
static command_t command;
if (!get_command_input(&command))
return false;
+ /* Every input, check "foobar" flag. If zero, nothing's going
+ * on. If pos, make neg. If neg, he skipped a word, so make it
+ * zero.
+ */
+ game.foobar = (game.foobar > WORD_EMPTY) ? -game.foobar : WORD_EMPTY;
+
++game.turns;
preprocess_command(&command);
}