Update copyright notices with scripts/update-copyrights.
[jlayton/glibc.git] / sysdeps / ieee754 / ldbl-opt / nldbl-compat.c
1 /* *printf* family compatibility routines for IEEE double as long double
2    Copyright (C) 2006-2013 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4    Contributed by Jakub Jelinek <jakub@cygnus.com>, 2006.
5
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.
10
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.
15
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/>.  */
19
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>
29
30 #include "nldbl-compat.h"
31
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)
59
60 static void
61 __nldbl_cleanup (void *arg)
62 {
63   __no_long_double = 0;
64 }
65
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)
70
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.  */
75
76 int
77 attribute_compat_text_section
78 __nldbl___asprintf (char **string_ptr, const char *fmt, ...)
79 {
80   va_list arg;
81   int done;
82
83   va_start (arg, fmt);
84   done = __nldbl_vasprintf (string_ptr, fmt, arg);
85   va_end (arg);
86
87   return done;
88 }
89 weak_alias (__nldbl___asprintf, __nldbl_asprintf)
90
91 int
92 attribute_compat_text_section
93 __nldbl_dprintf (int d, const char *fmt, ...)
94 {
95   va_list arg;
96   int done;
97
98   va_start (arg, fmt);
99   done = __nldbl_vdprintf (d, fmt, arg);
100   va_end (arg);
101
102   return done;
103 }
104
105 int
106 attribute_compat_text_section
107 __nldbl_fprintf (FILE *stream, const char *fmt, ...)
108 {
109   va_list arg;
110   int done;
111
112   va_start (arg, fmt);
113   done = __nldbl_vfprintf (stream, fmt, arg);
114   va_end (arg);
115
116   return done;
117 }
118 weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf)
119
120 int
121 attribute_compat_text_section weak_function
122 __nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...)
123 {
124   va_list arg;
125   int done;
126
127   va_start (arg, fmt);
128   done = __nldbl_vfwprintf (stream, fmt, arg);
129   va_end (arg);
130
131   return done;
132 }
133
134 int
135 attribute_compat_text_section
136 __nldbl_printf (const char *fmt, ...)
137 {
138   va_list arg;
139   int done;
140
141   va_start (arg, fmt);
142   done = __nldbl_vfprintf (stdout, fmt, arg);
143   va_end (arg);
144
145   return done;
146 }
147 strong_alias (__nldbl_printf, __nldbl__IO_printf)
148
149 int
150 attribute_compat_text_section
151 __nldbl_sprintf (char *s, const char *fmt, ...)
152 {
153   va_list arg;
154   int done;
155
156   va_start (arg, fmt);
157   done = __nldbl_vsprintf (s, fmt, arg);
158   va_end (arg);
159
160   return done;
161 }
162 strong_alias (__nldbl_sprintf, __nldbl__IO_sprintf)
163
164 int
165 attribute_compat_text_section
166 __nldbl_vfprintf (FILE *s, const char *fmt, va_list ap)
167 {
168   int done;
169   set_no_long_double ();
170   done = _IO_vfprintf (s, fmt, ap);
171   clear_no_long_double ();
172   return done;
173 }
174 libc_hidden_def (__nldbl_vfprintf)
175 strong_alias (__nldbl_vfprintf, __nldbl__IO_vfprintf)
176
177 int
178 attribute_compat_text_section
179 __nldbl__IO_vsprintf (char *string, const char *fmt, va_list ap)
180 {
181   int done;
182   __no_long_double = 1;
183   done = _IO_vsprintf (string, fmt, ap);
184   __no_long_double = 0;
185   return done;
186 }
187 weak_alias (__nldbl__IO_vsprintf, __nldbl_vsprintf)
188 libc_hidden_def (__nldbl_vsprintf)
189
190 int
191 attribute_compat_text_section
192 __nldbl_obstack_vprintf (struct obstack *obstack, const char *fmt,
193                          va_list ap)
194 {
195   int done;
196   __no_long_double = 1;
197   done = _IO_obstack_vprintf (obstack, fmt, ap);
198   __no_long_double = 0;
199   return done;
200 }
201 libc_hidden_def (__nldbl_obstack_vprintf)
202
203 int
204 attribute_compat_text_section
205 __nldbl_obstack_printf (struct obstack *obstack, const char *fmt, ...)
206 {
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;
213 }
214
215 int
216 attribute_compat_text_section weak_function
217 __nldbl_snprintf (char *s, size_t maxlen, const char *fmt, ...)
218 {
219   va_list arg;
220   int done;
221
222   va_start (arg, fmt);
223   done = __nldbl_vsnprintf (s, maxlen, fmt, arg);
224   va_end (arg);
225
226   return done;
227 }
228
229 int
230 attribute_compat_text_section
231 __nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
232 {
233   va_list arg;
234   int done;
235
236   va_start (arg, fmt);
237   done = __nldbl_vswprintf (s, n, fmt, arg);
238   va_end (arg);
239
240   return done;
241 }
242
243 int
244 attribute_compat_text_section weak_function
245 __nldbl_vasprintf (char **result_ptr, const char *fmt, va_list ap)
246 {
247   int res;
248   __no_long_double = 1;
249   res = _IO_vasprintf (result_ptr, fmt, ap);
250   __no_long_double = 0;
251   return res;
252 }
253 libc_hidden_def (__nldbl_vasprintf)
254
255 int
256 attribute_compat_text_section
257 __nldbl_vdprintf (int d, const char *fmt, va_list arg)
258 {
259   int res;
260   set_no_long_double ();
261   res = _IO_vdprintf (d, fmt, arg);
262   clear_no_long_double ();
263   return res;
264 }
265 libc_hidden_def (__nldbl_vdprintf)
266
267 int
268 attribute_compat_text_section weak_function
269 __nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
270 {
271   int res;
272   set_no_long_double ();
273   res = _IO_vfwprintf (s, fmt, ap);
274   clear_no_long_double ();
275   return res;
276 }
277 libc_hidden_def (__nldbl_vfwprintf)
278
279 int
280 attribute_compat_text_section
281 __nldbl_vprintf (const char *fmt, va_list ap)
282 {
283   return __nldbl_vfprintf (stdout, fmt, ap);
284 }
285
286 int
287 attribute_compat_text_section
288 __nldbl_vsnprintf (char *string, size_t maxlen, const char *fmt,
289                    va_list ap)
290 {
291   int res;
292   __no_long_double = 1;
293   res = _IO_vsnprintf (string, maxlen, fmt, ap);
294   __no_long_double = 0;
295   return res;
296 }
297 libc_hidden_def (__nldbl_vsnprintf)
298 weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf)
299
300 int
301 attribute_compat_text_section weak_function
302 __nldbl_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt,
303                    va_list ap)
304 {
305   int res;
306   __no_long_double = 1;
307   res = _IO_vswprintf (string, maxlen, fmt, ap);
308   __no_long_double = 0;
309   return res;
310 }
311 libc_hidden_def (__nldbl_vswprintf)
312
313 int
314 attribute_compat_text_section
315 __nldbl_vwprintf (const wchar_t *fmt, va_list ap)
316 {
317   return __nldbl_vfwprintf (stdout, fmt, ap);
318 }
319
320 int
321 attribute_compat_text_section
322 __nldbl_wprintf (const wchar_t *fmt, ...)
323 {
324   va_list arg;
325   int done;
326
327   va_start (arg, fmt);
328   done = __nldbl_vfwprintf (stdout, fmt, arg);
329   va_end (arg);
330
331   return done;
332 }
333
334 int
335 attribute_compat_text_section
336 __nldbl__IO_vfscanf (FILE *s, const char *fmt, _IO_va_list ap,
337                     int *errp)
338 {
339   int res;
340   set_no_long_double ();
341   res = _IO_vfscanf (s, fmt, ap, errp);
342   clear_no_long_double ();
343   return res;
344 }
345
346 int
347 attribute_compat_text_section
348 __nldbl___vfscanf (FILE *s, const char *fmt, va_list ap)
349 {
350   int res;
351   set_no_long_double ();
352   res = _IO_vfscanf (s, fmt, ap, NULL);
353   clear_no_long_double ();
354   return res;
355 }
356 weak_alias (__nldbl___vfscanf, __nldbl_vfscanf)
357 libc_hidden_def (__nldbl_vfscanf)
358
359 int
360 attribute_compat_text_section
361 __nldbl_sscanf (const char *s, const char *fmt, ...)
362 {
363   va_list arg;
364   int done;
365
366   va_start (arg, fmt);
367   done = __nldbl_vsscanf (s, fmt, arg);
368   va_end (arg);
369
370   return done;
371 }
372 strong_alias (__nldbl_sscanf, __nldbl__IO_sscanf)
373
374 int
375 attribute_compat_text_section
376 __nldbl___vsscanf (const char *string, const char *fmt, va_list ap)
377 {
378   int res;
379   __no_long_double = 1;
380   res = _IO_vsscanf (string, fmt, ap);
381   __no_long_double = 0;
382   return res;
383 }
384 weak_alias (__nldbl___vsscanf, __nldbl_vsscanf)
385 libc_hidden_def (__nldbl_vsscanf)
386
387 int
388 attribute_compat_text_section weak_function
389 __nldbl_vscanf (const char *fmt, va_list ap)
390 {
391   return __nldbl_vfscanf (stdin, fmt, ap);
392 }
393
394 int
395 attribute_compat_text_section
396 __nldbl_fscanf (FILE *stream, const char *fmt, ...)
397 {
398   va_list arg;
399   int done;
400
401   va_start (arg, fmt);
402   done = __nldbl_vfscanf (stream, fmt, arg);
403   va_end (arg);
404
405   return done;
406 }
407
408 int
409 attribute_compat_text_section
410 __nldbl_scanf (const char *fmt, ...)
411 {
412   va_list arg;
413   int done;
414
415   va_start (arg, fmt);
416   done = __nldbl_vfscanf (stdin, fmt, arg);
417   va_end (arg);
418
419   return done;
420 }
421
422 int
423 attribute_compat_text_section
424 __nldbl_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
425 {
426   int res;
427   set_no_long_double ();
428   res = _IO_vfwscanf (s, fmt, ap, NULL);
429   clear_no_long_double ();
430   return res;
431 }
432 libc_hidden_def (__nldbl_vfwscanf)
433
434 int
435 attribute_compat_text_section
436 __nldbl_swscanf (const wchar_t *s, const wchar_t *fmt, ...)
437 {
438   va_list arg;
439   int done;
440
441   va_start (arg, fmt);
442   done = __nldbl_vswscanf (s, fmt, arg);
443   va_end (arg);
444
445   return done;
446 }
447
448 int
449 attribute_compat_text_section
450 __nldbl_vswscanf (const wchar_t *string, const wchar_t *fmt, va_list ap)
451 {
452   int res;
453   __no_long_double = 1;
454   res = vswscanf (string, fmt, ap);
455   __no_long_double = 0;
456   return res;
457 }
458 libc_hidden_def (__nldbl_vswscanf)
459
460 int
461 attribute_compat_text_section weak_function
462 __nldbl_vwscanf (const wchar_t *fmt, va_list ap)
463 {
464   return __nldbl_vfwscanf (stdin, fmt, ap);
465 }
466
467 int
468 attribute_compat_text_section
469 __nldbl_fwscanf (FILE *stream, const wchar_t *fmt, ...)
470 {
471   va_list arg;
472   int done;
473
474   va_start (arg, fmt);
475   done = __nldbl_vfwscanf (stream, fmt, arg);
476   va_end (arg);
477
478   return done;
479 }
480
481 int
482 attribute_compat_text_section
483 __nldbl_wscanf (const wchar_t *fmt, ...)
484 {
485   va_list arg;
486   int done;
487
488   va_start (arg, fmt);
489   done = __nldbl_vfwscanf (stdin, fmt, arg);
490   va_end (arg);
491
492   return done;
493 }
494
495 int
496 attribute_compat_text_section
497 __nldbl___fprintf_chk (FILE *stream, int flag, const char *fmt, ...)
498 {
499   va_list arg;
500   int done;
501
502   va_start (arg, fmt);
503   done = __nldbl___vfprintf_chk (stream, flag, fmt, arg);
504   va_end (arg);
505
506   return done;
507 }
508
509 int
510 attribute_compat_text_section
511 __nldbl___fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
512 {
513   va_list arg;
514   int done;
515
516   va_start (arg, fmt);
517   done = __nldbl___vfwprintf_chk (stream, flag, fmt, arg);
518   va_end (arg);
519
520   return done;
521 }
522
523 int
524 attribute_compat_text_section
525 __nldbl___printf_chk (int flag, const char *fmt, ...)
526 {
527   va_list arg;
528   int done;
529
530   va_start (arg, fmt);
531   done = __nldbl___vfprintf_chk (stdout, flag, fmt, arg);
532   va_end (arg);
533
534   return done;
535 }
536
537 int
538 attribute_compat_text_section
539 __nldbl___snprintf_chk (char *s, size_t maxlen, int flag, size_t slen,
540                         const char *fmt, ...)
541 {
542   va_list arg;
543   int done;
544
545   va_start (arg, fmt);
546   done = __nldbl___vsnprintf_chk (s, maxlen, flag, slen, fmt, arg);
547   va_end (arg);
548
549   return done;
550 }
551
552 int
553 attribute_compat_text_section
554 __nldbl___sprintf_chk (char *s, int flag, size_t slen, const char *fmt, ...)
555 {
556   va_list arg;
557   int done;
558
559   va_start (arg, fmt);
560   done = __nldbl___vsprintf_chk (s, flag, slen, fmt, arg);
561   va_end (arg);
562
563   return done;
564 }
565
566 int
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, ...)
570 {
571   va_list arg;
572   int done;
573
574   va_start (arg, fmt);
575   done = __nldbl___vswprintf_chk (s, n, flag, slen, fmt, arg);
576   va_end (arg);
577
578   return done;
579 }
580
581 int
582 attribute_compat_text_section
583 __nldbl___vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
584 {
585   int res;
586   set_no_long_double ();
587   res = __vfprintf_chk (s, flag, fmt, ap);
588   clear_no_long_double ();
589   return res;
590 }
591 libc_hidden_def (__nldbl___vfprintf_chk)
592
593 int
594 attribute_compat_text_section
595 __nldbl___vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
596 {
597   int res;
598   set_no_long_double ();
599   res = __vfwprintf_chk (s, flag, fmt, ap);
600   clear_no_long_double ();
601   return res;
602 }
603 libc_hidden_def (__nldbl___vfwprintf_chk)
604
605 int
606 attribute_compat_text_section
607 __nldbl___vprintf_chk (int flag, const char *fmt, va_list ap)
608 {
609   return __nldbl___vfprintf_chk (stdout, flag, fmt, ap);
610 }
611
612 int
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)
616 {
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;
622 }
623 libc_hidden_def (__nldbl___vsnprintf_chk)
624
625 int
626 attribute_compat_text_section
627 __nldbl___vsprintf_chk (char *string, int flag, size_t slen, const char *fmt,
628                         va_list ap)
629 {
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;
635 }
636 libc_hidden_def (__nldbl___vsprintf_chk)
637
638 int
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)
642 {
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;
648 }
649 libc_hidden_def (__nldbl___vswprintf_chk)
650
651 int
652 attribute_compat_text_section
653 __nldbl___vwprintf_chk (int flag, const wchar_t *fmt, va_list ap)
654 {
655   return __nldbl___vfwprintf_chk (stdout, flag, fmt, ap);
656 }
657
658 int
659 attribute_compat_text_section
660 __nldbl___wprintf_chk (int flag, const wchar_t *fmt, ...)
661 {
662   va_list arg;
663   int done;
664
665   va_start (arg, fmt);
666   done = __nldbl___vfwprintf_chk (stdout, flag, fmt, arg);
667   va_end (arg);
668
669   return done;
670 }
671
672 int
673 attribute_compat_text_section
674 __nldbl___vasprintf_chk (char **ptr, int flag, const char *fmt, va_list arg)
675 {
676   int res;
677   __no_long_double = 1;
678   res = __vasprintf_chk (ptr, flag, fmt, arg);
679   __no_long_double = 0;
680   return res;
681 }
682 libc_hidden_def (__nldbl___vasprintf_chk)
683
684 int
685 attribute_compat_text_section
686 __nldbl___asprintf_chk (char **ptr, int flag, const char *fmt, ...)
687 {
688   va_list arg;
689   int done;
690
691   va_start (arg, fmt);
692   done = __nldbl___vasprintf_chk (ptr, flag, fmt, arg);
693   va_end (arg);
694
695   return done;
696 }
697
698 int
699 attribute_compat_text_section
700 __nldbl___vdprintf_chk (int d, int flag, const char *fmt, va_list arg)
701 {
702   int res;
703   set_no_long_double ();
704   res = __vdprintf_chk (d, flag, fmt, arg);
705   clear_no_long_double ();
706   return res;
707 }
708 libc_hidden_def (__nldbl___vdprintf_chk)
709
710 int
711 attribute_compat_text_section
712 __nldbl___dprintf_chk (int d, int flag, const char *fmt, ...)
713 {
714   va_list arg;
715   int done;
716
717   va_start (arg, fmt);
718   done = __nldbl___vdprintf_chk (d, flag, fmt, arg);
719   va_end (arg);
720
721   return done;
722 }
723
724 int
725 attribute_compat_text_section
726 __nldbl___obstack_vprintf_chk (struct obstack *obstack, int flag,
727                                const char *fmt, va_list arg)
728 {
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;
734 }
735 libc_hidden_def (__nldbl___obstack_vprintf_chk)
736
737 int
738 attribute_compat_text_section
739 __nldbl___obstack_printf_chk (struct obstack *obstack, int flag,
740                               const char *fmt, ...)
741 {
742   va_list arg;
743   int done;
744
745   va_start (arg, fmt);
746   done = __nldbl___obstack_vprintf_chk (obstack, flag, fmt, arg);
747   va_end (arg);
748
749   return done;
750 }
751
752 extern __typeof (printf_size) __printf_size;
753
754 int
755 attribute_compat_text_section
756 __nldbl_printf_size (FILE *fp, const struct printf_info *info,
757                      const void *const *args)
758 {
759   struct printf_info info_no_ldbl = *info;
760
761   info_no_ldbl.is_long_double = 0;
762   return __printf_size (fp, &info_no_ldbl, args);
763 }
764
765 extern __typeof (__printf_fp) ___printf_fp;
766
767 int
768 attribute_compat_text_section
769 __nldbl___printf_fp (FILE *fp, const struct printf_info *info,
770                      const void *const *args)
771 {
772   struct printf_info info_no_ldbl = *info;
773
774   info_no_ldbl.is_long_double = 0;
775   return ___printf_fp (fp, &info_no_ldbl, args);
776 }
777
778 ssize_t
779 attribute_compat_text_section
780 __nldbl_strfmon (char *s, size_t maxsize, const char *format, ...)
781 {
782   va_list ap;
783   ssize_t res;
784
785   va_start (ap, format);
786   res = __nldbl___vstrfmon (s, maxsize, format, ap);
787   va_end (ap);
788   return res;
789 }
790
791 ssize_t
792 attribute_compat_text_section
793 __nldbl___strfmon_l (char *s, size_t maxsize, __locale_t loc,
794                      const char *format, ...)
795 {
796   va_list ap;
797   ssize_t res;
798
799   va_start (ap, format);
800   res = __nldbl___vstrfmon_l (s, maxsize, loc, format, ap);
801   va_end (ap);
802   return res;
803 }
804 weak_alias (__nldbl___strfmon_l, __nldbl_strfmon_l)
805
806 ssize_t
807 attribute_compat_text_section
808 __nldbl___vstrfmon (char *s, size_t maxsize, const char *format, va_list ap)
809 {
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;
816 }
817 libc_hidden_def (__nldbl___vstrfmon)
818
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)
823 {
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;
830 }
831 libc_hidden_def (__nldbl___vstrfmon_l)
832
833 void
834 attribute_compat_text_section
835 __nldbl_syslog (int pri, const char *fmt, ...)
836 {
837   va_list ap;
838   va_start (ap, fmt);
839   __nldbl___vsyslog_chk (pri, -1, fmt, ap);
840   va_end (ap);
841 }
842
843 void
844 attribute_compat_text_section
845 __nldbl___syslog_chk (int pri, int flag, const char *fmt, ...)
846 {
847   va_list ap;
848
849   va_start (ap, fmt);
850   __nldbl___vsyslog_chk (pri, flag, fmt, ap);
851   va_end(ap);
852 }
853
854 void
855 attribute_compat_text_section
856 __nldbl___vsyslog_chk (int pri, int flag, const char *fmt, va_list ap)
857 {
858   set_no_long_double ();
859   __vsyslog_chk (pri, flag, fmt, ap);
860   clear_no_long_double ();
861 }
862 libc_hidden_def (__nldbl___vsyslog_chk)
863
864 void
865 attribute_compat_text_section
866 __nldbl_vsyslog (int pri, const char *fmt, va_list ap)
867 {
868   __nldbl___vsyslog_chk (pri, -1, fmt, ap);
869 }
870
871 int
872 attribute_compat_text_section
873 __nldbl___isoc99_vfscanf (FILE *s, const char *fmt, va_list ap)
874 {
875   int res;
876   set_no_long_double ();
877   res = __isoc99_vfscanf (s, fmt, ap);
878   clear_no_long_double ();
879   return res;
880 }
881 libc_hidden_def (__nldbl___isoc99_vfscanf)
882
883 int
884 attribute_compat_text_section
885 __nldbl___isoc99_sscanf (const char *s, const char *fmt, ...)
886 {
887   va_list arg;
888   int done;
889
890   va_start (arg, fmt);
891   done = __nldbl___isoc99_vsscanf (s, fmt, arg);
892   va_end (arg);
893
894   return done;
895 }
896
897 int
898 attribute_compat_text_section
899 __nldbl___isoc99_vsscanf (const char *string, const char *fmt, va_list ap)
900 {
901   int res;
902   __no_long_double = 1;
903   res = __isoc99_vsscanf (string, fmt, ap);
904   __no_long_double = 0;
905   return res;
906 }
907 libc_hidden_def (__nldbl___isoc99_vsscanf)
908
909 int
910 attribute_compat_text_section
911 __nldbl___isoc99_vscanf (const char *fmt, va_list ap)
912 {
913   return __nldbl___isoc99_vfscanf (stdin, fmt, ap);
914 }
915
916 int
917 attribute_compat_text_section
918 __nldbl___isoc99_fscanf (FILE *stream, const char *fmt, ...)
919 {
920   va_list arg;
921   int done;
922
923   va_start (arg, fmt);
924   done = __nldbl___isoc99_vfscanf (stream, fmt, arg);
925   va_end (arg);
926
927   return done;
928 }
929
930 int
931 attribute_compat_text_section
932 __nldbl___isoc99_scanf (const char *fmt, ...)
933 {
934   va_list arg;
935   int done;
936
937   va_start (arg, fmt);
938   done = __nldbl___isoc99_vfscanf (stdin, fmt, arg);
939   va_end (arg);
940
941   return done;
942 }
943
944 int
945 attribute_compat_text_section
946 __nldbl___isoc99_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
947 {
948   int res;
949   set_no_long_double ();
950   res = __isoc99_vfwscanf (s, fmt, ap);
951   clear_no_long_double ();
952   return res;
953 }
954 libc_hidden_def (__nldbl___isoc99_vfwscanf)
955
956 int
957 attribute_compat_text_section
958 __nldbl___isoc99_swscanf (const wchar_t *s, const wchar_t *fmt, ...)
959 {
960   va_list arg;
961   int done;
962
963   va_start (arg, fmt);
964   done = __nldbl___isoc99_vswscanf (s, fmt, arg);
965   va_end (arg);
966
967   return done;
968 }
969
970 int
971 attribute_compat_text_section
972 __nldbl___isoc99_vswscanf (const wchar_t *string, const wchar_t *fmt,
973                            va_list ap)
974 {
975   int res;
976   __no_long_double = 1;
977   res = __isoc99_vswscanf (string, fmt, ap);
978   __no_long_double = 0;
979   return res;
980 }
981 libc_hidden_def (__nldbl___isoc99_vswscanf)
982
983 int
984 attribute_compat_text_section
985 __nldbl___isoc99_vwscanf (const wchar_t *fmt, va_list ap)
986 {
987   return __nldbl___isoc99_vfwscanf (stdin, fmt, ap);
988 }
989
990 int
991 attribute_compat_text_section
992 __nldbl___isoc99_fwscanf (FILE *stream, const wchar_t *fmt, ...)
993 {
994   va_list arg;
995   int done;
996
997   va_start (arg, fmt);
998   done = __nldbl___isoc99_vfwscanf (stream, fmt, arg);
999   va_end (arg);
1000
1001   return done;
1002 }
1003
1004 int
1005 attribute_compat_text_section
1006 __nldbl___isoc99_wscanf (const wchar_t *fmt, ...)
1007 {
1008   va_list arg;
1009   int done;
1010
1011   va_start (arg, fmt);
1012   done = __nldbl___isoc99_vfwscanf (stdin, fmt, arg);
1013   va_end (arg);
1014
1015   return done;
1016 }
1017
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