Correct the handling of (for example) the N command by only zeroing the

input space in mf_fgets() if we reach the end of all input files.
This commit is contained in:
Tim J. Robbins 2002-06-16 08:44:39 +00:00
parent 2b13992856
commit 254fac850d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=98294

View File

@ -315,7 +315,6 @@ mf_fgets(sp, spflag)
firstfile = 1;
}
sp->len = 0;
for (;;) {
if (f != NULL && (c = getc(f)) != EOF) {
(void)ungetc(c, f);
@ -323,6 +322,7 @@ mf_fgets(sp, spflag)
}
/* If we are here then either eof or no files are open yet */
if (f == stdin) {
sp->len = 0;
lastline = 1;
return (0);
}
@ -334,6 +334,7 @@ mf_fgets(sp, spflag)
} else
firstfile = 0;
if (files == NULL) {
sp->len = 0;
lastline = 1;
return (0);
}