modernc.org/cc@v1.0.1/v2/headers/linux_arm/usr/include/stdio.h (about) 1 /* Define ISO C stdio on top of C++ iostreams. 2 Copyright (C) 1991-2016 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 <http://www.gnu.org/licenses/>. */ 18 19 /* 20 * ISO C99 Standard: 7.19 Input/output <stdio.h> 21 */ 22 23 #ifndef _STDIO_H 24 25 #if !defined __need_FILE && !defined __need___FILE 26 #define _STDIO_H 1 27 #include <features.h> 28 29 __BEGIN_DECLS 30 #define __need_size_t 31 #define __need_NULL 32 #include <stddef.h> 33 #include <bits/types.h> 34 #define __need_FILE 35 #define __need___FILE 36 #endif /* Don't need FILE. */ 37 #if !defined __FILE_defined && defined __need_FILE 38 /* Define outside of namespace so the C++ is happy. */ 39 struct _IO_FILE; 40 41 __BEGIN_NAMESPACE_STD 42 /* The opaque type of streams. This is the definition used elsewhere. */ 43 typedef struct _IO_FILE FILE; 44 __END_NAMESPACE_STD 45 #if defined __USE_LARGEFILE64 || defined __USE_POSIX \ 46 || defined __USE_ISOC99 || defined __USE_XOPEN \ 47 || defined __USE_POSIX2 48 __USING_NAMESPACE_STD(FILE) 49 #endif 50 #define __FILE_defined 1 51 #endif /* FILE not defined. */ 52 #undef __need_FILE 53 #if !defined ____FILE_defined && defined __need___FILE 54 /* The opaque type of streams. This is the definition used elsewhere. */ 55 typedef struct _IO_FILE __FILE; 56 57 #define ____FILE_defined 1 58 #endif /* __FILE not defined. */ 59 #undef __need___FILE 60 61 #ifdef _STDIO_H 62 #define _STDIO_USES_IOSTREAM 63 64 #include <libio.h> 65 66 #if defined __USE_XOPEN || defined __USE_XOPEN2K8 67 #ifdef __GNUC__ 68 #ifndef _VA_LIST_DEFINED 69 typedef _G_va_list va_list; 70 #define _VA_LIST_DEFINED 71 #endif 72 #else 73 #include <stdarg.h> 74 #endif 75 #endif 76 77 #if defined __USE_UNIX98 || defined __USE_XOPEN2K 78 #ifndef __off_t_defined 79 #ifndef __USE_FILE_OFFSET64 80 typedef __off_t off_t; 81 #else 82 typedef __off64_t off_t; 83 #endif 84 #define __off_t_defined 85 #endif 86 #if defined __USE_LARGEFILE64 && !defined __off64_t_defined 87 typedef __off64_t off64_t; 88 #define __off64_t_defined 89 #endif 90 #endif 91 92 #ifdef __USE_XOPEN2K8 93 #ifndef __ssize_t_defined 94 typedef __ssize_t ssize_t; 95 #define __ssize_t_defined 96 #endif 97 #endif 98 99 /* The type of the second argument to `fgetpos' and `fsetpos'. */ 100 __BEGIN_NAMESPACE_STD 101 #ifndef __USE_FILE_OFFSET64 102 typedef _G_fpos_t fpos_t; 103 #else 104 typedef _G_fpos64_t fpos_t; 105 #endif 106 __END_NAMESPACE_STD 107 #ifdef __USE_LARGEFILE64 108 typedef _G_fpos64_t fpos64_t; 109 #endif 110 111 /* The possibilities for the third argument to `setvbuf'. */ 112 #define _IOFBF 0 /* Fully buffered. */ 113 #define _IOLBF 1 /* Line buffered. */ 114 #define _IONBF 2 /* No buffering. */ 115 116 /* Default buffer size. */ 117 #ifndef BUFSIZ 118 #define BUFSIZ _IO_BUFSIZ 119 #endif 120 121 /* End of file character. 122 Some things throughout the library rely on this being -1. */ 123 #ifndef EOF 124 #define EOF (-1) 125 #endif 126 127 /* The possibilities for the third argument to `fseek'. 128 These values should not be changed. */ 129 #define SEEK_SET 0 /* Seek from beginning of file. */ 130 #define SEEK_CUR 1 /* Seek from current position. */ 131 #define SEEK_END 2 /* Seek from end of file. */ 132 #ifdef __USE_GNU 133 #define SEEK_DATA 3 /* Seek to next data. */ 134 #define SEEK_HOLE 4 /* Seek to next hole. */ 135 #endif 136 137 #if defined __USE_MISC || defined __USE_XOPEN 138 /* Default path prefix for `tempnam' and `tmpnam'. */ 139 #define P_tmpdir "/tmp" 140 #endif 141 142 /* Get the values: 143 L_tmpnam How long an array of chars must be to be passed to `tmpnam'. 144 TMP_MAX The minimum number of unique filenames generated by tmpnam 145 (and tempnam when it uses tmpnam's name space), 146 or tempnam (the two are separate). 147 L_ctermid How long an array to pass to `ctermid'. 148 L_cuserid How long an array to pass to `cuserid'. 149 FOPEN_MAX Minimum number of files that can be open at once. 150 FILENAME_MAX Maximum length of a filename. */ 151 #include <bits/stdio_lim.h> 152 153 /* Standard streams. */ 154 extern struct _IO_FILE *stdin; /* Standard input stream. */ 155 extern struct _IO_FILE *stdout; /* Standard output stream. */ 156 extern struct _IO_FILE *stderr; /* Standard error output stream. */ 157 /* C89/C99 say they're macros. Make them happy. */ 158 #define stdin stdin 159 #define stdout stdout 160 #define stderr stderr 161 162 __BEGIN_NAMESPACE_STD 163 /* Remove file FILENAME. */ 164 extern int remove(const char *__filename) __THROW; 165 /* Rename file OLD to NEW. */ 166 extern int rename(const char *__old, const char *__new) __THROW; 167 __END_NAMESPACE_STD 168 #ifdef __USE_ATFILE 169 /* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */ 170 extern int renameat(int __oldfd, const char *__old, int __newfd, const char *__new) __THROW; 171 #endif 172 173 __BEGIN_NAMESPACE_STD 174 /* Create a temporary file and open it read/write. 175 176 This function is a possible cancellation point and therefore not 177 marked with __THROW. */ 178 #ifndef __USE_FILE_OFFSET64 179 extern FILE *tmpfile(void) __wur; 180 #else 181 #ifdef __REDIRECT 182 extern FILE *__REDIRECT(tmpfile, (void), tmpfile64) __wur; 183 #else 184 #define tmpfile tmpfile64 185 #endif 186 #endif 187 #ifdef __USE_LARGEFILE64 188 extern FILE *tmpfile64(void) __wur; 189 #endif 190 191 /* Generate a temporary filename. */ 192 extern char *tmpnam(char *__s) 193 __THROW __wur; 194 __END_NAMESPACE_STD 195 #ifdef __USE_MISC 196 /* This is the reentrant variant of `tmpnam'. The only difference is 197 that it does not allow S to be NULL. */ 198 extern char *tmpnam_r(char *__s) 199 __THROW __wur; 200 #endif 201 202 #if defined __USE_MISC || defined __USE_XOPEN 203 /* Generate a unique temporary filename using up to five characters of PFX 204 if it is not NULL. The directory to put this file in is searched for 205 as follows: First the environment variable "TMPDIR" is checked. 206 If it contains the name of a writable directory, that directory is used. 207 If not and if DIR is not NULL, that value is checked. If that fails, 208 P_tmpdir is tried and finally "/tmp". The storage for the filename 209 is allocated by `malloc'. */ 210 extern char *tempnam(const char *__dir, const char *__pfx) 211 __THROW __attribute_malloc__ __wur; 212 #endif 213 214 __BEGIN_NAMESPACE_STD 215 /* Close STREAM. 216 217 This function is a possible cancellation point and therefore not 218 marked with __THROW. */ 219 extern int fclose(FILE * __stream); 220 /* Flush STREAM, or all streams if STREAM is NULL. 221 222 This function is a possible cancellation point and therefore not 223 marked with __THROW. */ 224 extern int fflush(FILE * __stream); 225 __END_NAMESPACE_STD 226 #ifdef __USE_MISC 227 /* Faster versions when locking is not required. 228 229 This function is not part of POSIX and therefore no official 230 cancellation point. But due to similarity with an POSIX interface 231 or due to the implementation it is a cancellation point and 232 therefore not marked with __THROW. */ 233 extern int fflush_unlocked(FILE * __stream); 234 #endif 235 236 #ifdef __USE_GNU 237 /* Close all streams. 238 239 This function is not part of POSIX and therefore no official 240 cancellation point. But due to similarity with an POSIX interface 241 or due to the implementation it is a cancellation point and 242 therefore not marked with __THROW. */ 243 extern int fcloseall(void); 244 #endif 245 246 __BEGIN_NAMESPACE_STD 247 #ifndef __USE_FILE_OFFSET64 248 /* Open a file and create a new stream for it. 249 250 This function is a possible cancellation point and therefore not 251 marked with __THROW. */ 252 extern FILE *fopen(const char *__restrict __filename, const char *__restrict __modes) __wur; 253 /* Open a file, replacing an existing stream with it. 254 255 This function is a possible cancellation point and therefore not 256 marked with __THROW. */ 257 extern FILE *freopen(const char *__restrict __filename, const char *__restrict __modes, FILE * __restrict __stream) __wur; 258 #else 259 #ifdef __REDIRECT 260 extern FILE *__REDIRECT(fopen, (const char *__restrict __filename, const char *__restrict __modes), fopen64) __wur; 261 extern FILE *__REDIRECT(freopen, (const char *__restrict __filename, const char *__restrict __modes, FILE * __restrict __stream), freopen64) __wur; 262 #else 263 #define fopen fopen64 264 #define freopen freopen64 265 #endif 266 #endif 267 __END_NAMESPACE_STD 268 #ifdef __USE_LARGEFILE64 269 extern FILE *fopen64(const char *__restrict __filename, const char *__restrict __modes) __wur; 270 extern FILE *freopen64(const char *__restrict __filename, const char *__restrict __modes, FILE * __restrict __stream) __wur; 271 #endif 272 273 #ifdef __USE_POSIX 274 /* Create a new stream that refers to an existing system file descriptor. */ 275 extern FILE *fdopen(int __fd, const char *__modes) 276 __THROW __wur; 277 #endif 278 279 #ifdef __USE_GNU 280 /* Create a new stream that refers to the given magic cookie, 281 and uses the given functions for input and output. */ 282 extern FILE *fopencookie(void *__restrict __magic_cookie, const char *__restrict __modes, _IO_cookie_io_functions_t __io_funcs) 283 __THROW __wur; 284 #endif 285 286 #ifdef __USE_XOPEN2K8 287 /* Create a new stream that refers to a memory buffer. */ 288 extern FILE *fmemopen(void *__s, size_t __len, const char *__modes) 289 __THROW __wur; 290 291 /* Open a stream that writes into a malloc'd buffer that is expanded as 292 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location 293 and the number of characters written on fflush or fclose. */ 294 extern FILE *open_memstream(char **__bufloc, size_t * __sizeloc) 295 __THROW __wur; 296 #endif 297 298 __BEGIN_NAMESPACE_STD 299 /* If BUF is NULL, make STREAM unbuffered. 300 Else make it use buffer BUF, of size BUFSIZ. */ 301 extern void setbuf(FILE * __restrict __stream, char *__restrict __buf) __THROW; 302 /* Make STREAM use buffering mode MODE. 303 If BUF is not NULL, use N bytes of it for buffering; 304 else allocate an internal buffer N bytes long. */ 305 extern int setvbuf(FILE * __restrict __stream, char *__restrict __buf, int __modes, size_t __n) __THROW; 306 __END_NAMESPACE_STD 307 #ifdef __USE_MISC 308 /* If BUF is NULL, make STREAM unbuffered. 309 Else make it use SIZE bytes of BUF for buffering. */ 310 extern void setbuffer(FILE * __restrict __stream, char *__restrict __buf, size_t __size) __THROW; 311 312 /* Make STREAM line-buffered. */ 313 extern void setlinebuf(FILE * __stream) __THROW; 314 #endif 315 316 __BEGIN_NAMESPACE_STD 317 /* Write formatted output to STREAM. 318 319 This function is a possible cancellation point and therefore not 320 marked with __THROW. */ 321 extern int fprintf(FILE * __restrict __stream, const char *__restrict __format, ...); 322 /* Write formatted output to stdout. 323 324 This function is a possible cancellation point and therefore not 325 marked with __THROW. */ 326 extern int printf(const char *__restrict __format, ...); 327 /* Write formatted output to S. */ 328 extern int sprintf(char *__restrict __s, const char *__restrict __format, ...) __THROWNL; 329 330 /* Write formatted output to S from argument list ARG. 331 332 This function is a possible cancellation point and therefore not 333 marked with __THROW. */ 334 extern int vfprintf(FILE * __restrict __s, const char *__restrict __format, _G_va_list __arg); 335 /* Write formatted output to stdout from argument list ARG. 336 337 This function is a possible cancellation point and therefore not 338 marked with __THROW. */ 339 extern int vprintf(const char *__restrict __format, _G_va_list __arg); 340 /* Write formatted output to S from argument list ARG. */ 341 extern int vsprintf(char *__restrict __s, const char *__restrict __format, _G_va_list __arg) __THROWNL; 342 __END_NAMESPACE_STD 343 #if defined __USE_ISOC99 || defined __USE_UNIX98 344 __BEGIN_NAMESPACE_C99 345 /* Maximum chars of output to write in MAXLEN. */ 346 extern int snprintf(char *__restrict __s, size_t __maxlen, const char *__restrict __format, ...) 347 __THROWNL __attribute__ ((__format__(__printf__, 3, 4))); 348 349 extern int vsnprintf(char *__restrict __s, size_t __maxlen, const char *__restrict __format, _G_va_list __arg) 350 __THROWNL __attribute__ ((__format__(__printf__, 3, 0))); 351 __END_NAMESPACE_C99 352 #endif 353 #ifdef __USE_GNU 354 /* Write formatted output to a string dynamically allocated with `malloc'. 355 Store the address of the string in *PTR. */ 356 extern int vasprintf(char **__restrict __ptr, const char *__restrict __f, _G_va_list __arg) 357 __THROWNL __attribute__ ((__format__(__printf__, 2, 0))) __wur; 358 extern int __asprintf(char **__restrict __ptr, const char *__restrict __fmt, ...) 359 __THROWNL __attribute__ ((__format__(__printf__, 2, 3))) __wur; 360 extern int asprintf(char **__restrict __ptr, const char *__restrict __fmt, ...) 361 __THROWNL __attribute__ ((__format__(__printf__, 2, 3))) __wur; 362 #endif 363 364 #ifdef __USE_XOPEN2K8 365 /* Write formatted output to a file descriptor. */ 366 extern int vdprintf(int __fd, const char *__restrict __fmt, _G_va_list __arg) 367 __attribute__ ((__format__(__printf__, 2, 0))); 368 extern int dprintf(int __fd, const char *__restrict __fmt, ...) 369 __attribute__ ((__format__(__printf__, 2, 3))); 370 #endif 371 372 __BEGIN_NAMESPACE_STD 373 /* Read formatted input from STREAM. 374 375 This function is a possible cancellation point and therefore not 376 marked with __THROW. */ 377 extern int fscanf(FILE * __restrict __stream, const char *__restrict __format, ...) __wur; 378 /* Read formatted input from stdin. 379 380 This function is a possible cancellation point and therefore not 381 marked with __THROW. */ 382 extern int scanf(const char *__restrict __format, ...) __wur; 383 /* Read formatted input from S. */ 384 extern int sscanf(const char *__restrict __s, const char *__restrict __format, ...) __THROW; 385 386 #if defined __USE_ISOC99 && !defined __USE_GNU \ 387 && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ 388 && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) 389 #ifdef __REDIRECT 390 /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[ 391 GNU extension which conflicts with valid %a followed by letter 392 s, S or [. */ 393 extern int __REDIRECT(fscanf, (FILE * __restrict __stream, const char *__restrict __format, ...), __isoc99_fscanf) __wur; 394 extern int __REDIRECT(scanf, (const char *__restrict __format, ...), __isoc99_scanf) __wur; 395 extern int __REDIRECT_NTH(sscanf, (const char *__restrict __s, const char *__restrict __format, ...), __isoc99_sscanf); 396 #else 397 extern int __isoc99_fscanf(FILE * __restrict __stream, const char *__restrict __format, ...) __wur; 398 extern int __isoc99_scanf(const char *__restrict __format, ...) __wur; 399 extern int __isoc99_sscanf(const char *__restrict __s, const char *__restrict __format, ...) __THROW; 400 #define fscanf __isoc99_fscanf 401 #define scanf __isoc99_scanf 402 #define sscanf __isoc99_sscanf 403 #endif 404 #endif 405 406 __END_NAMESPACE_STD 407 #ifdef __USE_ISOC99 408 __BEGIN_NAMESPACE_C99 409 /* Read formatted input from S into argument list ARG. 410 411 This function is a possible cancellation point and therefore not 412 marked with __THROW. */ 413 extern int vfscanf(FILE * __restrict __s, const char *__restrict __format, _G_va_list __arg) 414 __attribute__ ((__format__(__scanf__, 2, 0))) __wur; 415 416 /* Read formatted input from stdin into argument list ARG. 417 418 This function is a possible cancellation point and therefore not 419 marked with __THROW. */ 420 extern int vscanf(const char *__restrict __format, _G_va_list __arg) 421 __attribute__ ((__format__(__scanf__, 1, 0))) __wur; 422 423 /* Read formatted input from S into argument list ARG. */ 424 extern int vsscanf(const char *__restrict __s, const char *__restrict __format, _G_va_list __arg) 425 __THROW __attribute__ ((__format__(__scanf__, 2, 0))); 426 427 #if !defined __USE_GNU \ 428 && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ 429 && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) 430 #ifdef __REDIRECT 431 /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[ 432 GNU extension which conflicts with valid %a followed by letter 433 s, S or [. */ 434 extern int __REDIRECT(vfscanf, (FILE * __restrict __s, const char *__restrict __format, _G_va_list __arg), __isoc99_vfscanf) 435 __attribute__ ((__format__(__scanf__, 2, 0))) __wur; 436 extern int __REDIRECT(vscanf, (const char *__restrict __format, _G_va_list __arg), __isoc99_vscanf) 437 __attribute__ ((__format__(__scanf__, 1, 0))) __wur; 438 extern int __REDIRECT_NTH(vsscanf, (const char *__restrict __s, const char *__restrict __format, _G_va_list __arg), __isoc99_vsscanf) 439 __attribute__ ((__format__(__scanf__, 2, 0))); 440 #else 441 extern int __isoc99_vfscanf(FILE * __restrict __s, const char *__restrict __format, _G_va_list __arg) __wur; 442 extern int __isoc99_vscanf(const char *__restrict __format, _G_va_list __arg) __wur; 443 extern int __isoc99_vsscanf(const char *__restrict __s, const char *__restrict __format, _G_va_list __arg) __THROW; 444 #define vfscanf __isoc99_vfscanf 445 #define vscanf __isoc99_vscanf 446 #define vsscanf __isoc99_vsscanf 447 #endif 448 #endif 449 450 __END_NAMESPACE_C99 451 #endif /* Use ISO C9x. */ 452 __BEGIN_NAMESPACE_STD 453 /* Read a character from STREAM. 454 455 These functions are possible cancellation points and therefore not 456 marked with __THROW. */ 457 extern int fgetc(FILE * __stream); 458 extern int getc(FILE * __stream); 459 460 /* Read a character from stdin. 461 462 This function is a possible cancellation point and therefore not 463 marked with __THROW. */ 464 extern int getchar(void); 465 __END_NAMESPACE_STD 466 /* The C standard explicitly says this is a macro, so we always do the 467 optimization for it. */ 468 #define getc(_fp) _IO_getc (_fp) 469 #ifdef __USE_POSIX199506 470 /* These are defined in POSIX.1:1996. 471 472 These functions are possible cancellation points and therefore not 473 marked with __THROW. */ 474 extern int getc_unlocked(FILE * __stream); 475 extern int getchar_unlocked(void); 476 #endif /* Use POSIX. */ 477 478 #ifdef __USE_MISC 479 /* Faster version when locking is not necessary. 480 481 This function is not part of POSIX and therefore no official 482 cancellation point. But due to similarity with an POSIX interface 483 or due to the implementation it is a cancellation point and 484 therefore not marked with __THROW. */ 485 extern int fgetc_unlocked(FILE * __stream); 486 #endif /* Use MISC. */ 487 488 __BEGIN_NAMESPACE_STD 489 /* Write a character to STREAM. 490 491 These functions are possible cancellation points and therefore not 492 marked with __THROW. 493 494 These functions is a possible cancellation point and therefore not 495 marked with __THROW. */ 496 extern int fputc(int __c, FILE * __stream); 497 extern int putc(int __c, FILE * __stream); 498 499 /* Write a character to stdout. 500 501 This function is a possible cancellation point and therefore not 502 marked with __THROW. */ 503 extern int putchar(int __c); 504 __END_NAMESPACE_STD 505 /* The C standard explicitly says this can be a macro, 506 so we always do the optimization for it. */ 507 #define putc(_ch, _fp) _IO_putc (_ch, _fp) 508 #ifdef __USE_MISC 509 /* Faster version when locking is not necessary. 510 511 This function is not part of POSIX and therefore no official 512 cancellation point. But due to similarity with an POSIX interface 513 or due to the implementation it is a cancellation point and 514 therefore not marked with __THROW. */ 515 extern int fputc_unlocked(int __c, FILE * __stream); 516 #endif /* Use MISC. */ 517 518 #ifdef __USE_POSIX199506 519 /* These are defined in POSIX.1:1996. 520 521 These functions are possible cancellation points and therefore not 522 marked with __THROW. */ 523 extern int putc_unlocked(int __c, FILE * __stream); 524 extern int putchar_unlocked(int __c); 525 #endif /* Use POSIX. */ 526 527 #if defined __USE_MISC \ 528 || (defined __USE_XOPEN && !defined __USE_XOPEN2K) 529 /* Get a word (int) from STREAM. */ 530 extern int getw(FILE * __stream); 531 532 /* Write a word (int) to STREAM. */ 533 extern int putw(int __w, FILE * __stream); 534 #endif 535 536 __BEGIN_NAMESPACE_STD 537 /* Get a newline-terminated string of finite length from STREAM. 538 539 This function is a possible cancellation point and therefore not 540 marked with __THROW. */ 541 extern char *fgets(char *__restrict __s, int __n, FILE * __restrict __stream) __wur; 542 543 #if !defined __USE_ISOC11 \ 544 || (defined __cplusplus && __cplusplus <= 201103L) 545 /* Get a newline-terminated string from stdin, removing the newline. 546 DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. 547 548 The function has been officially removed in ISO C11. This opportunity 549 is used to also remove it from the GNU feature list. It is now only 550 available when explicitly using an old ISO C, Unix, or POSIX standard. 551 GCC defines _GNU_SOURCE when building C++ code and the function is still 552 in C++11, so it is also available for C++. 553 554 This function is a possible cancellation point and therefore not 555 marked with __THROW. */ 556 extern char *gets(char *__s) 557 __wur __attribute_deprecated__; 558 #endif 559 __END_NAMESPACE_STD 560 #ifdef __USE_GNU 561 /* This function does the same as `fgets' but does not lock the stream. 562 563 This function is not part of POSIX and therefore no official 564 cancellation point. But due to similarity with an POSIX interface 565 or due to the implementation it is a cancellation point and 566 therefore not marked with __THROW. */ 567 extern char *fgets_unlocked(char *__restrict __s, int __n, FILE * __restrict __stream) __wur; 568 #endif 569 570 #ifdef __USE_XOPEN2K8 571 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR 572 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or 573 NULL), pointing to *N characters of space. It is realloc'd as 574 necessary. Returns the number of characters read (not including the 575 null terminator), or -1 on error or EOF. 576 577 These functions are not part of POSIX and therefore no official 578 cancellation point. But due to similarity with an POSIX interface 579 or due to the implementation they are cancellation points and 580 therefore not marked with __THROW. */ 581 extern _IO_ssize_t __getdelim(char **__restrict __lineptr, size_t * __restrict __n, int __delimiter, FILE * __restrict __stream) __wur; 582 extern _IO_ssize_t getdelim(char **__restrict __lineptr, size_t * __restrict __n, int __delimiter, FILE * __restrict __stream) __wur; 583 584 /* Like `getdelim', but reads up to a newline. 585 586 This function is not part of POSIX and therefore no official 587 cancellation point. But due to similarity with an POSIX interface 588 or due to the implementation it is a cancellation point and 589 therefore not marked with __THROW. */ 590 extern _IO_ssize_t getline(char **__restrict __lineptr, size_t * __restrict __n, FILE * __restrict __stream) __wur; 591 #endif 592 593 __BEGIN_NAMESPACE_STD 594 /* Write a string to STREAM. 595 596 This function is a possible cancellation point and therefore not 597 marked with __THROW. */ 598 extern int fputs(const char *__restrict __s, FILE * __restrict __stream); 599 600 /* Write a string, followed by a newline, to stdout. 601 602 This function is a possible cancellation point and therefore not 603 marked with __THROW. */ 604 extern int puts(const char *__s); 605 606 /* Push a character back onto the input buffer of STREAM. 607 608 This function is a possible cancellation point and therefore not 609 marked with __THROW. */ 610 extern int ungetc(int __c, FILE * __stream); 611 612 /* Read chunks of generic data from STREAM. 613 614 This function is a possible cancellation point and therefore not 615 marked with __THROW. */ 616 extern size_t fread(void *__restrict __ptr, size_t __size, size_t __n, FILE * __restrict __stream) __wur; 617 /* Write chunks of generic data to STREAM. 618 619 This function is a possible cancellation point and therefore not 620 marked with __THROW. */ 621 extern size_t fwrite(const void *__restrict __ptr, size_t __size, size_t __n, FILE * __restrict __s); 622 __END_NAMESPACE_STD 623 #ifdef __USE_GNU 624 /* This function does the same as `fputs' but does not lock the stream. 625 626 This function is not part of POSIX and therefore no official 627 cancellation point. But due to similarity with an POSIX interface 628 or due to the implementation it is a cancellation point and 629 therefore not marked with __THROW. */ 630 extern int fputs_unlocked(const char *__restrict __s, FILE * __restrict __stream); 631 #endif 632 633 #ifdef __USE_MISC 634 /* Faster versions when locking is not necessary. 635 636 These functions are not part of POSIX and therefore no official 637 cancellation point. But due to similarity with an POSIX interface 638 or due to the implementation they are cancellation points and 639 therefore not marked with __THROW. */ 640 extern size_t fread_unlocked(void *__restrict __ptr, size_t __size, size_t __n, FILE * __restrict __stream) __wur; 641 extern size_t fwrite_unlocked(const void *__restrict __ptr, size_t __size, size_t __n, FILE * __restrict __stream); 642 #endif 643 644 __BEGIN_NAMESPACE_STD 645 /* Seek to a certain position on STREAM. 646 647 This function is a possible cancellation point and therefore not 648 marked with __THROW. */ 649 extern int fseek(FILE * __stream, long int __off, int __whence); 650 /* Return the current position of STREAM. 651 652 This function is a possible cancellation point and therefore not 653 marked with __THROW. */ 654 extern long int ftell(FILE * __stream) __wur; 655 /* Rewind to the beginning of STREAM. 656 657 This function is a possible cancellation point and therefore not 658 marked with __THROW. */ 659 extern void rewind(FILE * __stream); 660 __END_NAMESPACE_STD 661 /* The Single Unix Specification, Version 2, specifies an alternative, 662 more adequate interface for the two functions above which deal with 663 file offset. `long int' is not the right type. These definitions 664 are originally defined in the Large File Support API. */ 665 #if defined __USE_LARGEFILE || defined __USE_XOPEN2K 666 #ifndef __USE_FILE_OFFSET64 667 /* Seek to a certain position on STREAM. 668 669 This function is a possible cancellation point and therefore not 670 marked with __THROW. */ 671 extern int fseeko(FILE * __stream, __off_t __off, int __whence); 672 /* Return the current position of STREAM. 673 674 This function is a possible cancellation point and therefore not 675 marked with __THROW. */ 676 extern __off_t ftello(FILE * __stream) __wur; 677 #else 678 #ifdef __REDIRECT 679 extern int __REDIRECT(fseeko, (FILE * __stream, __off64_t __off, int __whence), fseeko64); 680 extern __off64_t __REDIRECT(ftello, (FILE * __stream), ftello64); 681 #else 682 #define fseeko fseeko64 683 #define ftello ftello64 684 #endif 685 #endif 686 #endif 687 __BEGIN_NAMESPACE_STD 688 #ifndef __USE_FILE_OFFSET64 689 /* Get STREAM's position. 690 691 This function is a possible cancellation point and therefore not 692 marked with __THROW. */ 693 extern int fgetpos(FILE * __restrict __stream, fpos_t * __restrict __pos); 694 /* Set STREAM's position. 695 696 This function is a possible cancellation point and therefore not 697 marked with __THROW. */ 698 extern int fsetpos(FILE * __stream, const fpos_t * __pos); 699 #else 700 #ifdef __REDIRECT 701 extern int __REDIRECT(fgetpos, (FILE * __restrict __stream, fpos_t * __restrict __pos), fgetpos64); 702 extern int __REDIRECT(fsetpos, (FILE * __stream, const fpos_t * __pos), fsetpos64); 703 #else 704 #define fgetpos fgetpos64 705 #define fsetpos fsetpos64 706 #endif 707 #endif 708 __END_NAMESPACE_STD 709 #ifdef __USE_LARGEFILE64 710 extern int fseeko64(FILE * __stream, __off64_t __off, int __whence); 711 extern __off64_t ftello64(FILE * __stream) __wur; 712 extern int fgetpos64(FILE * __restrict __stream, fpos64_t * __restrict __pos); 713 extern int fsetpos64(FILE * __stream, const fpos64_t * __pos); 714 #endif 715 716 __BEGIN_NAMESPACE_STD 717 /* Clear the error and EOF indicators for STREAM. */ 718 extern void clearerr(FILE * __stream) __THROW; 719 /* Return the EOF indicator for STREAM. */ 720 extern int feof(FILE * __stream) 721 __THROW __wur; 722 /* Return the error indicator for STREAM. */ 723 extern int ferror(FILE * __stream) 724 __THROW __wur; 725 __END_NAMESPACE_STD 726 #ifdef __USE_MISC 727 /* Faster versions when locking is not required. */ 728 extern void clearerr_unlocked(FILE * __stream) __THROW; 729 extern int feof_unlocked(FILE * __stream) 730 __THROW __wur; 731 extern int ferror_unlocked(FILE * __stream) 732 __THROW __wur; 733 #endif 734 735 __BEGIN_NAMESPACE_STD 736 /* Print a message describing the meaning of the value of errno. 737 738 This function is a possible cancellation point and therefore not 739 marked with __THROW. */ 740 extern void perror(const char *__s); 741 __END_NAMESPACE_STD 742 /* Provide the declarations for `sys_errlist' and `sys_nerr' if they 743 are available on this system. Even if available, these variables 744 should not be used directly. The `strerror' function provides 745 all the necessary functionality. */ 746 #include <bits/sys_errlist.h> 747 #ifdef __USE_POSIX 748 /* Return the system file descriptor for STREAM. */ 749 extern int fileno(FILE * __stream) 750 __THROW __wur; 751 #endif /* Use POSIX. */ 752 753 #ifdef __USE_MISC 754 /* Faster version when locking is not required. */ 755 extern int fileno_unlocked(FILE * __stream) 756 __THROW __wur; 757 #endif 758 759 #ifdef __USE_POSIX2 760 /* Create a new stream connected to a pipe running the given command. 761 762 This function is a possible cancellation point and therefore not 763 marked with __THROW. */ 764 extern FILE *popen(const char *__command, const char *__modes) __wur; 765 766 /* Close a stream opened by popen and return the status of its child. 767 768 This function is a possible cancellation point and therefore not 769 marked with __THROW. */ 770 extern int pclose(FILE * __stream); 771 #endif 772 773 #ifdef __USE_POSIX 774 /* Return the name of the controlling terminal. */ 775 extern char *ctermid(char *__s) __THROW; 776 #endif /* Use POSIX. */ 777 778 #if (defined __USE_XOPEN && !defined __USE_XOPEN2K) || defined __USE_GNU 779 /* Return the name of the current user. */ 780 extern char *cuserid(char *__s); 781 #endif /* Use X/Open, but not issue 6. */ 782 783 #ifdef __USE_GNU 784 struct obstack; /* See <obstack.h>. */ 785 786 /* Write formatted output to an obstack. */ 787 extern int obstack_printf(struct obstack *__restrict __obstack, const char *__restrict __format, ...) 788 __THROWNL __attribute__ ((__format__(__printf__, 2, 3))); 789 extern int obstack_vprintf(struct obstack *__restrict __obstack, const char *__restrict __format, _G_va_list __args) 790 __THROWNL __attribute__ ((__format__(__printf__, 2, 0))); 791 #endif /* Use GNU. */ 792 793 #ifdef __USE_POSIX199506 794 /* These are defined in POSIX.1:1996. */ 795 796 /* Acquire ownership of STREAM. */ 797 extern void flockfile(FILE * __stream) __THROW; 798 799 /* Try to acquire ownership of STREAM but do not block if it is not 800 possible. */ 801 extern int ftrylockfile(FILE * __stream) 802 __THROW __wur; 803 804 /* Relinquish the ownership granted for STREAM. */ 805 extern void funlockfile(FILE * __stream) __THROW; 806 #endif /* POSIX */ 807 808 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU 809 /* The X/Open standard requires some functions and variables to be 810 declared here which do not belong into this header. But we have to 811 follow. In GNU mode we don't do this nonsense. */ 812 #define __need_getopt 813 #include <getopt.h> 814 #endif /* X/Open, but not issue 6 and not for GNU. */ 815 816 /* If we are compiling with optimizing read this file. It contains 817 several optimizing inline functions and macros. */ 818 #ifdef __USE_EXTERN_INLINES 819 #include <bits/stdio.h> 820 #endif 821 #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function 822 #include <bits/stdio2.h> 823 #endif 824 #ifdef __LDBL_COMPAT 825 #include <bits/stdio-ldbl.h> 826 #endif 827 828 __END_DECLS 829 #endif /* <stdio.h> included. */ 830 #endif /* !_STDIO_H */