+2000-10-04 Jakub Jelinek <jakub@redhat.com>
+
+ * stdio-common/vfscanf.c (_IO_vfscanf): For [ conversion do
+ input_error() if EOF is seen before processing.
+ * stdio-common/tstscanf.c (main): Add testcase.
+
2000-10-04 Ulrich Drepper <drepper@redhat.com>
* argp/argp-help.c: Make sure we get the correct gettext and
result = 1;
}
+ if (sscanf ("", "%10[a-z]", buf) != EOF)
+ {
+ fputs ("test failed!\n", stdout);
+ result = 1;
+ }
+
sscanf ("conversion] Zero flag Ze]ro#\n", "%*[^]] %[^#]\n", buf);
if (strcmp (buf, "] Zero flag Ze]ro") != 0)
{
{
size_t now = read_in;
#ifdef COMPILE_WSCANF
+ if (inchar () == WEOF)
+ input_error ();
+
do
{
wchar_t *runp;
- if (inchar () == WEOF)
- break;
-
/* Test whether it's in the scanlist. */
runp = tw;
while (runp < wp)
}
}
}
- while (--width > 0);
+ while (--width > 0 && inchar () != WEOF);
out:
#else
char buf[MB_LEN_MAX];
size_t cnt = 0;
mbstate_t cstate;
+ if (inchar () == EOF)
+ input_error ();
+
memset (&cstate, '\0', sizeof (cstate));
do
{
- again:
- if (inchar () == EOF)
- break;
-
if (wp[c] == not_in)
{
ungetc_not_eof (c, s);
/* Possibly correct character, just not enough
input. */
assert (cnt < MB_CUR_MAX);
- goto again;
+ continue;
}
if (n != cnt)
}
}
}
+
+ if (--width <= 0)
+ break;
}
- while (--width > 0);
+ while (inchar () != EOF);
if (cnt != 0)
/* We stopped in the middle of recognizing another
else
{
size_t now = read_in;
+
+ if (inchar () == EOF)
+ input_error ();
+
#ifdef COMPILE_WSCANF
memset (&state, '\0', sizeof (state));
wchar_t *runp;
size_t n;
- if (inchar () == WEOF)
- break;
-
/* Test whether it's in the scanlist. */
runp = tw;
while (runp < wp)
assert (n <= MB_CUR_MAX);
str += n;
}
- while (--width > 0);
+ while (--width > 0 && inchar () != WEOF);
out2:
#else
do
{
- if (inchar () == EOF)
- break;
-
if (wp[c] == not_in)
{
ungetc_not_eof (c, s);
}
}
}
- while (--width > 0);
+ while (--width > 0 && inchar () != EOF);
#endif
if (now == read_in)