1 /* Define ISO C stdio on top of C++ iostreams.
2 Copyright (C) 1991,1994-2002,2003,2004 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 __BEGIN_NAMESPACE_STD
161 /* Create a temporary file and open it read/write.
163 This function is a possible cancellation points and therefore not
164 marked with __THROW. */
165 #ifndef __USE_FILE_OFFSET64
166 extern FILE *tmpfile (void);
169 extern FILE *__REDIRECT (tmpfile
, (void), tmpfile64
);
171 # define tmpfile tmpfile64
175 #ifdef __USE_LARGEFILE64
176 extern FILE *tmpfile64 (void);
179 /* Generate a temporary filename. */
180 extern char *tmpnam (char *__s
) __THROW
;
184 /* This is the reentrant variant of `tmpnam'. The only difference is
185 that it does not allow S to be NULL. */
186 extern char *tmpnam_r (char *__s
) __THROW
;
190 #if defined __USE_SVID || defined __USE_XOPEN
191 /* Generate a unique temporary filename using up to five characters of PFX
192 if it is not NULL. The directory to put this file in is searched for
193 as follows: First the environment variable "TMPDIR" is checked.
194 If it contains the name of a writable directory, that directory is used.
195 If not and if DIR is not NULL, that value is checked. If that fails,
196 P_tmpdir is tried and finally "/tmp". The storage for the filename
197 is allocated by `malloc'. */
198 extern char *tempnam (__const
char *__dir
, __const
char *__pfx
)
199 __THROW __attribute_malloc__
;
203 __BEGIN_NAMESPACE_STD
206 This function is a possible cancellation point and therefore not
207 marked with __THROW. */
208 extern int fclose (FILE *__stream
);
209 /* Flush STREAM, or all streams if STREAM is NULL.
211 This function is a possible cancellation point and therefore not
212 marked with __THROW. */
213 extern int fflush (FILE *__stream
);
217 /* Faster versions when locking is not required.
219 This function is not part of POSIX and therefore no official
220 cancellation point. But due to similarity with an POSIX interface
221 or due to the implementation it is a cancellation point and
222 therefore not marked with __THROW. */
223 extern int fflush_unlocked (FILE *__stream
);
227 /* Close all streams.
229 This function is not part of POSIX and therefore no official
230 cancellation point. But due to similarity with an POSIX interface
231 or due to the implementation it is a cancellation point and
232 therefore not marked with __THROW. */
233 extern int fcloseall (void);
237 __BEGIN_NAMESPACE_STD
238 #ifndef __USE_FILE_OFFSET64
239 /* Open a file and create a new stream for it.
241 This function is a possible cancellation point and therefore not
242 marked with __THROW. */
243 extern FILE *fopen (__const
char *__restrict __filename
,
244 __const
char *__restrict __modes
);
245 /* Open a file, replacing an existing stream with it.
247 This function is a possible cancellation point and therefore not
248 marked with __THROW. */
249 extern FILE *freopen (__const
char *__restrict __filename
,
250 __const
char *__restrict __modes
,
251 FILE *__restrict __stream
);
254 extern FILE *__REDIRECT (fopen
, (__const
char *__restrict __filename
,
255 __const
char *__restrict __modes
), fopen64
);
256 extern FILE *__REDIRECT (freopen
, (__const
char *__restrict __filename
,
257 __const
char *__restrict __modes
,
258 FILE *__restrict __stream
), freopen64
);
260 # define fopen fopen64
261 # define freopen freopen64
265 #ifdef __USE_LARGEFILE64
266 extern FILE *fopen64 (__const
char *__restrict __filename
,
267 __const
char *__restrict __modes
);
268 extern FILE *freopen64 (__const
char *__restrict __filename
,
269 __const
char *__restrict __modes
,
270 FILE *__restrict __stream
);
274 /* Create a new stream that refers to an existing system file descriptor. */
275 extern FILE *fdopen (int __fd
, __const
char *__modes
) __THROW
;
279 /* Create a new stream that refers to the given magic cookie,
280 and uses the given functions for input and output. */
281 extern FILE *fopencookie (void *__restrict __magic_cookie
,
282 __const
char *__restrict __modes
,
283 _IO_cookie_io_functions_t __io_funcs
) __THROW
;
285 /* Create a new stream that refers to a memory buffer. */
286 extern FILE *fmemopen (void *__s
, size_t __len
, __const
char *__modes
) __THROW
;
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. */
291 extern FILE *open_memstream (char **__restrict __bufloc
,
292 size_t *__restrict __sizeloc
) __THROW
;
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
,
304 int __modes
, size_t __n
) __THROW
;
308 /* If BUF is NULL, make STREAM unbuffered.
309 Else make it use SIZE bytes of BUF for buffering. */
310 extern void setbuffer (FILE *__restrict __stream
, char *__restrict __buf
,
311 size_t __size
) __THROW
;
313 /* Make STREAM line-buffered. */
314 extern void setlinebuf (FILE *__stream
) __THROW
;
318 __BEGIN_NAMESPACE_STD
319 /* Write formatted output to STREAM.
321 This function is a possible cancellation point and therefore not
322 marked with __THROW. */
323 extern int fprintf (FILE *__restrict __stream
,
324 __const
char *__restrict __format
, ...);
325 /* Write formatted output to stdout.
327 This function is a possible cancellation point and therefore not
328 marked with __THROW. */
329 extern int printf (__const
char *__restrict __format
, ...);
330 /* Write formatted output to S. */
331 extern int sprintf (char *__restrict __s
,
332 __const
char *__restrict __format
, ...) __THROW
;
334 /* Write formatted output to S from argument list ARG.
336 This function is a possible cancellation point and therefore not
337 marked with __THROW. */
338 extern int vfprintf (FILE *__restrict __s
, __const
char *__restrict __format
,
340 /* Write formatted output to stdout from argument list ARG.
342 This function is a possible cancellation point and therefore not
343 marked with __THROW. */
344 extern int vprintf (__const
char *__restrict __format
, _G_va_list __arg
);
345 /* Write formatted output to S from argument list ARG. */
346 extern int vsprintf (char *__restrict __s
, __const
char *__restrict __format
,
347 _G_va_list __arg
) __THROW
;
350 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
351 __BEGIN_NAMESPACE_C99
352 /* Maximum chars of output to write in MAXLEN. */
353 extern int snprintf (char *__restrict __s
, size_t __maxlen
,
354 __const
char *__restrict __format
, ...)
355 __THROW
__attribute__ ((__format__ (__printf__
, 3, 4)));
357 extern int vsnprintf (char *__restrict __s
, size_t __maxlen
,
358 __const
char *__restrict __format
, _G_va_list __arg
)
359 __THROW
__attribute__ ((__format__ (__printf__
, 3, 0)));
364 /* Write formatted output to a string dynamically allocated with `malloc'.
365 Store the address of the string in *PTR. */
366 extern int vasprintf (char **__restrict __ptr
, __const
char *__restrict __f
,
368 __THROW
__attribute__ ((__format__ (__printf__
, 2, 0)));
369 extern int __asprintf (char **__restrict __ptr
,
370 __const
char *__restrict __fmt
, ...)
371 __THROW
__attribute__ ((__format__ (__printf__
, 2, 3)));
372 extern int asprintf (char **__restrict __ptr
,
373 __const
char *__restrict __fmt
, ...)
374 __THROW
__attribute__ ((__format__ (__printf__
, 2, 3)));
376 /* Write formatted output to a file descriptor.
378 These functions are not part of POSIX and therefore no official
379 cancellation point. But due to similarity with an POSIX interface
380 or due to the implementation they are cancellation points and
381 therefore not marked with __THROW. */
382 extern int vdprintf (int __fd
, __const
char *__restrict __fmt
,
384 __attribute__ ((__format__ (__printf__
, 2, 0)));
385 extern int dprintf (int __fd
, __const
char *__restrict __fmt
, ...)
386 __attribute__ ((__format__ (__printf__
, 2, 3)));
390 __BEGIN_NAMESPACE_STD
391 /* Read formatted input from STREAM.
393 This function is a possible cancellation point and therefore not
394 marked with __THROW. */
395 extern int fscanf (FILE *__restrict __stream
,
396 __const
char *__restrict __format
, ...);
397 /* Read formatted input from stdin.
399 This function is a possible cancellation point and therefore not
400 marked with __THROW. */
401 extern int scanf (__const
char *__restrict __format
, ...);
402 /* Read formatted input from S. */
403 extern int sscanf (__const
char *__restrict __s
,
404 __const
char *__restrict __format
, ...) __THROW
;
408 __BEGIN_NAMESPACE_C99
409 /* Read formatted input from S into argument list ARG.
411 This function is a possible cancellation point and therefore not
412 marked with __THROW. */
413 extern int vfscanf (FILE *__restrict __s
, __const
char *__restrict __format
,
415 __attribute__ ((__format__ (__scanf__
, 2, 0)));
417 /* Read formatted input from stdin into argument list ARG.
419 This function is a possible cancellation point and therefore not
420 marked with __THROW. */
421 extern int vscanf (__const
char *__restrict __format
, _G_va_list __arg
)
422 __attribute__ ((__format__ (__scanf__
, 1, 0)));
424 /* Read formatted input from S into argument list ARG. */
425 extern int vsscanf (__const
char *__restrict __s
,
426 __const
char *__restrict __format
, _G_va_list __arg
)
427 __THROW
__attribute__ ((__format__ (__scanf__
, 2, 0)));
429 #endif /* Use ISO C9x. */
432 __BEGIN_NAMESPACE_STD
433 /* Read a character from STREAM.
435 These functions are possible cancellation points and therefore not
436 marked with __THROW. */
437 extern int fgetc (FILE *__stream
);
438 extern int getc (FILE *__stream
);
440 /* Read a character from stdin.
442 This function is a possible cancellation point and therefore not
443 marked with __THROW. */
444 extern int getchar (void);
447 /* The C standard explicitly says this is a macro, so we always do the
448 optimization for it. */
449 #define getc(_fp) _IO_getc (_fp)
451 #if defined __USE_POSIX || defined __USE_MISC
452 /* These are defined in POSIX.1:1996.
454 These functions are possible cancellation points and therefore not
455 marked with __THROW. */
456 extern int getc_unlocked (FILE *__stream
);
457 extern int getchar_unlocked (void);
458 #endif /* Use POSIX or MISC. */
461 /* Faster version when locking is not necessary.
463 This function is not part of POSIX and therefore no official
464 cancellation point. But due to similarity with an POSIX interface
465 or due to the implementation it is a cancellation point and
466 therefore not marked with __THROW. */
467 extern int fgetc_unlocked (FILE *__stream
);
468 #endif /* Use MISC. */
471 __BEGIN_NAMESPACE_STD
472 /* Write a character to STREAM.
474 These functions are possible cancellation points and therefore not
477 These functions is a possible cancellation point and therefore not
478 marked with __THROW. */
479 extern int fputc (int __c
, FILE *__stream
);
480 extern int putc (int __c
, FILE *__stream
);
482 /* Write a character to stdout.
484 This function is a possible cancellation point and therefore not
485 marked with __THROW. */
486 extern int putchar (int __c
);
489 /* The C standard explicitly says this can be a macro,
490 so we always do the optimization for it. */
491 #define putc(_ch, _fp) _IO_putc (_ch, _fp)
494 /* Faster version when locking is not necessary.
496 This function is not part of POSIX and therefore no official
497 cancellation point. But due to similarity with an POSIX interface
498 or due to the implementation it is a cancellation point and
499 therefore not marked with __THROW. */
500 extern int fputc_unlocked (int __c
, FILE *__stream
);
501 #endif /* Use MISC. */
503 #if defined __USE_POSIX || defined __USE_MISC
504 /* These are defined in POSIX.1:1996.
506 These functions are possible cancellation points and therefore not
507 marked with __THROW. */
508 extern int putc_unlocked (int __c
, FILE *__stream
);
509 extern int putchar_unlocked (int __c
);
510 #endif /* Use POSIX or MISC. */
513 #if defined __USE_SVID || defined __USE_MISC \
514 || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
515 /* Get a word (int) from STREAM. */
516 extern int getw (FILE *__stream
);
518 /* Write a word (int) to STREAM. */
519 extern int putw (int __w
, FILE *__stream
);
523 __BEGIN_NAMESPACE_STD
524 /* Get a newline-terminated string of finite length from STREAM.
526 This function is a possible cancellation point and therefore not
527 marked with __THROW. */
528 extern char *fgets (char *__restrict __s
, int __n
, FILE *__restrict __stream
);
530 /* Get a newline-terminated string from stdin, removing the newline.
531 DO NOT USE THIS FUNCTION!! There is no limit on how much it will read.
533 This function is a possible cancellation point and therefore not
534 marked with __THROW. */
535 extern char *gets (char *__s
);
539 /* This function does the same as `fgets' but does not lock the stream.
541 This function is not part of POSIX and therefore no official
542 cancellation point. But due to similarity with an POSIX interface
543 or due to the implementation it is a cancellation point and
544 therefore not marked with __THROW. */
545 extern char *fgets_unlocked (char *__restrict __s
, int __n
,
546 FILE *__restrict __stream
);
551 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
552 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
553 NULL), pointing to *N characters of space. It is realloc'd as
554 necessary. Returns the number of characters read (not including the
555 null terminator), or -1 on error or EOF.
557 These functions are not part of POSIX and therefore no official
558 cancellation point. But due to similarity with an POSIX interface
559 or due to the implementation they are cancellation points and
560 therefore not marked with __THROW. */
561 extern _IO_ssize_t
__getdelim (char **__restrict __lineptr
,
562 size_t *__restrict __n
, int __delimiter
,
563 FILE *__restrict __stream
);
564 extern _IO_ssize_t
getdelim (char **__restrict __lineptr
,
565 size_t *__restrict __n
, int __delimiter
,
566 FILE *__restrict __stream
);
568 /* Like `getdelim', but reads up to a newline.
570 This function is not part of POSIX and therefore no official
571 cancellation point. But due to similarity with an POSIX interface
572 or due to the implementation it is a cancellation point and
573 therefore not marked with __THROW. */
574 extern _IO_ssize_t
getline (char **__restrict __lineptr
,
575 size_t *__restrict __n
,
576 FILE *__restrict __stream
);
580 __BEGIN_NAMESPACE_STD
581 /* Write a string to STREAM.
583 This function is a possible cancellation points and therefore not
584 marked with __THROW. */
585 extern int fputs (__const
char *__restrict __s
, FILE *__restrict __stream
);
587 /* Write a string, followed by a newline, to stdout.
589 This function is a possible cancellation points and therefore not
590 marked with __THROW. */
591 extern int puts (__const
char *__s
);
594 /* Push a character back onto the input buffer of STREAM.
596 This function is a possible cancellation points and therefore not
597 marked with __THROW. */
598 extern int ungetc (int __c
, FILE *__stream
);
601 /* Read chunks of generic data from STREAM.
603 This function is a possible cancellation points and therefore not
604 marked with __THROW. */
605 extern size_t fread (void *__restrict __ptr
, size_t __size
,
606 size_t __n
, FILE *__restrict __stream
);
607 /* Write chunks of generic data to STREAM.
609 This function is a possible cancellation points and therefore not
610 marked with __THROW. */
611 extern size_t fwrite (__const
void *__restrict __ptr
, size_t __size
,
612 size_t __n
, FILE *__restrict __s
);
616 /* This function does the same as `fputs' but does not lock the stream.
618 This function is not part of POSIX and therefore no official
619 cancellation point. But due to similarity with an POSIX interface
620 or due to the implementation it is a cancellation point and
621 therefore not marked with __THROW. */
622 extern int fputs_unlocked (__const
char *__restrict __s
,
623 FILE *__restrict __stream
);
627 /* Faster versions when locking is not necessary.
629 These functions are not part of POSIX and therefore no official
630 cancellation point. But due to similarity with an POSIX interface
631 or due to the implementation they are cancellation points and
632 therefore not marked with __THROW. */
633 extern size_t fread_unlocked (void *__restrict __ptr
, size_t __size
,
634 size_t __n
, FILE *__restrict __stream
);
635 extern size_t fwrite_unlocked (__const
void *__restrict __ptr
, size_t __size
,
636 size_t __n
, FILE *__restrict __stream
);
640 __BEGIN_NAMESPACE_STD
641 /* Seek to a certain position on STREAM.
643 This function is a possible cancellation point and therefore not
644 marked with __THROW. */
645 extern int fseek (FILE *__stream
, long int __off
, int __whence
);
646 /* Return the current position of STREAM.
648 This function is a possible cancellation point and therefore not
649 marked with __THROW. */
650 extern long int ftell (FILE *__stream
);
651 /* Rewind to the beginning of STREAM.
653 This function is a possible cancellation point and therefore not
654 marked with __THROW. */
655 extern void rewind (FILE *__stream
);
658 /* The Single Unix Specification, Version 2, specifies an alternative,
659 more adequate interface for the two functions above which deal with
660 file offset. `long int' is not the right type. These definitions
661 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.
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.
672 This function is a possible cancellation point and therefore not
673 marked with __THROW. */
674 extern __off_t
ftello (FILE *__stream
);
677 extern int __REDIRECT (fseeko
,
678 (FILE *__stream
, __off64_t __off
, int __whence
),
680 extern __off64_t
__REDIRECT (ftello
, (FILE *__stream
), ftello64
);
682 # define fseeko fseeko64
683 # define ftello ftello64
688 __BEGIN_NAMESPACE_STD
689 #ifndef __USE_FILE_OFFSET64
690 /* Get STREAM's position.
692 This function is a possible cancellation point and therefore not
693 marked with __THROW. */
694 extern int fgetpos (FILE *__restrict __stream
, fpos_t *__restrict __pos
);
695 /* Set STREAM's position.
697 This function is a possible cancellation point and therefore not
698 marked with __THROW. */
699 extern int fsetpos (FILE *__stream
, __const
fpos_t *__pos
);
702 extern int __REDIRECT (fgetpos
, (FILE *__restrict __stream
,
703 fpos_t *__restrict __pos
), fgetpos64
);
704 extern int __REDIRECT (fsetpos
,
705 (FILE *__stream
, __const
fpos_t *__pos
), fsetpos64
);
707 # define fgetpos fgetpos64
708 # define fsetpos fsetpos64
713 #ifdef __USE_LARGEFILE64
714 extern int fseeko64 (FILE *__stream
, __off64_t __off
, int __whence
);
715 extern __off64_t
ftello64 (FILE *__stream
);
716 extern int fgetpos64 (FILE *__restrict __stream
, fpos64_t
*__restrict __pos
);
717 extern int fsetpos64 (FILE *__stream
, __const fpos64_t
*__pos
);
720 __BEGIN_NAMESPACE_STD
721 /* Clear the error and EOF indicators for STREAM. */
722 extern void clearerr (FILE *__stream
) __THROW
;
723 /* Return the EOF indicator for STREAM. */
724 extern int feof (FILE *__stream
) __THROW
;
725 /* Return the error indicator for STREAM. */
726 extern int ferror (FILE *__stream
) __THROW
;
730 /* Faster versions when locking is not required. */
731 extern void clearerr_unlocked (FILE *__stream
) __THROW
;
732 extern int feof_unlocked (FILE *__stream
) __THROW
;
733 extern int ferror_unlocked (FILE *__stream
) __THROW
;
737 __BEGIN_NAMESPACE_STD
738 /* Print a message describing the meaning of the value of errno.
740 This function is a possible cancellation point and therefore not
741 marked with __THROW. */
742 extern void perror (__const
char *__s
);
745 /* Provide the declarations for `sys_errlist' and `sys_nerr' if they
746 are available on this system. Even if available, these variables
747 should not be used directly. The `strerror' function provides
748 all the necessary functionality. */
749 #include <bits/sys_errlist.h>
753 /* Return the system file descriptor for STREAM. */
754 extern int fileno (FILE *__stream
) __THROW
;
755 #endif /* Use POSIX. */
758 /* Faster version when locking is not required. */
759 extern int fileno_unlocked (FILE *__stream
) __THROW
;
763 #if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \
765 /* Create a new stream connected to a pipe running the given command.
767 This function is a possible cancellation point and therefore not
768 marked with __THROW. */
769 extern FILE *popen (__const
char *__command
, __const
char *__modes
);
771 /* Close a stream opened by popen and return the status of its child.
773 This function is a possible cancellation point and therefore not
774 marked with __THROW. */
775 extern int pclose (FILE *__stream
);
780 /* Return the name of the controlling terminal. */
781 extern char *ctermid (char *__s
) __THROW
;
782 #endif /* Use POSIX. */
786 /* Return the name of the current user. */
787 extern char *cuserid (char *__s
);
788 #endif /* Use X/Open, but not issue 6. */
792 struct obstack
; /* See <obstack.h>. */
794 /* Write formatted output to an obstack. */
795 extern int obstack_printf (struct obstack
*__restrict __obstack
,
796 __const
char *__restrict __format
, ...)
797 __THROW
__attribute__ ((__format__ (__printf__
, 2, 3)));
798 extern int obstack_vprintf (struct obstack
*__restrict __obstack
,
799 __const
char *__restrict __format
,
801 __THROW
__attribute__ ((__format__ (__printf__
, 2, 0)));
802 #endif /* Use GNU. */
805 #if defined __USE_POSIX || defined __USE_MISC
806 /* These are defined in POSIX.1:1996. */
808 /* Acquire ownership of STREAM. */
809 extern void flockfile (FILE *__stream
) __THROW
;
811 /* Try to acquire ownership of STREAM but do not block if it is not
813 extern int ftrylockfile (FILE *__stream
) __THROW
;
815 /* Relinquish the ownership granted for STREAM. */
816 extern void funlockfile (FILE *__stream
) __THROW
;
817 #endif /* POSIX || misc */
819 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
820 /* The X/Open standard requires some functions and variables to be
821 declared here which do not belong into this header. But we have to
822 follow. In GNU mode we don't do this nonsense. */
823 # define __need_getopt
825 #endif /* X/Open, but not issue 6 and not for GNU. */
827 /* If we are compiling with optimizing read this file. It contains
828 several optimizing inline functions and macros. */
829 #ifdef __USE_EXTERN_INLINES
830 # include <bits/stdio.h>
832 #if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
833 # include <bits/stdio2.h>
838 #endif /* <stdio.h> included. */
840 #endif /* !_STDIO_H */