| 1 | /* *printf* family compatibility routines for IEEE double as long double |
| 2 | Copyright (C) 2006-2024 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 5 | The GNU C Library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with the GNU C Library; if not, see |
| 17 | <https://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | /* This file may define some of the deprecated scanf variants. */ |
| 20 | #include <features.h> |
| 21 | #undef __GLIBC_USE_DEPRECATED_SCANF |
| 22 | #define __GLIBC_USE_DEPRECATED_SCANF 1 |
| 23 | |
| 24 | #include <argp.h> |
| 25 | #include <err.h> |
| 26 | #include <error.h> |
| 27 | #include <stdarg.h> |
| 28 | #include <stdio.h> |
| 29 | #include <libio/strfile.h> |
| 30 | #include <math.h> |
| 31 | #include <wchar.h> |
| 32 | #include <printf.h> |
| 33 | #include <monetary.h> |
| 34 | #include <locale/localeinfo.h> |
| 35 | #include <sys/syslog.h> |
| 36 | #include <libc-lock.h> |
| 37 | |
| 38 | #include "nldbl-compat.h" |
| 39 | |
| 40 | libc_hidden_proto (__nldbl_vsscanf) |
| 41 | libc_hidden_proto (__nldbl_vfscanf) |
| 42 | libc_hidden_proto (__nldbl_vfwscanf) |
| 43 | libc_hidden_proto (__nldbl_vswscanf) |
| 44 | libc_hidden_proto (__nldbl___isoc99_vsscanf) |
| 45 | libc_hidden_proto (__nldbl___isoc99_vfscanf) |
| 46 | libc_hidden_proto (__nldbl___isoc99_vswscanf) |
| 47 | libc_hidden_proto (__nldbl___isoc99_vfwscanf) |
| 48 | libc_hidden_proto (__nldbl___isoc23_vsscanf) |
| 49 | libc_hidden_proto (__nldbl___isoc23_vfscanf) |
| 50 | libc_hidden_proto (__nldbl___isoc23_vswscanf) |
| 51 | libc_hidden_proto (__nldbl___isoc23_vfwscanf) |
| 52 | |
| 53 | /* Compatibility with IEEE double as long double. |
| 54 | IEEE quad long double is used by default for most programs, so |
| 55 | we don't need to split this into one file per function for the |
| 56 | sake of statically linked programs. */ |
| 57 | |
| 58 | int |
| 59 | attribute_compat_text_section |
| 60 | __nldbl___asprintf (char **string_ptr, const char *fmt, ...) |
| 61 | { |
| 62 | va_list ap; |
| 63 | int ret; |
| 64 | |
| 65 | va_start (ap, fmt); |
| 66 | ret = __vasprintf_internal (result_ptr: string_ptr, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 67 | va_end (ap); |
| 68 | |
| 69 | return ret; |
| 70 | } |
| 71 | weak_alias (__nldbl___asprintf, __nldbl_asprintf) |
| 72 | |
| 73 | int |
| 74 | attribute_compat_text_section |
| 75 | __nldbl_dprintf (int d, const char *fmt, ...) |
| 76 | { |
| 77 | va_list ap; |
| 78 | int ret; |
| 79 | |
| 80 | va_start (ap, fmt); |
| 81 | ret = __vdprintf_internal (d, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 82 | va_end (ap); |
| 83 | |
| 84 | return ret; |
| 85 | } |
| 86 | |
| 87 | int |
| 88 | attribute_compat_text_section |
| 89 | __nldbl_fprintf (FILE *stream, const char *fmt, ...) |
| 90 | { |
| 91 | va_list ap; |
| 92 | int ret; |
| 93 | |
| 94 | va_start (ap, fmt); |
| 95 | ret = __vfprintf_internal (fp: stream, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 96 | va_end (ap); |
| 97 | |
| 98 | return ret; |
| 99 | } |
| 100 | weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf) |
| 101 | |
| 102 | int |
| 103 | attribute_compat_text_section weak_function |
| 104 | __nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...) |
| 105 | { |
| 106 | va_list ap; |
| 107 | int ret; |
| 108 | |
| 109 | va_start (ap, fmt); |
| 110 | ret = __vfwprintf_internal (fp: stream, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 111 | va_end (ap); |
| 112 | |
| 113 | return ret; |
| 114 | } |
| 115 | |
| 116 | int |
| 117 | attribute_compat_text_section |
| 118 | __nldbl_printf (const char *fmt, ...) |
| 119 | { |
| 120 | va_list ap; |
| 121 | int ret; |
| 122 | |
| 123 | va_start (ap, fmt); |
| 124 | ret = __vfprintf_internal (stdout, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 125 | va_end (ap); |
| 126 | |
| 127 | return ret; |
| 128 | } |
| 129 | strong_alias (__nldbl_printf, __nldbl__IO_printf) |
| 130 | |
| 131 | int |
| 132 | attribute_compat_text_section |
| 133 | __nldbl_sprintf (char *s, const char *fmt, ...) |
| 134 | { |
| 135 | va_list ap; |
| 136 | int ret; |
| 137 | |
| 138 | va_start (ap, fmt); |
| 139 | ret = __vsprintf_internal (string: s, maxlen: -1, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 140 | va_end (ap); |
| 141 | |
| 142 | return ret; |
| 143 | } |
| 144 | strong_alias (__nldbl_sprintf, __nldbl__IO_sprintf) |
| 145 | |
| 146 | int |
| 147 | attribute_compat_text_section |
| 148 | __nldbl_vfprintf (FILE *s, const char *fmt, va_list ap) |
| 149 | { |
| 150 | return __vfprintf_internal (fp: s, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 151 | } |
| 152 | strong_alias (__nldbl_vfprintf, __nldbl__IO_vfprintf) |
| 153 | |
| 154 | int |
| 155 | attribute_compat_text_section |
| 156 | __nldbl___vsprintf (char *string, const char *fmt, va_list ap) |
| 157 | { |
| 158 | return __vsprintf_internal (string, maxlen: -1, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 159 | } |
| 160 | strong_alias (__nldbl___vsprintf, __nldbl__IO_vsprintf) |
| 161 | weak_alias (__nldbl___vsprintf, __nldbl_vsprintf) |
| 162 | |
| 163 | int |
| 164 | attribute_compat_text_section |
| 165 | __nldbl_obstack_vprintf (struct obstack *obstack, const char *fmt, |
| 166 | va_list ap) |
| 167 | { |
| 168 | return __obstack_vprintf_internal (ob: obstack, fmt, ap, PRINTF_LDBL_IS_DBL); |
| 169 | } |
| 170 | |
| 171 | int |
| 172 | attribute_compat_text_section |
| 173 | __nldbl_obstack_printf (struct obstack *obstack, const char *fmt, ...) |
| 174 | { |
| 175 | int ret; |
| 176 | va_list ap; |
| 177 | va_start (ap, fmt); |
| 178 | ret = __obstack_vprintf_internal (ob: obstack, fmt, ap, PRINTF_LDBL_IS_DBL); |
| 179 | va_end (ap); |
| 180 | return ret; |
| 181 | } |
| 182 | |
| 183 | int |
| 184 | attribute_compat_text_section weak_function |
| 185 | __nldbl_snprintf (char *s, size_t maxlen, const char *fmt, ...) |
| 186 | { |
| 187 | va_list ap; |
| 188 | int ret; |
| 189 | |
| 190 | va_start (ap, fmt); |
| 191 | ret = __vsnprintf_internal (string: s, maxlen, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 192 | va_end (ap); |
| 193 | |
| 194 | return ret; |
| 195 | } |
| 196 | |
| 197 | int |
| 198 | attribute_compat_text_section |
| 199 | __nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...) |
| 200 | { |
| 201 | va_list ap; |
| 202 | int ret; |
| 203 | |
| 204 | va_start (ap, fmt); |
| 205 | ret = __vswprintf_internal (string: s, maxlen: n, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 206 | va_end (ap); |
| 207 | |
| 208 | return ret; |
| 209 | } |
| 210 | |
| 211 | int |
| 212 | attribute_compat_text_section weak_function |
| 213 | __nldbl_vasprintf (char **result_ptr, const char *fmt, va_list ap) |
| 214 | { |
| 215 | return __vasprintf_internal (result_ptr, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 216 | } |
| 217 | |
| 218 | int |
| 219 | attribute_compat_text_section |
| 220 | __nldbl_vdprintf (int d, const char *fmt, va_list ap) |
| 221 | { |
| 222 | return __vdprintf_internal (d, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 223 | } |
| 224 | |
| 225 | int |
| 226 | attribute_compat_text_section weak_function |
| 227 | __nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap) |
| 228 | { |
| 229 | return __vfwprintf_internal (fp: s, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 230 | } |
| 231 | |
| 232 | int |
| 233 | attribute_compat_text_section |
| 234 | __nldbl_vprintf (const char *fmt, va_list ap) |
| 235 | { |
| 236 | return __vfprintf_internal (stdout, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 237 | } |
| 238 | |
| 239 | int |
| 240 | attribute_compat_text_section |
| 241 | __nldbl_vsnprintf (char *string, size_t maxlen, const char *fmt, |
| 242 | va_list ap) |
| 243 | { |
| 244 | return __vsnprintf_internal (string, maxlen, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 245 | } |
| 246 | weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf) |
| 247 | |
| 248 | int |
| 249 | attribute_compat_text_section weak_function |
| 250 | __nldbl_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt, |
| 251 | va_list ap) |
| 252 | { |
| 253 | return __vswprintf_internal (string, maxlen, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 254 | } |
| 255 | |
| 256 | int |
| 257 | attribute_compat_text_section |
| 258 | __nldbl_vwprintf (const wchar_t *fmt, va_list ap) |
| 259 | { |
| 260 | return __vfwprintf_internal (stdout, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 261 | } |
| 262 | |
| 263 | int |
| 264 | attribute_compat_text_section |
| 265 | __nldbl_wprintf (const wchar_t *fmt, ...) |
| 266 | { |
| 267 | va_list ap; |
| 268 | int ret; |
| 269 | |
| 270 | va_start (ap, fmt); |
| 271 | ret = __vfwprintf_internal (stdout, format: fmt, ap, PRINTF_LDBL_IS_DBL); |
| 272 | va_end (ap); |
| 273 | |
| 274 | return ret; |
| 275 | } |
| 276 | |
| 277 | #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_29) |
| 278 | int |
| 279 | attribute_compat_text_section |
| 280 | __nldbl__IO_vfscanf (FILE *s, const char *fmt, va_list ap, int *errp) |
| 281 | { |
| 282 | int ret = __vfscanf_internal (s, fmt, ap, SCANF_LDBL_IS_DBL); |
| 283 | if (__glibc_unlikely (errp != 0)) |
| 284 | *errp = (ret == -1); |
| 285 | return ret; |
| 286 | } |
| 287 | #endif |
| 288 | |
| 289 | int |
| 290 | attribute_compat_text_section |
| 291 | __nldbl___vfscanf (FILE *s, const char *fmt, va_list ap) |
| 292 | { |
| 293 | return __vfscanf_internal (fp: s, format: fmt, argp: ap, SCANF_LDBL_IS_DBL); |
| 294 | } |
| 295 | weak_alias (__nldbl___vfscanf, __nldbl_vfscanf) |
| 296 | libc_hidden_def (__nldbl_vfscanf) |
| 297 | |
| 298 | int |
| 299 | attribute_compat_text_section |
| 300 | __nldbl_sscanf (const char *s, const char *fmt, ...) |
| 301 | { |
| 302 | _IO_strfile sf; |
| 303 | FILE *f = _IO_strfile_read (sf: &sf, string: s); |
| 304 | va_list ap; |
| 305 | int ret; |
| 306 | |
| 307 | va_start (ap, fmt); |
| 308 | ret = __vfscanf_internal (fp: f, format: fmt, argp: ap, SCANF_LDBL_IS_DBL); |
| 309 | va_end (ap); |
| 310 | |
| 311 | return ret; |
| 312 | } |
| 313 | strong_alias (__nldbl_sscanf, __nldbl__IO_sscanf) |
| 314 | |
| 315 | int |
| 316 | attribute_compat_text_section |
| 317 | __nldbl___vsscanf (const char *s, const char *fmt, va_list ap) |
| 318 | { |
| 319 | _IO_strfile sf; |
| 320 | FILE *f = _IO_strfile_read (sf: &sf, string: s); |
| 321 | return __vfscanf_internal (fp: f, format: fmt, argp: ap, SCANF_LDBL_IS_DBL); |
| 322 | } |
| 323 | weak_alias (__nldbl___vsscanf, __nldbl_vsscanf) |
| 324 | libc_hidden_def (__nldbl_vsscanf) |
| 325 | |
| 326 | int |
| 327 | attribute_compat_text_section weak_function |
| 328 | __nldbl_vscanf (const char *fmt, va_list ap) |
| 329 | { |
| 330 | return __vfscanf_internal (stdin, format: fmt, argp: ap, SCANF_LDBL_IS_DBL); |
| 331 | } |
| 332 | |
| 333 | int |
| 334 | attribute_compat_text_section |
| 335 | __nldbl_fscanf (FILE *stream, const char *fmt, ...) |
| 336 | { |
| 337 | va_list ap; |
| 338 | int ret; |
| 339 | |
| 340 | va_start (ap, fmt); |
| 341 | ret = __vfscanf_internal (fp: stream, format: fmt, argp: ap, SCANF_LDBL_IS_DBL); |
| 342 | va_end (ap); |
| 343 | |
| 344 | return ret; |
| 345 | } |
| 346 | |
| 347 | int |
| 348 | attribute_compat_text_section |
| 349 | __nldbl_scanf (const char *fmt, ...) |
| 350 | { |
| 351 | va_list ap; |
| 352 | int ret; |
| 353 | |
| 354 | va_start (ap, fmt); |
| 355 | ret = __vfscanf_internal (stdin, format: fmt, argp: ap, SCANF_LDBL_IS_DBL); |
| 356 | va_end (ap); |
| 357 | |
| 358 | return ret; |
| 359 | } |
| 360 | |
| 361 | int |
| 362 | attribute_compat_text_section |
| 363 | __nldbl_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap) |
| 364 | { |
| 365 | return __vfwscanf_internal (fp: s, format: fmt, argp: ap, SCANF_LDBL_IS_DBL); |
| 366 | } |
| 367 | libc_hidden_def (__nldbl_vfwscanf) |
| 368 | |
| 369 | int |
| 370 | attribute_compat_text_section |
| 371 | __nldbl_swscanf (const wchar_t *s, const wchar_t *fmt, ...) |
| 372 | { |
| 373 | _IO_strfile sf; |
| 374 | struct _IO_wide_data wd; |
| 375 | FILE *f = _IO_strfile_readw (sf: &sf, wd: &wd, string: s); |
| 376 | va_list ap; |
| 377 | int ret; |
| 378 | |
| 379 | va_start (ap, fmt); |
| 380 | ret = __vfwscanf_internal (fp: f, format: fmt, argp: ap, SCANF_LDBL_IS_DBL); |
| 381 | va_end (ap); |
| 382 | |
| 383 | return ret; |
| 384 | } |
| 385 | |
| 386 | int |
| 387 | attribute_compat_text_section |
| 388 | __nldbl_vswscanf (const wchar_t *s, const wchar_t *fmt, va_list ap) |
| 389 | { |
| 390 | _IO_strfile sf; |
| 391 | struct _IO_wide_data wd; |
| 392 | FILE *f = _IO_strfile_readw (sf: &sf, wd: &wd, string: s); |
| 393 | |
| 394 | return __vfwscanf_internal (fp: f, format: fmt, argp: ap, SCANF_LDBL_IS_DBL); |
| 395 | } |
| 396 | libc_hidden_def (__nldbl_vswscanf) |
| 397 | |
| 398 | int |
| 399 | attribute_compat_text_section weak_function |
| 400 | __nldbl_vwscanf (const wchar_t *fmt, va_list ap) |
| 401 | { |
| 402 | return __vfwscanf_internal (stdin, format: fmt, argp: ap, SCANF_LDBL_IS_DBL); |
| 403 | } |
| 404 | |
| 405 | int |
| 406 | attribute_compat_text_section |
| 407 | __nldbl_fwscanf (FILE *stream, const wchar_t *fmt, ...) |
| 408 | { |
| 409 | va_list ap; |
| 410 | int ret; |
| 411 | |
| 412 | va_start (ap, fmt); |
| 413 | ret = __vfwscanf_internal (fp: stream, format: fmt, argp: ap, SCANF_LDBL_IS_DBL); |
| 414 | va_end (ap); |
| 415 | |
| 416 | return ret; |
| 417 | } |
| 418 | |
| 419 | int |
| 420 | attribute_compat_text_section |
| 421 | __nldbl_wscanf (const wchar_t *fmt, ...) |
| 422 | { |
| 423 | va_list ap; |
| 424 | int ret; |
| 425 | |
| 426 | va_start (ap, fmt); |
| 427 | ret = __vfwscanf_internal (stdin, format: fmt, argp: ap, SCANF_LDBL_IS_DBL); |
| 428 | va_end (ap); |
| 429 | |
| 430 | return ret; |
| 431 | } |
| 432 | |
| 433 | int |
| 434 | attribute_compat_text_section |
| 435 | __nldbl___fprintf_chk (FILE *stream, int flag, const char *fmt, ...) |
| 436 | { |
| 437 | va_list ap; |
| 438 | int ret; |
| 439 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 440 | if (flag > 0) |
| 441 | mode |= PRINTF_FORTIFY; |
| 442 | |
| 443 | va_start (ap, fmt); |
| 444 | ret = __vfprintf_internal (fp: stream, format: fmt, ap, mode_flags: mode); |
| 445 | va_end (ap); |
| 446 | |
| 447 | return ret; |
| 448 | } |
| 449 | |
| 450 | int |
| 451 | attribute_compat_text_section |
| 452 | __nldbl___fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...) |
| 453 | { |
| 454 | va_list ap; |
| 455 | int ret; |
| 456 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 457 | if (flag > 0) |
| 458 | mode |= PRINTF_FORTIFY; |
| 459 | |
| 460 | va_start (ap, fmt); |
| 461 | ret = __vfwprintf_internal (fp: stream, format: fmt, ap, mode_flags: mode); |
| 462 | va_end (ap); |
| 463 | |
| 464 | return ret; |
| 465 | } |
| 466 | |
| 467 | int |
| 468 | attribute_compat_text_section |
| 469 | __nldbl___printf_chk (int flag, const char *fmt, ...) |
| 470 | { |
| 471 | va_list ap; |
| 472 | int ret; |
| 473 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 474 | if (flag > 0) |
| 475 | mode |= PRINTF_FORTIFY; |
| 476 | |
| 477 | va_start (ap, fmt); |
| 478 | ret = __vfprintf_internal (stdout, format: fmt, ap, mode_flags: mode); |
| 479 | va_end (ap); |
| 480 | |
| 481 | return ret; |
| 482 | } |
| 483 | |
| 484 | int |
| 485 | attribute_compat_text_section |
| 486 | __nldbl___snprintf_chk (char *s, size_t maxlen, int flag, size_t slen, |
| 487 | const char *fmt, ...) |
| 488 | { |
| 489 | if (__glibc_unlikely (slen < maxlen)) |
| 490 | __chk_fail (); |
| 491 | |
| 492 | va_list ap; |
| 493 | int ret; |
| 494 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 495 | if (flag > 0) |
| 496 | mode |= PRINTF_FORTIFY; |
| 497 | |
| 498 | va_start (ap, fmt); |
| 499 | ret = __vsnprintf_internal (string: s, maxlen, format: fmt, ap, mode_flags: mode); |
| 500 | va_end (ap); |
| 501 | |
| 502 | return ret; |
| 503 | } |
| 504 | |
| 505 | int |
| 506 | attribute_compat_text_section |
| 507 | __nldbl___sprintf_chk (char *s, int flag, size_t slen, const char *fmt, ...) |
| 508 | { |
| 509 | if (slen == 0) |
| 510 | __chk_fail (); |
| 511 | |
| 512 | va_list ap; |
| 513 | int ret; |
| 514 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 515 | if (flag > 0) |
| 516 | mode |= PRINTF_FORTIFY; |
| 517 | |
| 518 | va_start (ap, fmt); |
| 519 | ret = __vsprintf_internal (string: s, maxlen: slen, format: fmt, ap, mode_flags: mode); |
| 520 | va_end (ap); |
| 521 | |
| 522 | return ret; |
| 523 | } |
| 524 | |
| 525 | int |
| 526 | attribute_compat_text_section |
| 527 | __nldbl___swprintf_chk (wchar_t *s, size_t maxlen, int flag, size_t slen, |
| 528 | const wchar_t *fmt, ...) |
| 529 | { |
| 530 | if (__glibc_unlikely (slen < maxlen)) |
| 531 | __chk_fail (); |
| 532 | |
| 533 | va_list ap; |
| 534 | int ret; |
| 535 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 536 | if (flag > 0) |
| 537 | mode |= PRINTF_FORTIFY; |
| 538 | |
| 539 | va_start (ap, fmt); |
| 540 | ret = __vswprintf_internal (string: s, maxlen, format: fmt, ap, mode_flags: mode); |
| 541 | va_end (ap); |
| 542 | |
| 543 | return ret; |
| 544 | } |
| 545 | |
| 546 | int |
| 547 | attribute_compat_text_section |
| 548 | __nldbl___vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap) |
| 549 | { |
| 550 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 551 | if (flag > 0) |
| 552 | mode |= PRINTF_FORTIFY; |
| 553 | |
| 554 | return __vfprintf_internal (fp: s, format: fmt, ap, mode_flags: mode); |
| 555 | } |
| 556 | |
| 557 | int |
| 558 | attribute_compat_text_section |
| 559 | __nldbl___vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap) |
| 560 | { |
| 561 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 562 | if (flag > 0) |
| 563 | mode |= PRINTF_FORTIFY; |
| 564 | |
| 565 | return __vfwprintf_internal (fp: s, format: fmt, ap, mode_flags: mode); |
| 566 | } |
| 567 | |
| 568 | int |
| 569 | attribute_compat_text_section |
| 570 | __nldbl___vprintf_chk (int flag, const char *fmt, va_list ap) |
| 571 | { |
| 572 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 573 | if (flag > 0) |
| 574 | mode |= PRINTF_FORTIFY; |
| 575 | |
| 576 | return __vfprintf_internal (stdout, format: fmt, ap, mode_flags: mode); |
| 577 | } |
| 578 | |
| 579 | int |
| 580 | attribute_compat_text_section |
| 581 | __nldbl___vsnprintf_chk (char *string, size_t maxlen, int flag, size_t slen, |
| 582 | const char *fmt, va_list ap) |
| 583 | { |
| 584 | if (__glibc_unlikely (slen < maxlen)) |
| 585 | __chk_fail (); |
| 586 | |
| 587 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 588 | if (flag > 0) |
| 589 | mode |= PRINTF_FORTIFY; |
| 590 | |
| 591 | return __vsnprintf_internal (string, maxlen, format: fmt, ap, mode_flags: mode); |
| 592 | } |
| 593 | |
| 594 | int |
| 595 | attribute_compat_text_section |
| 596 | __nldbl___vsprintf_chk (char *string, int flag, size_t slen, const char *fmt, |
| 597 | va_list ap) |
| 598 | { |
| 599 | if (slen == 0) |
| 600 | __chk_fail (); |
| 601 | |
| 602 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 603 | if (flag > 0) |
| 604 | mode |= PRINTF_FORTIFY; |
| 605 | |
| 606 | return __vsprintf_internal (string, maxlen: slen, format: fmt, ap, mode_flags: mode); |
| 607 | } |
| 608 | |
| 609 | int |
| 610 | attribute_compat_text_section |
| 611 | __nldbl___vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen, |
| 612 | const wchar_t *fmt, va_list ap) |
| 613 | { |
| 614 | if (__glibc_unlikely (slen < maxlen)) |
| 615 | __chk_fail (); |
| 616 | |
| 617 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 618 | if (flag > 0) |
| 619 | mode |= PRINTF_FORTIFY; |
| 620 | |
| 621 | return __vswprintf_internal (string, maxlen, format: fmt, ap, mode_flags: mode); |
| 622 | } |
| 623 | |
| 624 | int |
| 625 | attribute_compat_text_section |
| 626 | __nldbl___vwprintf_chk (int flag, const wchar_t *fmt, va_list ap) |
| 627 | { |
| 628 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 629 | if (flag > 0) |
| 630 | mode |= PRINTF_FORTIFY; |
| 631 | |
| 632 | return __vfwprintf_internal (stdout, format: fmt, ap, mode_flags: mode); |
| 633 | } |
| 634 | |
| 635 | int |
| 636 | attribute_compat_text_section |
| 637 | __nldbl___wprintf_chk (int flag, const wchar_t *fmt, ...) |
| 638 | { |
| 639 | va_list ap; |
| 640 | int ret; |
| 641 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 642 | if (flag > 0) |
| 643 | mode |= PRINTF_FORTIFY; |
| 644 | |
| 645 | va_start (ap, fmt); |
| 646 | ret = __vfwprintf_internal (stdout, format: fmt, ap, mode_flags: mode); |
| 647 | va_end (ap); |
| 648 | |
| 649 | return ret; |
| 650 | } |
| 651 | |
| 652 | int |
| 653 | attribute_compat_text_section |
| 654 | __nldbl___vasprintf_chk (char **ptr, int flag, const char *fmt, va_list ap) |
| 655 | { |
| 656 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 657 | if (flag > 0) |
| 658 | mode |= PRINTF_FORTIFY; |
| 659 | |
| 660 | return __vasprintf_internal (result_ptr: ptr, format: fmt, ap, mode_flags: mode); |
| 661 | } |
| 662 | |
| 663 | int |
| 664 | attribute_compat_text_section |
| 665 | __nldbl___asprintf_chk (char **ptr, int flag, const char *fmt, ...) |
| 666 | { |
| 667 | va_list ap; |
| 668 | int ret; |
| 669 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 670 | if (flag > 0) |
| 671 | mode |= PRINTF_FORTIFY; |
| 672 | |
| 673 | va_start (ap, fmt); |
| 674 | ret = __vasprintf_internal (result_ptr: ptr, format: fmt, ap, mode_flags: mode); |
| 675 | va_end (ap); |
| 676 | |
| 677 | return ret; |
| 678 | } |
| 679 | |
| 680 | int |
| 681 | attribute_compat_text_section |
| 682 | __nldbl___vdprintf_chk (int d, int flag, const char *fmt, va_list ap) |
| 683 | { |
| 684 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 685 | if (flag > 0) |
| 686 | mode |= PRINTF_FORTIFY; |
| 687 | |
| 688 | return __vdprintf_internal (d, format: fmt, ap, mode_flags: mode); |
| 689 | } |
| 690 | |
| 691 | int |
| 692 | attribute_compat_text_section |
| 693 | __nldbl___dprintf_chk (int d, int flag, const char *fmt, ...) |
| 694 | { |
| 695 | va_list ap; |
| 696 | int ret; |
| 697 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 698 | if (flag > 0) |
| 699 | mode |= PRINTF_FORTIFY; |
| 700 | |
| 701 | va_start (ap, fmt); |
| 702 | ret = __vdprintf_internal (d, format: fmt, ap, mode_flags: mode); |
| 703 | va_end (ap); |
| 704 | |
| 705 | return ret; |
| 706 | } |
| 707 | |
| 708 | int |
| 709 | attribute_compat_text_section |
| 710 | __nldbl___obstack_vprintf_chk (struct obstack *obstack, int flag, |
| 711 | const char *fmt, va_list ap) |
| 712 | { |
| 713 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 714 | if (flag > 0) |
| 715 | mode |= PRINTF_FORTIFY; |
| 716 | |
| 717 | return __obstack_vprintf_internal (ob: obstack, fmt, ap, mode_flags: mode); |
| 718 | } |
| 719 | |
| 720 | int |
| 721 | attribute_compat_text_section |
| 722 | __nldbl___obstack_printf_chk (struct obstack *obstack, int flag, |
| 723 | const char *fmt, ...) |
| 724 | { |
| 725 | va_list ap; |
| 726 | int ret; |
| 727 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 728 | if (flag > 0) |
| 729 | mode |= PRINTF_FORTIFY; |
| 730 | |
| 731 | va_start (ap, fmt); |
| 732 | ret = __obstack_vprintf_internal (ob: obstack, fmt, ap, mode_flags: mode); |
| 733 | va_end (ap); |
| 734 | |
| 735 | return ret; |
| 736 | } |
| 737 | |
| 738 | extern __typeof (printf_size) __printf_size; |
| 739 | |
| 740 | int |
| 741 | attribute_compat_text_section |
| 742 | __nldbl_printf_size (FILE *fp, const struct printf_info *info, |
| 743 | const void *const *args) |
| 744 | { |
| 745 | struct printf_info info_no_ldbl = *info; |
| 746 | |
| 747 | info_no_ldbl.is_long_double = 0; |
| 748 | return __printf_size (fp, &info_no_ldbl, args); |
| 749 | } |
| 750 | |
| 751 | extern __typeof (__printf_fp) ___printf_fp; |
| 752 | |
| 753 | int |
| 754 | attribute_compat_text_section |
| 755 | __nldbl___printf_fp (FILE *fp, const struct printf_info *info, |
| 756 | const void *const *args) |
| 757 | { |
| 758 | struct printf_info info_no_ldbl = *info; |
| 759 | |
| 760 | info_no_ldbl.is_long_double = 0; |
| 761 | return ___printf_fp (fp, &info_no_ldbl, args); |
| 762 | } |
| 763 | |
| 764 | ssize_t |
| 765 | attribute_compat_text_section |
| 766 | __nldbl_strfmon (char *s, size_t maxsize, const char *format, ...) |
| 767 | { |
| 768 | va_list ap; |
| 769 | ssize_t ret; |
| 770 | |
| 771 | va_start (ap, format); |
| 772 | ret = __vstrfmon_l_internal (s, maxsize, _NL_CURRENT_LOCALE, format, ap, |
| 773 | STRFMON_LDBL_IS_DBL); |
| 774 | va_end (ap); |
| 775 | return ret; |
| 776 | } |
| 777 | |
| 778 | ssize_t |
| 779 | attribute_compat_text_section |
| 780 | __nldbl___strfmon_l (char *s, size_t maxsize, locale_t loc, |
| 781 | const char *format, ...) |
| 782 | { |
| 783 | va_list ap; |
| 784 | ssize_t ret; |
| 785 | |
| 786 | va_start (ap, format); |
| 787 | ret = __vstrfmon_l_internal (s, maxsize, loc, format, ap, |
| 788 | STRFMON_LDBL_IS_DBL); |
| 789 | va_end (ap); |
| 790 | return ret; |
| 791 | } |
| 792 | weak_alias (__nldbl___strfmon_l, __nldbl_strfmon_l) |
| 793 | |
| 794 | ssize_t |
| 795 | attribute_compat_text_section |
| 796 | __nldbl___vstrfmon (char *s, size_t maxsize, const char *format, va_list ap) |
| 797 | { |
| 798 | return __vstrfmon_l_internal (s, maxsize, _NL_CURRENT_LOCALE, format, ap, |
| 799 | STRFMON_LDBL_IS_DBL); |
| 800 | } |
| 801 | |
| 802 | ssize_t |
| 803 | attribute_compat_text_section |
| 804 | __nldbl___vstrfmon_l (char *s, size_t maxsize, locale_t loc, |
| 805 | const char *format, va_list ap) |
| 806 | { |
| 807 | return __vstrfmon_l_internal (s, maxsize, loc, format, ap, |
| 808 | STRFMON_LDBL_IS_DBL); |
| 809 | } |
| 810 | |
| 811 | void |
| 812 | attribute_compat_text_section |
| 813 | __nldbl_syslog (int pri, const char *fmt, ...) |
| 814 | { |
| 815 | va_list ap; |
| 816 | va_start (ap, fmt); |
| 817 | __vsyslog_internal (pri, fmt, ap, PRINTF_LDBL_IS_DBL); |
| 818 | va_end (ap); |
| 819 | } |
| 820 | |
| 821 | void |
| 822 | attribute_compat_text_section |
| 823 | __nldbl_vsyslog (int pri, const char *fmt, va_list ap) |
| 824 | { |
| 825 | __vsyslog_internal (pri, fmt, ap, PRINTF_LDBL_IS_DBL); |
| 826 | } |
| 827 | |
| 828 | void |
| 829 | attribute_compat_text_section |
| 830 | __nldbl___syslog_chk (int pri, int flag, const char *fmt, ...) |
| 831 | { |
| 832 | va_list ap; |
| 833 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 834 | if (flag > 0) |
| 835 | mode |= PRINTF_FORTIFY; |
| 836 | |
| 837 | va_start (ap, fmt); |
| 838 | __vsyslog_internal (pri, fmt, ap, mode_flags: mode); |
| 839 | va_end(ap); |
| 840 | } |
| 841 | |
| 842 | void |
| 843 | attribute_compat_text_section |
| 844 | __nldbl___vsyslog_chk (int pri, int flag, const char *fmt, va_list ap) |
| 845 | { |
| 846 | unsigned int mode = PRINTF_LDBL_IS_DBL; |
| 847 | if (flag > 0) |
| 848 | mode |= PRINTF_FORTIFY; |
| 849 | |
| 850 | __vsyslog_internal (pri, fmt, ap, mode_flags: mode); |
| 851 | } |
| 852 | |
| 853 | int |
| 854 | attribute_compat_text_section |
| 855 | __nldbl___isoc99_vfscanf (FILE *s, const char *fmt, va_list ap) |
| 856 | { |
| 857 | return __vfscanf_internal (fp: s, format: fmt, argp: ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A); |
| 858 | } |
| 859 | libc_hidden_def (__nldbl___isoc99_vfscanf) |
| 860 | |
| 861 | int |
| 862 | attribute_compat_text_section |
| 863 | __nldbl___isoc99_sscanf (const char *s, const char *fmt, ...) |
| 864 | { |
| 865 | _IO_strfile sf; |
| 866 | FILE *f = _IO_strfile_read (sf: &sf, string: s); |
| 867 | va_list ap; |
| 868 | int ret; |
| 869 | |
| 870 | va_start (ap, fmt); |
| 871 | ret = __vfscanf_internal (fp: f, format: fmt, argp: ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A); |
| 872 | va_end (ap); |
| 873 | |
| 874 | return ret; |
| 875 | } |
| 876 | |
| 877 | int |
| 878 | attribute_compat_text_section |
| 879 | __nldbl___isoc99_vsscanf (const char *s, const char *fmt, va_list ap) |
| 880 | { |
| 881 | _IO_strfile sf; |
| 882 | FILE *f = _IO_strfile_read (sf: &sf, string: s); |
| 883 | |
| 884 | return __vfscanf_internal (fp: f, format: fmt, argp: ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A); |
| 885 | } |
| 886 | libc_hidden_def (__nldbl___isoc99_vsscanf) |
| 887 | |
| 888 | int |
| 889 | attribute_compat_text_section |
| 890 | __nldbl___isoc99_vscanf (const char *fmt, va_list ap) |
| 891 | { |
| 892 | return __vfscanf_internal (stdin, format: fmt, argp: ap, |
| 893 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A); |
| 894 | } |
| 895 | |
| 896 | int |
| 897 | attribute_compat_text_section |
| 898 | __nldbl___isoc99_fscanf (FILE *s, const char *fmt, ...) |
| 899 | { |
| 900 | va_list ap; |
| 901 | int ret; |
| 902 | |
| 903 | va_start (ap, fmt); |
| 904 | ret = __vfscanf_internal (fp: s, format: fmt, argp: ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A); |
| 905 | va_end (ap); |
| 906 | |
| 907 | return ret; |
| 908 | } |
| 909 | |
| 910 | int |
| 911 | attribute_compat_text_section |
| 912 | __nldbl___isoc99_scanf (const char *fmt, ...) |
| 913 | { |
| 914 | va_list ap; |
| 915 | int ret; |
| 916 | |
| 917 | va_start (ap, fmt); |
| 918 | ret = __vfscanf_internal (stdin, format: fmt, argp: ap, |
| 919 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A); |
| 920 | va_end (ap); |
| 921 | |
| 922 | return ret; |
| 923 | } |
| 924 | |
| 925 | int |
| 926 | attribute_compat_text_section |
| 927 | __nldbl___isoc99_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap) |
| 928 | { |
| 929 | return __vfwscanf_internal (fp: s, format: fmt, argp: ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A); |
| 930 | } |
| 931 | libc_hidden_def (__nldbl___isoc99_vfwscanf) |
| 932 | |
| 933 | int |
| 934 | attribute_compat_text_section |
| 935 | __nldbl___isoc99_swscanf (const wchar_t *s, const wchar_t *fmt, ...) |
| 936 | { |
| 937 | _IO_strfile sf; |
| 938 | struct _IO_wide_data wd; |
| 939 | FILE *f = _IO_strfile_readw (sf: &sf, wd: &wd, string: s); |
| 940 | va_list ap; |
| 941 | int ret; |
| 942 | |
| 943 | va_start (ap, fmt); |
| 944 | ret = __vfwscanf_internal (fp: f, format: fmt, argp: ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A); |
| 945 | va_end (ap); |
| 946 | |
| 947 | return ret; |
| 948 | } |
| 949 | |
| 950 | int |
| 951 | attribute_compat_text_section |
| 952 | __nldbl___isoc99_vswscanf (const wchar_t *s, const wchar_t *fmt, va_list ap) |
| 953 | { |
| 954 | _IO_strfile sf; |
| 955 | struct _IO_wide_data wd; |
| 956 | FILE *f = _IO_strfile_readw (sf: &sf, wd: &wd, string: s); |
| 957 | |
| 958 | return __vfwscanf_internal (fp: f, format: fmt, argp: ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A); |
| 959 | } |
| 960 | libc_hidden_def (__nldbl___isoc99_vswscanf) |
| 961 | |
| 962 | int |
| 963 | attribute_compat_text_section |
| 964 | __nldbl___isoc99_vwscanf (const wchar_t *fmt, va_list ap) |
| 965 | { |
| 966 | return __vfwscanf_internal (stdin, format: fmt, argp: ap, |
| 967 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A); |
| 968 | } |
| 969 | |
| 970 | int |
| 971 | attribute_compat_text_section |
| 972 | __nldbl___isoc99_fwscanf (FILE *s, const wchar_t *fmt, ...) |
| 973 | { |
| 974 | va_list ap; |
| 975 | int ret; |
| 976 | |
| 977 | va_start (ap, fmt); |
| 978 | ret = __vfwscanf_internal (fp: s, format: fmt, argp: ap, SCANF_LDBL_IS_DBL | SCANF_ISOC99_A); |
| 979 | va_end (ap); |
| 980 | |
| 981 | return ret; |
| 982 | } |
| 983 | |
| 984 | int |
| 985 | attribute_compat_text_section |
| 986 | __nldbl___isoc99_wscanf (const wchar_t *fmt, ...) |
| 987 | { |
| 988 | va_list ap; |
| 989 | int ret; |
| 990 | |
| 991 | va_start (ap, fmt); |
| 992 | ret = __vfwscanf_internal (stdin, format: fmt, argp: ap, |
| 993 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A); |
| 994 | va_end (ap); |
| 995 | |
| 996 | return ret; |
| 997 | } |
| 998 | |
| 999 | int |
| 1000 | attribute_compat_text_section |
| 1001 | __nldbl___isoc23_vfscanf (FILE *s, const char *fmt, va_list ap) |
| 1002 | { |
| 1003 | return __vfscanf_internal (fp: s, format: fmt, argp: ap, |
| 1004 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A |
| 1005 | | SCANF_ISOC23_BIN_CST); |
| 1006 | } |
| 1007 | libc_hidden_def (__nldbl___isoc23_vfscanf) |
| 1008 | |
| 1009 | int |
| 1010 | attribute_compat_text_section |
| 1011 | __nldbl___isoc23_sscanf (const char *s, const char *fmt, ...) |
| 1012 | { |
| 1013 | _IO_strfile sf; |
| 1014 | FILE *f = _IO_strfile_read (sf: &sf, string: s); |
| 1015 | va_list ap; |
| 1016 | int ret; |
| 1017 | |
| 1018 | va_start (ap, fmt); |
| 1019 | ret = __vfscanf_internal (fp: f, format: fmt, argp: ap, |
| 1020 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A |
| 1021 | | SCANF_ISOC23_BIN_CST); |
| 1022 | va_end (ap); |
| 1023 | |
| 1024 | return ret; |
| 1025 | } |
| 1026 | |
| 1027 | int |
| 1028 | attribute_compat_text_section |
| 1029 | __nldbl___isoc23_vsscanf (const char *s, const char *fmt, va_list ap) |
| 1030 | { |
| 1031 | _IO_strfile sf; |
| 1032 | FILE *f = _IO_strfile_read (sf: &sf, string: s); |
| 1033 | |
| 1034 | return __vfscanf_internal (fp: f, format: fmt, argp: ap, |
| 1035 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A |
| 1036 | | SCANF_ISOC23_BIN_CST); |
| 1037 | } |
| 1038 | libc_hidden_def (__nldbl___isoc23_vsscanf) |
| 1039 | |
| 1040 | int |
| 1041 | attribute_compat_text_section |
| 1042 | __nldbl___isoc23_vscanf (const char *fmt, va_list ap) |
| 1043 | { |
| 1044 | return __vfscanf_internal (stdin, format: fmt, argp: ap, |
| 1045 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A |
| 1046 | | SCANF_ISOC23_BIN_CST); |
| 1047 | } |
| 1048 | |
| 1049 | int |
| 1050 | attribute_compat_text_section |
| 1051 | __nldbl___isoc23_fscanf (FILE *s, const char *fmt, ...) |
| 1052 | { |
| 1053 | va_list ap; |
| 1054 | int ret; |
| 1055 | |
| 1056 | va_start (ap, fmt); |
| 1057 | ret = __vfscanf_internal (fp: s, format: fmt, argp: ap, |
| 1058 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A |
| 1059 | | SCANF_ISOC23_BIN_CST); |
| 1060 | va_end (ap); |
| 1061 | |
| 1062 | return ret; |
| 1063 | } |
| 1064 | |
| 1065 | int |
| 1066 | attribute_compat_text_section |
| 1067 | __nldbl___isoc23_scanf (const char *fmt, ...) |
| 1068 | { |
| 1069 | va_list ap; |
| 1070 | int ret; |
| 1071 | |
| 1072 | va_start (ap, fmt); |
| 1073 | ret = __vfscanf_internal (stdin, format: fmt, argp: ap, |
| 1074 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A |
| 1075 | | SCANF_ISOC23_BIN_CST); |
| 1076 | va_end (ap); |
| 1077 | |
| 1078 | return ret; |
| 1079 | } |
| 1080 | |
| 1081 | int |
| 1082 | attribute_compat_text_section |
| 1083 | __nldbl___isoc23_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap) |
| 1084 | { |
| 1085 | return __vfwscanf_internal (fp: s, format: fmt, argp: ap, |
| 1086 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A |
| 1087 | | SCANF_ISOC23_BIN_CST); |
| 1088 | } |
| 1089 | libc_hidden_def (__nldbl___isoc23_vfwscanf) |
| 1090 | |
| 1091 | int |
| 1092 | attribute_compat_text_section |
| 1093 | __nldbl___isoc23_swscanf (const wchar_t *s, const wchar_t *fmt, ...) |
| 1094 | { |
| 1095 | _IO_strfile sf; |
| 1096 | struct _IO_wide_data wd; |
| 1097 | FILE *f = _IO_strfile_readw (sf: &sf, wd: &wd, string: s); |
| 1098 | va_list ap; |
| 1099 | int ret; |
| 1100 | |
| 1101 | va_start (ap, fmt); |
| 1102 | ret = __vfwscanf_internal (fp: f, format: fmt, argp: ap, |
| 1103 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A |
| 1104 | | SCANF_ISOC23_BIN_CST); |
| 1105 | va_end (ap); |
| 1106 | |
| 1107 | return ret; |
| 1108 | } |
| 1109 | |
| 1110 | int |
| 1111 | attribute_compat_text_section |
| 1112 | __nldbl___isoc23_vswscanf (const wchar_t *s, const wchar_t *fmt, va_list ap) |
| 1113 | { |
| 1114 | _IO_strfile sf; |
| 1115 | struct _IO_wide_data wd; |
| 1116 | FILE *f = _IO_strfile_readw (sf: &sf, wd: &wd, string: s); |
| 1117 | |
| 1118 | return __vfwscanf_internal (fp: f, format: fmt, argp: ap, |
| 1119 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A |
| 1120 | | SCANF_ISOC23_BIN_CST); |
| 1121 | } |
| 1122 | libc_hidden_def (__nldbl___isoc23_vswscanf) |
| 1123 | |
| 1124 | int |
| 1125 | attribute_compat_text_section |
| 1126 | __nldbl___isoc23_vwscanf (const wchar_t *fmt, va_list ap) |
| 1127 | { |
| 1128 | return __vfwscanf_internal (stdin, format: fmt, argp: ap, |
| 1129 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A |
| 1130 | | SCANF_ISOC23_BIN_CST); |
| 1131 | } |
| 1132 | |
| 1133 | int |
| 1134 | attribute_compat_text_section |
| 1135 | __nldbl___isoc23_fwscanf (FILE *s, const wchar_t *fmt, ...) |
| 1136 | { |
| 1137 | va_list ap; |
| 1138 | int ret; |
| 1139 | |
| 1140 | va_start (ap, fmt); |
| 1141 | ret = __vfwscanf_internal (fp: s, format: fmt, argp: ap, |
| 1142 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A |
| 1143 | | SCANF_ISOC23_BIN_CST); |
| 1144 | va_end (ap); |
| 1145 | |
| 1146 | return ret; |
| 1147 | } |
| 1148 | |
| 1149 | int |
| 1150 | attribute_compat_text_section |
| 1151 | __nldbl___isoc23_wscanf (const wchar_t *fmt, ...) |
| 1152 | { |
| 1153 | va_list ap; |
| 1154 | int ret; |
| 1155 | |
| 1156 | va_start (ap, fmt); |
| 1157 | ret = __vfwscanf_internal (stdin, format: fmt, argp: ap, |
| 1158 | SCANF_LDBL_IS_DBL | SCANF_ISOC99_A |
| 1159 | | SCANF_ISOC23_BIN_CST); |
| 1160 | va_end (ap); |
| 1161 | |
| 1162 | return ret; |
| 1163 | } |
| 1164 | |
| 1165 | void |
| 1166 | __nldbl_argp_error (const struct argp_state *state, const char *fmt, ...) |
| 1167 | { |
| 1168 | va_list ap; |
| 1169 | va_start (ap, fmt); |
| 1170 | __argp_error_internal (state, fmt, ap, PRINTF_LDBL_IS_DBL); |
| 1171 | va_end (ap); |
| 1172 | } |
| 1173 | |
| 1174 | void |
| 1175 | __nldbl_argp_failure (const struct argp_state *state, int status, |
| 1176 | int errnum, const char *fmt, ...) |
| 1177 | { |
| 1178 | va_list ap; |
| 1179 | va_start (ap, fmt); |
| 1180 | __argp_failure_internal (state, status, errnum, fmt, ap, |
| 1181 | PRINTF_LDBL_IS_DBL); |
| 1182 | va_end (ap); |
| 1183 | } |
| 1184 | |
| 1185 | #define VA_CALL(call) \ |
| 1186 | { \ |
| 1187 | va_list ap; \ |
| 1188 | va_start (ap, format); \ |
| 1189 | call (format, ap, PRINTF_LDBL_IS_DBL); \ |
| 1190 | va_end (ap); \ |
| 1191 | } |
| 1192 | |
| 1193 | void |
| 1194 | __nldbl_err (int status, const char *format, ...) |
| 1195 | { |
| 1196 | VA_CALL (__vwarn_internal) |
| 1197 | exit (status: status); |
| 1198 | } |
| 1199 | |
| 1200 | void |
| 1201 | __nldbl_errx (int status, const char *format, ...) |
| 1202 | { |
| 1203 | VA_CALL (__vwarnx_internal) |
| 1204 | exit (status: status); |
| 1205 | } |
| 1206 | |
| 1207 | void |
| 1208 | __nldbl_verr (int status, const char *format, __gnuc_va_list ap) |
| 1209 | { |
| 1210 | __vwarn_internal (format, ap, PRINTF_LDBL_IS_DBL); |
| 1211 | exit (status: status); |
| 1212 | } |
| 1213 | |
| 1214 | void |
| 1215 | __nldbl_verrx (int status, const char *format, __gnuc_va_list ap) |
| 1216 | { |
| 1217 | __vwarnx_internal (format, ap, PRINTF_LDBL_IS_DBL); |
| 1218 | exit (status: status); |
| 1219 | } |
| 1220 | |
| 1221 | void |
| 1222 | __nldbl_warn (const char *format, ...) |
| 1223 | { |
| 1224 | VA_CALL (__vwarn_internal) |
| 1225 | } |
| 1226 | |
| 1227 | void |
| 1228 | __nldbl_warnx (const char *format, ...) |
| 1229 | { |
| 1230 | VA_CALL (__vwarnx_internal) |
| 1231 | } |
| 1232 | |
| 1233 | void |
| 1234 | __nldbl_vwarn (const char *format, __gnuc_va_list ap) |
| 1235 | { |
| 1236 | __vwarn_internal (format, ap, PRINTF_LDBL_IS_DBL); |
| 1237 | } |
| 1238 | |
| 1239 | void |
| 1240 | __nldbl_vwarnx (const char *format, __gnuc_va_list ap) |
| 1241 | { |
| 1242 | __vwarnx_internal (format, ap, PRINTF_LDBL_IS_DBL); |
| 1243 | } |
| 1244 | |
| 1245 | void |
| 1246 | __nldbl_error (int status, int errnum, const char *message, ...) |
| 1247 | { |
| 1248 | va_list ap; |
| 1249 | va_start (ap, message); |
| 1250 | __error_internal (status, errnum, message, args: ap, PRINTF_LDBL_IS_DBL); |
| 1251 | va_end (ap); |
| 1252 | } |
| 1253 | |
| 1254 | void |
| 1255 | __nldbl_error_at_line (int status, int errnum, const char *file_name, |
| 1256 | unsigned int line_number, const char *message, |
| 1257 | ...) |
| 1258 | { |
| 1259 | va_list ap; |
| 1260 | va_start (ap, message); |
| 1261 | __error_at_line_internal (status, errnum, file_name, line_number, |
| 1262 | message, args: ap, PRINTF_LDBL_IS_DBL); |
| 1263 | va_end (ap); |
| 1264 | } |
| 1265 | |
| 1266 | #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) |
| 1267 | compat_symbol (libc, __nldbl__IO_printf, _IO_printf, GLIBC_2_0); |
| 1268 | compat_symbol (libc, __nldbl__IO_sprintf, _IO_sprintf, GLIBC_2_0); |
| 1269 | compat_symbol (libc, __nldbl__IO_vfprintf, _IO_vfprintf, GLIBC_2_0); |
| 1270 | compat_symbol (libc, __nldbl__IO_vsprintf, _IO_vsprintf, GLIBC_2_0); |
| 1271 | compat_symbol (libc, __nldbl_dprintf, dprintf, GLIBC_2_0); |
| 1272 | compat_symbol (libc, __nldbl_fprintf, fprintf, GLIBC_2_0); |
| 1273 | compat_symbol (libc, __nldbl_printf, printf, GLIBC_2_0); |
| 1274 | compat_symbol (libc, __nldbl_sprintf, sprintf, GLIBC_2_0); |
| 1275 | compat_symbol (libc, __nldbl_vfprintf, vfprintf, GLIBC_2_0); |
| 1276 | compat_symbol (libc, __nldbl_vprintf, vprintf, GLIBC_2_0); |
| 1277 | compat_symbol (libc, __nldbl__IO_fprintf, _IO_fprintf, GLIBC_2_0); |
| 1278 | compat_symbol (libc, __nldbl___vsnprintf, __vsnprintf, GLIBC_2_0); |
| 1279 | compat_symbol (libc, __nldbl_asprintf, asprintf, GLIBC_2_0); |
| 1280 | compat_symbol (libc, __nldbl_obstack_printf, obstack_printf, GLIBC_2_0); |
| 1281 | compat_symbol (libc, __nldbl_obstack_vprintf, obstack_vprintf, GLIBC_2_0); |
| 1282 | compat_symbol (libc, __nldbl_snprintf, snprintf, GLIBC_2_0); |
| 1283 | compat_symbol (libc, __nldbl_vasprintf, vasprintf, GLIBC_2_0); |
| 1284 | compat_symbol (libc, __nldbl_vdprintf, vdprintf, GLIBC_2_0); |
| 1285 | compat_symbol (libc, __nldbl_vsnprintf, vsnprintf, GLIBC_2_0); |
| 1286 | compat_symbol (libc, __nldbl_vsprintf, vsprintf, GLIBC_2_0); |
| 1287 | compat_symbol (libc, __nldbl__IO_sscanf, _IO_sscanf, GLIBC_2_0); |
| 1288 | compat_symbol (libc, __nldbl___vfscanf, __vfscanf, GLIBC_2_0); |
| 1289 | compat_symbol (libc, __nldbl___vsscanf, __vsscanf, GLIBC_2_0); |
| 1290 | compat_symbol (libc, __nldbl_fscanf, fscanf, GLIBC_2_0); |
| 1291 | compat_symbol (libc, __nldbl_scanf, scanf, GLIBC_2_0); |
| 1292 | compat_symbol (libc, __nldbl_sscanf, sscanf, GLIBC_2_0); |
| 1293 | compat_symbol (libc, __nldbl_vfscanf, vfscanf, GLIBC_2_0); |
| 1294 | compat_symbol (libc, __nldbl_vscanf, vscanf, GLIBC_2_0); |
| 1295 | compat_symbol (libc, __nldbl_vsscanf, vsscanf, GLIBC_2_0); |
| 1296 | compat_symbol (libc, __nldbl___printf_fp, __printf_fp, GLIBC_2_0); |
| 1297 | compat_symbol (libc, __nldbl_strfmon, strfmon, GLIBC_2_0); |
| 1298 | compat_symbol (libc, __nldbl_syslog, syslog, GLIBC_2_0); |
| 1299 | compat_symbol (libc, __nldbl_vsyslog, vsyslog, GLIBC_2_0); |
| 1300 | /* This function is not in public headers, but was exported until |
| 1301 | version 2.29. For platforms that are newer than that, there's no |
| 1302 | need to expose the symbol. */ |
| 1303 | # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_29) |
| 1304 | compat_symbol (libc, __nldbl__IO_vfscanf, _IO_vfscanf, GLIBC_2_0); |
| 1305 | # endif |
| 1306 | #endif |
| 1307 | #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_1) |
| 1308 | compat_symbol (libc, __nldbl___asprintf, __asprintf, GLIBC_2_1); |
| 1309 | compat_symbol (libc, __nldbl_printf_size, printf_size, GLIBC_2_1); |
| 1310 | compat_symbol (libc, __nldbl___strfmon_l, __strfmon_l, GLIBC_2_1); |
| 1311 | #endif |
| 1312 | #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_2) |
| 1313 | compat_symbol (libc, __nldbl_swprintf, swprintf, GLIBC_2_2); |
| 1314 | compat_symbol (libc, __nldbl_vwprintf, vwprintf, GLIBC_2_2); |
| 1315 | compat_symbol (libc, __nldbl_wprintf, wprintf, GLIBC_2_2); |
| 1316 | compat_symbol (libc, __nldbl_fwprintf, fwprintf, GLIBC_2_2); |
| 1317 | compat_symbol (libc, __nldbl_vfwprintf, vfwprintf, GLIBC_2_2); |
| 1318 | compat_symbol (libc, __nldbl_vswprintf, vswprintf, GLIBC_2_2); |
| 1319 | compat_symbol (libc, __nldbl_fwscanf, fwscanf, GLIBC_2_2); |
| 1320 | compat_symbol (libc, __nldbl_swscanf, swscanf, GLIBC_2_2); |
| 1321 | compat_symbol (libc, __nldbl_vfwscanf, vfwscanf, GLIBC_2_2); |
| 1322 | compat_symbol (libc, __nldbl_vswscanf, vswscanf, GLIBC_2_2); |
| 1323 | compat_symbol (libc, __nldbl_vwscanf, vwscanf, GLIBC_2_2); |
| 1324 | compat_symbol (libc, __nldbl_wscanf, wscanf, GLIBC_2_2); |
| 1325 | #endif |
| 1326 | #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3) |
| 1327 | compat_symbol (libc, __nldbl_strfmon_l, strfmon_l, GLIBC_2_3); |
| 1328 | #endif |
| 1329 | #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3_4) |
| 1330 | compat_symbol (libc, __nldbl___sprintf_chk, __sprintf_chk, GLIBC_2_3_4); |
| 1331 | compat_symbol (libc, __nldbl___vsprintf_chk, __vsprintf_chk, GLIBC_2_3_4); |
| 1332 | compat_symbol (libc, __nldbl___snprintf_chk, __snprintf_chk, GLIBC_2_3_4); |
| 1333 | compat_symbol (libc, __nldbl___vsnprintf_chk, __vsnprintf_chk, GLIBC_2_3_4); |
| 1334 | compat_symbol (libc, __nldbl___printf_chk, __printf_chk, GLIBC_2_3_4); |
| 1335 | compat_symbol (libc, __nldbl___fprintf_chk, __fprintf_chk, GLIBC_2_3_4); |
| 1336 | compat_symbol (libc, __nldbl___vprintf_chk, __vprintf_chk, GLIBC_2_3_4); |
| 1337 | compat_symbol (libc, __nldbl___vfprintf_chk, __vfprintf_chk, GLIBC_2_3_4); |
| 1338 | #endif |
| 1339 | |