From 9df541684a60a94d94cc0c08de119eec718f2318 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 22 Sep 1999 16:03:46 +0000 Subject: Update. 1999-09-22 Andreas Jaeger * stdio-common/tstscanf.c (main): Add test case from PR libc/1313 reported by Ben Caradoc-Davies . 1999-09-22 Andreas Schwab * stdio-common/vfscanf.c: Fix width handling when scanning floats. 1999-04-02 Andreas Jaeger * elf/Makefile (CFLAGS-multiload.c): Change to allow building in the source directory. Fixes PR libc/1059. --- ChangeLog | 14 + elf/Makefile | 2 +- localedata/ChangeLog | 4 + localedata/locales/zh_CN | 894 +++++++++++++++++++++++------------------------ stdio-common/tstscanf.c | 14 + stdio-common/vfscanf.c | 50 ++- 6 files changed, 518 insertions(+), 460 deletions(-) diff --git a/ChangeLog b/ChangeLog index 10f85c3..9c4fd63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +1999-09-22 Andreas Jaeger + + * stdio-common/tstscanf.c (main): Add test case from PR libc/1313 + reported by Ben Caradoc-Davies . + +1999-09-22 Andreas Schwab + + * stdio-common/vfscanf.c: Fix width handling when scanning floats. + +1999-04-02 Andreas Jaeger + + * elf/Makefile (CFLAGS-multiload.c): Change to allow building in + the source directory. Fixes PR libc/1059. + 1999-09-21 Ulrich Drepper * locale/programs/repertoire.c (repertoire_find_value): Abort if diff --git a/elf/Makefile b/elf/Makefile index c93e3eb..ff5f44a 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -230,7 +230,7 @@ $(objpfx)loadfail.out: $(objpfx)failobj.so $(objpfx)multiload: $(libdl) LDFLAGS-multiload = -rdynamic -CFLAGS-multiload.c = -DOBJDIR=\"$(objpfx)\" +CFLAGS-multiload.c = -DOBJDIR=\"$(elf-objpfx)\" $(objpfx)multiload.out: $(objpfx)testobj1.so diff --git a/localedata/ChangeLog b/localedata/ChangeLog index f55c3cd..37d566c 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,7 @@ +1999-09-22 Ulrich Drepper + + * locales/zh_CN: Some first patches to make the file usable. + 1999-09-13 Ulrich Drepper * locales/id_ID: Fix typo. diff --git a/localedata/locales/zh_CN b/localedata/locales/zh_CN index 34d8528..6ac39fe 100644 --- a/localedata/locales/zh_CN +++ b/localedata/locales/zh_CN @@ -35,12 +35,12 @@ LC_CTYPE % Greek letters in GB2312-1980, % Russian letters in GB2312-1980. -upper ;;;;;;;;;;;;;\ - ;;

;;;;;;;;;;;/ + ....;/ + ....;/ + .... + % % lower class: % Alphabets in portable character set, @@ -48,11 +48,11 @@ upper ;;;;;;;;;;;;;\ % Greek letters in GB2312-1980, % Russian letters in GB2312-1980. -lower ;;;;;;;;;;;;;\ - ;;

;;;;;;;;;;;\ - ;...;;\ - ;...;;\ - ;...; +lower ;;;;;;;;;;;;;/ + ;;

;;;;;;;;;;;/ + ....;/ + ....;/ + .... % % alpha class (default): @@ -63,55 +63,55 @@ lower ;;;;;;;;;;;;;\ % % digit class % -digit ;;;;;\ +digit ;;;;;/ ;;;; - + % % space class: % Space characters defined in ISO DIS 9945-2 "POSIX" locale % Space in GB2312-1980 % -space ;;;;\ - ;;\ +space ;;;;/ + ;;/ % % cntrl class: C0 and C1 control characters as per ISO 6429. % SS2 and SS3 may be excluded if an acompanying charmap uses them -% as single shifts to invoke graphic characters (as in EUC). +% as single shifts to invoke graphic characters (as in EUC). % Control characters in udc or vdc may be added. -% - - -cntrl ;;;;;\ - ;;\ - ;;;;;;;;\ - ;;;;;;;;\ - ;;;;;;;;\ - ;;\ - ;;;;;;;;;;\ - ;;;;;;\ - ;;;;;;;;\ +% + + +cntrl ;;;;;/ + ;;/ + ;;;;;;;;/ + ;;;;;;;;/ + ;;;;;;;;/ + ;;/ + ;;;;;;;;;;/ + ;;;;;;/ + ;;;;;;;;/ ;;;;;;;; - + % % punct class: % Special characters in udc or vdc may be added as long as they % do not belong to classes cntrl, alpha, digit. % -punct ;;;\ - ;;;;\ - ;;;\ - ;;;;;\ - ;;;;\ - ;;;\ - ;;;\ - ;;;\ - ;;;;\ - ;...;;\ - ;...;;\ +punct ;;;/ + ;;;;/ + ;;;/ + ;;;;;/ + ;;;;/ + ;;;/ + ;;;/ + ;;;/ + ;;;;/ + ....;/ + ....;/ ;;;; % @@ -120,229 +120,229 @@ punct ;;;\ % GB2312-1980 printable characters % Printable characters in udc or vdc classes may be added. -graph ;;;\ - ;;;;\ - ;;;\ - ;;;;;\ - ;;;;;\ - ;;;;;\ - ;;;;\ - ;;\ - ;\ - ;;;;;;;;;;;;;\ - ;;

;;;;;;;;;;;\ - ;;;\ - ;;\ - ;\ - ;;;;;;;;;;;;;\ - ;;

;;;;;;;;;;;\ - ;;;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...; - +graph ;;;/ + ;;;;/ + ;;;/ + ;;;;;/ + ;;;;;/ + ;;;;;/ + ;;;;/ + ;;/ + ;/ + ;;;;;;;;;;;;;/ + ;;

;;;;;;;;;;;/ + ;;;/ + ;;/ + ;/ + ;;;;;;;;;;;;;/ + ;;

;;;;;;;;;;;/ + ;;;;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + .... + % % print class: % , , % upper, lower, alpha, digit, xdigit % GB2312-1980 printable characters -print ;\ - ;;;\ - ;;;;\ - ;;;\ - ;;;;;\ - ;;;;;\ - ;;;;;\ - ;;;;\ - ;;\ - ;\ - ;;;;;;;;;;;;;\ - ;;

;;;;;;;;;;;\ - ;;;\ - ;;\ - ;\ - ;;;;;;;;;;;;;\ - ;;

;;;;;;;;;;;\ - ;;;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...;;\ - ;...; +print ;/ + ;;;/ + ;;;;/ + ;;;/ + ;;;;;/ + ;;;;;/ + ;;;;;/ + ;;;;/ + ;;/ + ;/ + ;;;;;;;;;;;;;/ + ;;

;;;;;;;;;;;/ + ;;;/ + ;;/ + ;/ + ;;;;;;;;;;;;;/ + ;;

;;;;;;;;;;;/ + ;;;;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + ....;/ + .... % % xdigit class % -xdigit ;;;;;\ - ;;;;;\ - ;;;;;;\ +xdigit ;;;;;/ + ;;;;;/ + ;;;;;;/ ;;;;; - + % % blank class % @@ -352,206 +352,206 @@ blank ; % toupper and tolower: also handle Roman, Greek and Russian % characters in GB3212-1980 -toupper (,);(,);(,);(,);(,);\ - (,);(,);(,);(,);(,);\ - (,);(,);(,);(,);(,);\ - (

,

);(,);(,);(,);(,);\ - (,);(,);(,);(,);(,);\ - (,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ +toupper (,);(,);(,);(,);(,);/ + (,);(,);(,);(,);(,);/ + (,);(,);(,);(,);(,);/ + (

,

);(,);(,);(,);(,);/ + (,);(,);(,);(,);(,);/ + (,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ (,);(,);(,) -tolower (,);(,);(,);(,);(,);\ - (,);(,);(,);(,);(,);\ - (,);(,);(,);(,);(,);\ - (

,

);(,);(,);(,);(,);\ - (,);(,);(,);(,);(,);\ - (,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ - (,);(,);(,);\ +tolower (,);(,);(,);(,);(,);/ + (,);(,);(,);(,);(,);/ + (,);(,);(,);(,);(,);/ + (

,

);(,);(,);(,);(,);/ + (,);(,);(,);(,);(,);/ + (,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ + (,);(,);(,);/ (,);(,);(,) END LC_CTYPE - + LC_COLLATE order_start forward - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + % % GB2312-1980 Code order here @@ -824,7 +824,7 @@ END LC_COLLATE % The following is Keld Simonsen's work. % I guess no need to add anything. - + LC_MONETARY int_curr_symbol "" currency_symbol "" @@ -842,14 +842,14 @@ n_sep_by_space 0 p_sign_posn 1 n_sign_posn 4 END LC_MONETARY - + LC_NUMERIC decimal_point "<.>" thousands_sep "<,>" grouping 3;0 END LC_NUMERIC - -LC_TIME + +LC_TIME abday "","";"";"";/ "";"";"" day "";/ @@ -889,8 +889,8 @@ t_fmt "<%>" am_pm "";"" t_fmt_ampm "" END LC_TIME - + LC_MESSAGES yesexpr "<<(><1><)/>><.><*>" noexpr "<<(><0><)/>><.><*>" -END LC_MESSAGES \ No newline at end of file +END LC_MESSAGES diff --git a/stdio-common/tstscanf.c b/stdio-common/tstscanf.c index 4e56251..93f77ce 100644 --- a/stdio-common/tstscanf.c +++ b/stdio-common/tstscanf.c @@ -265,5 +265,19 @@ main (int argc, char **argv) } } + fputs ("Test 9:\n", stdout); + { + /* From PR libc/1313 reported by Ben Caradoc-Davies . */ + float value; + int res; + + res = sscanf ("0123", "%2f", &value); + if (res != 1 || value != 1.0) + { + fputs ("test failed!\n", stdout); + result = 1; + } + } + exit (result); } diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index a6e3bb2..b50e7b8 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -1300,7 +1300,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr) if (c == L_('-') || c == L_('+')) { negative = c == L_('-'); - if (inchar () == EOF) + if (width == 0 || inchar () == EOF) /* EOF is only an input error before we read any chars. */ conv_error (); if (! ISDIGIT (c) && c != decimal) @@ -1320,11 +1320,15 @@ __vfscanf (FILE *s, const char *format, va_list argptr) { /* Maybe "nan". */ ADDW (c); - if (inchar () == EOF || TOLOWER (c) != L_('a')) + if (width == 0 || inchar () == EOF || TOLOWER (c) != L_('a')) input_error (); + if (width > 0) + --width; ADDW (c); - if (inchar () == EOF || TOLOWER (c) != L_('n')) + if (width == 0 || inchar () == EOF || TOLOWER (c) != L_('n')) input_error (); + if (width > 0) + --width; ADDW (c); /* It is "nan". */ goto scan_float; @@ -1333,30 +1337,48 @@ __vfscanf (FILE *s, const char *format, va_list argptr) { /* Maybe "inf" or "infinity". */ ADDW (c); - if (inchar () == EOF || TOLOWER (c) != L_('n')) + if (width == 0 || inchar () == EOF || TOLOWER (c) != L_('n')) input_error (); + if (width > 0) + --width; ADDW (c); - if (inchar () == EOF || TOLOWER (c) != L_('f')) + if (width == 0 || inchar () == EOF || TOLOWER (c) != L_('f')) input_error (); + if (width > 0) + --width; ADDW (c); /* It is as least "inf". */ - if (inchar () != EOF) + if (width != 0 && inchar () != EOF) { if (TOLOWER (c) == L_('i')) { + if (width > 0) + --width; /* Now we have to read the rest as well. */ ADDW (c); - if (inchar () == EOF || TOLOWER (c) != L_('n')) + if (width == 0 || inchar () == EOF + || TOLOWER (c) != L_('n')) input_error (); + if (width > 0) + --width; ADDW (c); - if (inchar () == EOF || TOLOWER (c) != L_('i')) + if (width == 0 || inchar () == EOF + || TOLOWER (c) != L_('i')) input_error (); + if (width > 0) + --width; ADDW (c); - if (inchar () == EOF || TOLOWER (c) != L_('t')) + if (width == 0 || inchar () == EOF + || TOLOWER (c) != L_('t')) input_error (); + if (width > 0) + --width; ADDW (c); - if (inchar () == EOF || TOLOWER (c) != L_('y')) + if (width == 0 || inchar () == EOF + || TOLOWER (c) != L_('y')) input_error (); + if (width > 0) + --width; ADDW (c); } else @@ -1368,11 +1390,13 @@ __vfscanf (FILE *s, const char *format, va_list argptr) is_hexa = 0; exp_char = L_('e'); - if (c == L_('0')) + if (width != 0 && c == L_('0')) { ADDW (c); c = inchar (); - if (TOLOWER (c) == L_('x')) + if (width > 0) + --width; + if (width != 0 && TOLOWER (c) == L_('x')) { /* It is a number in hexadecimal format. */ ADDW (c); @@ -1383,6 +1407,8 @@ __vfscanf (FILE *s, const char *format, va_list argptr) /* Grouping is not allowed. */ flags &= ~GROUP; c = inchar (); + if (width > 0) + --width; } } -- cgit v1.1

;;;;;;;;;;;\ - ;...;;\ - ;...;;\ - ;...; - +upper ;;;;;;;;;;;;;/ + ;;