1 /* Define ISO C stdio on top of C++ iostreams.
2 Copyright (C) 1991,1994-2004,2005,2006 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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
21 * ISO C99 Standard: 7.19 Input/output <stdio.h>
26 #if !defined __need_FILE && !defined __need___FILE
28 # include <features.h>
32 # define __need_size_t
36 # include <bits/types.h>
38 # define __need___FILE
39 #endif /* Don't need FILE. */
42 #if !defined __FILE_defined && defined __need_FILE
45 /* The opaque type of streams. This is the definition used elsewhere. */
46 typedef struct _IO_FILE
FILE;
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)
54 # define __FILE_defined 1
55 #endif /* FILE not defined. */
59 #if !defined ____FILE_defined && defined __need___FILE
61 /* The opaque type of streams. This is the definition used elsewhere. */
62 typedef struct _IO_FILE __FILE
;
64 # define ____FILE_defined 1
65 #endif /* __FILE not defined. */
70 #define _STDIO_USES_IOSTREAM
76 # ifndef _VA_LIST_DEFINED
77 typedef _G_va_list
va_list;
78 # define _VA_LIST_DEFINED
85 /* The type of the second argument to `fgetpos' and `fsetpos'. */
87 #ifndef __USE_FILE_OFFSET64
88 typedef _G_fpos_t
fpos_t;
90 typedef _G_fpos64_t
fpos_t;
93 #ifdef __USE_LARGEFILE64
94 typedef _G_fpos64_t fpos64_t
;
97 /* The possibilities for the third argument to `setvbuf'. */
98 #define _IOFBF 0 /* Fully buffered. */
99 #define _IOLBF 1 /* Line buffered. */
100 #define _IONBF 2 /* No buffering. */
103 /* Default buffer size. */
105 # define BUFSIZ _IO_BUFSIZ
109 /* End of file character.
110 Some things throughout the library rely on this being -1. */
116 /* The possibilities for the third argument to `fseek'.
117 These values should not be changed. */
118 #define SEEK_SET 0 /* Seek from beginning of file. */
119 #define SEEK_CUR 1 /* Seek from current position. */
120 #define SEEK_END 2 /* Seek from end of file. */
123 #if defined __USE_SVID || defined __USE_XOPEN
124 /* Default path prefix for `tempnam' and `tmpnam'. */
125 # define P_tmpdir "/tmp"
130 L_tmpnam How long an array of chars must be to be passed to `tmpnam'.
131 TMP_MAX The minimum number of unique filenames generated by tmpnam
132 (and tempnam when it uses tmpnam's name space),
133 or tempnam (the two are separate).
134 L_ctermid How long an array to pass to `ctermid'.
135 L_cuserid How long an array to pass to `cuserid'.
136 FOPEN_MAX Minimum number of files that can be open at once.
137 FILENAME_MAX Maximum length of a filename. */
138 #include <bits/stdio_lim.h>
141 /* Standard streams. */
142 extern struct _IO_FILE
*stdin
; /* Standard input stream. */
143 extern struct _IO_FILE
*stdout
; /* Standard output stream. */
144 extern struct _IO_FILE
*stderr
; /* Standard error output stream. */
146 /* C89/C99 say they're macros. Make them happy. */
148 #define stdout stdout
149 #define stderr stderr
152 __BEGIN_NAMESPACE_STD
153 /* Remove file FILENAME. */
154 extern int remove (__const
char *__filename
) __THROW
;
155 /* Rename file OLD to NEW. */
156 extern int rename (__const
char *__old
, __const
char *__new
) __THROW
;
160 /* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */
161 extern int renameat (int __oldfd
, __const
char *__old
, int __newfd
,
162 __const
char *__new
) __THROW
;
165 __BEGIN_NAMESPACE_STD
166 /* Create a temporary file and open it read/write.
168 This function is a possible cancellation points and therefore not
169 marked with __THROW. */
170 #ifndef __USE_FILE_OFFSET64
171 extern FILE *tmpfile (void) __wur
;
174 extern FILE *__REDIRECT (tmpfile
, (void), tmpfile64
) __wur
;
176 # define tmpfile tmpfile64
180 #ifdef __USE_LARGEFILE64
181 extern FILE *tmpfile64 (void) __wur
;
184 /* Generate a temporary filename. */
185 extern char *tmpnam (char *__s
) __THROW __wur
;
189 /* This is the reentrant variant of `tmpnam'. The only difference is
190 that it does not allow S to be NULL. */
191 extern char *tmpnam_r (char *__s
) __THROW __wur
;
195 #if defined __USE_SVID || defined __USE_XOPEN
196 /* Generate a unique temporary filename using up to five characters of PFX
197 if it is not NULL. The directory to put this file in is searched for
198 as follows: First the environment variable "TMPDIR" is checked.
199 If it contains the name of a writable directory, that directory is used.
200 If not and if DIR is not NULL, that value is checked. If that fails,
201 P_tmpdir is tried and finally "/tmp". The storage for the filename
202 is allocated by `malloc'. */
203 extern char *tempnam (__const
char *__dir
, __const
char *__pfx
)
204 __THROW __attribute_malloc__ __wur
;
208 __BEGIN_NAMESPACE_STD
211 This function is a possible cancellation point and therefore not
212 marked with __THROW. */
213 extern int fclose (FILE *__stream
);
214 /* Flush STREAM, or all streams if STREAM is NULL.
216 This function is a possible cancellation point and therefore not
217 marked with __THROW. */
218 extern int fflush (FILE *__stream
);
222 /* Faster versions when locking is not required.
224 This function is not part of POSIX and therefore no official
225 cancellation point. But due to similarity with an POSIX interface
226 or due to the implementation it is a cancellation point and
227 therefore not marked with __THROW. */
228 extern int fflush_unlocked (FILE *__stream
);
232 /* Close all streams.
234 This function is not part of POSIX and therefore no official
235 cancellation point. But due to similarity with an POSIX interface
236 or due to the implementation it is a cancellation point and
237 therefore not marked with __THROW. */
238 extern int fcloseall (void);
242 __BEGIN_NAMESPACE_STD
243 #ifndef __USE_FILE_OFFSET64
244 /* Open a file and create a new stream for it.
246 This function is a possible cancellation point and therefore not
247 marked with __THROW. */
248 extern FILE *fopen (__const
char *__restrict __filename
,
249 __const
char *__restrict __modes
) __wur
;
250 /* Open a file, replacing an existing stream with it.
252 This function is a possible cancellation point and therefore not
253 marked with __THROW. */
254 extern FILE *freopen (__const
char *__restrict __filename
,
255 __const
char *__restrict __modes
,
256 FILE *__restrict __stream
) __wur
;
259 extern FILE *__REDIRECT (fopen
, (__const
char *__restrict __filename
,
260 __const
char *__restrict __modes
), fopen64
)
262 extern FILE *__REDIRECT (freopen
, (__const
char *__restrict __filename
,
263 __const
char *__restrict __modes
,
264 FILE *__restrict __stream
), freopen64
)
267 # define fopen fopen64
268 # define freopen freopen64
272 #ifdef __USE_LARGEFILE64
273 extern FILE *fopen64 (__const
char *__restrict __filename
,
274 __const
char *__restrict __modes
) __wur
;
275 extern FILE *freopen64 (__const
char *__restrict __filename
,
276 __const
char *__restrict __modes
,
277 FILE *__restrict __stream
) __wur
;
281 /* Create a new stream that refers to an existing system file descriptor. */
282 extern FILE *fdopen (int __fd
, __const
char *__modes
) __THROW __wur
;
286 /* Create a new stream that refers to the given magic cookie,
287 and uses the given functions for input and output. */
288 extern FILE *fopencookie (void *__restrict __magic_cookie
,
289 __const
char *__restrict __modes
,
290 _IO_cookie_io_functions_t __io_funcs
) __THROW __wur
;
292 /* Create a new stream that refers to a memory buffer. */
293 extern FILE *fmemopen (void *__s
, size_t __len
, __const
char *__modes
)
296 /* Open a stream that writes into a malloc'd buffer that is expanded as
297 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
298 and the number of characters written on fflush or fclose. */
299 extern FILE *open_memstream (char **__bufloc
, size_t *__sizeloc
) __THROW __wur
;
303 __BEGIN_NAMESPACE_STD
304 /* If BUF is NULL, make STREAM unbuffered.
305 Else make it use buffer BUF, of size BUFSIZ. */
306 extern void setbuf (FILE *__restrict __stream
, char *__restrict __buf
) __THROW
;
307 /* Make STREAM use buffering mode MODE.
308 If BUF is not NULL, use N bytes of it for buffering;
309 else allocate an internal buffer N bytes long. */
310 extern int setvbuf (FILE *__restrict __stream
, char *__restrict __buf
,
311 int __modes
, size_t __n
) __THROW
;
315 /* If BUF is NULL, make STREAM unbuffered.
316 Else make it use SIZE bytes of BUF for buffering. */
317 extern void setbuffer (FILE *__restrict __stream
, char *__restrict __buf
,
318 size_t __size
) __THROW
;
320 /* Make STREAM line-buffered. */
321 extern void setlinebuf (FILE *__stream
) __THROW
;
325 __BEGIN_NAMESPACE_STD
326 /* Write formatted output to STREAM.
328 This function is a possible cancellation point and therefore not
329 marked with __THROW. */
330 extern int fprintf (FILE *__restrict __stream
,
331 __const
char *__restrict __format
, ...);
332 /* Write formatted output to stdout.
334 This function is a possible cancellation point and therefore not
335 marked with __THROW. */
336 extern int printf (__const
char *__restrict __format
, ...);
337 /* Write formatted output to S. */
338 extern int sprintf (char *__restrict __s
,
339 __const
char *__restrict __format
, ...) __THROW
;
341 /* Write formatted output to S from argument list ARG.
343 This function is a possible cancellation point and therefore not
344 marked with __THROW. */
345 extern int vfprintf (FILE *__restrict __s
, __const
char *__restrict __format
,
347 /* Write formatted output to stdout from argument list ARG.
349 This function is a possible cancellation point and therefore not
350 marked with __THROW. */
351 extern int vprintf (__const
char *__restrict __format
, _G_va_list __arg
);
352 /* Write formatted output to S from argument list ARG. */
353 extern int vsprintf (char *__restrict __s
, __const
char *__restrict __format
,
354 _G_va_list __arg
) __THROW
;
357 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
358 __BEGIN_NAMESPACE_C99
359 /* Maximum chars of output to write in MAXLEN. */
360 extern int snprintf (char *__restrict __s
, size_t __maxlen
,
361 __const
char *__restrict __format
, ...)
362 __THROW
__attribute__ ((__format__ (__printf__
, 3, 4)));
364 extern int vsnprintf (char *__restrict __s
, size_t __maxlen
,
365 __const
char *__restrict __format
, _G_va_list __arg
)
366 __THROW
__attribute__ ((__format__ (__printf__
, 3, 0)));
371 /* Write formatted output to a string dynamically allocated with `malloc'.
372 Store the address of the string in *PTR. */
373 extern int vasprintf (char **__restrict __ptr
, __const
char *__restrict __f
,
375 __THROW
__attribute__ ((__format__ (__printf__
, 2, 0))) __wur
;
376 extern int __asprintf (char **__restrict __ptr
,
377 __const
char *__restrict __fmt
, ...)
378 __THROW
__attribute__ ((__format__ (__printf__
, 2, 3))) __wur
;
379 extern int asprintf (char **__restrict __ptr
,
380 __const
char *__restrict __fmt
, ...)
381 __THROW
__attribute__ ((__format__ (__printf__
, 2, 3))) __wur
;
383 /* Write formatted output to a file descriptor.
385 These functions are not part of POSIX and therefore no official
386 cancellation point. But due to similarity with an POSIX interface
387 or due to the implementation they are cancellation points and
388 therefore not marked with __THROW. */
389 extern int vdprintf (int __fd
, __const
char *__restrict __fmt
,
391 __attribute__ ((__format__ (__printf__
, 2, 0)));
392 extern int dprintf (int __fd
, __const
char *__restrict __fmt
, ...)
393 __attribute__ ((__format__ (__printf__
, 2, 3)));
397 __BEGIN_NAMESPACE_STD
398 /* Read formatted input from STREAM.
400 This function is a possible cancellation point and therefore not
401 marked with __THROW. */
402 extern int fscanf (FILE *__restrict __stream
,
403 __const
char *__restrict __format
, ...) __wur
;
404 /* Read formatted input from stdin.
406 This function is a possible cancellation point and therefore not
407 marked with __THROW. */
408 extern int scanf (__const
char *__restrict __format
, ...) __wur
;
409 /* Read formatted input from S. */
410 extern int sscanf (__const
char *__restrict __s
,
411 __const
char *__restrict __format
, ...) __THROW
;
415 __BEGIN_NAMESPACE_C99
416 /* Read formatted input from S into argument list ARG.
418 This function is a possible cancellation point and therefore not
419 marked with __THROW. */
420 extern int vfscanf (FILE *__restrict __s
, __const
char *__restrict __format
,
422 __attribute__ ((__format__ (__scanf__
, 2, 0))) __wur
;
424 /* Read formatted input from stdin into argument list ARG.
426 This function is a possible cancellation point and therefore not
427 marked with __THROW. */
428 extern int vscanf (__const
char *__restrict __format
, _G_va_list __arg
)
429 __attribute__ ((__format__ (__scanf__
, 1, 0))) __wur
;
431 /* Read formatted input from S into argument list ARG. */
432 extern int vsscanf (__const
char *__restrict __s
,
433 __const
char *__restrict __format
, _G_va_list __arg
)
434 __THROW
__attribute__ ((__format__ (__scanf__
, 2, 0)));
436 #endif /* Use ISO C9x. */
439 __BEGIN_NAMESPACE_STD
440 /* Read a character from STREAM.
442 These functions are possible cancellation points and therefore not
443 marked with __THROW. */
444 extern int fgetc (FILE *__stream
);
445 extern int getc (FILE *__stream
);
447 /* Read a character from stdin.
449 This function is a possible cancellation point and therefore not
450 marked with __THROW. */
451 extern int getchar (void);
454 /* The C standard explicitly says this is a macro, so we always do the
455 optimization for it. */
456 #define getc(_fp) _IO_getc (_fp)
458 #if defined __USE_POSIX || defined __USE_MISC
459 /* These are defined in POSIX.1:1996.
461 These functions are possible cancellation points and therefore not
462 marked with __THROW. */
463 extern int getc_unlocked (FILE *__stream
);
464 extern int getchar_unlocked (void);
465 #endif /* Use POSIX or MISC. */
468 /* Faster version when locking is not necessary.
470 This function is not part of POSIX and therefore no official
471 cancellation point. But due to similarity with an POSIX interface
472 or due to the implementation it is a cancellation point and
473 therefore not marked with __THROW. */
474 extern int fgetc_unlocked (FILE *__stream
);
475 #endif /* Use MISC. */
478 __BEGIN_NAMESPACE_STD
479 /* Write a character to STREAM.
481 These functions are possible cancellation points and therefore not
484 These functions is a possible cancellation point and therefore not
485 marked with __THROW. */
486 extern int fputc (int __c
, FILE *__stream
);
487 extern int putc (int __c
, FILE *__stream
);
489 /* Write a character to stdout.
491 This function is a possible cancellation point and therefore not
492 marked with __THROW. */
493 extern int putchar (int __c
);
496 /* The C standard explicitly says this can be a macro,
497 so we always do the optimization for it. */
498 #define putc(_ch, _fp) _IO_putc (_ch, _fp)
501 /* Faster version when locking is not necessary.
503 This function is not part of POSIX and therefore no official
504 cancellation point. But due to similarity with an POSIX interface
505 or due to the implementation it is a cancellation point and
506 therefore not marked with __THROW. */
507 extern int fputc_unlocked (int __c
, FILE *__stream
);
508 #endif /* Use MISC. */
510 #if defined __USE_POSIX || defined __USE_MISC
511 /* These are defined in POSIX.1:1996.
513 These functions are possible cancellation points and therefore not
514 marked with __THROW. */
515 extern int putc_unlocked (int __c
, FILE *__stream
);
516 extern int putchar_unlocked (int __c
);
517 #endif /* Use POSIX or MISC. */
520 #if defined __USE_SVID || defined __USE_MISC \
521 || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
522 /* Get a word (int) from STREAM. */
523 extern int getw (FILE *__stream
);
525 /* Write a word (int) to STREAM. */
526 extern int putw (int __w
, FILE *__stream
);
530 __BEGIN_NAMESPACE_STD
531 /* Get a newline-terminated string of finite length from STREAM.
533 This function is a possible cancellation point and therefore not
534 marked with __THROW. */
535 extern char *fgets (char *__restrict __s
, int __n
, FILE *__restrict __stream
)
538 /* Get a newline-terminated string from stdin, removing the newline.
539 DO NOT USE THIS FUNCTION!! There is no limit on how much it will read.
541 This function is a possible cancellation point and therefore not
542 marked with __THROW. */
543 extern char *gets (char *__s
) __wur
;
547 /* This function does the same as `fgets' but does not lock the stream.
549 This function is not part of POSIX and therefore no official
550 cancellation point. But due to similarity with an POSIX interface
551 or due to the implementation it is a cancellation point and
552 therefore not marked with __THROW. */
553 extern char *fgets_unlocked (char *__restrict __s
, int __n
,
554 FILE *__restrict __stream
) __wur
;
559 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
560 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
561 NULL), pointing to *N characters of space. It is realloc'd as
562 necessary. Returns the number of characters read (not including the
563 null terminator), or -1 on error or EOF.
565 These functions are not part of POSIX and therefore no official
566 cancellation point. But due to similarity with an POSIX interface
567 or due to the implementation they are cancellation points and
568 therefore not marked with __THROW. */
569 extern _IO_ssize_t
__getdelim (char **__restrict __lineptr
,
570 size_t *__restrict __n
, int __delimiter
,
571 FILE *__restrict __stream
) __wur
;
572 extern _IO_ssize_t
getdelim (char **__restrict __lineptr
,
573 size_t *__restrict __n
, int __delimiter
,
574 FILE *__restrict __stream
) __wur
;
576 /* Like `getdelim', but reads up to a newline.
578 This function is not part of POSIX and therefore no official
579 cancellation point. But due to similarity with an POSIX interface
580 or due to the implementation it is a cancellation point and
581 therefore not marked with __THROW. */
582 extern _IO_ssize_t
getline (char **__restrict __lineptr
,
583 size_t *__restrict __n
,
584 FILE *__restrict __stream
) __wur
;
588 __BEGIN_NAMESPACE_STD
589 /* Write a string to STREAM.
591 This function is a possible cancellation points and therefore not
592 marked with __THROW. */
593 extern int fputs (__const
char *__restrict __s
, FILE *__restrict __stream
);
595 /* Write a string, followed by a newline, to stdout.
597 This function is a possible cancellation points and therefore not
598 marked with __THROW. */
599 extern int puts (__const
char *__s
);
602 /* Push a character back onto the input buffer of STREAM.
604 This function is a possible cancellation points and therefore not
605 marked with __THROW. */
606 extern int ungetc (int __c
, FILE *__stream
);
609 /* Read chunks of generic data from STREAM.
611 This function is a possible cancellation points and therefore not
612 marked with __THROW. */
613 extern size_t fread (void *__restrict __ptr
, size_t __size
,
614 size_t __n
, FILE *__restrict __stream
) __wur
;
615 /* Write chunks of generic data to STREAM.
617 This function is a possible cancellation points and therefore not
618 marked with __THROW. */
619 extern size_t fwrite (__const
void *__restrict __ptr
, size_t __size
,
620 size_t __n
, FILE *__restrict __s
) __wur
;
624 /* This function does the same as `fputs' but does not lock the stream.
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
,
631 FILE *__restrict __stream
);
635 /* Faster versions when locking is not necessary.
637 These functions are not part of POSIX and therefore no official
638 cancellation point. But due to similarity with an POSIX interface
639 or due to the implementation they are cancellation points and
640 therefore not marked with __THROW. */
641 extern size_t fread_unlocked (void *__restrict __ptr
, size_t __size
,
642 size_t __n
, FILE *__restrict __stream
) __wur
;
643 extern size_t fwrite_unlocked (__const
void *__restrict __ptr
, size_t __size
,
644 size_t __n
, FILE *__restrict __stream
) __wur
;
648 __BEGIN_NAMESPACE_STD
649 /* Seek to a certain position on STREAM.
651 This function is a possible cancellation point and therefore not
652 marked with __THROW. */
653 extern int fseek (FILE *__stream
, long int __off
, int __whence
);
654 /* Return the current position of STREAM.
656 This function is a possible cancellation point and therefore not
657 marked with __THROW. */
658 extern long int ftell (FILE *__stream
) __wur
;
659 /* Rewind to the beginning of STREAM.
661 This function is a possible cancellation point and therefore not
662 marked with __THROW. */
663 extern void rewind (FILE *__stream
);
666 /* The Single Unix Specification, Version 2, specifies an alternative,
667 more adequate interface for the two functions above which deal with
668 file offset. `long int' is not the right type. These definitions
669 are originally defined in the Large File Support API. */
671 #if defined __USE_LARGEFILE || defined __USE_XOPEN2K
672 # ifndef __USE_FILE_OFFSET64
673 /* Seek to a certain position on STREAM.
675 This function is a possible cancellation point and therefore not
676 marked with __THROW. */
677 extern int fseeko (FILE *__stream
, __off_t __off
, int __whence
);
678 /* Return the current position of STREAM.
680 This function is a possible cancellation point and therefore not
681 marked with __THROW. */
682 extern __off_t
ftello (FILE *__stream
) __wur
;
685 extern int __REDIRECT (fseeko
,
686 (FILE *__stream
, __off64_t __off
, int __whence
),
688 extern __off64_t
__REDIRECT (ftello
, (FILE *__stream
), ftello64
);
690 # define fseeko fseeko64
691 # define ftello ftello64
696 __BEGIN_NAMESPACE_STD
697 #ifndef __USE_FILE_OFFSET64
698 /* Get STREAM's position.
700 This function is a possible cancellation point and therefore not
701 marked with __THROW. */
702 extern int fgetpos (FILE *__restrict __stream
, fpos_t *__restrict __pos
);
703 /* Set STREAM's position.
705 This function is a possible cancellation point and therefore not
706 marked with __THROW. */
707 extern int fsetpos (FILE *__stream
, __const
fpos_t *__pos
);
710 extern int __REDIRECT (fgetpos
, (FILE *__restrict __stream
,
711 fpos_t *__restrict __pos
), fgetpos64
);
712 extern int __REDIRECT (fsetpos
,
713 (FILE *__stream
, __const
fpos_t *__pos
), fsetpos64
);
715 # define fgetpos fgetpos64
716 # define fsetpos fsetpos64
721 #ifdef __USE_LARGEFILE64
722 extern int fseeko64 (FILE *__stream
, __off64_t __off
, int __whence
);
723 extern __off64_t
ftello64 (FILE *__stream
) __wur
;
724 extern int fgetpos64 (FILE *__restrict __stream
, fpos64_t
*__restrict __pos
);
725 extern int fsetpos64 (FILE *__stream
, __const fpos64_t
*__pos
);
728 __BEGIN_NAMESPACE_STD
729 /* Clear the error and EOF indicators for STREAM. */
730 extern void clearerr (FILE *__stream
) __THROW
;
731 /* Return the EOF indicator for STREAM. */
732 extern int feof (FILE *__stream
) __THROW __wur
;
733 /* Return the error indicator for STREAM. */
734 extern int ferror (FILE *__stream
) __THROW __wur
;
738 /* Faster versions when locking is not required. */
739 extern void clearerr_unlocked (FILE *__stream
) __THROW
;
740 extern int feof_unlocked (FILE *__stream
) __THROW __wur
;
741 extern int ferror_unlocked (FILE *__stream
) __THROW __wur
;
745 __BEGIN_NAMESPACE_STD
746 /* Print a message describing the meaning of the value of errno.
748 This function is a possible cancellation point and therefore not
749 marked with __THROW. */
750 extern void perror (__const
char *__s
);
753 /* Provide the declarations for `sys_errlist' and `sys_nerr' if they
754 are available on this system. Even if available, these variables
755 should not be used directly. The `strerror' function provides
756 all the necessary functionality. */
757 #include <bits/sys_errlist.h>
761 /* Return the system file descriptor for STREAM. */
762 extern int fileno (FILE *__stream
) __THROW __wur
;
763 #endif /* Use POSIX. */
766 /* Faster version when locking is not required. */
767 extern int fileno_unlocked (FILE *__stream
) __THROW __wur
;
771 #if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \
773 /* Create a new stream connected to a pipe running the given command.
775 This function is a possible cancellation point and therefore not
776 marked with __THROW. */
777 extern FILE *popen (__const
char *__command
, __const
char *__modes
) __wur
;
779 /* Close a stream opened by popen and return the status of its child.
781 This function is a possible cancellation point and therefore not
782 marked with __THROW. */
783 extern int pclose (FILE *__stream
);
788 /* Return the name of the controlling terminal. */
789 extern char *ctermid (char *__s
) __THROW
;
790 #endif /* Use POSIX. */
794 /* Return the name of the current user. */
795 extern char *cuserid (char *__s
);
796 #endif /* Use X/Open, but not issue 6. */
800 struct obstack
; /* See <obstack.h>. */
802 /* Write formatted output to an obstack. */
803 extern int obstack_printf (struct obstack
*__restrict __obstack
,
804 __const
char *__restrict __format
, ...)
805 __THROW
__attribute__ ((__format__ (__printf__
, 2, 3)));
806 extern int obstack_vprintf (struct obstack
*__restrict __obstack
,
807 __const
char *__restrict __format
,
809 __THROW
__attribute__ ((__format__ (__printf__
, 2, 0)));
810 #endif /* Use GNU. */
813 #if defined __USE_POSIX || defined __USE_MISC
814 /* These are defined in POSIX.1:1996. */
816 /* Acquire ownership of STREAM. */
817 extern void flockfile (FILE *__stream
) __THROW
;
819 /* Try to acquire ownership of STREAM but do not block if it is not
821 extern int ftrylockfile (FILE *__stream
) __THROW __wur
;
823 /* Relinquish the ownership granted for STREAM. */
824 extern void funlockfile (FILE *__stream
) __THROW
;
825 #endif /* POSIX || misc */
827 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
828 /* The X/Open standard requires some functions and variables to be
829 declared here which do not belong into this header. But we have to
830 follow. In GNU mode we don't do this nonsense. */
831 # define __need_getopt
833 #endif /* X/Open, but not issue 6 and not for GNU. */
835 /* If we are compiling with optimizing read this file. It contains
836 several optimizing inline functions and macros. */
837 #ifdef __USE_EXTERN_INLINES
838 # include <bits/stdio.h>
840 #if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
841 # include <bits/stdio2.h>
844 # include <bits/stdio-ldbl.h>
849 #endif /* <stdio.h> included. */
851 #endif /* !_STDIO_H */