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