1 /* *printf* family compatibility routines for IEEE double as long double
2 Copyright (C) 2006-2024 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, see
17 <https://www.gnu.org/licenses/>. */
19 /* This file may define some of the deprecated scanf variants. */
21 #undef __GLIBC_USE_DEPRECATED_SCANF
22 #define __GLIBC_USE_DEPRECATED_SCANF 1
29 #include <libio/strfile.h>
34 #include <locale/localeinfo.h>
35 #include <sys/syslog.h>
36 #include <libc-lock.h>
38 #include "nldbl-compat.h"
40 libc_hidden_proto (__nldbl_vsscanf
)
41 libc_hidden_proto (__nldbl_vfscanf
)
42 libc_hidden_proto (__nldbl_vfwscanf
)
43 libc_hidden_proto (__nldbl_vswscanf
)
44 libc_hidden_proto (__nldbl___isoc99_vsscanf
)
45 libc_hidden_proto (__nldbl___isoc99_vfscanf
)
46 libc_hidden_proto (__nldbl___isoc99_vswscanf
)
47 libc_hidden_proto (__nldbl___isoc99_vfwscanf
)
48 libc_hidden_proto (__nldbl___isoc23_vsscanf
)
49 libc_hidden_proto (__nldbl___isoc23_vfscanf
)
50 libc_hidden_proto (__nldbl___isoc23_vswscanf
)
51 libc_hidden_proto (__nldbl___isoc23_vfwscanf
)
53 /* Compatibility with IEEE double as long double.
54 IEEE quad long double is used by default for most programs, so
55 we don't need to split this into one file per function for the
56 sake of statically linked programs. */
59 attribute_compat_text_section
60 __nldbl___asprintf (char **string_ptr
, const char *fmt
, ...)
66 ret
= __vasprintf_internal (string_ptr
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
71 weak_alias (__nldbl___asprintf
, __nldbl_asprintf
)
74 attribute_compat_text_section
75 __nldbl_dprintf (int d
, const char *fmt
, ...)
81 ret
= __vdprintf_internal (d
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
88 attribute_compat_text_section
89 __nldbl_fprintf (FILE *stream
, const char *fmt
, ...)
95 ret
= __vfprintf_internal (stream
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
100 weak_alias (__nldbl_fprintf
, __nldbl__IO_fprintf
)
103 attribute_compat_text_section weak_function
104 __nldbl_fwprintf (FILE *stream
, const wchar_t *fmt
, ...)
110 ret
= __vfwprintf_internal (stream
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
117 attribute_compat_text_section
118 __nldbl_printf (const char *fmt
, ...)
124 ret
= __vfprintf_internal (stdout
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
129 strong_alias (__nldbl_printf
, __nldbl__IO_printf
)
132 attribute_compat_text_section
133 __nldbl_sprintf (char *s
, const char *fmt
, ...)
139 ret
= __vsprintf_internal (s
, -1, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
144 strong_alias (__nldbl_sprintf
, __nldbl__IO_sprintf
)
147 attribute_compat_text_section
148 __nldbl_vfprintf (FILE *s
, const char *fmt
, va_list ap
)
150 return __vfprintf_internal (s
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
152 strong_alias (__nldbl_vfprintf
, __nldbl__IO_vfprintf
)
155 attribute_compat_text_section
156 __nldbl___vsprintf (char *string
, const char *fmt
, va_list ap
)
158 return __vsprintf_internal (string
, -1, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
160 strong_alias (__nldbl___vsprintf
, __nldbl__IO_vsprintf
)
161 weak_alias (__nldbl___vsprintf
, __nldbl_vsprintf
)
164 attribute_compat_text_section
165 __nldbl_obstack_vprintf (struct obstack
*obstack
, const char *fmt
,
168 return __obstack_vprintf_internal (obstack
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
172 attribute_compat_text_section
173 __nldbl_obstack_printf (struct obstack
*obstack
, const char *fmt
, ...)
178 ret
= __obstack_vprintf_internal (obstack
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
184 attribute_compat_text_section weak_function
185 __nldbl_snprintf (char *s
, size_t maxlen
, const char *fmt
, ...)
191 ret
= __vsnprintf_internal (s
, maxlen
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
198 attribute_compat_text_section
199 __nldbl_swprintf (wchar_t *s
, size_t n
, const wchar_t *fmt
, ...)
205 ret
= __vswprintf_internal (s
, n
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
212 attribute_compat_text_section weak_function
213 __nldbl_vasprintf (char **result_ptr
, const char *fmt
, va_list ap
)
215 return __vasprintf_internal (result_ptr
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
219 attribute_compat_text_section
220 __nldbl_vdprintf (int d
, const char *fmt
, va_list ap
)
222 return __vdprintf_internal (d
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
226 attribute_compat_text_section weak_function
227 __nldbl_vfwprintf (FILE *s
, const wchar_t *fmt
, va_list ap
)
229 return __vfwprintf_internal (s
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
233 attribute_compat_text_section
234 __nldbl_vprintf (const char *fmt
, va_list ap
)
236 return __vfprintf_internal (stdout
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
240 attribute_compat_text_section
241 __nldbl_vsnprintf (char *string
, size_t maxlen
, const char *fmt
,
244 return __vsnprintf_internal (string
, maxlen
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
246 weak_alias (__nldbl_vsnprintf
, __nldbl___vsnprintf
)
249 attribute_compat_text_section weak_function
250 __nldbl_vswprintf (wchar_t *string
, size_t maxlen
, const wchar_t *fmt
,
253 return __vswprintf_internal (string
, maxlen
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
257 attribute_compat_text_section
258 __nldbl_vwprintf (const wchar_t *fmt
, va_list ap
)
260 return __vfwprintf_internal (stdout
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
264 attribute_compat_text_section
265 __nldbl_wprintf (const wchar_t *fmt
, ...)
271 ret
= __vfwprintf_internal (stdout
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
277 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_29)
279 attribute_compat_text_section
280 __nldbl__IO_vfscanf (FILE *s
, const char *fmt
, va_list ap
, int *errp
)
282 int ret
= __vfscanf_internal (s
, fmt
, ap
, SCANF_LDBL_IS_DBL
);
283 if (__glibc_unlikely (errp
!= 0))
290 attribute_compat_text_section
291 __nldbl___vfscanf (FILE *s
, const char *fmt
, va_list ap
)
293 return __vfscanf_internal (s
, fmt
, ap
, SCANF_LDBL_IS_DBL
);
295 weak_alias (__nldbl___vfscanf
, __nldbl_vfscanf
)
296 libc_hidden_def (__nldbl_vfscanf
)
299 attribute_compat_text_section
300 __nldbl_sscanf (const char *s
, const char *fmt
, ...)
303 FILE *f
= _IO_strfile_read (&sf
, s
);
308 ret
= __vfscanf_internal (f
, fmt
, ap
, SCANF_LDBL_IS_DBL
);
313 strong_alias (__nldbl_sscanf
, __nldbl__IO_sscanf
)
316 attribute_compat_text_section
317 __nldbl___vsscanf (const char *s
, const char *fmt
, va_list ap
)
320 FILE *f
= _IO_strfile_read (&sf
, s
);
321 return __vfscanf_internal (f
, fmt
, ap
, SCANF_LDBL_IS_DBL
);
323 weak_alias (__nldbl___vsscanf
, __nldbl_vsscanf
)
324 libc_hidden_def (__nldbl_vsscanf
)
327 attribute_compat_text_section weak_function
328 __nldbl_vscanf (const char *fmt
, va_list ap
)
330 return __vfscanf_internal (stdin
, fmt
, ap
, SCANF_LDBL_IS_DBL
);
334 attribute_compat_text_section
335 __nldbl_fscanf (FILE *stream
, const char *fmt
, ...)
341 ret
= __vfscanf_internal (stream
, fmt
, ap
, SCANF_LDBL_IS_DBL
);
348 attribute_compat_text_section
349 __nldbl_scanf (const char *fmt
, ...)
355 ret
= __vfscanf_internal (stdin
, fmt
, ap
, SCANF_LDBL_IS_DBL
);
362 attribute_compat_text_section
363 __nldbl_vfwscanf (FILE *s
, const wchar_t *fmt
, va_list ap
)
365 return __vfwscanf_internal (s
, fmt
, ap
, SCANF_LDBL_IS_DBL
);
367 libc_hidden_def (__nldbl_vfwscanf
)
370 attribute_compat_text_section
371 __nldbl_swscanf (const wchar_t *s
, const wchar_t *fmt
, ...)
374 struct _IO_wide_data wd
;
375 FILE *f
= _IO_strfile_readw (&sf
, &wd
, s
);
380 ret
= __vfwscanf_internal (f
, fmt
, ap
, SCANF_LDBL_IS_DBL
);
387 attribute_compat_text_section
388 __nldbl_vswscanf (const wchar_t *s
, const wchar_t *fmt
, va_list ap
)
391 struct _IO_wide_data wd
;
392 FILE *f
= _IO_strfile_readw (&sf
, &wd
, s
);
394 return __vfwscanf_internal (f
, fmt
, ap
, SCANF_LDBL_IS_DBL
);
396 libc_hidden_def (__nldbl_vswscanf
)
399 attribute_compat_text_section weak_function
400 __nldbl_vwscanf (const wchar_t *fmt
, va_list ap
)
402 return __vfwscanf_internal (stdin
, fmt
, ap
, SCANF_LDBL_IS_DBL
);
406 attribute_compat_text_section
407 __nldbl_fwscanf (FILE *stream
, const wchar_t *fmt
, ...)
413 ret
= __vfwscanf_internal (stream
, fmt
, ap
, SCANF_LDBL_IS_DBL
);
420 attribute_compat_text_section
421 __nldbl_wscanf (const wchar_t *fmt
, ...)
427 ret
= __vfwscanf_internal (stdin
, fmt
, ap
, SCANF_LDBL_IS_DBL
);
434 attribute_compat_text_section
435 __nldbl___fprintf_chk (FILE *stream
, int flag
, const char *fmt
, ...)
439 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
441 mode
|= PRINTF_FORTIFY
;
444 ret
= __vfprintf_internal (stream
, fmt
, ap
, mode
);
451 attribute_compat_text_section
452 __nldbl___fwprintf_chk (FILE *stream
, int flag
, const wchar_t *fmt
, ...)
456 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
458 mode
|= PRINTF_FORTIFY
;
461 ret
= __vfwprintf_internal (stream
, fmt
, ap
, mode
);
468 attribute_compat_text_section
469 __nldbl___printf_chk (int flag
, const char *fmt
, ...)
473 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
475 mode
|= PRINTF_FORTIFY
;
478 ret
= __vfprintf_internal (stdout
, fmt
, ap
, mode
);
485 attribute_compat_text_section
486 __nldbl___snprintf_chk (char *s
, size_t maxlen
, int flag
, size_t slen
,
487 const char *fmt
, ...)
489 if (__glibc_unlikely (slen
< maxlen
))
494 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
496 mode
|= PRINTF_FORTIFY
;
499 ret
= __vsnprintf_internal (s
, maxlen
, fmt
, ap
, mode
);
506 attribute_compat_text_section
507 __nldbl___sprintf_chk (char *s
, int flag
, size_t slen
, const char *fmt
, ...)
514 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
516 mode
|= PRINTF_FORTIFY
;
519 ret
= __vsprintf_internal (s
, slen
, fmt
, ap
, mode
);
526 attribute_compat_text_section
527 __nldbl___swprintf_chk (wchar_t *s
, size_t maxlen
, int flag
, size_t slen
,
528 const wchar_t *fmt
, ...)
530 if (__glibc_unlikely (slen
< maxlen
))
535 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
537 mode
|= PRINTF_FORTIFY
;
540 ret
= __vswprintf_internal (s
, maxlen
, fmt
, ap
, mode
);
547 attribute_compat_text_section
548 __nldbl___vfprintf_chk (FILE *s
, int flag
, const char *fmt
, va_list ap
)
550 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
552 mode
|= PRINTF_FORTIFY
;
554 return __vfprintf_internal (s
, fmt
, ap
, mode
);
558 attribute_compat_text_section
559 __nldbl___vfwprintf_chk (FILE *s
, int flag
, const wchar_t *fmt
, va_list ap
)
561 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
563 mode
|= PRINTF_FORTIFY
;
565 return __vfwprintf_internal (s
, fmt
, ap
, mode
);
569 attribute_compat_text_section
570 __nldbl___vprintf_chk (int flag
, const char *fmt
, va_list ap
)
572 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
574 mode
|= PRINTF_FORTIFY
;
576 return __vfprintf_internal (stdout
, fmt
, ap
, mode
);
580 attribute_compat_text_section
581 __nldbl___vsnprintf_chk (char *string
, size_t maxlen
, int flag
, size_t slen
,
582 const char *fmt
, va_list ap
)
584 if (__glibc_unlikely (slen
< maxlen
))
587 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
589 mode
|= PRINTF_FORTIFY
;
591 return __vsnprintf_internal (string
, maxlen
, fmt
, ap
, mode
);
595 attribute_compat_text_section
596 __nldbl___vsprintf_chk (char *string
, int flag
, size_t slen
, const char *fmt
,
602 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
604 mode
|= PRINTF_FORTIFY
;
606 return __vsprintf_internal (string
, slen
, fmt
, ap
, mode
);
610 attribute_compat_text_section
611 __nldbl___vswprintf_chk (wchar_t *string
, size_t maxlen
, int flag
, size_t slen
,
612 const wchar_t *fmt
, va_list ap
)
614 if (__glibc_unlikely (slen
< maxlen
))
617 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
619 mode
|= PRINTF_FORTIFY
;
621 return __vswprintf_internal (string
, maxlen
, fmt
, ap
, mode
);
625 attribute_compat_text_section
626 __nldbl___vwprintf_chk (int flag
, const wchar_t *fmt
, va_list ap
)
628 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
630 mode
|= PRINTF_FORTIFY
;
632 return __vfwprintf_internal (stdout
, fmt
, ap
, mode
);
636 attribute_compat_text_section
637 __nldbl___wprintf_chk (int flag
, const wchar_t *fmt
, ...)
641 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
643 mode
|= PRINTF_FORTIFY
;
646 ret
= __vfwprintf_internal (stdout
, fmt
, ap
, mode
);
653 attribute_compat_text_section
654 __nldbl___vasprintf_chk (char **ptr
, int flag
, const char *fmt
, va_list ap
)
656 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
658 mode
|= PRINTF_FORTIFY
;
660 return __vasprintf_internal (ptr
, fmt
, ap
, mode
);
664 attribute_compat_text_section
665 __nldbl___asprintf_chk (char **ptr
, int flag
, const char *fmt
, ...)
669 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
671 mode
|= PRINTF_FORTIFY
;
674 ret
= __vasprintf_internal (ptr
, fmt
, ap
, mode
);
681 attribute_compat_text_section
682 __nldbl___vdprintf_chk (int d
, int flag
, const char *fmt
, va_list ap
)
684 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
686 mode
|= PRINTF_FORTIFY
;
688 return __vdprintf_internal (d
, fmt
, ap
, mode
);
692 attribute_compat_text_section
693 __nldbl___dprintf_chk (int d
, int flag
, const char *fmt
, ...)
697 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
699 mode
|= PRINTF_FORTIFY
;
702 ret
= __vdprintf_internal (d
, fmt
, ap
, mode
);
709 attribute_compat_text_section
710 __nldbl___obstack_vprintf_chk (struct obstack
*obstack
, int flag
,
711 const char *fmt
, va_list ap
)
713 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
715 mode
|= PRINTF_FORTIFY
;
717 return __obstack_vprintf_internal (obstack
, fmt
, ap
, mode
);
721 attribute_compat_text_section
722 __nldbl___obstack_printf_chk (struct obstack
*obstack
, int flag
,
723 const char *fmt
, ...)
727 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
729 mode
|= PRINTF_FORTIFY
;
732 ret
= __obstack_vprintf_internal (obstack
, fmt
, ap
, mode
);
738 extern __typeof (printf_size
) __printf_size
;
741 attribute_compat_text_section
742 __nldbl_printf_size (FILE *fp
, const struct printf_info
*info
,
743 const void *const *args
)
745 struct printf_info info_no_ldbl
= *info
;
747 info_no_ldbl
.is_long_double
= 0;
748 return __printf_size (fp
, &info_no_ldbl
, args
);
751 extern __typeof (__printf_fp
) ___printf_fp
;
754 attribute_compat_text_section
755 __nldbl___printf_fp (FILE *fp
, const struct printf_info
*info
,
756 const void *const *args
)
758 struct printf_info info_no_ldbl
= *info
;
760 info_no_ldbl
.is_long_double
= 0;
761 return ___printf_fp (fp
, &info_no_ldbl
, args
);
765 attribute_compat_text_section
766 __nldbl_strfmon (char *s
, size_t maxsize
, const char *format
, ...)
771 va_start (ap
, format
);
772 ret
= __vstrfmon_l_internal (s
, maxsize
, _NL_CURRENT_LOCALE
, format
, ap
,
773 STRFMON_LDBL_IS_DBL
);
779 attribute_compat_text_section
780 __nldbl___strfmon_l (char *s
, size_t maxsize
, locale_t loc
,
781 const char *format
, ...)
786 va_start (ap
, format
);
787 ret
= __vstrfmon_l_internal (s
, maxsize
, loc
, format
, ap
,
788 STRFMON_LDBL_IS_DBL
);
792 weak_alias (__nldbl___strfmon_l
, __nldbl_strfmon_l
)
795 attribute_compat_text_section
796 __nldbl___vstrfmon (char *s
, size_t maxsize
, const char *format
, va_list ap
)
798 return __vstrfmon_l_internal (s
, maxsize
, _NL_CURRENT_LOCALE
, format
, ap
,
799 STRFMON_LDBL_IS_DBL
);
803 attribute_compat_text_section
804 __nldbl___vstrfmon_l (char *s
, size_t maxsize
, locale_t loc
,
805 const char *format
, va_list ap
)
807 return __vstrfmon_l_internal (s
, maxsize
, loc
, format
, ap
,
808 STRFMON_LDBL_IS_DBL
);
812 attribute_compat_text_section
813 __nldbl_syslog (int pri
, const char *fmt
, ...)
817 __vsyslog_internal (pri
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
822 attribute_compat_text_section
823 __nldbl_vsyslog (int pri
, const char *fmt
, va_list ap
)
825 __vsyslog_internal (pri
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
829 attribute_compat_text_section
830 __nldbl___syslog_chk (int pri
, int flag
, const char *fmt
, ...)
833 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
835 mode
|= PRINTF_FORTIFY
;
838 __vsyslog_internal (pri
, fmt
, ap
, mode
);
843 attribute_compat_text_section
844 __nldbl___vsyslog_chk (int pri
, int flag
, const char *fmt
, va_list ap
)
846 unsigned int mode
= PRINTF_LDBL_IS_DBL
;
848 mode
|= PRINTF_FORTIFY
;
850 __vsyslog_internal (pri
, fmt
, ap
, mode
);
854 attribute_compat_text_section
855 __nldbl___isoc99_vfscanf (FILE *s
, const char *fmt
, va_list ap
)
857 return __vfscanf_internal (s
, fmt
, ap
, SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
);
859 libc_hidden_def (__nldbl___isoc99_vfscanf
)
862 attribute_compat_text_section
863 __nldbl___isoc99_sscanf (const char *s
, const char *fmt
, ...)
866 FILE *f
= _IO_strfile_read (&sf
, s
);
871 ret
= __vfscanf_internal (f
, fmt
, ap
, SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
);
878 attribute_compat_text_section
879 __nldbl___isoc99_vsscanf (const char *s
, const char *fmt
, va_list ap
)
882 FILE *f
= _IO_strfile_read (&sf
, s
);
884 return __vfscanf_internal (f
, fmt
, ap
, SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
);
886 libc_hidden_def (__nldbl___isoc99_vsscanf
)
889 attribute_compat_text_section
890 __nldbl___isoc99_vscanf (const char *fmt
, va_list ap
)
892 return __vfscanf_internal (stdin
, fmt
, ap
,
893 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
);
897 attribute_compat_text_section
898 __nldbl___isoc99_fscanf (FILE *s
, const char *fmt
, ...)
904 ret
= __vfscanf_internal (s
, fmt
, ap
, SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
);
911 attribute_compat_text_section
912 __nldbl___isoc99_scanf (const char *fmt
, ...)
918 ret
= __vfscanf_internal (stdin
, fmt
, ap
,
919 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
);
926 attribute_compat_text_section
927 __nldbl___isoc99_vfwscanf (FILE *s
, const wchar_t *fmt
, va_list ap
)
929 return __vfwscanf_internal (s
, fmt
, ap
, SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
);
931 libc_hidden_def (__nldbl___isoc99_vfwscanf
)
934 attribute_compat_text_section
935 __nldbl___isoc99_swscanf (const wchar_t *s
, const wchar_t *fmt
, ...)
938 struct _IO_wide_data wd
;
939 FILE *f
= _IO_strfile_readw (&sf
, &wd
, s
);
944 ret
= __vfwscanf_internal (f
, fmt
, ap
, SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
);
951 attribute_compat_text_section
952 __nldbl___isoc99_vswscanf (const wchar_t *s
, const wchar_t *fmt
, va_list ap
)
955 struct _IO_wide_data wd
;
956 FILE *f
= _IO_strfile_readw (&sf
, &wd
, s
);
958 return __vfwscanf_internal (f
, fmt
, ap
, SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
);
960 libc_hidden_def (__nldbl___isoc99_vswscanf
)
963 attribute_compat_text_section
964 __nldbl___isoc99_vwscanf (const wchar_t *fmt
, va_list ap
)
966 return __vfwscanf_internal (stdin
, fmt
, ap
,
967 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
);
971 attribute_compat_text_section
972 __nldbl___isoc99_fwscanf (FILE *s
, const wchar_t *fmt
, ...)
978 ret
= __vfwscanf_internal (s
, fmt
, ap
, SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
);
985 attribute_compat_text_section
986 __nldbl___isoc99_wscanf (const wchar_t *fmt
, ...)
992 ret
= __vfwscanf_internal (stdin
, fmt
, ap
,
993 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
);
1000 attribute_compat_text_section
1001 __nldbl___isoc23_vfscanf (FILE *s
, const char *fmt
, va_list ap
)
1003 return __vfscanf_internal (s
, fmt
, ap
,
1004 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
1005 | SCANF_ISOC23_BIN_CST
);
1007 libc_hidden_def (__nldbl___isoc23_vfscanf
)
1010 attribute_compat_text_section
1011 __nldbl___isoc23_sscanf (const char *s
, const char *fmt
, ...)
1014 FILE *f
= _IO_strfile_read (&sf
, s
);
1019 ret
= __vfscanf_internal (f
, fmt
, ap
,
1020 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
1021 | SCANF_ISOC23_BIN_CST
);
1028 attribute_compat_text_section
1029 __nldbl___isoc23_vsscanf (const char *s
, const char *fmt
, va_list ap
)
1032 FILE *f
= _IO_strfile_read (&sf
, s
);
1034 return __vfscanf_internal (f
, fmt
, ap
,
1035 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
1036 | SCANF_ISOC23_BIN_CST
);
1038 libc_hidden_def (__nldbl___isoc23_vsscanf
)
1041 attribute_compat_text_section
1042 __nldbl___isoc23_vscanf (const char *fmt
, va_list ap
)
1044 return __vfscanf_internal (stdin
, fmt
, ap
,
1045 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
1046 | SCANF_ISOC23_BIN_CST
);
1050 attribute_compat_text_section
1051 __nldbl___isoc23_fscanf (FILE *s
, const char *fmt
, ...)
1057 ret
= __vfscanf_internal (s
, fmt
, ap
,
1058 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
1059 | SCANF_ISOC23_BIN_CST
);
1066 attribute_compat_text_section
1067 __nldbl___isoc23_scanf (const char *fmt
, ...)
1073 ret
= __vfscanf_internal (stdin
, fmt
, ap
,
1074 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
1075 | SCANF_ISOC23_BIN_CST
);
1082 attribute_compat_text_section
1083 __nldbl___isoc23_vfwscanf (FILE *s
, const wchar_t *fmt
, va_list ap
)
1085 return __vfwscanf_internal (s
, fmt
, ap
,
1086 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
1087 | SCANF_ISOC23_BIN_CST
);
1089 libc_hidden_def (__nldbl___isoc23_vfwscanf
)
1092 attribute_compat_text_section
1093 __nldbl___isoc23_swscanf (const wchar_t *s
, const wchar_t *fmt
, ...)
1096 struct _IO_wide_data wd
;
1097 FILE *f
= _IO_strfile_readw (&sf
, &wd
, s
);
1102 ret
= __vfwscanf_internal (f
, fmt
, ap
,
1103 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
1104 | SCANF_ISOC23_BIN_CST
);
1111 attribute_compat_text_section
1112 __nldbl___isoc23_vswscanf (const wchar_t *s
, const wchar_t *fmt
, va_list ap
)
1115 struct _IO_wide_data wd
;
1116 FILE *f
= _IO_strfile_readw (&sf
, &wd
, s
);
1118 return __vfwscanf_internal (f
, fmt
, ap
,
1119 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
1120 | SCANF_ISOC23_BIN_CST
);
1122 libc_hidden_def (__nldbl___isoc23_vswscanf
)
1125 attribute_compat_text_section
1126 __nldbl___isoc23_vwscanf (const wchar_t *fmt
, va_list ap
)
1128 return __vfwscanf_internal (stdin
, fmt
, ap
,
1129 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
1130 | SCANF_ISOC23_BIN_CST
);
1134 attribute_compat_text_section
1135 __nldbl___isoc23_fwscanf (FILE *s
, const wchar_t *fmt
, ...)
1141 ret
= __vfwscanf_internal (s
, fmt
, ap
,
1142 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
1143 | SCANF_ISOC23_BIN_CST
);
1150 attribute_compat_text_section
1151 __nldbl___isoc23_wscanf (const wchar_t *fmt
, ...)
1157 ret
= __vfwscanf_internal (stdin
, fmt
, ap
,
1158 SCANF_LDBL_IS_DBL
| SCANF_ISOC99_A
1159 | SCANF_ISOC23_BIN_CST
);
1166 __nldbl_argp_error (const struct argp_state
*state
, const char *fmt
, ...)
1170 __argp_error_internal (state
, fmt
, ap
, PRINTF_LDBL_IS_DBL
);
1175 __nldbl_argp_failure (const struct argp_state
*state
, int status
,
1176 int errnum
, const char *fmt
, ...)
1180 __argp_failure_internal (state
, status
, errnum
, fmt
, ap
,
1181 PRINTF_LDBL_IS_DBL
);
1185 #define VA_CALL(call) \
1188 va_start (ap, format); \
1189 call (format, ap, PRINTF_LDBL_IS_DBL); \
1194 __nldbl_err (int status
, const char *format
, ...)
1196 VA_CALL (__vwarn_internal
)
1201 __nldbl_errx (int status
, const char *format
, ...)
1203 VA_CALL (__vwarnx_internal
)
1208 __nldbl_verr (int status
, const char *format
, __gnuc_va_list ap
)
1210 __vwarn_internal (format
, ap
, PRINTF_LDBL_IS_DBL
);
1215 __nldbl_verrx (int status
, const char *format
, __gnuc_va_list ap
)
1217 __vwarnx_internal (format
, ap
, PRINTF_LDBL_IS_DBL
);
1222 __nldbl_warn (const char *format
, ...)
1224 VA_CALL (__vwarn_internal
)
1228 __nldbl_warnx (const char *format
, ...)
1230 VA_CALL (__vwarnx_internal
)
1234 __nldbl_vwarn (const char *format
, __gnuc_va_list ap
)
1236 __vwarn_internal (format
, ap
, PRINTF_LDBL_IS_DBL
);
1240 __nldbl_vwarnx (const char *format
, __gnuc_va_list ap
)
1242 __vwarnx_internal (format
, ap
, PRINTF_LDBL_IS_DBL
);
1246 __nldbl_error (int status
, int errnum
, const char *message
, ...)
1249 va_start (ap
, message
);
1250 __error_internal (status
, errnum
, message
, ap
, PRINTF_LDBL_IS_DBL
);
1255 __nldbl_error_at_line (int status
, int errnum
, const char *file_name
,
1256 unsigned int line_number
, const char *message
,
1260 va_start (ap
, message
);
1261 __error_at_line_internal (status
, errnum
, file_name
, line_number
,
1262 message
, ap
, PRINTF_LDBL_IS_DBL
);
1266 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
1267 compat_symbol (libc
, __nldbl__IO_printf
, _IO_printf
, GLIBC_2_0
);
1268 compat_symbol (libc
, __nldbl__IO_sprintf
, _IO_sprintf
, GLIBC_2_0
);
1269 compat_symbol (libc
, __nldbl__IO_vfprintf
, _IO_vfprintf
, GLIBC_2_0
);
1270 compat_symbol (libc
, __nldbl__IO_vsprintf
, _IO_vsprintf
, GLIBC_2_0
);
1271 compat_symbol (libc
, __nldbl_dprintf
, dprintf
, GLIBC_2_0
);
1272 compat_symbol (libc
, __nldbl_fprintf
, fprintf
, GLIBC_2_0
);
1273 compat_symbol (libc
, __nldbl_printf
, printf
, GLIBC_2_0
);
1274 compat_symbol (libc
, __nldbl_sprintf
, sprintf
, GLIBC_2_0
);
1275 compat_symbol (libc
, __nldbl_vfprintf
, vfprintf
, GLIBC_2_0
);
1276 compat_symbol (libc
, __nldbl_vprintf
, vprintf
, GLIBC_2_0
);
1277 compat_symbol (libc
, __nldbl__IO_fprintf
, _IO_fprintf
, GLIBC_2_0
);
1278 compat_symbol (libc
, __nldbl___vsnprintf
, __vsnprintf
, GLIBC_2_0
);
1279 compat_symbol (libc
, __nldbl_asprintf
, asprintf
, GLIBC_2_0
);
1280 compat_symbol (libc
, __nldbl_obstack_printf
, obstack_printf
, GLIBC_2_0
);
1281 compat_symbol (libc
, __nldbl_obstack_vprintf
, obstack_vprintf
, GLIBC_2_0
);
1282 compat_symbol (libc
, __nldbl_snprintf
, snprintf
, GLIBC_2_0
);
1283 compat_symbol (libc
, __nldbl_vasprintf
, vasprintf
, GLIBC_2_0
);
1284 compat_symbol (libc
, __nldbl_vdprintf
, vdprintf
, GLIBC_2_0
);
1285 compat_symbol (libc
, __nldbl_vsnprintf
, vsnprintf
, GLIBC_2_0
);
1286 compat_symbol (libc
, __nldbl_vsprintf
, vsprintf
, GLIBC_2_0
);
1287 compat_symbol (libc
, __nldbl__IO_sscanf
, _IO_sscanf
, GLIBC_2_0
);
1288 compat_symbol (libc
, __nldbl___vfscanf
, __vfscanf
, GLIBC_2_0
);
1289 compat_symbol (libc
, __nldbl___vsscanf
, __vsscanf
, GLIBC_2_0
);
1290 compat_symbol (libc
, __nldbl_fscanf
, fscanf
, GLIBC_2_0
);
1291 compat_symbol (libc
, __nldbl_scanf
, scanf
, GLIBC_2_0
);
1292 compat_symbol (libc
, __nldbl_sscanf
, sscanf
, GLIBC_2_0
);
1293 compat_symbol (libc
, __nldbl_vfscanf
, vfscanf
, GLIBC_2_0
);
1294 compat_symbol (libc
, __nldbl_vscanf
, vscanf
, GLIBC_2_0
);
1295 compat_symbol (libc
, __nldbl_vsscanf
, vsscanf
, GLIBC_2_0
);
1296 compat_symbol (libc
, __nldbl___printf_fp
, __printf_fp
, GLIBC_2_0
);
1297 compat_symbol (libc
, __nldbl_strfmon
, strfmon
, GLIBC_2_0
);
1298 compat_symbol (libc
, __nldbl_syslog
, syslog
, GLIBC_2_0
);
1299 compat_symbol (libc
, __nldbl_vsyslog
, vsyslog
, GLIBC_2_0
);
1300 /* This function is not in public headers, but was exported until
1301 version 2.29. For platforms that are newer than that, there's no
1302 need to expose the symbol. */
1303 # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_29)
1304 compat_symbol (libc
, __nldbl__IO_vfscanf
, _IO_vfscanf
, GLIBC_2_0
);
1307 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_1)
1308 compat_symbol (libc
, __nldbl___asprintf
, __asprintf
, GLIBC_2_1
);
1309 compat_symbol (libc
, __nldbl_printf_size
, printf_size
, GLIBC_2_1
);
1310 compat_symbol (libc
, __nldbl___strfmon_l
, __strfmon_l
, GLIBC_2_1
);
1312 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_2)
1313 compat_symbol (libc
, __nldbl_swprintf
, swprintf
, GLIBC_2_2
);
1314 compat_symbol (libc
, __nldbl_vwprintf
, vwprintf
, GLIBC_2_2
);
1315 compat_symbol (libc
, __nldbl_wprintf
, wprintf
, GLIBC_2_2
);
1316 compat_symbol (libc
, __nldbl_fwprintf
, fwprintf
, GLIBC_2_2
);
1317 compat_symbol (libc
, __nldbl_vfwprintf
, vfwprintf
, GLIBC_2_2
);
1318 compat_symbol (libc
, __nldbl_vswprintf
, vswprintf
, GLIBC_2_2
);
1319 compat_symbol (libc
, __nldbl_fwscanf
, fwscanf
, GLIBC_2_2
);
1320 compat_symbol (libc
, __nldbl_swscanf
, swscanf
, GLIBC_2_2
);
1321 compat_symbol (libc
, __nldbl_vfwscanf
, vfwscanf
, GLIBC_2_2
);
1322 compat_symbol (libc
, __nldbl_vswscanf
, vswscanf
, GLIBC_2_2
);
1323 compat_symbol (libc
, __nldbl_vwscanf
, vwscanf
, GLIBC_2_2
);
1324 compat_symbol (libc
, __nldbl_wscanf
, wscanf
, GLIBC_2_2
);
1326 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3)
1327 compat_symbol (libc
, __nldbl_strfmon_l
, strfmon_l
, GLIBC_2_3
);
1329 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3_4)
1330 compat_symbol (libc
, __nldbl___sprintf_chk
, __sprintf_chk
, GLIBC_2_3_4
);
1331 compat_symbol (libc
, __nldbl___vsprintf_chk
, __vsprintf_chk
, GLIBC_2_3_4
);
1332 compat_symbol (libc
, __nldbl___snprintf_chk
, __snprintf_chk
, GLIBC_2_3_4
);
1333 compat_symbol (libc
, __nldbl___vsnprintf_chk
, __vsnprintf_chk
, GLIBC_2_3_4
);
1334 compat_symbol (libc
, __nldbl___printf_chk
, __printf_chk
, GLIBC_2_3_4
);
1335 compat_symbol (libc
, __nldbl___fprintf_chk
, __fprintf_chk
, GLIBC_2_3_4
);
1336 compat_symbol (libc
, __nldbl___vprintf_chk
, __vprintf_chk
, GLIBC_2_3_4
);
1337 compat_symbol (libc
, __nldbl___vfprintf_chk
, __vfprintf_chk
, GLIBC_2_3_4
);