]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/ieee754/ldbl-opt/nldbl-compat.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / ieee754 / ldbl-opt / nldbl-compat.c
CommitLineData
c6251f03 1/* *printf* family compatibility routines for IEEE double as long double
bfff8b1b 2 Copyright (C) 2006-2017 Free Software Foundation, Inc.
c6251f03
RM
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
59ba27a6
PE
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
c6251f03
RM
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>
ec999b8e 28#include <libc-lock.h>
c6251f03
RM
29
30#include "nldbl-compat.h"
31
32libc_hidden_proto (__nldbl_vfprintf)
33libc_hidden_proto (__nldbl_vsscanf)
34libc_hidden_proto (__nldbl_vsprintf)
35libc_hidden_proto (__nldbl_vfscanf)
36libc_hidden_proto (__nldbl_vfwscanf)
37libc_hidden_proto (__nldbl_vdprintf)
38libc_hidden_proto (__nldbl_vswscanf)
39libc_hidden_proto (__nldbl_vfwprintf)
40libc_hidden_proto (__nldbl_vswprintf)
41libc_hidden_proto (__nldbl_vsnprintf)
42libc_hidden_proto (__nldbl_vasprintf)
43libc_hidden_proto (__nldbl_obstack_vprintf)
44libc_hidden_proto (__nldbl___vfwprintf_chk)
45libc_hidden_proto (__nldbl___vsnprintf_chk)
46libc_hidden_proto (__nldbl___vfprintf_chk)
47libc_hidden_proto (__nldbl___vsyslog_chk)
48libc_hidden_proto (__nldbl___vsprintf_chk)
49libc_hidden_proto (__nldbl___vswprintf_chk)
dff37515
UD
50libc_hidden_proto (__nldbl___vasprintf_chk)
51libc_hidden_proto (__nldbl___vdprintf_chk)
52libc_hidden_proto (__nldbl___obstack_vprintf_chk)
c6251f03
RM
53libc_hidden_proto (__nldbl___vstrfmon)
54libc_hidden_proto (__nldbl___vstrfmon_l)
874aa523
UD
55libc_hidden_proto (__nldbl___isoc99_vsscanf)
56libc_hidden_proto (__nldbl___isoc99_vfscanf)
57libc_hidden_proto (__nldbl___isoc99_vswscanf)
58libc_hidden_proto (__nldbl___isoc99_vfwscanf)
c6251f03
RM
59
60static 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
76int
77attribute_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}
89weak_alias (__nldbl___asprintf, __nldbl_asprintf)
90
91int
92attribute_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
105int
106attribute_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}
118weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf)
119
120int
121attribute_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
134int
135attribute_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}
147strong_alias (__nldbl_printf, __nldbl__IO_printf)
148
149int
150attribute_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}
162strong_alias (__nldbl_sprintf, __nldbl__IO_sprintf)
163
164int
165attribute_compat_text_section
166__nldbl_vfprintf (FILE *s, const char *fmt, va_list ap)
167{
168 int done;
169 set_no_long_double ();
d18ea0c5 170 done = _IO_vfprintf (s, fmt, ap);
c6251f03
RM
171 clear_no_long_double ();
172 return done;
173}
174libc_hidden_def (__nldbl_vfprintf)
175strong_alias (__nldbl_vfprintf, __nldbl__IO_vfprintf)
176
177int
178attribute_compat_text_section
179__nldbl__IO_vsprintf (char *string, const char *fmt, va_list ap)
180{
181 int done;
182 __no_long_double = 1;
d18ea0c5 183 done = _IO_vsprintf (string, fmt, ap);
c6251f03
RM
184 __no_long_double = 0;
185 return done;
186}
187weak_alias (__nldbl__IO_vsprintf, __nldbl_vsprintf)
188libc_hidden_def (__nldbl_vsprintf)
189
190int
191attribute_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}
201libc_hidden_def (__nldbl_obstack_vprintf)
202
203int
204attribute_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
215int
216attribute_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
229int
230attribute_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
243int
244attribute_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}
253libc_hidden_def (__nldbl_vasprintf)
254
255int
256attribute_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}
265libc_hidden_def (__nldbl_vdprintf)
266
267int
268attribute_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}
277libc_hidden_def (__nldbl_vfwprintf)
278
279int
280attribute_compat_text_section
281__nldbl_vprintf (const char *fmt, va_list ap)
282{
283 return __nldbl_vfprintf (stdout, fmt, ap);
284}
285
286int
287attribute_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}
297libc_hidden_def (__nldbl_vsnprintf)
298weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf)
299
300int
301attribute_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}
311libc_hidden_def (__nldbl_vswprintf)
312
313int
314attribute_compat_text_section
315__nldbl_vwprintf (const wchar_t *fmt, va_list ap)
316{
317 return __nldbl_vfwprintf (stdout, fmt, ap);
318}
319
320int
321attribute_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
334int
335attribute_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 ();
d18ea0c5 341 res = _IO_vfscanf (s, fmt, ap, errp);
c6251f03
RM
342 clear_no_long_double ();
343 return res;
344}
345
346int
347attribute_compat_text_section
348__nldbl___vfscanf (FILE *s, const char *fmt, va_list ap)
349{
350 int res;
351 set_no_long_double ();
d18ea0c5 352 res = _IO_vfscanf (s, fmt, ap, NULL);
c6251f03
RM
353 clear_no_long_double ();
354 return res;
355}
356weak_alias (__nldbl___vfscanf, __nldbl_vfscanf)
357libc_hidden_def (__nldbl_vfscanf)
358
359int
360attribute_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}
372strong_alias (__nldbl_sscanf, __nldbl__IO_sscanf)
373
374int
375attribute_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}
384weak_alias (__nldbl___vsscanf, __nldbl_vsscanf)
385libc_hidden_def (__nldbl_vsscanf)
386
387int
388attribute_compat_text_section weak_function
389__nldbl_vscanf (const char *fmt, va_list ap)
390{
391 return __nldbl_vfscanf (stdin, fmt, ap);
392}
393
394int
395attribute_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
408int
409attribute_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
422int
423attribute_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}
432libc_hidden_def (__nldbl_vfwscanf)
433
434int
435attribute_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
448int
449attribute_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}
458libc_hidden_def (__nldbl_vswscanf)
459
460int
461attribute_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
467int
468attribute_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
481int
482attribute_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
495int
496attribute_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
509int
510attribute_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
523int
524attribute_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
537int
538attribute_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
552int
553attribute_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
566int
567attribute_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
581int
582attribute_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}
591libc_hidden_def (__nldbl___vfprintf_chk)
592
593int
594attribute_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}
603libc_hidden_def (__nldbl___vfwprintf_chk)
604
605int
606attribute_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
612int
613attribute_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}
623libc_hidden_def (__nldbl___vsnprintf_chk)
624
625int
626attribute_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}
636libc_hidden_def (__nldbl___vsprintf_chk)
637
638int
639attribute_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}
649libc_hidden_def (__nldbl___vswprintf_chk)
650
651int
652attribute_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
658int
659attribute_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
dff37515
UD
672int
673attribute_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}
682libc_hidden_def (__nldbl___vasprintf_chk)
683
684int
685attribute_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
698int
699attribute_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}
708libc_hidden_def (__nldbl___vdprintf_chk)
709
710int
711attribute_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
724int
725attribute_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}
735libc_hidden_def (__nldbl___obstack_vprintf_chk)
736
737int
738attribute_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
c6251f03
RM
752extern __typeof (printf_size) __printf_size;
753
754int
755attribute_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
765extern __typeof (__printf_fp) ___printf_fp;
766
767int
768attribute_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
778ssize_t
779attribute_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
791ssize_t
792attribute_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}
804weak_alias (__nldbl___strfmon_l, __nldbl_strfmon_l)
805
806ssize_t
807attribute_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}
817libc_hidden_def (__nldbl___vstrfmon)
818
819ssize_t
820attribute_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}
831libc_hidden_def (__nldbl___vstrfmon_l)
832
833void
834attribute_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
843void
844attribute_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
854void
855attribute_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}
862libc_hidden_def (__nldbl___vsyslog_chk)
863
864void
865attribute_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
874aa523
UD
871int
872attribute_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}
881libc_hidden_def (__nldbl___isoc99_vfscanf)
882
883int
884attribute_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
897int
898attribute_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}
907libc_hidden_def (__nldbl___isoc99_vsscanf)
908
909int
910attribute_compat_text_section
911__nldbl___isoc99_vscanf (const char *fmt, va_list ap)
912{
913 return __nldbl___isoc99_vfscanf (stdin, fmt, ap);
914}
915
916int
917attribute_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
930int
931attribute_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
944int
945attribute_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}
954libc_hidden_def (__nldbl___isoc99_vfwscanf)
955
956int
957attribute_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
970int
971attribute_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}
981libc_hidden_def (__nldbl___isoc99_vswscanf)
982
983int
984attribute_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
990int
991attribute_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
1004int
1005attribute_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
c6251f03
RM
1018#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
1019compat_symbol (libc, __nldbl__IO_printf, _IO_printf, GLIBC_2_0);
1020compat_symbol (libc, __nldbl__IO_sprintf, _IO_sprintf, GLIBC_2_0);
1021compat_symbol (libc, __nldbl__IO_vfprintf, _IO_vfprintf, GLIBC_2_0);
1022compat_symbol (libc, __nldbl__IO_vsprintf, _IO_vsprintf, GLIBC_2_0);
1023compat_symbol (libc, __nldbl_dprintf, dprintf, GLIBC_2_0);
1024compat_symbol (libc, __nldbl_fprintf, fprintf, GLIBC_2_0);
1025compat_symbol (libc, __nldbl_printf, printf, GLIBC_2_0);
1026compat_symbol (libc, __nldbl_sprintf, sprintf, GLIBC_2_0);
1027compat_symbol (libc, __nldbl_vfprintf, vfprintf, GLIBC_2_0);
1028compat_symbol (libc, __nldbl_vprintf, vprintf, GLIBC_2_0);
1029compat_symbol (libc, __nldbl__IO_fprintf, _IO_fprintf, GLIBC_2_0);
1030compat_symbol (libc, __nldbl___vsnprintf, __vsnprintf, GLIBC_2_0);
1031compat_symbol (libc, __nldbl_asprintf, asprintf, GLIBC_2_0);
1032compat_symbol (libc, __nldbl_obstack_printf, obstack_printf, GLIBC_2_0);
1033compat_symbol (libc, __nldbl_obstack_vprintf, obstack_vprintf, GLIBC_2_0);
1034compat_symbol (libc, __nldbl_snprintf, snprintf, GLIBC_2_0);
1035compat_symbol (libc, __nldbl_vasprintf, vasprintf, GLIBC_2_0);
1036compat_symbol (libc, __nldbl_vdprintf, vdprintf, GLIBC_2_0);
1037compat_symbol (libc, __nldbl_vsnprintf, vsnprintf, GLIBC_2_0);
1038compat_symbol (libc, __nldbl_vsprintf, vsprintf, GLIBC_2_0);
1039compat_symbol (libc, __nldbl__IO_sscanf, _IO_sscanf, GLIBC_2_0);
1040compat_symbol (libc, __nldbl__IO_vfscanf, _IO_vfscanf, GLIBC_2_0);
1041compat_symbol (libc, __nldbl___vfscanf, __vfscanf, GLIBC_2_0);
1042compat_symbol (libc, __nldbl___vsscanf, __vsscanf, GLIBC_2_0);
1043compat_symbol (libc, __nldbl_fscanf, fscanf, GLIBC_2_0);
1044compat_symbol (libc, __nldbl_scanf, scanf, GLIBC_2_0);
1045compat_symbol (libc, __nldbl_sscanf, sscanf, GLIBC_2_0);
1046compat_symbol (libc, __nldbl_vfscanf, vfscanf, GLIBC_2_0);
1047compat_symbol (libc, __nldbl_vscanf, vscanf, GLIBC_2_0);
1048compat_symbol (libc, __nldbl_vsscanf, vsscanf, GLIBC_2_0);
1049compat_symbol (libc, __nldbl___printf_fp, __printf_fp, GLIBC_2_0);
1050compat_symbol (libc, __nldbl_strfmon, strfmon, GLIBC_2_0);
1051compat_symbol (libc, __nldbl_syslog, syslog, GLIBC_2_0);
1052compat_symbol (libc, __nldbl_vsyslog, vsyslog, GLIBC_2_0);
1053#endif
1054#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_1)
1055compat_symbol (libc, __nldbl___asprintf, __asprintf, GLIBC_2_1);
1056compat_symbol (libc, __nldbl_printf_size, printf_size, GLIBC_2_1);
1057compat_symbol (libc, __nldbl___strfmon_l, __strfmon_l, GLIBC_2_1);
1058#endif
1059#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_2)
1060compat_symbol (libc, __nldbl_swprintf, swprintf, GLIBC_2_2);
1061compat_symbol (libc, __nldbl_vwprintf, vwprintf, GLIBC_2_2);
1062compat_symbol (libc, __nldbl_wprintf, wprintf, GLIBC_2_2);
1063compat_symbol (libc, __nldbl_fwprintf, fwprintf, GLIBC_2_2);
1064compat_symbol (libc, __nldbl_vfwprintf, vfwprintf, GLIBC_2_2);
1065compat_symbol (libc, __nldbl_vswprintf, vswprintf, GLIBC_2_2);
1066compat_symbol (libc, __nldbl_fwscanf, fwscanf, GLIBC_2_2);
1067compat_symbol (libc, __nldbl_swscanf, swscanf, GLIBC_2_2);
1068compat_symbol (libc, __nldbl_vfwscanf, vfwscanf, GLIBC_2_2);
1069compat_symbol (libc, __nldbl_vswscanf, vswscanf, GLIBC_2_2);
1070compat_symbol (libc, __nldbl_vwscanf, vwscanf, GLIBC_2_2);
1071compat_symbol (libc, __nldbl_wscanf, wscanf, GLIBC_2_2);
1072#endif
1073#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3)
1074compat_symbol (libc, __nldbl_strfmon_l, strfmon_l, GLIBC_2_3);
1075#endif
1076#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3_4)
1077compat_symbol (libc, __nldbl___sprintf_chk, __sprintf_chk, GLIBC_2_3_4);
1078compat_symbol (libc, __nldbl___vsprintf_chk, __vsprintf_chk, GLIBC_2_3_4);
1079compat_symbol (libc, __nldbl___snprintf_chk, __snprintf_chk, GLIBC_2_3_4);
1080compat_symbol (libc, __nldbl___vsnprintf_chk, __vsnprintf_chk, GLIBC_2_3_4);
1081compat_symbol (libc, __nldbl___printf_chk, __printf_chk, GLIBC_2_3_4);
1082compat_symbol (libc, __nldbl___fprintf_chk, __fprintf_chk, GLIBC_2_3_4);
1083compat_symbol (libc, __nldbl___vprintf_chk, __vprintf_chk, GLIBC_2_3_4);
1084compat_symbol (libc, __nldbl___vfprintf_chk, __vfprintf_chk, GLIBC_2_3_4);
1085#endif