static char sccsid
[] = "@(#)dounit.c 4.3 (Berkeley) 9/11/87";
int remind
= 2; /* to remind user of "again" and "bye" */
start(todo
); /* clean up play directory */
sprintf(tbuff
, "%s/%s/L%s", direct
, sname
, todo
); /* script = lesson */
scrin
= fopen(tbuff
, "r");
fprintf(stderr
, "Dounit: no lesson %s.\n", tbuff
);
copy(0, scrin
); /* print lesson, usually */
copy(1, stdin
); /* user takes over */
setdid(todo
, sequence
++);
if (again
|| skip
) /* if "again" or "skip" */
copy(0, scrin
); /* evaluate user's response */
printf("\nSorry, that's %snot right. Do you want to try again? ",
wrong
> 1 ? "still " : "");
printf("Try the problem again.\n");
printf("[ Whenever you want to re-read the lesson, type \"again\".\n");
printf(" You can always leave learn by typing \"bye\". ]\n");
} else if (strcmp(tbuff
, "bye") == 0) {
} else if (tbuff
[0] == 'n') {
printf("\nOK. That was lesson %s.\n", todo
);
printf("Skipping to next lesson.\n\n");
printf("\nPlease type yes, no or bye: ");
setdid(todo
, sequence
++);