Don't return immediately if EOF encountered while matching format string white

space in the input stream since there may be `conversion' specifiers following
the (format string) white space that do not operate on the input stream,
i.e. %n; from Chris Torek.
This commit is contained in:
kleink 1998-10-25 18:25:43 +00:00
parent d6ebbdb79a
commit 56068ec670
1 changed files with 4 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfscanf.c,v 1.20 1998/07/27 14:12:36 mycroft Exp $ */
/* $NetBSD: vfscanf.c,v 1.21 1998/10/25 18:25:43 kleink Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: vfscanf.c,v 1.20 1998/07/27 14:12:36 mycroft Exp $");
__RCSID("$NetBSD: vfscanf.c,v 1.21 1998/10/25 18:25:43 kleink Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -138,13 +138,9 @@ __svfscanf(fp, fmt0, ap)
if (c == 0)
return (nassigned);
if (isspace(c)) {
for (;;) {
if (fp->_r <= 0 && __srefill(fp))
return (nassigned);
if (!isspace(*fp->_p))
break;
while ((fp->_r > 0 || __srefill(fp) == 0) &&
isspace(*fp->_p))
nread++, fp->_r--, fp->_p++;
}
continue;
}
if (c != '%')