--- cci/usr/src/usr.bin/learn/dounit.c 2019/07/28 12:24:19 1.1 +++ cci/usr/src/usr.bin/learn/dounit.c 2019/07/28 12:26:13 1.1.1.2 @@ -36,8 +36,8 @@ retry: return; if (more == 0) return; - copy(0, scrin); /* evaluate user's response */ + copy(0, scrin); /* evaluate user's response */ if (comfile >= 0) close(comfile); wait(&didok); @@ -49,6 +49,7 @@ retry: fflush(stdout); for(;;) { gets(tbuff); + if (strcmp(tbuff, "bye") == 0) wrapup(0); if (tbuff[0] == 'y') { printf("Try the problem again.\n"); if (remind--) { @@ -56,18 +57,17 @@ retry: printf(" You can always leave learn by typing \"bye\". ]\n"); } goto retry; - } else if (strcmp(tbuff, "bye") == 0) { - wrapup(0); } else if (tbuff[0] == 'n') { wrong = 0; printf("\nOK. That was lesson %s.\n", todo); printf("Skipping to next lesson.\n\n"); fflush(stdout); break; - } else { - printf("Please type yes, no or bye: "); - fflush(stdout); + } else { + printf("\nPlease type yes, no or bye: "); + fflush(stdout); } + rewind(stdin); } } setdid(todo, sequence++);