--- cci/usr/src/usr.bin/learn/copy.c 2019/07/28 12:24:19 1.1 +++ cci/usr/src/usr.bin/learn/copy.c 2019/07/28 12:26:15 1.1.1.2 @@ -31,12 +31,11 @@ FILE *fin; sprintf(subdir, "%s/%s", direct, sname); for (;;) { if (pgets(s, prompt, fin) == 0) - if (fin == stdin) { + if (fin == stdin) { fprintf(stderr, "Type \"bye\" if you want to leave learn.\n"); fflush(stderr); continue; - } else - break; + } trim(s); /* trim newline */ /* change the sequence %s to lesson directory */ /* if needed */ @@ -221,7 +220,6 @@ FILE *fin; break; } } - return; } pgets(s, prompt, f) @@ -236,8 +234,8 @@ FILE *f; } if (fgets(s, 100,f)) return(1); - else - return(0); + if (f == stdin) rewind(f); + return(0); } trim(s)