1 /* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
31 #include <bits/libc-lock.h>
32 #include <locale/localeinfo.h>
35 # define HAVE_LONGLONG
36 # define LONGLONG long long
38 # define LONGLONG long
41 /* Determine whether we have to handle `long long' at all. */
42 #if LONG_MAX == LONG_LONG_MAX
43 # define need_longlong 0
45 # define need_longlong 1
48 /* Determine whether we have to handle `long'. */
49 #if INT_MAX == LONG_MAX
55 /* Those are flags in the conversion format. */
56 #define LONG 0x001 /* l: long or double */
57 #define LONGDBL 0x002 /* L: long long or long double */
58 #define SHORT 0x004 /* h: short */
59 #define SUPPRESS 0x008 /* *: suppress assignment */
60 #define POINTER 0x010 /* weird %p pointer (`fake hex') */
61 #define NOSKIP 0x020 /* do not skip blanks */
62 #define GROUP 0x080 /* ': group numbers */
63 #define MALLOC 0x100 /* a: malloc strings */
64 #define CHAR 0x200 /* hh: char */
65 #define I18N 0x400 /* I: use locale's digits */
68 #include <locale/localeinfo.h>
73 #define va_list _IO_va_list
76 # define ungetc(c, s) ((void) (c == WEOF \
78 INTUSE(_IO_sputbackwc) (s, c))))
79 # define ungetc_not_eof(c, s) ((void) (--read_in, \
80 INTUSE(_IO_sputbackwc) (s, c)))
81 # define inchar() (c == WEOF ? ((errno = inchar_errno), WEOF) \
82 : ((c = _IO_getwc_unlocked (s)), \
85 : (size_t) (inchar_errno = errno)), c))
87 # define MEMCPY(d, s, n) __wmemcpy (d, s, n)
88 # define ISSPACE(Ch) iswspace (Ch)
89 # define ISDIGIT(Ch) iswdigit (Ch)
90 # define ISXDIGIT(Ch) iswxdigit (Ch)
91 # define TOLOWER(Ch) towlower (Ch)
92 # define ORIENT if (_IO_fwide (s, 1) != 1) return WEOF
93 # define __strtoll_internal __wcstoll_internal
94 # define __strtoull_internal __wcstoull_internal
95 # define __strtol_internal __wcstol_internal
96 # define __strtoul_internal __wcstoul_internal
97 # define __strtold_internal __wcstold_internal
98 # define __strtod_internal __wcstod_internal
99 # define __strtof_internal __wcstof_internal
101 # define L_(Str) L##Str
102 # define CHAR_T wchar_t
103 # define UCHAR_T unsigned int
104 # define WINT_T wint_t
108 # define ungetc(c, s) ((void) ((int) c == EOF \
110 INTUSE(_IO_sputbackc) (s, (unsigned char) c))))
111 # define ungetc_not_eof(c, s) ((void) (--read_in, \
112 INTUSE(_IO_sputbackc) (s, (unsigned char) c)))
113 # define inchar() (c == EOF ? ((errno = inchar_errno), EOF) \
114 : ((c = _IO_getc_unlocked (s)), \
117 : (size_t) (inchar_errno = errno)), c))
118 # define MEMCPY(d, s, n) memcpy (d, s, n)
119 # define ISSPACE(Ch) __isspace_l (Ch, loc)
120 # define ISDIGIT(Ch) __isdigit_l (Ch, loc)
121 # define ISXDIGIT(Ch) __isxdigit_l (Ch, loc)
122 # define TOLOWER(Ch) __tolower_l ((unsigned char) (Ch), loc)
123 # define ORIENT if (_IO_vtable_offset (s) == 0 \
124 && _IO_fwide (s, -1) != -1) \
129 # define UCHAR_T unsigned char
133 #define encode_error() do { \
135 __set_errno (EILSEQ); \
138 #define conv_error() do { \
142 #define input_error() do { \
144 if (done == 0) done = EOF; \
147 #define ARGCHECK(s, format) \
150 /* Check file argument for consistence. */ \
151 CHECK_FILE (s, EOF); \
152 if (s->_flags & _IO_NO_READS) \
154 __set_errno (EBADF); \
157 else if (format == NULL) \
163 #define LOCK_STREAM(S) \
164 __libc_cleanup_region_start (1, (void (*) (void *)) &_IO_funlockfile, (S)); \
166 #define UNLOCK_STREAM(S) \
167 _IO_funlockfile (S); \
168 __libc_cleanup_region_end (0)
171 /* Read formatted input from S according to the format string
172 FORMAT, using the argument list in ARG.
173 Return the number of assignments made, or -1 for an input error. */
174 #ifdef COMPILE_WSCANF
176 _IO_vfwscanf (_IO_FILE
*s
, const wchar_t *format
, _IO_va_list argptr
,
180 _IO_vfscanf_internal (_IO_FILE
*s
, const char *format
, _IO_va_list argptr
,
185 register const CHAR_T
*f
= format
;
186 register UCHAR_T fc
; /* Current character of the format. */
187 register WINT_T done
= 0; /* Assignments done. */
188 register size_t read_in
= 0; /* Chars read in. */
189 register WINT_T c
= 0; /* Last char read. */
190 register int width
; /* Maximum field width. */
191 register int flags
; /* Modifiers for current format element. */
193 #ifndef COMPILE_WSCANF
194 __locale_t loc
= _NL_CURRENT_LOCALE
;
195 struct locale_data
*const curctype
= loc
->__locales
[LC_CTYPE
];
198 /* Errno of last failed inchar call. */
199 int inchar_errno
= 0;
200 /* Status for reading F-P nums. */
201 char got_dot
, got_e
, negative
;
202 /* If a [...] is a [^...]. */
204 #define exp_char not_in
205 /* Base for integral numbers. */
207 /* Signedness for integral numbers. */
209 #define is_hexa number_signed
210 /* Decimal point character. */
211 #ifdef COMPILE_WSCANF
216 /* The thousands character of the current locale. */
217 #ifdef COMPILE_WSCANF
220 const char *thousands
;
222 /* State for the conversions. */
224 /* Integral holding variables. */
228 unsigned long long int uq
;
230 unsigned long int ul
;
232 /* Character-buffer pointer. */
234 wchar_t *wstr
= NULL
;
235 char **strptr
= NULL
;
237 /* We must not react on white spaces immediately because they can
238 possibly be matched even if in the input stream no character is
239 available anymore. */
241 /* Nonzero if we are reading a pointer. */
244 CHAR_T
*tw
; /* Temporary pointer. */
245 CHAR_T
*wp
= NULL
; /* Workspace. */
246 size_t wpmax
= 0; /* Maximal size of workspace. */
247 size_t wpsize
; /* Currently used bytes in workspace. */
251 if (wpsize == wpmax) \
254 wpmax = (UCHAR_MAX + 1 > 2 * wpmax ? UCHAR_MAX + 1 : 2 * wpmax); \
255 wp = (CHAR_T *) alloca (wpmax * sizeof (wchar_t)); \
257 MEMCPY (wp, old, wpsize); \
259 wp[wpsize++] = (Ch); \
264 __va_copy (arg
, argptr
);
266 arg
= (va_list) argptr
;
273 ARGCHECK (s
, format
);
276 #ifndef COMPILE_WSCANF
277 struct locale_data
*const curnumeric
= loc
->__locales
[LC_NUMERIC
];
280 /* Figure out the decimal point character. */
281 #ifdef COMPILE_WSCANF
282 decimal
= _NL_CURRENT_WORD (LC_NUMERIC
, _NL_NUMERIC_DECIMAL_POINT_WC
);
284 decimal
= curnumeric
->values
[_NL_ITEM_INDEX (DECIMAL_POINT
)].string
;
286 /* Figure out the thousands separator character. */
287 #ifdef COMPILE_WSCANF
288 thousands
= _NL_CURRENT_WORD (LC_NUMERIC
, _NL_NUMERIC_THOUSANDS_SEP_WC
);
290 thousands
= curnumeric
->values
[_NL_ITEM_INDEX (THOUSANDS_SEP
)].string
;
291 if (*thousands
== '\0')
296 /* Lock the stream. */
300 #ifndef COMPILE_WSCANF
301 /* From now on we use `state' to convert the format string. */
302 memset (&state
, '\0', sizeof (state
));
305 /* Run through the format string. */
309 /* Extract the next argument, which is of type TYPE.
310 For a %N$... spec, this is the Nth argument from the beginning;
311 otherwise it is the next argument after the state now in ARG. */
313 # define ARG(type) (argpos == 0 ? va_arg (arg, type) : \
314 ({ unsigned int pos = argpos; \
316 __va_copy (arg, argptr); \
318 (void) va_arg (arg, void *); \
319 va_arg (arg, type); \
323 /* XXX Possible optimization. */
324 # define ARG(type) (argpos == 0 ? va_arg (arg, type) : \
325 ({ va_list arg = (va_list) argptr; \
326 arg = (va_list) ((char *) arg \
328 * __va_rounded_size (void *)); \
329 va_arg (arg, type); \
332 # define ARG(type) (argpos == 0 ? va_arg (arg, type) : \
333 ({ unsigned int pos = argpos; \
334 va_list arg = (va_list) argptr; \
336 (void) va_arg (arg, void *); \
337 va_arg (arg, type); \
342 #ifndef COMPILE_WSCANF
343 if (!isascii ((unsigned char) *f
))
345 /* Non-ASCII, may be a multibyte. */
346 int len
= __mbrlen (f
, strlen (f
), &state
);
352 if (__builtin_expect (c
== EOF
, 0))
354 else if (c
!= (unsigned char) *f
++)
356 ungetc_not_eof (c
, s
);
369 /* Remember to skip spaces. */
376 /* Read a character. */
379 /* Characters other than format specs must just match. */
380 if (__builtin_expect (c
== EOF
, 0))
383 /* We saw white space char as the last character in the format
384 string. Now it's time to skip all leading white space. */
388 if (__builtin_expect (inchar () == EOF
, 0))
393 if (__builtin_expect (c
!= fc
, 0))
402 /* This is the start of the conversion string. */
405 /* Not yet decided whether we read a pointer or not. */
408 /* Initialize state of modifiers. */
411 /* Prepare temporary buffer. */
414 /* Check for a positional parameter specification. */
415 if (ISDIGIT ((UCHAR_T
) *f
))
417 argpos
= (UCHAR_T
) *f
++ - L_('0');
418 while (ISDIGIT ((UCHAR_T
) *f
))
419 argpos
= argpos
* 10 + ((UCHAR_T
) *f
++ - L_('0'));
424 /* Oops; that was actually the field width. */
431 /* Check for the assignment-suppressing, the number grouping flag,
432 and the signal to use the locale's digit representation. */
433 while (*f
== L_('*') || *f
== L_('\'') || *f
== L_('I'))
447 /* Find the maximum field width. */
449 while (ISDIGIT ((UCHAR_T
) *f
))
452 width
+= (UCHAR_T
) *f
++ - L_('0');
458 /* Check for type modifiers. */
462 /* ints are short ints or chars. */
474 /* A double `l' is equivalent to an `L'. */
476 flags
|= LONGDBL
| LONG
;
479 /* ints are long ints. */
484 /* doubles are long doubles, and ints are long long ints. */
485 flags
|= LONGDBL
| LONG
;
488 /* The `a' is used as a flag only if followed by `s', `S' or
490 if (*f
!= L_('s') && *f
!= L_('S') && *f
!= L_('['))
495 /* String conversions (%s, %[) take a `char **'
496 arg and fill it in with a malloc'd pointer. */
500 if (need_longlong
&& sizeof (size_t) > sizeof (unsigned long int))
502 else if (sizeof (size_t) > sizeof (unsigned int))
506 if (need_longlong
&& sizeof (uintmax_t) > sizeof (unsigned long int))
508 else if (sizeof (uintmax_t) > sizeof (unsigned int))
512 if (need_longlong
&& sizeof (ptrdiff_t) > sizeof (long int))
514 else if (sizeof (ptrdiff_t) > sizeof (int))
518 /* Not a recognized modifier. Backup. */
523 /* End of the format string? */
524 if (__builtin_expect (*f
== L_('\0'), 0))
527 /* Find the conversion specifier. */
529 if (skip_space
|| (fc
!= L_('[') && fc
!= L_('c')
530 && fc
!= L_('C') && fc
!= L_('n')))
532 /* Eat whitespace. */
533 int save_errno
= errno
;
536 if (__builtin_expect (inchar () == EOF
&& errno
== EINTR
, 0))
546 case L_('%'): /* Must match a literal '%'. */
548 if (__builtin_expect (c
== EOF
, 0))
550 if (__builtin_expect (c
!= fc
, 0))
552 ungetc_not_eof (c
, s
);
557 case L_('n'): /* Answer number of assignments done. */
558 /* Corrigendum 1 to ISO C 1990 describes the allowed flags
559 with the 'n' conversion specifier. */
560 if (!(flags
& SUPPRESS
))
562 /* Don't count the read-ahead. */
563 if (need_longlong
&& (flags
& LONGDBL
))
564 *ARG (long long int *) = read_in
;
565 else if (need_long
&& (flags
& LONG
))
566 *ARG (long int *) = read_in
;
567 else if (flags
& SHORT
)
568 *ARG (short int *) = read_in
;
569 else if (!(flags
& CHAR
))
570 *ARG (int *) = read_in
;
572 *ARG (char *) = read_in
;
574 #ifdef NO_BUG_IN_ISO_C_CORRIGENDUM_1
575 /* We have a severe problem here. The ISO C standard
576 contradicts itself in explaining the effect of the %n
577 format in `scanf'. While in ISO C:1990 and the ISO C
578 Amendement 1:1995 the result is described as
580 Execution of a %n directive does not effect the
581 assignment count returned at the completion of
582 execution of the f(w)scanf function.
584 in ISO C Corrigendum 1:1994 the following was added:
587 Add the following fourth example:
590 int d1, d2, n1, n2, i;
591 i = sscanf("123", "%d%n%n%d", &d1, &n1, &n2, &d2);
592 the value 123 is assigned to d1 and the value3 to n1.
593 Because %n can never get an input failure the value
594 of 3 is also assigned to n2. The value of d2 is not
595 affected. The value 3 is assigned to i.
597 We go for now with the historically correct code from ISO C,
598 i.e., we don't count the %n assignments. When it ever
599 should proof to be wrong just remove the #ifdef above. */
605 case L_('c'): /* Match characters. */
606 if ((flags
& LONG
) == 0)
608 if (!(flags
& SUPPRESS
))
616 if (__builtin_expect (c
== EOF
, 0))
622 #ifdef COMPILE_WSCANF
623 /* We have to convert the wide character(s) into multibyte
624 characters and store the result. */
625 memset (&state
, '\0', sizeof (state
));
631 n
= __wcrtomb (!(flags
& SUPPRESS
) ? str
: NULL
, c
, &state
);
632 if (__builtin_expect (n
== (size_t) -1, 0))
633 /* No valid wide character. */
636 /* Increment the output pointer. Even if we don't
640 while (--width
> 0 && inchar () != EOF
);
642 if (!(flags
& SUPPRESS
))
646 while (--width
> 0 && inchar () != EOF
);
649 while (--width
> 0 && inchar () != EOF
);
652 if (!(flags
& SUPPRESS
))
659 if (!(flags
& SUPPRESS
))
661 wstr
= ARG (wchar_t *);
667 if (__builtin_expect (c
== EOF
, 0))
670 #ifdef COMPILE_WSCANF
671 /* Just store the incoming wide characters. */
672 if (!(flags
& SUPPRESS
))
676 while (--width
> 0 && inchar () != EOF
);
679 while (--width
> 0 && inchar () != EOF
);
682 /* We have to convert the multibyte input sequence to wide
687 memset (&cstate
, '\0', sizeof (cstate
));
691 /* This is what we present the mbrtowc function first. */
698 n
= __mbrtowc (!(flags
& SUPPRESS
) ? wstr
: NULL
,
701 if (n
== (size_t) -2)
703 /* Possibly correct character, just not enough
705 if (__builtin_expect (inchar () == EOF
, 0))
712 if (__builtin_expect (n
!= 1, 0))
715 /* We have a match. */
719 /* Advance the result pointer. */
722 while (--width
> 0 && inchar () != EOF
);
726 if (!(flags
& SUPPRESS
))
731 case L_('s'): /* Read a string. */
734 #define STRING_ARG(Str, Type) \
735 do if (!(flags & SUPPRESS)) \
737 if (flags & MALLOC) \
739 /* The string is to be stored in a malloc'd buffer. */ \
740 strptr = ARG (char **); \
741 if (strptr == NULL) \
743 /* Allocate an initial buffer. */ \
745 *strptr = (char *) malloc (strsize * sizeof (Type)); \
746 Str = (Type *) *strptr; \
749 Str = ARG (Type *); \
753 STRING_ARG (str
, char);
756 if (__builtin_expect (c
== EOF
, 0))
759 #ifdef COMPILE_WSCANF
760 memset (&state
, '\0', sizeof (state
));
767 ungetc_not_eof (c
, s
);
771 #ifdef COMPILE_WSCANF
772 /* This is quite complicated. We have to convert the
773 wide characters into multibyte characters and then
778 if (!(flags
& SUPPRESS
) && (flags
& MALLOC
)
779 && str
+ MB_CUR_MAX
>= *strptr
+ strsize
)
781 /* We have to enlarge the buffer if the `a' flag
783 size_t strleng
= str
- *strptr
;
786 newstr
= (char *) realloc (*strptr
, strsize
* 2);
789 /* Can't allocate that much. Last-ditch
791 newstr
= (char *) realloc (*strptr
,
792 strleng
+ MB_CUR_MAX
);
795 /* We lose. Oh well. Terminate the
796 string and stop converting,
797 so at least we don't skip any input. */
798 ((char *) (*strptr
))[strleng
] = '\0';
805 str
= newstr
+ strleng
;
806 strsize
= strleng
+ MB_CUR_MAX
;
812 str
= newstr
+ strleng
;
817 n
= __wcrtomb (!(flags
& SUPPRESS
) ? str
: NULL
, c
,
819 if (__builtin_expect (n
== (size_t) -1, 0))
822 assert (n
<= MB_CUR_MAX
);
827 if (!(flags
& SUPPRESS
))
831 && (char *) str
== *strptr
+ strsize
)
833 /* Enlarge the buffer. */
834 str
= (char *) realloc (*strptr
, 2 * strsize
);
837 /* Can't allocate that much. Last-ditch
839 str
= (char *) realloc (*strptr
, strsize
+ 1);
842 /* We lose. Oh well. Terminate the
843 string and stop converting,
844 so at least we don't skip any input. */
845 ((char *) (*strptr
))[strsize
- 1] = '\0';
851 *strptr
= (char *) str
;
858 *strptr
= (char *) str
;
866 while ((width
<= 0 || --width
> 0) && inchar () != EOF
);
868 if (!(flags
& SUPPRESS
))
870 #ifdef COMPILE_WSCANF
871 /* We have to emit the code to get into the initial
873 char buf
[MB_LEN_MAX
];
874 size_t n
= __wcrtomb (buf
, L
'\0', &state
);
875 if (n
> 0 && (flags
& MALLOC
)
876 && str
+ n
>= *strptr
+ strsize
)
878 /* Enlarge the buffer. */
879 size_t strleng
= str
- *strptr
;
882 newstr
= (char *) realloc (*strptr
, strleng
+ n
+ 1);
885 /* We lose. Oh well. Terminate the string
886 and stop converting, so at least we don't
888 ((char *) (*strptr
))[strleng
] = '\0';
895 str
= newstr
+ strleng
;
896 strsize
= strleng
+ n
+ 1;
900 str
= __mempcpy (str
, buf
, n
);
904 if ((flags
& MALLOC
) && str
- *strptr
!= strsize
)
906 char *cp
= (char *) realloc (*strptr
, str
- *strptr
);
919 #ifndef COMPILE_WSCANF
923 /* Wide character string. */
924 STRING_ARG (wstr
, wchar_t);
927 if (__builtin_expect (c
== EOF
, 0))
930 #ifndef COMPILE_WSCANF
931 memset (&cstate
, '\0', sizeof (cstate
));
938 ungetc_not_eof (c
, s
);
942 #ifdef COMPILE_WSCANF
944 if (!(flags
& SUPPRESS
))
948 && wstr
== (wchar_t *) *strptr
+ strsize
)
950 /* Enlarge the buffer. */
951 wstr
= (wchar_t *) realloc (*strptr
,
956 /* Can't allocate that much. Last-ditch
958 wstr
= (wchar_t *) realloc (*strptr
,
963 /* We lose. Oh well. Terminate the string
964 and stop converting, so at least we don't
966 ((wchar_t *) (*strptr
))[strsize
- 1] = L
'\0';
972 *strptr
= (char *) wstr
;
979 *strptr
= (char *) wstr
;
995 n
= __mbrtowc (!(flags
& SUPPRESS
) ? wstr
: NULL
,
998 if (n
== (size_t) -2)
1000 /* Possibly correct character, just not enough
1002 if (__builtin_expect (inchar () == EOF
, 0))
1009 if (__builtin_expect (n
!= 1, 0))
1012 /* We have a match. */
1017 if (!(flags
& SUPPRESS
) && (flags
& MALLOC
)
1018 && wstr
== (wchar_t *) *strptr
+ strsize
)
1020 /* Enlarge the buffer. */
1021 wstr
= (wchar_t *) realloc (*strptr
,
1023 * sizeof (wchar_t)));
1026 /* Can't allocate that much. Last-ditch effort. */
1027 wstr
= (wchar_t *) realloc (*strptr
,
1029 * sizeof (wchar_t)));
1032 /* We lose. Oh well. Terminate the
1033 string and stop converting, so at
1034 least we don't skip any input. */
1035 ((wchar_t *) (*strptr
))[strsize
- 1] = L
'\0';
1041 *strptr
= (char *) wstr
;
1048 *strptr
= (char *) wstr
;
1056 while ((width
<= 0 || --width
> 0) && inchar () != EOF
);
1058 if (!(flags
& SUPPRESS
))
1062 if ((flags
& MALLOC
) && wstr
- (wchar_t *) *strptr
!= strsize
)
1064 wchar_t *cp
= (wchar_t *) realloc (*strptr
,
1066 - (wchar_t *) *strptr
)
1067 * sizeof(wchar_t)));
1069 *strptr
= (char *) cp
;
1077 case L_('x'): /* Hexadecimal integer. */
1078 case L_('X'): /* Ditto. */
1083 case L_('o'): /* Octal integer. */
1088 case L_('u'): /* Unsigned decimal integer. */
1093 case L_('d'): /* Signed decimal integer. */
1098 case L_('i'): /* Generic number. */
1104 if (__builtin_expect (c
== EOF
, 0))
1107 /* Check for a sign. */
1108 if (c
== L_('-') || c
== L_('+'))
1116 /* Look for a leading indication of base. */
1117 if (width
!= 0 && c
== L_('0'))
1125 if (width
!= 0 && TOLOWER (c
) == L_('x'))
1143 if (base
== 10 && __builtin_expect ((flags
& I18N
) != 0, 0))
1148 #ifdef COMPILE_WSCANF
1149 const wchar_t *wcdigits
[10];
1150 const wchar_t *wcdigits_extended
[10];
1152 const char *mbdigits
[10];
1153 const char *mbdigits_extended
[10];
1155 /* "to_inpunct" is a map from ASCII digits to their
1156 equivalent in locale. This is defined for locales
1157 which use an extra digits set. */
1158 wctrans_t map
= __wctrans ("to_inpunct");
1162 #ifdef COMPILE_WSCANF
1163 to_level
= _NL_CURRENT_WORD (LC_CTYPE
,
1164 _NL_CTYPE_INDIGITS_WC_LEN
) - 1;
1166 to_level
= (uint32_t) curctype
->values
[_NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_MB_LEN
)].word
- 1;
1169 /* Get the alternative digit forms if there are any. */
1170 if (__builtin_expect (map
!= NULL
, 0))
1172 /* Adding new level for extra digits set in locale file. */
1175 for (n
= 0; n
< 10; ++n
)
1177 #ifdef COMPILE_WSCANF
1178 wcdigits
[n
] = (const wchar_t *)
1179 _NL_CURRENT (LC_CTYPE
, _NL_CTYPE_INDIGITS0_WC
+ n
);
1181 wchar_t *wc_extended
= (wchar_t *)
1182 alloca ((to_level
+ 2) * sizeof (wchar_t));
1183 __wmemcpy (wc_extended
, wcdigits
[n
], to_level
);
1184 wc_extended
[to_level
] = __towctrans (L
'0' + n
, map
);
1185 wc_extended
[to_level
+ 1] = '\0';
1186 wcdigits_extended
[n
] = wc_extended
;
1189 = curctype
->values
[_NL_CTYPE_INDIGITS0_MB
+ n
].string
;
1191 /* Get the equivalent wide char in map. */
1192 wint_t extra_wcdigit
= __towctrans (L
'0' + n
, map
);
1194 /* Convert it to multibyte representation. */
1196 memset (&state
, '\0', sizeof (state
));
1198 char extra_mbdigit
[MB_LEN_MAX
];
1200 = __wcrtomb (extra_mbdigit
, extra_wcdigit
, &state
);
1202 if (mblen
== (size_t) -1)
1204 /* Ignore this new level. */
1209 /* Calculate the length of mbdigits[n]. */
1210 const char *last_char
= mbdigits
[n
];
1211 for (level
= 0; level
< to_level
; ++level
)
1212 last_char
= strchr (last_char
, '\0') + 1;
1214 size_t mbdigits_len
= last_char
- mbdigits
[n
];
1216 /* Allocate memory for extended multibyte digit. */
1218 mb_extended
= (char *) alloca (mbdigits_len
+ mblen
+ 1);
1220 /* And get the mbdigits + extra_digit string. */
1221 *(char *) __mempcpy (__mempcpy (mb_extended
, mbdigits
[n
],
1223 extra_mbdigit
, mblen
) = '\0';
1224 mbdigits_extended
[n
] = mb_extended
;
1229 /* Read the number into workspace. */
1230 while (c
!= EOF
&& width
!= 0)
1232 /* In this round we get the pointer to the digit strings
1233 and also perform the first round of comparisons. */
1234 for (n
= 0; n
< 10; ++n
)
1236 /* Get the string for the digits with value N. */
1237 #ifdef COMPILE_WSCANF
1238 if (__builtin_expect (map
!= NULL
, 0))
1239 wcdigits
[n
] = wcdigits_extended
[n
];
1241 wcdigits
[n
] = (const wchar_t *)
1242 _NL_CURRENT (LC_CTYPE
, _NL_CTYPE_INDIGITS0_WC
+ n
);
1243 wcdigits
[n
] += from_level
;
1245 if (c
== (wint_t) *wcdigits
[n
])
1247 to_level
= from_level
;
1251 /* Advance the pointer to the next string. */
1255 int avail
= width
> 0 ? width
: INT_MAX
;
1257 if (__builtin_expect (map
!= NULL
, 0))
1258 mbdigits
[n
] = mbdigits_extended
[n
];
1261 = curctype
->values
[_NL_CTYPE_INDIGITS0_MB
+ n
].string
;
1263 for (level
= 0; level
< from_level
; level
++)
1264 mbdigits
[n
] = strchr (mbdigits
[n
], '\0') + 1;
1267 while ((unsigned char) *cmpp
== c
&& avail
> 0)
1269 if (*++cmpp
== '\0')
1273 if ((c
= inchar ()) == EOF
)
1283 to_level
= from_level
;
1287 /* We are pushing all read characters back. */
1288 if (cmpp
> mbdigits
[n
])
1291 while (--cmpp
> mbdigits
[n
])
1292 ungetc_not_eof ((unsigned char) *cmpp
, s
);
1293 c
= (unsigned char) *cmpp
;
1296 /* Advance the pointer to the next string. */
1297 mbdigits
[n
] = strchr (mbdigits
[n
], '\0') + 1;
1303 /* Have not yet found the digit. */
1304 for (level
= from_level
+ 1; level
<= to_level
; ++level
)
1306 /* Search all ten digits of this level. */
1307 for (n
= 0; n
< 10; ++n
)
1309 #ifdef COMPILE_WSCANF
1310 if (c
== (wint_t) *wcdigits
[n
])
1313 /* Advance the pointer to the next string. */
1317 int avail
= width
> 0 ? width
: INT_MAX
;
1320 while ((unsigned char) *cmpp
== c
&& avail
> 0)
1322 if (*++cmpp
== '\0')
1326 if ((c
= inchar ()) == EOF
)
1339 /* We are pushing all read characters back. */
1340 if (cmpp
> mbdigits
[n
])
1343 while (--cmpp
> mbdigits
[n
])
1344 ungetc_not_eof ((unsigned char) *cmpp
, s
);
1345 c
= (unsigned char) *cmpp
;
1348 /* Advance the pointer to the next string. */
1349 mbdigits
[n
] = strchr (mbdigits
[n
], '\0') + 1;
1365 else if ((flags
& GROUP
)
1366 #ifdef COMPILE_WSCANF
1367 && thousands
!= L
'\0'
1369 && thousands
!= NULL
1373 /* Try matching against the thousands separator. */
1374 #ifdef COMPILE_WSCANF
1378 const char *cmpp
= thousands
;
1379 int avail
= width
> 0 ? width
: INT_MAX
;
1381 while ((unsigned char) *cmpp
== c
&& avail
> 0)
1384 if (*++cmpp
== '\0')
1388 if ((c
= inchar ()) == EOF
)
1396 /* We are pushing all read characters back. */
1397 if (cmpp
> thousands
)
1399 wpsize
-= cmpp
- thousands
;
1401 while (--cmpp
> thousands
)
1402 ungetc_not_eof ((unsigned char) *cmpp
, s
);
1403 c
= (unsigned char) *cmpp
;
1411 /* The last thousands character will be added back by
1427 /* Read the number into workspace. */
1428 while (c
!= EOF
&& width
!= 0)
1435 else if (!ISDIGIT (c
) || (int) (c
- L_('0')) >= base
)
1437 if (base
== 10 && (flags
& GROUP
)
1438 #ifdef COMPILE_WSCANF
1439 && thousands
!= L
'\0'
1441 && thousands
!= NULL
1445 /* Try matching against the thousands separator. */
1446 #ifdef COMPILE_WSCANF
1450 const char *cmpp
= thousands
;
1451 int avail
= width
> 0 ? width
: INT_MAX
;
1453 while ((unsigned char) *cmpp
== c
&& avail
> 0)
1456 if (*++cmpp
== '\0')
1460 if ((c
= inchar ()) == EOF
)
1468 /* We are pushing all read characters back. */
1469 if (cmpp
> thousands
)
1471 wpsize
-= cmpp
- thousands
;
1473 while (--cmpp
> thousands
)
1474 ungetc_not_eof ((unsigned char) *cmpp
, s
);
1475 c
= (unsigned char) *cmpp
;
1483 /* The last thousands character will be added back by
1499 || (wpsize
== 1 && (wp
[0] == L_('+') || wp
[0] == L_('-'))))
1501 /* There was no number. If we are supposed to read a pointer
1502 we must recognize "(nil)" as well. */
1503 if (__builtin_expect (wpsize
== 0
1505 && (width
< 0 || width
>= 0)
1507 && TOLOWER (inchar ()) == L_('n')
1508 && TOLOWER (inchar ()) == L_('i')
1509 && TOLOWER (inchar ()) == L_('l')
1510 && inchar () == L_(')'), 1))
1511 /* We must produce the value of a NULL pointer. A single
1512 '0' digit is enough. */
1516 /* The last read character is not part of the number
1524 /* The just read character is not part of the number anymore. */
1527 /* Convert the number. */
1529 if (need_longlong
&& (flags
& LONGDBL
))
1532 num
.q
= __strtoll_internal (wp
, &tw
, base
, flags
& GROUP
);
1534 num
.uq
= __strtoull_internal (wp
, &tw
, base
, flags
& GROUP
);
1539 num
.l
= __strtol_internal (wp
, &tw
, base
, flags
& GROUP
);
1541 num
.ul
= __strtoul_internal (wp
, &tw
, base
, flags
& GROUP
);
1543 if (__builtin_expect (wp
== tw
, 0))
1546 if (!(flags
& SUPPRESS
))
1548 if (! number_signed
)
1550 if (need_longlong
&& (flags
& LONGDBL
))
1551 *ARG (unsigned LONGLONG
int *) = num
.uq
;
1552 else if (need_long
&& (flags
& LONG
))
1553 *ARG (unsigned long int *) = num
.ul
;
1554 else if (flags
& SHORT
)
1555 *ARG (unsigned short int *)
1556 = (unsigned short int) num
.ul
;
1557 else if (!(flags
& CHAR
))
1558 *ARG (unsigned int *) = (unsigned int) num
.ul
;
1560 *ARG (unsigned char *) = (unsigned char) num
.ul
;
1564 if (need_longlong
&& (flags
& LONGDBL
))
1565 *ARG (LONGLONG
int *) = num
.q
;
1566 else if (need_long
&& (flags
& LONG
))
1567 *ARG (long int *) = num
.l
;
1568 else if (flags
& SHORT
)
1569 *ARG (short int *) = (short int) num
.l
;
1570 else if (!(flags
& CHAR
))
1571 *ARG (int *) = (int) num
.l
;
1573 *ARG (signed char *) = (signed char) num
.ul
;
1579 case L_('e'): /* Floating-point numbers. */
1588 if (__builtin_expect (c
== EOF
, 0))
1591 got_dot
= got_e
= 0;
1593 /* Check for a sign. */
1594 if (c
== L_('-') || c
== L_('+'))
1596 negative
= c
== L_('-');
1597 if (__builtin_expect (width
== 0 || inchar () == EOF
, 0))
1598 /* EOF is only an input error before we read any chars. */
1606 /* Take care for the special arguments "nan" and "inf". */
1607 if (TOLOWER (c
) == L_('n'))
1611 if (__builtin_expect (width
== 0
1613 || TOLOWER (c
) != L_('a'), 0))
1618 if (__builtin_expect (width
== 0
1620 || TOLOWER (c
) != L_('n'), 0))
1628 else if (TOLOWER (c
) == L_('i'))
1630 /* Maybe "inf" or "infinity". */
1632 if (__builtin_expect (width
== 0
1634 || TOLOWER (c
) != L_('n'), 0))
1639 if (__builtin_expect (width
== 0
1641 || TOLOWER (c
) != L_('f'), 0))
1646 /* It is as least "inf". */
1647 if (width
!= 0 && inchar () != EOF
)
1649 if (TOLOWER (c
) == L_('i'))
1653 /* Now we have to read the rest as well. */
1655 if (__builtin_expect (width
== 0
1657 || TOLOWER (c
) != L_('n'), 0))
1662 if (__builtin_expect (width
== 0
1664 || TOLOWER (c
) != L_('i'), 0))
1669 if (__builtin_expect (width
== 0
1671 || TOLOWER (c
) != L_('t'), 0))
1676 if (__builtin_expect (width
== 0
1678 || TOLOWER (c
) != L_('y'), 0))
1693 if (width
!= 0 && c
== L_('0'))
1699 if (width
!= 0 && TOLOWER (c
) == L_('x'))
1701 /* It is a number in hexadecimal format. */
1707 /* Grouping is not allowed. */
1719 else if (!got_e
&& is_hexa
&& ISXDIGIT (c
))
1721 else if (got_e
&& wp
[wpsize
- 1] == exp_char
1722 && (c
== L_('-') || c
== L_('+')))
1724 else if (wpsize
> 0 && !got_e
1725 && (CHAR_T
) TOLOWER (c
) == exp_char
)
1728 got_e
= got_dot
= 1;
1732 #ifdef COMPILE_WSCANF
1733 if (! got_dot
&& c
== decimal
)
1738 else if ((flags
& GROUP
) != 0 && thousands
!= L
'\0'
1739 && ! got_dot
&& c
== thousands
)
1743 /* The last read character is not part of the number
1749 const char *cmpp
= decimal
;
1750 int avail
= width
> 0 ? width
: INT_MAX
;
1754 while ((unsigned char) *cmpp
== c
&& avail
> 0)
1755 if (*++cmpp
== '\0')
1759 if (inchar () == EOF
)
1767 /* Add all the characters. */
1768 for (cmpp
= decimal
; *cmpp
!= '\0'; ++cmpp
)
1769 ADDW ((unsigned char) *cmpp
);
1776 /* Figure out whether it is a thousands separator.
1777 There is one problem: we possibly read more than
1778 one character. We cannot push them back but since
1779 we know that parts of the `decimal' string matched,
1780 we can compare against it. */
1781 const char *cmp2p
= thousands
;
1783 if ((flags
& GROUP
) != 0 && thousands
!= NULL
1786 while (cmp2p
- thousands
< cmpp
- decimal
1787 && *cmp2p
== decimal
[cmp2p
- thousands
])
1789 if (cmp2p
- thousands
== cmpp
- decimal
)
1791 while ((unsigned char) *cmp2p
== c
&& avail
> 0)
1792 if (*++cmp2p
== '\0')
1796 if (inchar () == EOF
)
1803 if (cmp2p
!= NULL
&& *cmp2p
== '\0')
1805 /* Add all the characters. */
1806 for (cmpp
= thousands
; *cmpp
!= '\0'; ++cmpp
)
1807 ADDW ((unsigned char) *cmpp
);
1813 /* The last read character is not part of the number
1824 while (width
!= 0 && inchar () != EOF
);
1826 /* Have we read any character? If we try to read a number
1827 in hexadecimal notation and we have read only the `0x'
1828 prefix or no exponent this is an error. */
1829 if (__builtin_expect (wpsize
== 0
1830 || (is_hexa
&& (wpsize
== 2 || ! got_e
)), 0))
1834 /* Convert the number. */
1836 if ((flags
& LONGDBL
) && !__ldbl_is_dbl
)
1838 long double d
= __strtold_internal (wp
, &tw
, flags
& GROUP
);
1839 if (!(flags
& SUPPRESS
) && tw
!= wp
)
1840 *ARG (long double *) = negative
? -d
: d
;
1842 else if (flags
& (LONG
| LONGDBL
))
1844 double d
= __strtod_internal (wp
, &tw
, flags
& GROUP
);
1845 if (!(flags
& SUPPRESS
) && tw
!= wp
)
1846 *ARG (double *) = negative
? -d
: d
;
1850 float d
= __strtof_internal (wp
, &tw
, flags
& GROUP
);
1851 if (!(flags
& SUPPRESS
) && tw
!= wp
)
1852 *ARG (float *) = negative
? -d
: d
;
1855 if (__builtin_expect (tw
== wp
, 0))
1858 if (!(flags
& SUPPRESS
))
1862 case L_('['): /* Character class. */
1864 STRING_ARG (wstr
, wchar_t);
1866 STRING_ARG (str
, char);
1877 /* There is no width given so there is also no limit on the
1878 number of characters we read. Therefore we set width to
1879 a very high value to make the algorithm easier. */
1882 #ifdef COMPILE_WSCANF
1883 /* Find the beginning and the end of the scanlist. We are not
1884 creating a lookup table since it would have to be too large.
1885 Instead we search each time through the string. This is not
1886 a constant lookup time but who uses this feature deserves to
1888 tw
= (wchar_t *) f
; /* Marks the beginning. */
1893 while ((fc
= *f
++) != L
'\0' && fc
!= L
']');
1895 if (__builtin_expect (fc
== L
'\0', 0))
1897 wp
= (wchar_t *) f
- 1;
1899 /* Fill WP with byte flags indexed by character.
1900 We will use this flag map for matching input characters. */
1901 if (wpmax
< UCHAR_MAX
+ 1)
1903 wpmax
= UCHAR_MAX
+ 1;
1904 wp
= (char *) alloca (wpmax
);
1906 memset (wp
, '\0', UCHAR_MAX
+ 1);
1909 if (fc
== ']' || fc
== '-')
1911 /* If ] or - appears before any char in the set, it is not
1912 the terminator or separator, but the first char in the
1918 while ((fc
= *f
++) != '\0' && fc
!= ']')
1919 if (fc
== '-' && *f
!= '\0' && *f
!= ']'
1920 && (unsigned char) f
[-2] <= (unsigned char) *f
)
1922 /* Add all characters from the one before the '-'
1923 up to (but not including) the next format char. */
1924 for (fc
= (unsigned char) f
[-2]; fc
< (unsigned char) *f
; ++fc
)
1928 /* Add the character to the flag map. */
1931 if (__builtin_expect (fc
== '\0', 0))
1937 size_t now
= read_in
;
1938 #ifdef COMPILE_WSCANF
1939 if (__builtin_expect (inchar () == WEOF
, 0))
1946 /* Test whether it's in the scanlist. */
1950 if (runp
[0] == L
'-' && runp
[1] != '\0' && runp
+ 1 != wp
1952 && (unsigned int) runp
[-1] <= (unsigned int) runp
[1])
1954 /* Match against all characters in between the
1955 first and last character of the sequence. */
1958 for (wc
= runp
[-1] + 1; wc
<= runp
[1]; ++wc
)
1959 if ((wint_t) wc
== c
)
1962 if (wc
<= runp
[1] && !not_in
)
1964 if (wc
<= runp
[1] && not_in
)
1966 /* The current character is not in the
1976 if ((wint_t) *runp
== c
&& !not_in
)
1978 if ((wint_t) *runp
== c
&& not_in
)
1988 if (runp
== wp
&& !not_in
)
1994 if (!(flags
& SUPPRESS
))
1998 if ((flags
& MALLOC
)
1999 && wstr
== (wchar_t *) *strptr
+ strsize
)
2001 /* Enlarge the buffer. */
2002 wstr
= (wchar_t *) realloc (*strptr
,
2004 * sizeof (wchar_t));
2007 /* Can't allocate that much. Last-ditch
2010 realloc (*strptr
, (strsize
+ 1)
2011 * sizeof (wchar_t));
2014 /* We lose. Oh well. Terminate the string
2015 and stop converting, so at least we don't
2017 ((wchar_t *) (*strptr
))[strsize
- 1] = L
'\0';
2023 *strptr
= (char *) wstr
;
2030 *strptr
= (char *) wstr
;
2037 while (--width
> 0 && inchar () != WEOF
);
2040 char buf
[MB_LEN_MAX
];
2044 if (__builtin_expect (inchar () == EOF
, 0))
2047 memset (&cstate
, '\0', sizeof (cstate
));
2051 if (wp
[c
] == not_in
)
2053 ungetc_not_eof (c
, s
);
2058 if (!(flags
& SUPPRESS
))
2062 /* Convert it into a wide character. */
2064 n
= __mbrtowc (wstr
, buf
, 1, &cstate
);
2066 if (n
== (size_t) -2)
2068 /* Possibly correct character, just not enough
2071 assert (cnt
< MB_CUR_MAX
);
2077 if ((flags
& MALLOC
)
2078 && wstr
== (wchar_t *) *strptr
+ strsize
)
2080 /* Enlarge the buffer. */
2081 wstr
= (wchar_t *) realloc (*strptr
,
2083 * sizeof (wchar_t)));
2086 /* Can't allocate that much. Last-ditch
2089 realloc (*strptr
, ((strsize
+ 1)
2090 * sizeof (wchar_t)));
2093 /* We lose. Oh well. Terminate the
2094 string and stop converting,
2095 so at least we don't skip any input. */
2096 ((wchar_t *) (*strptr
))[strsize
- 1] = L
'\0';
2102 *strptr
= (char *) wstr
;
2109 *strptr
= (char *) wstr
;
2119 while (inchar () != EOF
);
2121 if (__builtin_expect (cnt
!= 0, 0))
2122 /* We stopped in the middle of recognizing another
2123 character. That's a problem. */
2127 if (__builtin_expect (now
== read_in
, 0))
2128 /* We haven't succesfully read any character. */
2131 if (!(flags
& SUPPRESS
))
2135 if ((flags
& MALLOC
)
2136 && wstr
- (wchar_t *) *strptr
!= strsize
)
2138 wchar_t *cp
= (wchar_t *)
2139 realloc (*strptr
, ((wstr
- (wchar_t *) *strptr
)
2140 * sizeof(wchar_t)));
2142 *strptr
= (char *) cp
;
2150 size_t now
= read_in
;
2152 if (__builtin_expect (inchar () == EOF
, 0))
2155 #ifdef COMPILE_WSCANF
2157 memset (&state
, '\0', sizeof (state
));
2164 /* Test whether it's in the scanlist. */
2168 if (runp
[0] == L
'-' && runp
[1] != '\0' && runp
+ 1 != wp
2170 && (unsigned int) runp
[-1] <= (unsigned int) runp
[1])
2172 /* Match against all characters in between the
2173 first and last character of the sequence. */
2176 for (wc
= runp
[-1] + 1; wc
<= runp
[1]; ++wc
)
2177 if ((wint_t) wc
== c
)
2180 if (wc
<= runp
[1] && !not_in
)
2182 if (wc
<= runp
[1] && not_in
)
2184 /* The current character is not in the
2194 if ((wint_t) *runp
== c
&& !not_in
)
2196 if ((wint_t) *runp
== c
&& not_in
)
2206 if (runp
== wp
&& !not_in
)
2212 if (!(flags
& SUPPRESS
))
2214 if ((flags
& MALLOC
)
2215 && str
+ MB_CUR_MAX
>= *strptr
+ strsize
)
2217 /* Enlarge the buffer. */
2218 size_t strleng
= str
- *strptr
;
2221 newstr
= (char *) realloc (*strptr
, 2 * strsize
);
2224 /* Can't allocate that much. Last-ditch
2226 newstr
= (char *) realloc (*strptr
,
2227 strleng
+ MB_CUR_MAX
);
2230 /* We lose. Oh well. Terminate the string
2231 and stop converting, so at least we don't
2233 ((char *) (*strptr
))[strleng
] = '\0';
2240 str
= newstr
+ strleng
;
2241 strsize
= strleng
+ MB_CUR_MAX
;
2247 str
= newstr
+ strleng
;
2253 n
= __wcrtomb (!(flags
& SUPPRESS
) ? str
: NULL
, c
, &state
);
2254 if (__builtin_expect (n
== (size_t) -1, 0))
2257 assert (n
<= MB_CUR_MAX
);
2260 while (--width
> 0 && inchar () != WEOF
);
2265 if (wp
[c
] == not_in
)
2267 ungetc_not_eof (c
, s
);
2272 if (!(flags
& SUPPRESS
))
2275 if ((flags
& MALLOC
)
2276 && (char *) str
== *strptr
+ strsize
)
2278 /* Enlarge the buffer. */
2279 size_t newsize
= 2 * strsize
;
2282 str
= (char *) realloc (*strptr
, newsize
);
2285 /* Can't allocate that much. Last-ditch
2287 if (newsize
> strsize
+ 1)
2289 newsize
= strsize
+ 1;
2292 /* We lose. Oh well. Terminate the
2293 string and stop converting,
2294 so at least we don't skip any input. */
2295 ((char *) (*strptr
))[strsize
- 1] = '\0';
2301 *strptr
= (char *) str
;
2308 while (--width
> 0 && inchar () != EOF
);
2311 if (__builtin_expect (now
== read_in
, 0))
2312 /* We haven't succesfully read any character. */
2315 if (!(flags
& SUPPRESS
))
2317 #ifdef COMPILE_WSCANF
2318 /* We have to emit the code to get into the initial
2320 char buf
[MB_LEN_MAX
];
2321 size_t n
= __wcrtomb (buf
, L
'\0', &state
);
2322 if (n
> 0 && (flags
& MALLOC
)
2323 && str
+ n
>= *strptr
+ strsize
)
2325 /* Enlarge the buffer. */
2326 size_t strleng
= str
- *strptr
;
2329 newstr
= (char *) realloc (*strptr
, strleng
+ n
+ 1);
2332 /* We lose. Oh well. Terminate the string
2333 and stop converting, so at least we don't
2335 ((char *) (*strptr
))[strleng
] = '\0';
2342 str
= newstr
+ strleng
;
2343 strsize
= strleng
+ n
+ 1;
2347 str
= __mempcpy (str
, buf
, n
);
2351 if ((flags
& MALLOC
) && str
- *strptr
!= strsize
)
2353 char *cp
= (char *) realloc (*strptr
, str
- *strptr
);
2363 case L_('p'): /* Generic pointer. */
2365 /* A PTR must be the same size as a `long int'. */
2366 flags
&= ~(SHORT
|LONGDBL
);
2374 /* If this is an unknown format character punt. */
2379 /* The last thing we saw int the format string was a white space.
2380 Consume the last white spaces. */
2385 while (ISSPACE (c
));
2390 /* Unlock stream. */
2399 #ifdef COMPILE_WSCANF
2401 __vfwscanf (FILE *s
, const wchar_t *format
, va_list argptr
)
2403 return _IO_vfwscanf (s
, format
, argptr
, NULL
);
2405 ldbl_weak_alias (__vfwscanf
, vfwscanf
)
2408 ___vfscanf (FILE *s
, const char *format
, va_list argptr
)
2410 return _IO_vfscanf_internal (s
, format
, argptr
, NULL
);
2412 ldbl_strong_alias (_IO_vfscanf_internal
, _IO_vfscanf
)
2413 ldbl_strong_alias (___vfscanf
, __vfscanf
)
2414 ldbl_hidden_def (___vfscanf
, __vfscanf
)
2415 ldbl_weak_alias (___vfscanf
, vfscanf
)