]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/ieee754/ldbl-opt/nldbl-compat.c
4f70207f2dd3005621c13ffa9cbe0067cec9831d
[thirdparty/glibc.git] / sysdeps / ieee754 / ldbl-opt / nldbl-compat.c
1 /* *printf* family compatibility routines for IEEE double as long double
2 Copyright (C) 2006-2019 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 /* This file may define some of the deprecated scanf variants. */
21 #include <features.h>
22 #undef __GLIBC_USE_DEPRECATED_SCANF
23 #define __GLIBC_USE_DEPRECATED_SCANF 1
24
25 #include <argp.h>
26 #include <stdarg.h>
27 #include <stdio.h>
28 #include <libio/strfile.h>
29 #include <math.h>
30 #include <wchar.h>
31 #include <printf.h>
32 #include <monetary.h>
33 #include <locale/localeinfo.h>
34 #include <sys/syslog.h>
35 #include <libc-lock.h>
36
37 #include "nldbl-compat.h"
38
39 libc_hidden_proto (__nldbl_vsscanf)
40 libc_hidden_proto (__nldbl_vfscanf)
41 libc_hidden_proto (__nldbl_vfwscanf)
42 libc_hidden_proto (__nldbl_vswscanf)
43 libc_hidden_proto (__nldbl___isoc99_vsscanf)
44 libc_hidden_proto (__nldbl___isoc99_vfscanf)
45 libc_hidden_proto (__nldbl___isoc99_vswscanf)
46 libc_hidden_proto (__nldbl___isoc99_vfwscanf)
47
48 /* Compatibility with IEEE double as long double.
49 IEEE quad long double is used by default for most programs, so
50 we don't need to split this into one file per function for the
51 sake of statically linked programs. */
52
53 int
54 attribute_compat_text_section
55 __nldbl___asprintf (char **string_ptr, const char *fmt, ...)
56 {
57 va_list ap;
58 int ret;
59
60 va_start (ap, fmt);
61 ret = __vasprintf_internal (string_ptr, fmt, ap, PRINTF_LDBL_IS_DBL);
62 va_end (ap);
63
64 return ret;
65 }
66 weak_alias (__nldbl___asprintf, __nldbl_asprintf)
67
68 int
69 attribute_compat_text_section
70 __nldbl_dprintf (int d, const char *fmt, ...)
71 {
72 va_list ap;
73 int ret;
74
75 va_start (ap, fmt);
76 ret = __vdprintf_internal (d, fmt, ap, PRINTF_LDBL_IS_DBL);
77 va_end (ap);
78
79 return ret;
80 }
81
82 int
83 attribute_compat_text_section
84 __nldbl_fprintf (FILE *stream, const char *fmt, ...)
85 {
86 va_list ap;
87 int ret;
88
89 va_start (ap, fmt);
90 ret = __vfprintf_internal (stream, fmt, ap, PRINTF_LDBL_IS_DBL);
91 va_end (ap);
92
93 return ret;
94 }
95 weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf)
96
97 int
98 attribute_compat_text_section weak_function
99 __nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...)
100 {
101 va_list ap;
102 int ret;
103
104 va_start (ap, fmt);
105 ret = __vfwprintf_internal (stream, fmt, ap, PRINTF_LDBL_IS_DBL);
106 va_end (ap);
107
108 return ret;
109 }
110
111 int
112 attribute_compat_text_section
113 __nldbl_printf (const char *fmt, ...)
114 {
115 va_list ap;
116 int ret;
117
118 va_start (ap, fmt);
119 ret = __vfprintf_internal (stdout, fmt, ap, PRINTF_LDBL_IS_DBL);
120 va_end (ap);
121
122 return ret;
123 }
124 strong_alias (__nldbl_printf, __nldbl__IO_printf)
125
126 int
127 attribute_compat_text_section
128 __nldbl_sprintf (char *s, const char *fmt, ...)
129 {
130 va_list ap;
131 int ret;
132
133 va_start (ap, fmt);
134 ret = __vsprintf_internal (s, -1, fmt, ap, PRINTF_LDBL_IS_DBL);
135 va_end (ap);
136
137 return ret;
138 }
139 strong_alias (__nldbl_sprintf, __nldbl__IO_sprintf)
140
141 int
142 attribute_compat_text_section
143 __nldbl_vfprintf (FILE *s, const char *fmt, va_list ap)
144 {
145 return __vfprintf_internal (s, fmt, ap, PRINTF_LDBL_IS_DBL);
146 }
147 strong_alias (__nldbl_vfprintf, __nldbl__IO_vfprintf)
148
149 int
150 attribute_compat_text_section
151 __nldbl___vsprintf (char *string, const char *fmt, va_list ap)
152 {
153 return __vsprintf_internal (string, -1, fmt, ap, PRINTF_LDBL_IS_DBL);
154 }
155 strong_alias (__nldbl___vsprintf, __nldbl__IO_vsprintf)
156 weak_alias (__nldbl___vsprintf, __nldbl_vsprintf)
157
158 int
159 attribute_compat_text_section
160 __nldbl_obstack_vprintf (struct obstack *obstack, const char *fmt,
161 va_list ap)
162 {
163 return __obstack_vprintf_internal (obstack, fmt, ap, PRINTF_LDBL_IS_DBL);
164 }
165
166 int
167 attribute_compat_text_section
168 __nldbl_obstack_printf (struct obstack *obstack, const char *fmt, ...)
169 {
170 int ret;
171 va_list ap;
172 va_start (ap, fmt);
173 ret = __obstack_vprintf_internal (obstack, fmt, ap, PRINTF_LDBL_IS_DBL);
174 va_end (ap);
175 return ret;
176 }
177
178 int
179 attribute_compat_text_section weak_function
180 __nldbl_snprintf (char *s, size_t maxlen, const char *fmt, ...)
181 {
182 va_list ap;
183 int ret;
184
185 va_start (ap, fmt);
186 ret = __vsnprintf_internal (s, maxlen, fmt, ap, PRINTF_LDBL_IS_DBL);
187 va_end (ap);
188
189 return ret;
190 }
191
192 int
193 attribute_compat_text_section
194 __nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
195 {
196 va_list ap;
197 int ret;
198
199 va_start (ap, fmt);
200 ret = __vswprintf_internal (s, n, fmt, ap, PRINTF_LDBL_IS_DBL);
201 va_end (ap);
202
203 return ret;
204 }
205
206 int
207 attribute_compat_text_section weak_function
208 __nldbl_vasprintf (char **result_ptr, const char *fmt, va_list ap)
209 {
210 return __vasprintf_internal (result_ptr, fmt, ap, PRINTF_LDBL_IS_DBL);
211 }
212
213 int
214 attribute_compat_text_section
215 __nldbl_vdprintf (int d, const char *fmt, va_list ap)
216 {
217 return __vdprintf_internal (d, fmt, ap, PRINTF_LDBL_IS_DBL);
218 }
219
220 int
221 attribute_compat_text_section weak_function
222 __nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
223 {
224 return __vfwprintf_internal (s, fmt, ap, PRINTF_LDBL_IS_DBL);
225 }
226
227 int
228 attribute_compat_text_section
229 __nldbl_vprintf (const char *fmt, va_list ap)
230 {
231 return __vfprintf_internal (stdout, fmt, ap, PRINTF_LDBL_IS_DBL);
232 }
233
234 int
235 attribute_compat_text_section
236 __nldbl_vsnprintf (char *string, size_t maxlen, const char *fmt,
237 va_list ap)
238 {
239 return __vsnprintf_internal (string, maxlen, fmt, ap, PRINTF_LDBL_IS_DBL);
240 }
241 weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf)
242
243 int
244 attribute_compat_text_section weak_function
245 __nldbl_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt,
246 va_list ap)
247 {
248 return __vswprintf_internal (string, maxlen, fmt, ap, PRINTF_LDBL_IS_DBL);
249 }
250
251 int
252 attribute_compat_text_section
253 __nldbl_vwprintf (const wchar_t *fmt, va_list ap)
254 {
255 return __vfwprintf_internal (stdout, fmt, ap, PRINTF_LDBL_IS_DBL);
256 }
257
258 int
259 attribute_compat_text_section
260 __nldbl_wprintf (const wchar_t *fmt, ...)
261 {
262 va_list ap;
263 int ret;
264
265 va_start (ap, fmt);
266 ret = __vfwprintf_internal (stdout, fmt, ap, PRINTF_LDBL_IS_DBL);
267 va_end (ap);
268
269 return ret;
270 }
271
272 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_29)
273 int
274 attribute_compat_text_section
275 __nldbl__IO_vfscanf (FILE *s, const char *fmt, va_list ap, int *errp)
276 {
277 int ret = __vfscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL);
278 if (__glibc_unlikely (errp != 0))
279 *errp = (ret == -1);
280 return ret;
281 }
282 #endif
283
284 int
285 attribute_compat_text_section
286 __nldbl___vfscanf (FILE *s, const char *fmt, va_list ap)
287 {
288 return __vfscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL);
289 }
290 weak_alias (__nldbl___vfscanf, __nldbl_vfscanf)
291 libc_hidden_def (__nldbl_vfscanf)
292
293 int
294 attribute_compat_text_section
295 __nldbl_sscanf (const char *s, const char *fmt, ...)
296 {
297 _IO_strfile sf;
298 FILE *f = _IO_strfile_read (&sf, s);
299 va_list ap;
300 int ret;
301
302 va_start (ap, fmt);
303 ret = __vfscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL);
304 va_end (ap);
305
306 return ret;
307 }
308 strong_alias (__nldbl_sscanf, __nldbl__IO_sscanf)
309
310 int
311 attribute_compat_text_section
312 __nldbl___vsscanf (const char *s, const char *fmt, va_list ap)
313 {
314 _IO_strfile sf;
315 FILE *f = _IO_strfile_read (&sf, s);
316 return __vfscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL);
317 }
318 weak_alias (__nldbl___vsscanf, __nldbl_vsscanf)
319 libc_hidden_def (__nldbl_vsscanf)
320
321 int
322 attribute_compat_text_section weak_function
323 __nldbl_vscanf (const char *fmt, va_list ap)
324 {
325 return __vfscanf_internal (stdin, fmt, ap, SCANF_LDBL_IS_DBL);
326 }
327
328 int
329 attribute_compat_text_section
330 __nldbl_fscanf (FILE *stream, const char *fmt, ...)
331 {
332 va_list ap;
333 int ret;
334
335 va_start (ap, fmt);
336 ret = __vfscanf_internal (stream, fmt, ap, SCANF_LDBL_IS_DBL);
337 va_end (ap);
338
339 return ret;
340 }
341
342 int
343 attribute_compat_text_section
344 __nldbl_scanf (const char *fmt, ...)
345 {
346 va_list ap;
347 int ret;
348
349 va_start (ap, fmt);
350 ret = __vfscanf_internal (stdin, fmt, ap, SCANF_LDBL_IS_DBL);
351 va_end (ap);
352
353 return ret;
354 }
355
356 int
357 attribute_compat_text_section
358 __nldbl_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
359 {
360 return __vfwscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL);
361 }
362 libc_hidden_def (__nldbl_vfwscanf)
363
364 int
365 attribute_compat_text_section
366 __nldbl_swscanf (const wchar_t *s, const wchar_t *fmt, ...)
367 {
368 _IO_strfile sf;
369 struct _IO_wide_data wd;
370 FILE *f = _IO_strfile_readw (&sf, &wd, s);
371 va_list ap;
372 int ret;
373
374 va_start (ap, fmt);
375 ret = __vfwscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL);
376 va_end (ap);
377
378 return ret;
379 }
380
381 int
382 attribute_compat_text_section
383 __nldbl_vswscanf (const wchar_t *s, const wchar_t *fmt, va_list ap)
384 {
385 _IO_strfile sf;
386 struct _IO_wide_data wd;
387 FILE *f = _IO_strfile_readw (&sf, &wd, s);
388
389 return __vfwscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL);
390 }
391 libc_hidden_def (__nldbl_vswscanf)
392
393 int
394 attribute_compat_text_section weak_function
395 __nldbl_vwscanf (const wchar_t *fmt, va_list ap)
396 {
397 return __vfwscanf_internal (stdin, fmt, ap, SCANF_LDBL_IS_DBL);
398 }
399
400 int
401 attribute_compat_text_section
402 __nldbl_fwscanf (FILE *stream, const wchar_t *fmt, ...)
403 {
404 va_list ap;
405 int ret;
406
407 va_start (ap, fmt);
408 ret = __vfwscanf_internal (stream, fmt, ap, SCANF_LDBL_IS_DBL);
409 va_end (ap);
410
411 return ret;
412 }
413
414 int
415 attribute_compat_text_section
416 __nldbl_wscanf (const wchar_t *fmt, ...)
417 {
418 va_list ap;
419 int ret;
420
421 va_start (ap, fmt);
422 ret = __vfwscanf_internal (stdin, fmt, ap, SCANF_LDBL_IS_DBL);
423 va_end (ap);
424
425 return ret;
426 }
427
428 int
429 attribute_compat_text_section
430 __nldbl___fprintf_chk (FILE *stream, int flag, const char *fmt, ...)
431 {
432 va_list ap;
433 int ret;
434 unsigned int mode = PRINTF_LDBL_IS_DBL;
435 if (flag > 0)
436 mode |= PRINTF_FORTIFY;
437
438 va_start (ap, fmt);
439 ret = __vfprintf_internal (stream, fmt, ap, mode);
440 va_end (ap);
441
442 return ret;
443 }
444
445 int
446 attribute_compat_text_section
447 __nldbl___fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
448 {
449 va_list ap;
450 int ret;
451 unsigned int mode = PRINTF_LDBL_IS_DBL;
452 if (flag > 0)
453 mode |= PRINTF_FORTIFY;
454
455 va_start (ap, fmt);
456 ret = __vfwprintf_internal (stream, fmt, ap, mode);
457 va_end (ap);
458
459 return ret;
460 }
461
462 int
463 attribute_compat_text_section
464 __nldbl___printf_chk (int flag, const char *fmt, ...)
465 {
466 va_list ap;
467 int ret;
468 unsigned int mode = PRINTF_LDBL_IS_DBL;
469 if (flag > 0)
470 mode |= PRINTF_FORTIFY;
471
472 va_start (ap, fmt);
473 ret = __vfprintf_internal (stdout, fmt, ap, mode);
474 va_end (ap);
475
476 return ret;
477 }
478
479 int
480 attribute_compat_text_section
481 __nldbl___snprintf_chk (char *s, size_t maxlen, int flag, size_t slen,
482 const char *fmt, ...)
483 {
484 if (__glibc_unlikely (slen < maxlen))
485 __chk_fail ();
486
487 va_list ap;
488 int ret;
489 unsigned int mode = PRINTF_LDBL_IS_DBL;
490 if (flag > 0)
491 mode |= PRINTF_FORTIFY;
492
493 va_start (ap, fmt);
494 ret = __vsnprintf_internal (s, maxlen, fmt, ap, mode);
495 va_end (ap);
496
497 return ret;
498 }
499
500 int
501 attribute_compat_text_section
502 __nldbl___sprintf_chk (char *s, int flag, size_t slen, const char *fmt, ...)
503 {
504 if (slen == 0)
505 __chk_fail ();
506
507 va_list ap;
508 int ret;
509 unsigned int mode = PRINTF_LDBL_IS_DBL;
510 if (flag > 0)
511 mode |= PRINTF_FORTIFY;
512
513 va_start (ap, fmt);
514 ret = __vsprintf_internal (s, slen, fmt, ap, mode);
515 va_end (ap);
516
517 return ret;
518 }
519
520 int
521 attribute_compat_text_section
522 __nldbl___swprintf_chk (wchar_t *s, size_t maxlen, int flag, size_t slen,
523 const wchar_t *fmt, ...)
524 {
525 if (__glibc_unlikely (slen < maxlen))
526 __chk_fail ();
527
528 va_list ap;
529 int ret;
530 unsigned int mode = PRINTF_LDBL_IS_DBL;
531 if (flag > 0)
532 mode |= PRINTF_FORTIFY;
533
534 va_start (ap, fmt);
535 ret = __vswprintf_internal (s, maxlen, fmt, ap, mode);
536 va_end (ap);
537
538 return ret;
539 }
540
541 int
542 attribute_compat_text_section
543 __nldbl___vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
544 {
545 unsigned int mode = PRINTF_LDBL_IS_DBL;
546 if (flag > 0)
547 mode |= PRINTF_FORTIFY;
548
549 return __vfprintf_internal (s, fmt, ap, mode);
550 }
551
552 int
553 attribute_compat_text_section
554 __nldbl___vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
555 {
556 unsigned int mode = PRINTF_LDBL_IS_DBL;
557 if (flag > 0)
558 mode |= PRINTF_FORTIFY;
559
560 return __vfwprintf_internal (s, fmt, ap, mode);
561 }
562
563 int
564 attribute_compat_text_section
565 __nldbl___vprintf_chk (int flag, const char *fmt, va_list ap)
566 {
567 unsigned int mode = PRINTF_LDBL_IS_DBL;
568 if (flag > 0)
569 mode |= PRINTF_FORTIFY;
570
571 return __vfprintf_internal (stdout, fmt, ap, mode);
572 }
573
574 int
575 attribute_compat_text_section
576 __nldbl___vsnprintf_chk (char *string, size_t maxlen, int flag, size_t slen,
577 const char *fmt, va_list ap)
578 {
579 if (__glibc_unlikely (slen < maxlen))
580 __chk_fail ();
581
582 unsigned int mode = PRINTF_LDBL_IS_DBL;
583 if (flag > 0)
584 mode |= PRINTF_FORTIFY;
585
586 return __vsnprintf_internal (string, maxlen, fmt, ap, mode);
587 }
588
589 int
590 attribute_compat_text_section
591 __nldbl___vsprintf_chk (char *string, int flag, size_t slen, const char *fmt,
592 va_list ap)
593 {
594 if (slen == 0)
595 __chk_fail ();
596
597 unsigned int mode = PRINTF_LDBL_IS_DBL;
598 if (flag > 0)
599 mode |= PRINTF_FORTIFY;
600
601 return __vsprintf_internal (string, slen, fmt, ap, mode);
602 }
603
604 int
605 attribute_compat_text_section
606 __nldbl___vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen,
607 const wchar_t *fmt, va_list ap)
608 {
609 if (__glibc_unlikely (slen < maxlen))
610 __chk_fail ();
611
612 unsigned int mode = PRINTF_LDBL_IS_DBL;
613 if (flag > 0)
614 mode |= PRINTF_FORTIFY;
615
616 return __vswprintf_internal (string, maxlen, fmt, ap, mode);
617 }
618
619 int
620 attribute_compat_text_section
621 __nldbl___vwprintf_chk (int flag, const wchar_t *fmt, va_list ap)
622 {
623 unsigned int mode = PRINTF_LDBL_IS_DBL;
624 if (flag > 0)
625 mode |= PRINTF_FORTIFY;
626
627 return __vfwprintf_internal (stdout, fmt, ap, mode);
628 }
629
630 int
631 attribute_compat_text_section
632 __nldbl___wprintf_chk (int flag, const wchar_t *fmt, ...)
633 {
634 va_list ap;
635 int ret;
636 unsigned int mode = PRINTF_LDBL_IS_DBL;
637 if (flag > 0)
638 mode |= PRINTF_FORTIFY;
639
640 va_start (ap, fmt);
641 ret = __vfwprintf_internal (stdout, fmt, ap, mode);
642 va_end (ap);
643
644 return ret;
645 }
646
647 int
648 attribute_compat_text_section
649 __nldbl___vasprintf_chk (char **ptr, int flag, const char *fmt, va_list ap)
650 {
651 unsigned int mode = PRINTF_LDBL_IS_DBL;
652 if (flag > 0)
653 mode |= PRINTF_FORTIFY;
654
655 return __vasprintf_internal (ptr, fmt, ap, mode);
656 }
657
658 int
659 attribute_compat_text_section
660 __nldbl___asprintf_chk (char **ptr, int flag, const char *fmt, ...)
661 {
662 va_list ap;
663 int ret;
664 unsigned int mode = PRINTF_LDBL_IS_DBL;
665 if (flag > 0)
666 mode |= PRINTF_FORTIFY;
667
668 va_start (ap, fmt);
669 ret = __vasprintf_internal (ptr, fmt, ap, mode);
670 va_end (ap);
671
672 return ret;
673 }
674
675 int
676 attribute_compat_text_section
677 __nldbl___vdprintf_chk (int d, int flag, const char *fmt, va_list ap)
678 {
679 unsigned int mode = PRINTF_LDBL_IS_DBL;
680 if (flag > 0)
681 mode |= PRINTF_FORTIFY;
682
683 return __vdprintf_internal (d, fmt, ap, mode);
684 }
685
686 int
687 attribute_compat_text_section
688 __nldbl___dprintf_chk (int d, int flag, const char *fmt, ...)
689 {
690 va_list ap;
691 int ret;
692 unsigned int mode = PRINTF_LDBL_IS_DBL;
693 if (flag > 0)
694 mode |= PRINTF_FORTIFY;
695
696 va_start (ap, fmt);
697 ret = __vdprintf_internal (d, fmt, ap, mode);
698 va_end (ap);
699
700 return ret;
701 }
702
703 int
704 attribute_compat_text_section
705 __nldbl___obstack_vprintf_chk (struct obstack *obstack, int flag,
706 const char *fmt, va_list ap)
707 {
708 unsigned int mode = PRINTF_LDBL_IS_DBL;
709 if (flag > 0)
710 mode |= PRINTF_FORTIFY;
711
712 return __obstack_vprintf_internal (obstack, fmt, ap, mode);
713 }
714
715 int
716 attribute_compat_text_section
717 __nldbl___obstack_printf_chk (struct obstack *obstack, int flag,
718 const char *fmt, ...)
719 {
720 va_list ap;
721 int ret;
722 unsigned int mode = PRINTF_LDBL_IS_DBL;
723 if (flag > 0)
724 mode |= PRINTF_FORTIFY;
725
726 va_start (ap, fmt);
727 ret = __obstack_vprintf_internal (obstack, fmt, ap, mode);
728 va_end (ap);
729
730 return ret;
731 }
732
733 extern __typeof (printf_size) __printf_size;
734
735 int
736 attribute_compat_text_section
737 __nldbl_printf_size (FILE *fp, const struct printf_info *info,
738 const void *const *args)
739 {
740 struct printf_info info_no_ldbl = *info;
741
742 info_no_ldbl.is_long_double = 0;
743 return __printf_size (fp, &info_no_ldbl, args);
744 }
745
746 extern __typeof (__printf_fp) ___printf_fp;
747
748 int
749 attribute_compat_text_section
750 __nldbl___printf_fp (FILE *fp, const struct printf_info *info,
751 const void *const *args)
752 {
753 struct printf_info info_no_ldbl = *info;
754
755 info_no_ldbl.is_long_double = 0;
756 return ___printf_fp (fp, &info_no_ldbl, args);
757 }
758
759 ssize_t
760 attribute_compat_text_section
761 __nldbl_strfmon (char *s, size_t maxsize, const char *format, ...)
762 {
763 va_list ap;
764 ssize_t ret;
765
766 va_start (ap, format);
767 ret = __vstrfmon_l_internal (s, maxsize, _NL_CURRENT_LOCALE, format, ap,
768 STRFMON_LDBL_IS_DBL);
769 va_end (ap);
770 return ret;
771 }
772
773 ssize_t
774 attribute_compat_text_section
775 __nldbl___strfmon_l (char *s, size_t maxsize, locale_t loc,
776 const char *format, ...)
777 {
778 va_list ap;
779 ssize_t ret;
780
781 va_start (ap, format);
782 ret = __vstrfmon_l_internal (s, maxsize, loc, format, ap,
783 STRFMON_LDBL_IS_DBL);
784 va_end (ap);
785 return ret;
786 }
787 weak_alias (__nldbl___strfmon_l, __nldbl_strfmon_l)
788
789 ssize_t
790 attribute_compat_text_section
791 __nldbl___vstrfmon (char *s, size_t maxsize, const char *format, va_list ap)
792 {
793 return __vstrfmon_l_internal (s, maxsize, _NL_CURRENT_LOCALE, format, ap,
794 STRFMON_LDBL_IS_DBL);
795 }
796
797 ssize_t
798 attribute_compat_text_section
799 __nldbl___vstrfmon_l (char *s, size_t maxsize, locale_t loc,
800 const char *format, va_list ap)
801 {
802 return __vstrfmon_l_internal (s, maxsize, loc, format, ap,
803 STRFMON_LDBL_IS_DBL);
804 }
805
806 void
807 attribute_compat_text_section
808 __nldbl_syslog (int pri, const char *fmt, ...)
809 {
810 va_list ap;
811 va_start (ap, fmt);
812 __vsyslog_internal (pri, fmt, ap, PRINTF_LDBL_IS_DBL);
813 va_end (ap);
814 }
815
816 void
817 attribute_compat_text_section
818 __nldbl_vsyslog (int pri, const char *fmt, va_list ap)
819 {
820 __vsyslog_internal (pri, fmt, ap, PRINTF_LDBL_IS_DBL);
821 }
822
823 void
824 attribute_compat_text_section
825 __nldbl___syslog_chk (int pri, int flag, const char *fmt, ...)
826 {
827 va_list ap;
828 unsigned int mode = PRINTF_LDBL_IS_DBL;
829 if (flag > 0)
830 mode |= PRINTF_FORTIFY;
831
832 va_start (ap, fmt);
833 __vsyslog_internal (pri, fmt, ap, mode);
834 va_end(ap);
835 }
836
837 void
838 attribute_compat_text_section
839 __nldbl___vsyslog_chk (int pri, int flag, const char *fmt, va_list ap)
840 {
841 unsigned int mode = PRINTF_LDBL_IS_DBL;
842 if (flag > 0)
843 mode |= PRINTF_FORTIFY;
844
845 __vsyslog_internal (pri, fmt, ap, mode);
846 }
847
848 int
849 attribute_compat_text_section
850 __nldbl___isoc99_vfscanf (FILE *s, const char *fmt, va_list ap)
851 {
852 return __vfscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
853 }
854 libc_hidden_def (__nldbl___isoc99_vfscanf)
855
856 int
857 attribute_compat_text_section
858 __nldbl___isoc99_sscanf (const char *s, const char *fmt, ...)
859 {
860 _IO_strfile sf;
861 FILE *f = _IO_strfile_read (&sf, s);
862 va_list ap;
863 int ret;
864
865 va_start (ap, fmt);
866 ret = __vfscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
867 va_end (ap);
868
869 return ret;
870 }
871
872 int
873 attribute_compat_text_section
874 __nldbl___isoc99_vsscanf (const char *s, const char *fmt, va_list ap)
875 {
876 _IO_strfile sf;
877 FILE *f = _IO_strfile_read (&sf, s);
878
879 return __vfscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
880 }
881 libc_hidden_def (__nldbl___isoc99_vsscanf)
882
883 int
884 attribute_compat_text_section
885 __nldbl___isoc99_vscanf (const char *fmt, va_list ap)
886 {
887 return __vfscanf_internal (stdin, fmt, ap,
888 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
889 }
890
891 int
892 attribute_compat_text_section
893 __nldbl___isoc99_fscanf (FILE *s, const char *fmt, ...)
894 {
895 va_list ap;
896 int ret;
897
898 va_start (ap, fmt);
899 ret = __vfscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
900 va_end (ap);
901
902 return ret;
903 }
904
905 int
906 attribute_compat_text_section
907 __nldbl___isoc99_scanf (const char *fmt, ...)
908 {
909 va_list ap;
910 int ret;
911
912 va_start (ap, fmt);
913 ret = __vfscanf_internal (stdin, fmt, ap,
914 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
915 va_end (ap);
916
917 return ret;
918 }
919
920 int
921 attribute_compat_text_section
922 __nldbl___isoc99_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
923 {
924 return __vfwscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
925 }
926 libc_hidden_def (__nldbl___isoc99_vfwscanf)
927
928 int
929 attribute_compat_text_section
930 __nldbl___isoc99_swscanf (const wchar_t *s, const wchar_t *fmt, ...)
931 {
932 _IO_strfile sf;
933 struct _IO_wide_data wd;
934 FILE *f = _IO_strfile_readw (&sf, &wd, s);
935 va_list ap;
936 int ret;
937
938 va_start (ap, fmt);
939 ret = __vfwscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
940 va_end (ap);
941
942 return ret;
943 }
944
945 int
946 attribute_compat_text_section
947 __nldbl___isoc99_vswscanf (const wchar_t *s, const wchar_t *fmt, va_list ap)
948 {
949 _IO_strfile sf;
950 struct _IO_wide_data wd;
951 FILE *f = _IO_strfile_readw (&sf, &wd, s);
952
953 return __vfwscanf_internal (f, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
954 }
955 libc_hidden_def (__nldbl___isoc99_vswscanf)
956
957 int
958 attribute_compat_text_section
959 __nldbl___isoc99_vwscanf (const wchar_t *fmt, va_list ap)
960 {
961 return __vfwscanf_internal (stdin, fmt, ap,
962 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
963 }
964
965 int
966 attribute_compat_text_section
967 __nldbl___isoc99_fwscanf (FILE *s, const wchar_t *fmt, ...)
968 {
969 va_list ap;
970 int ret;
971
972 va_start (ap, fmt);
973 ret = __vfwscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
974 va_end (ap);
975
976 return ret;
977 }
978
979 int
980 attribute_compat_text_section
981 __nldbl___isoc99_wscanf (const wchar_t *fmt, ...)
982 {
983 va_list ap;
984 int ret;
985
986 va_start (ap, fmt);
987 ret = __vfwscanf_internal (stdin, fmt, ap,
988 SCANF_LDBL_IS_DBL | SCANF_ISOC99_A);
989 va_end (ap);
990
991 return ret;
992 }
993
994 void
995 __nldbl_argp_error (const struct argp_state *state, const char *fmt, ...)
996 {
997 va_list ap;
998 va_start (ap, fmt);
999 __argp_error_internal (state, fmt, ap, PRINTF_LDBL_IS_DBL);
1000 va_end (ap);
1001 }
1002
1003 void
1004 __nldbl_argp_failure (const struct argp_state *state, int status,
1005 int errnum, const char *fmt, ...)
1006 {
1007 va_list ap;
1008 va_start (ap, fmt);
1009 __argp_failure_internal (state, status, errnum, fmt, ap,
1010 PRINTF_LDBL_IS_DBL);
1011 va_end (ap);
1012 }
1013
1014 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
1015 compat_symbol (libc, __nldbl__IO_printf, _IO_printf, GLIBC_2_0);
1016 compat_symbol (libc, __nldbl__IO_sprintf, _IO_sprintf, GLIBC_2_0);
1017 compat_symbol (libc, __nldbl__IO_vfprintf, _IO_vfprintf, GLIBC_2_0);
1018 compat_symbol (libc, __nldbl__IO_vsprintf, _IO_vsprintf, GLIBC_2_0);
1019 compat_symbol (libc, __nldbl_dprintf, dprintf, GLIBC_2_0);
1020 compat_symbol (libc, __nldbl_fprintf, fprintf, GLIBC_2_0);
1021 compat_symbol (libc, __nldbl_printf, printf, GLIBC_2_0);
1022 compat_symbol (libc, __nldbl_sprintf, sprintf, GLIBC_2_0);
1023 compat_symbol (libc, __nldbl_vfprintf, vfprintf, GLIBC_2_0);
1024 compat_symbol (libc, __nldbl_vprintf, vprintf, GLIBC_2_0);
1025 compat_symbol (libc, __nldbl__IO_fprintf, _IO_fprintf, GLIBC_2_0);
1026 compat_symbol (libc, __nldbl___vsnprintf, __vsnprintf, GLIBC_2_0);
1027 compat_symbol (libc, __nldbl_asprintf, asprintf, GLIBC_2_0);
1028 compat_symbol (libc, __nldbl_obstack_printf, obstack_printf, GLIBC_2_0);
1029 compat_symbol (libc, __nldbl_obstack_vprintf, obstack_vprintf, GLIBC_2_0);
1030 compat_symbol (libc, __nldbl_snprintf, snprintf, GLIBC_2_0);
1031 compat_symbol (libc, __nldbl_vasprintf, vasprintf, GLIBC_2_0);
1032 compat_symbol (libc, __nldbl_vdprintf, vdprintf, GLIBC_2_0);
1033 compat_symbol (libc, __nldbl_vsnprintf, vsnprintf, GLIBC_2_0);
1034 compat_symbol (libc, __nldbl_vsprintf, vsprintf, GLIBC_2_0);
1035 compat_symbol (libc, __nldbl__IO_sscanf, _IO_sscanf, GLIBC_2_0);
1036 compat_symbol (libc, __nldbl___vfscanf, __vfscanf, GLIBC_2_0);
1037 compat_symbol (libc, __nldbl___vsscanf, __vsscanf, GLIBC_2_0);
1038 compat_symbol (libc, __nldbl_fscanf, fscanf, GLIBC_2_0);
1039 compat_symbol (libc, __nldbl_scanf, scanf, GLIBC_2_0);
1040 compat_symbol (libc, __nldbl_sscanf, sscanf, GLIBC_2_0);
1041 compat_symbol (libc, __nldbl_vfscanf, vfscanf, GLIBC_2_0);
1042 compat_symbol (libc, __nldbl_vscanf, vscanf, GLIBC_2_0);
1043 compat_symbol (libc, __nldbl_vsscanf, vsscanf, GLIBC_2_0);
1044 compat_symbol (libc, __nldbl___printf_fp, __printf_fp, GLIBC_2_0);
1045 compat_symbol (libc, __nldbl_strfmon, strfmon, GLIBC_2_0);
1046 compat_symbol (libc, __nldbl_syslog, syslog, GLIBC_2_0);
1047 compat_symbol (libc, __nldbl_vsyslog, vsyslog, GLIBC_2_0);
1048 /* This function is not in public headers, but was exported until
1049 version 2.29. For platforms that are newer than that, there's no
1050 need to expose the symbol. */
1051 # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_29)
1052 compat_symbol (libc, __nldbl__IO_vfscanf, _IO_vfscanf, GLIBC_2_0);
1053 # endif
1054 #endif
1055 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_1)
1056 compat_symbol (libc, __nldbl___asprintf, __asprintf, GLIBC_2_1);
1057 compat_symbol (libc, __nldbl_printf_size, printf_size, GLIBC_2_1);
1058 compat_symbol (libc, __nldbl___strfmon_l, __strfmon_l, GLIBC_2_1);
1059 #endif
1060 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_2)
1061 compat_symbol (libc, __nldbl_swprintf, swprintf, GLIBC_2_2);
1062 compat_symbol (libc, __nldbl_vwprintf, vwprintf, GLIBC_2_2);
1063 compat_symbol (libc, __nldbl_wprintf, wprintf, GLIBC_2_2);
1064 compat_symbol (libc, __nldbl_fwprintf, fwprintf, GLIBC_2_2);
1065 compat_symbol (libc, __nldbl_vfwprintf, vfwprintf, GLIBC_2_2);
1066 compat_symbol (libc, __nldbl_vswprintf, vswprintf, GLIBC_2_2);
1067 compat_symbol (libc, __nldbl_fwscanf, fwscanf, GLIBC_2_2);
1068 compat_symbol (libc, __nldbl_swscanf, swscanf, GLIBC_2_2);
1069 compat_symbol (libc, __nldbl_vfwscanf, vfwscanf, GLIBC_2_2);
1070 compat_symbol (libc, __nldbl_vswscanf, vswscanf, GLIBC_2_2);
1071 compat_symbol (libc, __nldbl_vwscanf, vwscanf, GLIBC_2_2);
1072 compat_symbol (libc, __nldbl_wscanf, wscanf, GLIBC_2_2);
1073 #endif
1074 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3)
1075 compat_symbol (libc, __nldbl_strfmon_l, strfmon_l, GLIBC_2_3);
1076 #endif
1077 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3_4)
1078 compat_symbol (libc, __nldbl___sprintf_chk, __sprintf_chk, GLIBC_2_3_4);
1079 compat_symbol (libc, __nldbl___vsprintf_chk, __vsprintf_chk, GLIBC_2_3_4);
1080 compat_symbol (libc, __nldbl___snprintf_chk, __snprintf_chk, GLIBC_2_3_4);
1081 compat_symbol (libc, __nldbl___vsnprintf_chk, __vsnprintf_chk, GLIBC_2_3_4);
1082 compat_symbol (libc, __nldbl___printf_chk, __printf_chk, GLIBC_2_3_4);
1083 compat_symbol (libc, __nldbl___fprintf_chk, __fprintf_chk, GLIBC_2_3_4);
1084 compat_symbol (libc, __nldbl___vprintf_chk, __vprintf_chk, GLIBC_2_3_4);
1085 compat_symbol (libc, __nldbl___vfprintf_chk, __vfprintf_chk, GLIBC_2_3_4);
1086 #endif