diff options
author | Roland McGrath <roland@gnu.org> | 1995-12-23 01:14:10 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1995-12-23 01:14:10 +0000 |
commit | 2114e10acb7494eddd5417c27cd52199f4fe9517 (patch) | |
tree | 30543b37265562f35608e99bb7c4a312c19c919c /stdio-common | |
parent | 975320984b9f9fa6742136447ec82e7e304d83fd (diff) | |
download | glibc-2114e10acb7494eddd5417c27cd52199f4fe9517.tar.gz |
Fri Dec 22 00:38:00 1995 H.J. Lu <hjl@nynexst.com>
* stdio-common/vfscanf.c: Correctly handle white space skipping.
* stdio-common/Makefile (tests): Add bug11.
* stdio-common/bug11.c: New file.
Fri Dec 22 00:38:00 1995 H.J. Lu <hjl@nynexst.com>
* stdio-common/vfscanf.c: Correctly handle white space skipping.
* stdio-common/Makefile (tests): Add bug11.
* stdio-common/bug11.c: New file.
Diffstat (limited to 'stdio-common')
-rw-r--r-- | stdio-common/Makefile | 2 | ||||
-rw-r--r-- | stdio-common/bug11.c | 13 | ||||
-rw-r--r-- | stdio-common/vfscanf.c | 7 |
3 files changed, 17 insertions, 5 deletions
diff --git a/stdio-common/Makefile b/stdio-common/Makefile index a718db6a2c..d8cd8af749 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -39,7 +39,7 @@ distribute := _itoa.h printf-parse.h tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \ temptest tst-fileno test-fwrite \ xbug errnobug \ - bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 \ + bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 \ tfformat tiformat tstdiomisc diff --git a/stdio-common/bug11.c b/stdio-common/bug11.c new file mode 100644 index 0000000000..1f5739cb7d --- /dev/null +++ b/stdio-common/bug11.c @@ -0,0 +1,13 @@ +#include <stdio.h> +#include <string.h> + +main () +{ + int ret; + char buf [1024] = "Ooops"; + + ret = sscanf ("static char Term_bits[] = {", "static char %s = {", buf); + printf ("ret: %d, name: %s\n", ret, buf); + + return strcmp (buf, "Term_bits[]") != 0 || ret != 1; +} diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index df68260cdd..14aa7d9748 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -233,9 +233,8 @@ __vfscanf (FILE *s, const char *format, va_list argptr) if (c == EOF) input_error (); - /* We saw an white space as the last character in the format - string. Now it's time to skip all leading white - spaces. */ + /* We saw white space char as the last character in the format + string. Now it's time to skip all leading white space. */ if (skip_space) { while (isspace (c)) @@ -243,7 +242,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr) skip_space = 0; } - else if (c == fc) + if (c == fc) (void) inchar (); else conv_error (); |