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