Update copyright notices with scripts/update-copyrights
[glibc.git] / sysdeps / ieee754 / ldbl-opt / nldbl-compat.c
bloba8e6ca0dcd4ccbea8850a513cdd158bd50f2dd46
1 /* *printf* family compatibility routines for IEEE double as long double
2 Copyright (C) 2006-2014 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Jakub Jelinek <jakub@cygnus.com>, 2006.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
20 #include <stdarg.h>
21 #include <stdio.h>
22 #include <libioP.h>
23 #include <wchar.h>
24 #include <printf.h>
25 #include <monetary.h>
26 #include <locale/localeinfo.h>
27 #include <sys/syslog.h>
28 #include <bits/libc-lock.h>
30 #include "nldbl-compat.h"
32 libc_hidden_proto (__nldbl_vfprintf)
33 libc_hidden_proto (__nldbl_vsscanf)
34 libc_hidden_proto (__nldbl_vsprintf)
35 libc_hidden_proto (__nldbl_vfscanf)
36 libc_hidden_proto (__nldbl_vfwscanf)
37 libc_hidden_proto (__nldbl_vdprintf)
38 libc_hidden_proto (__nldbl_vswscanf)
39 libc_hidden_proto (__nldbl_vfwprintf)
40 libc_hidden_proto (__nldbl_vswprintf)
41 libc_hidden_proto (__nldbl_vsnprintf)
42 libc_hidden_proto (__nldbl_vasprintf)
43 libc_hidden_proto (__nldbl_obstack_vprintf)
44 libc_hidden_proto (__nldbl___vfwprintf_chk)
45 libc_hidden_proto (__nldbl___vsnprintf_chk)
46 libc_hidden_proto (__nldbl___vfprintf_chk)
47 libc_hidden_proto (__nldbl___vsyslog_chk)
48 libc_hidden_proto (__nldbl___vsprintf_chk)
49 libc_hidden_proto (__nldbl___vswprintf_chk)
50 libc_hidden_proto (__nldbl___vasprintf_chk)
51 libc_hidden_proto (__nldbl___vdprintf_chk)
52 libc_hidden_proto (__nldbl___obstack_vprintf_chk)
53 libc_hidden_proto (__nldbl___vstrfmon)
54 libc_hidden_proto (__nldbl___vstrfmon_l)
55 libc_hidden_proto (__nldbl___isoc99_vsscanf)
56 libc_hidden_proto (__nldbl___isoc99_vfscanf)
57 libc_hidden_proto (__nldbl___isoc99_vswscanf)
58 libc_hidden_proto (__nldbl___isoc99_vfwscanf)
60 static void
61 __nldbl_cleanup (void *arg)
63 __no_long_double = 0;
66 #define set_no_long_double() \
67 __libc_cleanup_push (__nldbl_cleanup, NULL); __no_long_double = 1
68 #define clear_no_long_double() \
69 __no_long_double = 0; __libc_cleanup_pop (0)
71 /* Compatibility with IEEE double as long double.
72 IEEE quad long double is used by default for most programs, so
73 we don't need to split this into one file per function for the
74 sake of statically linked programs. */
76 int
77 attribute_compat_text_section
78 __nldbl___asprintf (char **string_ptr, const char *fmt, ...)
80 va_list arg;
81 int done;
83 va_start (arg, fmt);
84 done = __nldbl_vasprintf (string_ptr, fmt, arg);
85 va_end (arg);
87 return done;
89 weak_alias (__nldbl___asprintf, __nldbl_asprintf)
91 int
92 attribute_compat_text_section
93 __nldbl_dprintf (int d, const char *fmt, ...)
95 va_list arg;
96 int done;
98 va_start (arg, fmt);
99 done = __nldbl_vdprintf (d, fmt, arg);
100 va_end (arg);
102 return done;
106 attribute_compat_text_section
107 __nldbl_fprintf (FILE *stream, const char *fmt, ...)
109 va_list arg;
110 int done;
112 va_start (arg, fmt);
113 done = __nldbl_vfprintf (stream, fmt, arg);
114 va_end (arg);
116 return done;
118 weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf)
121 attribute_compat_text_section weak_function
122 __nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...)
124 va_list arg;
125 int done;
127 va_start (arg, fmt);
128 done = __nldbl_vfwprintf (stream, fmt, arg);
129 va_end (arg);
131 return done;
135 attribute_compat_text_section
136 __nldbl_printf (const char *fmt, ...)
138 va_list arg;
139 int done;
141 va_start (arg, fmt);
142 done = __nldbl_vfprintf (stdout, fmt, arg);
143 va_end (arg);
145 return done;
147 strong_alias (__nldbl_printf, __nldbl__IO_printf)
150 attribute_compat_text_section
151 __nldbl_sprintf (char *s, const char *fmt, ...)
153 va_list arg;
154 int done;
156 va_start (arg, fmt);
157 done = __nldbl_vsprintf (s, fmt, arg);
158 va_end (arg);
160 return done;
162 strong_alias (__nldbl_sprintf, __nldbl__IO_sprintf)
165 attribute_compat_text_section
166 __nldbl_vfprintf (FILE *s, const char *fmt, va_list ap)
168 int done;
169 set_no_long_double ();
170 done = _IO_vfprintf (s, fmt, ap);
171 clear_no_long_double ();
172 return done;
174 libc_hidden_def (__nldbl_vfprintf)
175 strong_alias (__nldbl_vfprintf, __nldbl__IO_vfprintf)
178 attribute_compat_text_section
179 __nldbl__IO_vsprintf (char *string, const char *fmt, va_list ap)
181 int done;
182 __no_long_double = 1;
183 done = _IO_vsprintf (string, fmt, ap);
184 __no_long_double = 0;
185 return done;
187 weak_alias (__nldbl__IO_vsprintf, __nldbl_vsprintf)
188 libc_hidden_def (__nldbl_vsprintf)
191 attribute_compat_text_section
192 __nldbl_obstack_vprintf (struct obstack *obstack, const char *fmt,
193 va_list ap)
195 int done;
196 __no_long_double = 1;
197 done = _IO_obstack_vprintf (obstack, fmt, ap);
198 __no_long_double = 0;
199 return done;
201 libc_hidden_def (__nldbl_obstack_vprintf)
204 attribute_compat_text_section
205 __nldbl_obstack_printf (struct obstack *obstack, const char *fmt, ...)
207 int result;
208 va_list ap;
209 va_start (ap, fmt);
210 result = __nldbl_obstack_vprintf (obstack, fmt, ap);
211 va_end (ap);
212 return result;
216 attribute_compat_text_section weak_function
217 __nldbl_snprintf (char *s, size_t maxlen, const char *fmt, ...)
219 va_list arg;
220 int done;
222 va_start (arg, fmt);
223 done = __nldbl_vsnprintf (s, maxlen, fmt, arg);
224 va_end (arg);
226 return done;
230 attribute_compat_text_section
231 __nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
233 va_list arg;
234 int done;
236 va_start (arg, fmt);
237 done = __nldbl_vswprintf (s, n, fmt, arg);
238 va_end (arg);
240 return done;
244 attribute_compat_text_section weak_function
245 __nldbl_vasprintf (char **result_ptr, const char *fmt, va_list ap)
247 int res;
248 __no_long_double = 1;
249 res = _IO_vasprintf (result_ptr, fmt, ap);
250 __no_long_double = 0;
251 return res;
253 libc_hidden_def (__nldbl_vasprintf)
256 attribute_compat_text_section
257 __nldbl_vdprintf (int d, const char *fmt, va_list arg)
259 int res;
260 set_no_long_double ();
261 res = _IO_vdprintf (d, fmt, arg);
262 clear_no_long_double ();
263 return res;
265 libc_hidden_def (__nldbl_vdprintf)
268 attribute_compat_text_section weak_function
269 __nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
271 int res;
272 set_no_long_double ();
273 res = _IO_vfwprintf (s, fmt, ap);
274 clear_no_long_double ();
275 return res;
277 libc_hidden_def (__nldbl_vfwprintf)
280 attribute_compat_text_section
281 __nldbl_vprintf (const char *fmt, va_list ap)
283 return __nldbl_vfprintf (stdout, fmt, ap);
287 attribute_compat_text_section
288 __nldbl_vsnprintf (char *string, size_t maxlen, const char *fmt,
289 va_list ap)
291 int res;
292 __no_long_double = 1;
293 res = _IO_vsnprintf (string, maxlen, fmt, ap);
294 __no_long_double = 0;
295 return res;
297 libc_hidden_def (__nldbl_vsnprintf)
298 weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf)
301 attribute_compat_text_section weak_function
302 __nldbl_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt,
303 va_list ap)
305 int res;
306 __no_long_double = 1;
307 res = _IO_vswprintf (string, maxlen, fmt, ap);
308 __no_long_double = 0;
309 return res;
311 libc_hidden_def (__nldbl_vswprintf)
314 attribute_compat_text_section
315 __nldbl_vwprintf (const wchar_t *fmt, va_list ap)
317 return __nldbl_vfwprintf (stdout, fmt, ap);
321 attribute_compat_text_section
322 __nldbl_wprintf (const wchar_t *fmt, ...)
324 va_list arg;
325 int done;
327 va_start (arg, fmt);
328 done = __nldbl_vfwprintf (stdout, fmt, arg);
329 va_end (arg);
331 return done;
335 attribute_compat_text_section
336 __nldbl__IO_vfscanf (FILE *s, const char *fmt, _IO_va_list ap,
337 int *errp)
339 int res;
340 set_no_long_double ();
341 res = _IO_vfscanf (s, fmt, ap, errp);
342 clear_no_long_double ();
343 return res;
347 attribute_compat_text_section
348 __nldbl___vfscanf (FILE *s, const char *fmt, va_list ap)
350 int res;
351 set_no_long_double ();
352 res = _IO_vfscanf (s, fmt, ap, NULL);
353 clear_no_long_double ();
354 return res;
356 weak_alias (__nldbl___vfscanf, __nldbl_vfscanf)
357 libc_hidden_def (__nldbl_vfscanf)
360 attribute_compat_text_section
361 __nldbl_sscanf (const char *s, const char *fmt, ...)
363 va_list arg;
364 int done;
366 va_start (arg, fmt);
367 done = __nldbl_vsscanf (s, fmt, arg);
368 va_end (arg);
370 return done;
372 strong_alias (__nldbl_sscanf, __nldbl__IO_sscanf)
375 attribute_compat_text_section
376 __nldbl___vsscanf (const char *string, const char *fmt, va_list ap)
378 int res;
379 __no_long_double = 1;
380 res = _IO_vsscanf (string, fmt, ap);
381 __no_long_double = 0;
382 return res;
384 weak_alias (__nldbl___vsscanf, __nldbl_vsscanf)
385 libc_hidden_def (__nldbl_vsscanf)
388 attribute_compat_text_section weak_function
389 __nldbl_vscanf (const char *fmt, va_list ap)
391 return __nldbl_vfscanf (stdin, fmt, ap);
395 attribute_compat_text_section
396 __nldbl_fscanf (FILE *stream, const char *fmt, ...)
398 va_list arg;
399 int done;
401 va_start (arg, fmt);
402 done = __nldbl_vfscanf (stream, fmt, arg);
403 va_end (arg);
405 return done;
409 attribute_compat_text_section
410 __nldbl_scanf (const char *fmt, ...)
412 va_list arg;
413 int done;
415 va_start (arg, fmt);
416 done = __nldbl_vfscanf (stdin, fmt, arg);
417 va_end (arg);
419 return done;
423 attribute_compat_text_section
424 __nldbl_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
426 int res;
427 set_no_long_double ();
428 res = _IO_vfwscanf (s, fmt, ap, NULL);
429 clear_no_long_double ();
430 return res;
432 libc_hidden_def (__nldbl_vfwscanf)
435 attribute_compat_text_section
436 __nldbl_swscanf (const wchar_t *s, const wchar_t *fmt, ...)
438 va_list arg;
439 int done;
441 va_start (arg, fmt);
442 done = __nldbl_vswscanf (s, fmt, arg);
443 va_end (arg);
445 return done;
449 attribute_compat_text_section
450 __nldbl_vswscanf (const wchar_t *string, const wchar_t *fmt, va_list ap)
452 int res;
453 __no_long_double = 1;
454 res = vswscanf (string, fmt, ap);
455 __no_long_double = 0;
456 return res;
458 libc_hidden_def (__nldbl_vswscanf)
461 attribute_compat_text_section weak_function
462 __nldbl_vwscanf (const wchar_t *fmt, va_list ap)
464 return __nldbl_vfwscanf (stdin, fmt, ap);
468 attribute_compat_text_section
469 __nldbl_fwscanf (FILE *stream, const wchar_t *fmt, ...)
471 va_list arg;
472 int done;
474 va_start (arg, fmt);
475 done = __nldbl_vfwscanf (stream, fmt, arg);
476 va_end (arg);
478 return done;
482 attribute_compat_text_section
483 __nldbl_wscanf (const wchar_t *fmt, ...)
485 va_list arg;
486 int done;
488 va_start (arg, fmt);
489 done = __nldbl_vfwscanf (stdin, fmt, arg);
490 va_end (arg);
492 return done;
496 attribute_compat_text_section
497 __nldbl___fprintf_chk (FILE *stream, int flag, const char *fmt, ...)
499 va_list arg;
500 int done;
502 va_start (arg, fmt);
503 done = __nldbl___vfprintf_chk (stream, flag, fmt, arg);
504 va_end (arg);
506 return done;
510 attribute_compat_text_section
511 __nldbl___fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
513 va_list arg;
514 int done;
516 va_start (arg, fmt);
517 done = __nldbl___vfwprintf_chk (stream, flag, fmt, arg);
518 va_end (arg);
520 return done;
524 attribute_compat_text_section
525 __nldbl___printf_chk (int flag, const char *fmt, ...)
527 va_list arg;
528 int done;
530 va_start (arg, fmt);
531 done = __nldbl___vfprintf_chk (stdout, flag, fmt, arg);
532 va_end (arg);
534 return done;
538 attribute_compat_text_section
539 __nldbl___snprintf_chk (char *s, size_t maxlen, int flag, size_t slen,
540 const char *fmt, ...)
542 va_list arg;
543 int done;
545 va_start (arg, fmt);
546 done = __nldbl___vsnprintf_chk (s, maxlen, flag, slen, fmt, arg);
547 va_end (arg);
549 return done;
553 attribute_compat_text_section
554 __nldbl___sprintf_chk (char *s, int flag, size_t slen, const char *fmt, ...)
556 va_list arg;
557 int done;
559 va_start (arg, fmt);
560 done = __nldbl___vsprintf_chk (s, flag, slen, fmt, arg);
561 va_end (arg);
563 return done;
567 attribute_compat_text_section
568 __nldbl___swprintf_chk (wchar_t *s, size_t n, int flag, size_t slen,
569 const wchar_t *fmt, ...)
571 va_list arg;
572 int done;
574 va_start (arg, fmt);
575 done = __nldbl___vswprintf_chk (s, n, flag, slen, fmt, arg);
576 va_end (arg);
578 return done;
582 attribute_compat_text_section
583 __nldbl___vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
585 int res;
586 set_no_long_double ();
587 res = __vfprintf_chk (s, flag, fmt, ap);
588 clear_no_long_double ();
589 return res;
591 libc_hidden_def (__nldbl___vfprintf_chk)
594 attribute_compat_text_section
595 __nldbl___vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
597 int res;
598 set_no_long_double ();
599 res = __vfwprintf_chk (s, flag, fmt, ap);
600 clear_no_long_double ();
601 return res;
603 libc_hidden_def (__nldbl___vfwprintf_chk)
606 attribute_compat_text_section
607 __nldbl___vprintf_chk (int flag, const char *fmt, va_list ap)
609 return __nldbl___vfprintf_chk (stdout, flag, fmt, ap);
613 attribute_compat_text_section
614 __nldbl___vsnprintf_chk (char *string, size_t maxlen, int flag, size_t slen,
615 const char *fmt, va_list ap)
617 int res;
618 __no_long_double = 1;
619 res = __vsnprintf_chk (string, maxlen, flag, slen, fmt, ap);
620 __no_long_double = 0;
621 return res;
623 libc_hidden_def (__nldbl___vsnprintf_chk)
626 attribute_compat_text_section
627 __nldbl___vsprintf_chk (char *string, int flag, size_t slen, const char *fmt,
628 va_list ap)
630 int res;
631 __no_long_double = 1;
632 res = __vsprintf_chk (string, flag, slen, fmt, ap);
633 __no_long_double = 0;
634 return res;
636 libc_hidden_def (__nldbl___vsprintf_chk)
639 attribute_compat_text_section
640 __nldbl___vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen,
641 const wchar_t *fmt, va_list ap)
643 int res;
644 __no_long_double = 1;
645 res = __vswprintf_chk (string, maxlen, flag, slen, fmt, ap);
646 __no_long_double = 0;
647 return res;
649 libc_hidden_def (__nldbl___vswprintf_chk)
652 attribute_compat_text_section
653 __nldbl___vwprintf_chk (int flag, const wchar_t *fmt, va_list ap)
655 return __nldbl___vfwprintf_chk (stdout, flag, fmt, ap);
659 attribute_compat_text_section
660 __nldbl___wprintf_chk (int flag, const wchar_t *fmt, ...)
662 va_list arg;
663 int done;
665 va_start (arg, fmt);
666 done = __nldbl___vfwprintf_chk (stdout, flag, fmt, arg);
667 va_end (arg);
669 return done;
673 attribute_compat_text_section
674 __nldbl___vasprintf_chk (char **ptr, int flag, const char *fmt, va_list arg)
676 int res;
677 __no_long_double = 1;
678 res = __vasprintf_chk (ptr, flag, fmt, arg);
679 __no_long_double = 0;
680 return res;
682 libc_hidden_def (__nldbl___vasprintf_chk)
685 attribute_compat_text_section
686 __nldbl___asprintf_chk (char **ptr, int flag, const char *fmt, ...)
688 va_list arg;
689 int done;
691 va_start (arg, fmt);
692 done = __nldbl___vasprintf_chk (ptr, flag, fmt, arg);
693 va_end (arg);
695 return done;
699 attribute_compat_text_section
700 __nldbl___vdprintf_chk (int d, int flag, const char *fmt, va_list arg)
702 int res;
703 set_no_long_double ();
704 res = __vdprintf_chk (d, flag, fmt, arg);
705 clear_no_long_double ();
706 return res;
708 libc_hidden_def (__nldbl___vdprintf_chk)
711 attribute_compat_text_section
712 __nldbl___dprintf_chk (int d, int flag, const char *fmt, ...)
714 va_list arg;
715 int done;
717 va_start (arg, fmt);
718 done = __nldbl___vdprintf_chk (d, flag, fmt, arg);
719 va_end (arg);
721 return done;
725 attribute_compat_text_section
726 __nldbl___obstack_vprintf_chk (struct obstack *obstack, int flag,
727 const char *fmt, va_list arg)
729 int res;
730 __no_long_double = 1;
731 res = __obstack_vprintf_chk (obstack, flag, fmt, arg);
732 __no_long_double = 0;
733 return res;
735 libc_hidden_def (__nldbl___obstack_vprintf_chk)
738 attribute_compat_text_section
739 __nldbl___obstack_printf_chk (struct obstack *obstack, int flag,
740 const char *fmt, ...)
742 va_list arg;
743 int done;
745 va_start (arg, fmt);
746 done = __nldbl___obstack_vprintf_chk (obstack, flag, fmt, arg);
747 va_end (arg);
749 return done;
752 extern __typeof (printf_size) __printf_size;
755 attribute_compat_text_section
756 __nldbl_printf_size (FILE *fp, const struct printf_info *info,
757 const void *const *args)
759 struct printf_info info_no_ldbl = *info;
761 info_no_ldbl.is_long_double = 0;
762 return __printf_size (fp, &info_no_ldbl, args);
765 extern __typeof (__printf_fp) ___printf_fp;
768 attribute_compat_text_section
769 __nldbl___printf_fp (FILE *fp, const struct printf_info *info,
770 const void *const *args)
772 struct printf_info info_no_ldbl = *info;
774 info_no_ldbl.is_long_double = 0;
775 return ___printf_fp (fp, &info_no_ldbl, args);
778 ssize_t
779 attribute_compat_text_section
780 __nldbl_strfmon (char *s, size_t maxsize, const char *format, ...)
782 va_list ap;
783 ssize_t res;
785 va_start (ap, format);
786 res = __nldbl___vstrfmon (s, maxsize, format, ap);
787 va_end (ap);
788 return res;
791 ssize_t
792 attribute_compat_text_section
793 __nldbl___strfmon_l (char *s, size_t maxsize, __locale_t loc,
794 const char *format, ...)
796 va_list ap;
797 ssize_t res;
799 va_start (ap, format);
800 res = __nldbl___vstrfmon_l (s, maxsize, loc, format, ap);
801 va_end (ap);
802 return res;
804 weak_alias (__nldbl___strfmon_l, __nldbl_strfmon_l)
806 ssize_t
807 attribute_compat_text_section
808 __nldbl___vstrfmon (char *s, size_t maxsize, const char *format, va_list ap)
810 ssize_t res;
811 __no_long_double = 1;
812 res = __vstrfmon_l (s, maxsize, _NL_CURRENT_LOCALE, format, ap);
813 __no_long_double = 0;
814 va_end (ap);
815 return res;
817 libc_hidden_def (__nldbl___vstrfmon)
819 ssize_t
820 attribute_compat_text_section
821 __nldbl___vstrfmon_l (char *s, size_t maxsize, __locale_t loc,
822 const char *format, va_list ap)
824 ssize_t res;
825 __no_long_double = 1;
826 res = __vstrfmon_l (s, maxsize, loc, format, ap);
827 __no_long_double = 0;
828 va_end (ap);
829 return res;
831 libc_hidden_def (__nldbl___vstrfmon_l)
833 void
834 attribute_compat_text_section
835 __nldbl_syslog (int pri, const char *fmt, ...)
837 va_list ap;
838 va_start (ap, fmt);
839 __nldbl___vsyslog_chk (pri, -1, fmt, ap);
840 va_end (ap);
843 void
844 attribute_compat_text_section
845 __nldbl___syslog_chk (int pri, int flag, const char *fmt, ...)
847 va_list ap;
849 va_start (ap, fmt);
850 __nldbl___vsyslog_chk (pri, flag, fmt, ap);
851 va_end(ap);
854 void
855 attribute_compat_text_section
856 __nldbl___vsyslog_chk (int pri, int flag, const char *fmt, va_list ap)
858 set_no_long_double ();
859 __vsyslog_chk (pri, flag, fmt, ap);
860 clear_no_long_double ();
862 libc_hidden_def (__nldbl___vsyslog_chk)
864 void
865 attribute_compat_text_section
866 __nldbl_vsyslog (int pri, const char *fmt, va_list ap)
868 __nldbl___vsyslog_chk (pri, -1, fmt, ap);
872 attribute_compat_text_section
873 __nldbl___isoc99_vfscanf (FILE *s, const char *fmt, va_list ap)
875 int res;
876 set_no_long_double ();
877 res = __isoc99_vfscanf (s, fmt, ap);
878 clear_no_long_double ();
879 return res;
881 libc_hidden_def (__nldbl___isoc99_vfscanf)
884 attribute_compat_text_section
885 __nldbl___isoc99_sscanf (const char *s, const char *fmt, ...)
887 va_list arg;
888 int done;
890 va_start (arg, fmt);
891 done = __nldbl___isoc99_vsscanf (s, fmt, arg);
892 va_end (arg);
894 return done;
898 attribute_compat_text_section
899 __nldbl___isoc99_vsscanf (const char *string, const char *fmt, va_list ap)
901 int res;
902 __no_long_double = 1;
903 res = __isoc99_vsscanf (string, fmt, ap);
904 __no_long_double = 0;
905 return res;
907 libc_hidden_def (__nldbl___isoc99_vsscanf)
910 attribute_compat_text_section
911 __nldbl___isoc99_vscanf (const char *fmt, va_list ap)
913 return __nldbl___isoc99_vfscanf (stdin, fmt, ap);
917 attribute_compat_text_section
918 __nldbl___isoc99_fscanf (FILE *stream, const char *fmt, ...)
920 va_list arg;
921 int done;
923 va_start (arg, fmt);
924 done = __nldbl___isoc99_vfscanf (stream, fmt, arg);
925 va_end (arg);
927 return done;
931 attribute_compat_text_section
932 __nldbl___isoc99_scanf (const char *fmt, ...)
934 va_list arg;
935 int done;
937 va_start (arg, fmt);
938 done = __nldbl___isoc99_vfscanf (stdin, fmt, arg);
939 va_end (arg);
941 return done;
945 attribute_compat_text_section
946 __nldbl___isoc99_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
948 int res;
949 set_no_long_double ();
950 res = __isoc99_vfwscanf (s, fmt, ap);
951 clear_no_long_double ();
952 return res;
954 libc_hidden_def (__nldbl___isoc99_vfwscanf)
957 attribute_compat_text_section
958 __nldbl___isoc99_swscanf (const wchar_t *s, const wchar_t *fmt, ...)
960 va_list arg;
961 int done;
963 va_start (arg, fmt);
964 done = __nldbl___isoc99_vswscanf (s, fmt, arg);
965 va_end (arg);
967 return done;
971 attribute_compat_text_section
972 __nldbl___isoc99_vswscanf (const wchar_t *string, const wchar_t *fmt,
973 va_list ap)
975 int res;
976 __no_long_double = 1;
977 res = __isoc99_vswscanf (string, fmt, ap);
978 __no_long_double = 0;
979 return res;
981 libc_hidden_def (__nldbl___isoc99_vswscanf)
984 attribute_compat_text_section
985 __nldbl___isoc99_vwscanf (const wchar_t *fmt, va_list ap)
987 return __nldbl___isoc99_vfwscanf (stdin, fmt, ap);
991 attribute_compat_text_section
992 __nldbl___isoc99_fwscanf (FILE *stream, const wchar_t *fmt, ...)
994 va_list arg;
995 int done;
997 va_start (arg, fmt);
998 done = __nldbl___isoc99_vfwscanf (stream, fmt, arg);
999 va_end (arg);
1001 return done;
1005 attribute_compat_text_section
1006 __nldbl___isoc99_wscanf (const wchar_t *fmt, ...)
1008 va_list arg;
1009 int done;
1011 va_start (arg, fmt);
1012 done = __nldbl___isoc99_vfwscanf (stdin, fmt, arg);
1013 va_end (arg);
1015 return done;
1018 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
1019 compat_symbol (libc, __nldbl__IO_printf, _IO_printf, GLIBC_2_0);
1020 compat_symbol (libc, __nldbl__IO_sprintf, _IO_sprintf, GLIBC_2_0);
1021 compat_symbol (libc, __nldbl__IO_vfprintf, _IO_vfprintf, GLIBC_2_0);
1022 compat_symbol (libc, __nldbl__IO_vsprintf, _IO_vsprintf, GLIBC_2_0);
1023 compat_symbol (libc, __nldbl_dprintf, dprintf, GLIBC_2_0);
1024 compat_symbol (libc, __nldbl_fprintf, fprintf, GLIBC_2_0);
1025 compat_symbol (libc, __nldbl_printf, printf, GLIBC_2_0);
1026 compat_symbol (libc, __nldbl_sprintf, sprintf, GLIBC_2_0);
1027 compat_symbol (libc, __nldbl_vfprintf, vfprintf, GLIBC_2_0);
1028 compat_symbol (libc, __nldbl_vprintf, vprintf, GLIBC_2_0);
1029 compat_symbol (libc, __nldbl__IO_fprintf, _IO_fprintf, GLIBC_2_0);
1030 compat_symbol (libc, __nldbl___vsnprintf, __vsnprintf, GLIBC_2_0);
1031 compat_symbol (libc, __nldbl_asprintf, asprintf, GLIBC_2_0);
1032 compat_symbol (libc, __nldbl_obstack_printf, obstack_printf, GLIBC_2_0);
1033 compat_symbol (libc, __nldbl_obstack_vprintf, obstack_vprintf, GLIBC_2_0);
1034 compat_symbol (libc, __nldbl_snprintf, snprintf, GLIBC_2_0);
1035 compat_symbol (libc, __nldbl_vasprintf, vasprintf, GLIBC_2_0);
1036 compat_symbol (libc, __nldbl_vdprintf, vdprintf, GLIBC_2_0);
1037 compat_symbol (libc, __nldbl_vsnprintf, vsnprintf, GLIBC_2_0);
1038 compat_symbol (libc, __nldbl_vsprintf, vsprintf, GLIBC_2_0);
1039 compat_symbol (libc, __nldbl__IO_sscanf, _IO_sscanf, GLIBC_2_0);
1040 compat_symbol (libc, __nldbl__IO_vfscanf, _IO_vfscanf, GLIBC_2_0);
1041 compat_symbol (libc, __nldbl___vfscanf, __vfscanf, GLIBC_2_0);
1042 compat_symbol (libc, __nldbl___vsscanf, __vsscanf, GLIBC_2_0);
1043 compat_symbol (libc, __nldbl_fscanf, fscanf, GLIBC_2_0);
1044 compat_symbol (libc, __nldbl_scanf, scanf, GLIBC_2_0);
1045 compat_symbol (libc, __nldbl_sscanf, sscanf, GLIBC_2_0);
1046 compat_symbol (libc, __nldbl_vfscanf, vfscanf, GLIBC_2_0);
1047 compat_symbol (libc, __nldbl_vscanf, vscanf, GLIBC_2_0);
1048 compat_symbol (libc, __nldbl_vsscanf, vsscanf, GLIBC_2_0);
1049 compat_symbol (libc, __nldbl___printf_fp, __printf_fp, GLIBC_2_0);
1050 compat_symbol (libc, __nldbl_strfmon, strfmon, GLIBC_2_0);
1051 compat_symbol (libc, __nldbl_syslog, syslog, GLIBC_2_0);
1052 compat_symbol (libc, __nldbl_vsyslog, vsyslog, GLIBC_2_0);
1053 #endif
1054 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_1)
1055 compat_symbol (libc, __nldbl___asprintf, __asprintf, GLIBC_2_1);
1056 compat_symbol (libc, __nldbl_printf_size, printf_size, GLIBC_2_1);
1057 compat_symbol (libc, __nldbl___strfmon_l, __strfmon_l, GLIBC_2_1);
1058 #endif
1059 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_2)
1060 compat_symbol (libc, __nldbl_swprintf, swprintf, GLIBC_2_2);
1061 compat_symbol (libc, __nldbl_vwprintf, vwprintf, GLIBC_2_2);
1062 compat_symbol (libc, __nldbl_wprintf, wprintf, GLIBC_2_2);
1063 compat_symbol (libc, __nldbl_fwprintf, fwprintf, GLIBC_2_2);
1064 compat_symbol (libc, __nldbl_vfwprintf, vfwprintf, GLIBC_2_2);
1065 compat_symbol (libc, __nldbl_vswprintf, vswprintf, GLIBC_2_2);
1066 compat_symbol (libc, __nldbl_fwscanf, fwscanf, GLIBC_2_2);
1067 compat_symbol (libc, __nldbl_swscanf, swscanf, GLIBC_2_2);
1068 compat_symbol (libc, __nldbl_vfwscanf, vfwscanf, GLIBC_2_2);
1069 compat_symbol (libc, __nldbl_vswscanf, vswscanf, GLIBC_2_2);
1070 compat_symbol (libc, __nldbl_vwscanf, vwscanf, GLIBC_2_2);
1071 compat_symbol (libc, __nldbl_wscanf, wscanf, GLIBC_2_2);
1072 #endif
1073 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3)
1074 compat_symbol (libc, __nldbl_strfmon_l, strfmon_l, GLIBC_2_3);
1075 #endif
1076 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3_4)
1077 compat_symbol (libc, __nldbl___sprintf_chk, __sprintf_chk, GLIBC_2_3_4);
1078 compat_symbol (libc, __nldbl___vsprintf_chk, __vsprintf_chk, GLIBC_2_3_4);
1079 compat_symbol (libc, __nldbl___snprintf_chk, __snprintf_chk, GLIBC_2_3_4);
1080 compat_symbol (libc, __nldbl___vsnprintf_chk, __vsnprintf_chk, GLIBC_2_3_4);
1081 compat_symbol (libc, __nldbl___printf_chk, __printf_chk, GLIBC_2_3_4);
1082 compat_symbol (libc, __nldbl___fprintf_chk, __fprintf_chk, GLIBC_2_3_4);
1083 compat_symbol (libc, __nldbl___vprintf_chk, __vprintf_chk, GLIBC_2_3_4);
1084 compat_symbol (libc, __nldbl___vfprintf_chk, __vfprintf_chk, GLIBC_2_3_4);
1085 #endif