diff options
Diffstat (limited to 'stdio-common')
-rw-r--r-- | stdio-common/tstscanf.c | 9 | ||||
-rw-r--r-- | stdio-common/vfscanf.c | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/stdio-common/tstscanf.c b/stdio-common/tstscanf.c index 93f77ce2d9..6db98eef31 100644 --- a/stdio-common/tstscanf.c +++ b/stdio-common/tstscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 96, 97, 98, 99 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -39,6 +39,13 @@ main (int argc, char **argv) result = 1; } + if (sscanf ("08905x", "%9[0-9]", buf) != 1 + || strcmp (buf, "08905") != 0) + { + fputs ("test failed!\n", stdout); + result = 1; + } + sscanf ("conversion] Zero flag Ze]ro#\n", "%*[^]] %[^#]\n", buf); if (strcmp (buf, "] Zero flag Ze]ro") != 0) { diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index 0412ca66eb..3ca82cc4c7 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -1657,9 +1657,8 @@ __vfscanf (FILE *s, const char *format, va_list argptr) ++f; } - tw = (char *) f; while ((fc = *f++) != '\0' && fc != ']') - if (fc == '-' && *f != '\0' && *f != ']' && f - 2 != tw + if (fc == '-' && *f != '\0' && *f != ']' && (unsigned char) f[-2] <= (unsigned char) *f) { /* Add all characters from the one before the '-' |