diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-07-22 07:26:13 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-07-22 07:26:13 +0000 |
commit | fcc10ffab6d696cdda8a1a33b8e1720d90f7a15b (patch) | |
tree | aae8d3effebc9e4e1428c1cedafc35666ebcb62c /stdio-common | |
parent | 40c014b3dcc698ae2cc935aefabbeb2196088128 (diff) | |
download | glibc-fcc10ffab6d696cdda8a1a33b8e1720d90f7a15b.zip glibc-fcc10ffab6d696cdda8a1a33b8e1720d90f7a15b.tar.gz glibc-fcc10ffab6d696cdda8a1a33b8e1720d90f7a15b.tar.bz2 |
Update.
* stdio-common/vfscanf.c: Handle input -- with format %f correctly
(it's no input error).
* stdio-common/tstscanf.c: Add test case for format %f with input --.
* stdio-common/scanf12.c: Correct expected result for first scanf.
Diffstat (limited to 'stdio-common')
-rw-r--r-- | stdio-common/scanf12.c | 2 | ||||
-rw-r--r-- | stdio-common/tstscanf.c | 17 | ||||
-rw-r--r-- | stdio-common/vfscanf.c | 6 |
3 files changed, 19 insertions, 6 deletions
diff --git a/stdio-common/scanf12.c b/stdio-common/scanf12.c index b557785..db37e2f 100644 --- a/stdio-common/scanf12.c +++ b/stdio-common/scanf12.c @@ -7,7 +7,7 @@ main (void) double d; int c; - if (scanf ("%lg", &d) != EOF) + if (scanf ("%lg", &d) != 0) { printf ("scanf didn't failed\n"); exit (1); diff --git a/stdio-common/tstscanf.c b/stdio-common/tstscanf.c index 6db98ee..4732657 100644 --- a/stdio-common/tstscanf.c +++ b/stdio-common/tstscanf.c @@ -277,7 +277,7 @@ main (int argc, char **argv) /* From PR libc/1313 reported by Ben Caradoc-Davies <bmcd@physics.otago.ac.nz>. */ float value; int res; - + res = sscanf ("0123", "%2f", &value); if (res != 1 || value != 1.0) { @@ -285,6 +285,19 @@ main (int argc, char **argv) result = 1; } } - + + fputs ("Test 10:\n", stdout); + { + float value; + int res; + + res = sscanf ("--", "%f", &value); + if (res != 0) + { + fputs ("test failed!\n", stdout); + result = 1; + } + } + exit (result); } diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index 90d73bd..9457c4c 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -1270,7 +1270,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr) if (n == 10) { - /*Have not yet found the digit. */ + /* Have not yet found the digit. */ while (++from_level <= to_level) { /* Search all ten digits of this level. */ @@ -1491,7 +1491,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr) { /* This is no valid number. */ ungetc (c, s); - input_error (); + conv_error (); } #else /* Match against the decimal point. At this point @@ -1524,7 +1524,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr) c = *--cmpp; } - input_error (); + conv_error (); } if (width > 0) /* +1 because we substract below. */ |