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);
174 extern FILE *__REDIRECT (tmpfile
, (void), tmpfile64
);
176 # define tmpfile tmpfile64
180 #ifdef __USE_LARGEFILE64
181 extern FILE *tmpfile64 (void);
184 /* Generate a temporary filename. */
185 extern char *tmpnam (char *__s
) __THROW
;
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
;
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__
;
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
);
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
);
259 extern FILE *__REDIRECT (fopen
, (__const
char *__restrict __filename
,
260 __const
char *__restrict __modes
), fopen64
);
261 extern FILE *__REDIRECT (freopen
, (__const
char *__restrict __filename
,
262 __const
char *__restrict __modes
,
263 FILE *__restrict __stream
), freopen64
);
265 # define fopen fopen64
266 # define freopen freopen64
270 #ifdef __USE_LARGEFILE64
271 extern FILE *fopen64 (__const
char *__restrict __filename
,
272 __const
char *__restrict __modes
);
273 extern FILE *freopen64 (__const
char *__restrict __filename
,
274 __const
char *__restrict __modes
,
275 FILE *__restrict __stream
);
279 /* Create a new stream that refers to an existing system file descriptor. */
280 extern FILE *fdopen (int __fd
, __const
char *__modes
) __THROW
;
284 /* Create a new stream that refers to the given magic cookie,
285 and uses the given functions for input and output. */
286 extern FILE *fopencookie (void *__restrict __magic_cookie
,
287 __const
char *__restrict __modes
,
288 _IO_cookie_io_functions_t __io_funcs
) __THROW
;
290 /* Create a new stream that refers to a memory buffer. */
291 extern FILE *fmemopen (void *__s
, size_t __len
, __const
char *__modes
) __THROW
;
293 /* Open a stream that writes into a malloc'd buffer that is expanded as
294 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
295 and the number of characters written on fflush or fclose. */
296 extern FILE *open_memstream (char **__restrict __bufloc
,
297 size_t *__restrict __sizeloc
) __THROW
;
299 /* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces
300 a wide character string. */
301 extern FILE *open_wmemstream (wchar_t **__restrict __bufloc
,
302 size_t *__restrict __sizeloc
) __THROW
;
306 __BEGIN_NAMESPACE_STD
307 /* If BUF is NULL, make STREAM unbuffered.
308 Else make it use buffer BUF, of size BUFSIZ. */
309 extern void setbuf (FILE *__restrict __stream
, char *__restrict __buf
) __THROW
;
310 /* Make STREAM use buffering mode MODE.
311 If BUF is not NULL, use N bytes of it for buffering;
312 else allocate an internal buffer N bytes long. */
313 extern int setvbuf (FILE *__restrict __stream
, char *__restrict __buf
,
314 int __modes
, size_t __n
) __THROW
;
318 /* If BUF is NULL, make STREAM unbuffered.
319 Else make it use SIZE bytes of BUF for buffering. */
320 extern void setbuffer (FILE *__restrict __stream
, char *__restrict __buf
,
321 size_t __size
) __THROW
;
323 /* Make STREAM line-buffered. */
324 extern void setlinebuf (FILE *__stream
) __THROW
;
328 __BEGIN_NAMESPACE_STD
329 /* Write formatted output to STREAM.
331 This function is a possible cancellation point and therefore not
332 marked with __THROW. */
333 extern int fprintf (FILE *__restrict __stream
,
334 __const
char *__restrict __format
, ...);
335 /* Write formatted output to stdout.
337 This function is a possible cancellation point and therefore not
338 marked with __THROW. */
339 extern int printf (__const
char *__restrict __format
, ...);
340 /* Write formatted output to S. */
341 extern int sprintf (char *__restrict __s
,
342 __const
char *__restrict __format
, ...) __THROW
;
344 /* Write formatted output to S from argument list ARG.
346 This function is a possible cancellation point and therefore not
347 marked with __THROW. */
348 extern int vfprintf (FILE *__restrict __s
, __const
char *__restrict __format
,
350 /* Write formatted output to stdout from argument list ARG.
352 This function is a possible cancellation point and therefore not
353 marked with __THROW. */
354 extern int vprintf (__const
char *__restrict __format
, _G_va_list __arg
);
355 /* Write formatted output to S from argument list ARG. */
356 extern int vsprintf (char *__restrict __s
, __const
char *__restrict __format
,
357 _G_va_list __arg
) __THROW
;
360 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
361 __BEGIN_NAMESPACE_C99
362 /* Maximum chars of output to write in MAXLEN. */
363 extern int snprintf (char *__restrict __s
, size_t __maxlen
,
364 __const
char *__restrict __format
, ...)
365 __THROW
__attribute__ ((__format__ (__printf__
, 3, 4)));
367 extern int vsnprintf (char *__restrict __s
, size_t __maxlen
,
368 __const
char *__restrict __format
, _G_va_list __arg
)
369 __THROW
__attribute__ ((__format__ (__printf__
, 3, 0)));
374 /* Write formatted output to a string dynamically allocated with `malloc'.
375 Store the address of the string in *PTR. */
376 extern int vasprintf (char **__restrict __ptr
, __const
char *__restrict __f
,
378 __THROW
__attribute__ ((__format__ (__printf__
, 2, 0)));
379 extern int __asprintf (char **__restrict __ptr
,
380 __const
char *__restrict __fmt
, ...)
381 __THROW
__attribute__ ((__format__ (__printf__
, 2, 3)));
382 extern int asprintf (char **__restrict __ptr
,
383 __const
char *__restrict __fmt
, ...)
384 __THROW
__attribute__ ((__format__ (__printf__
, 2, 3)));
386 /* Write formatted output to a file descriptor.
388 These functions are not part of POSIX and therefore no official
389 cancellation point. But due to similarity with an POSIX interface
390 or due to the implementation they are cancellation points and
391 therefore not marked with __THROW. */
392 extern int vdprintf (int __fd
, __const
char *__restrict __fmt
,
394 __attribute__ ((__format__ (__printf__
, 2, 0)));
395 extern int dprintf (int __fd
, __const
char *__restrict __fmt
, ...)
396 __attribute__ ((__format__ (__printf__
, 2, 3)));
400 __BEGIN_NAMESPACE_STD
401 /* Read formatted input from STREAM.
403 This function is a possible cancellation point and therefore not
404 marked with __THROW. */
405 extern int fscanf (FILE *__restrict __stream
,
406 __const
char *__restrict __format
, ...) __wur
;
407 /* Read formatted input from stdin.
409 This function is a possible cancellation point and therefore not
410 marked with __THROW. */
411 extern int scanf (__const
char *__restrict __format
, ...) __wur
;
412 /* Read formatted input from S. */
413 extern int sscanf (__const
char *__restrict __s
,
414 __const
char *__restrict __format
, ...) __THROW
;
418 __BEGIN_NAMESPACE_C99
419 /* Read formatted input from S into argument list ARG.
421 This function is a possible cancellation point and therefore not
422 marked with __THROW. */
423 extern int vfscanf (FILE *__restrict __s
, __const
char *__restrict __format
,
425 __attribute__ ((__format__ (__scanf__
, 2, 0))) __wur
;
427 /* Read formatted input from stdin into argument list ARG.
429 This function is a possible cancellation point and therefore not
430 marked with __THROW. */
431 extern int vscanf (__const
char *__restrict __format
, _G_va_list __arg
)
432 __attribute__ ((__format__ (__scanf__
, 1, 0))) __wur
;
434 /* Read formatted input from S into argument list ARG. */
435 extern int vsscanf (__const
char *__restrict __s
,
436 __const
char *__restrict __format
, _G_va_list __arg
)
437 __THROW
__attribute__ ((__format__ (__scanf__
, 2, 0)));
439 #endif /* Use ISO C9x. */
442 __BEGIN_NAMESPACE_STD
443 /* Read a character from STREAM.
445 These functions are possible cancellation points and therefore not
446 marked with __THROW. */
447 extern int fgetc (FILE *__stream
);
448 extern int getc (FILE *__stream
);
450 /* Read a character from stdin.
452 This function is a possible cancellation point and therefore not
453 marked with __THROW. */
454 extern int getchar (void);
457 /* The C standard explicitly says this is a macro, so we always do the
458 optimization for it. */
459 #define getc(_fp) _IO_getc (_fp)
461 #if defined __USE_POSIX || defined __USE_MISC
462 /* These are defined in POSIX.1:1996.
464 These functions are possible cancellation points and therefore not
465 marked with __THROW. */
466 extern int getc_unlocked (FILE *__stream
);
467 extern int getchar_unlocked (void);
468 #endif /* Use POSIX or MISC. */
471 /* Faster version when locking is not necessary.
473 This function is not part of POSIX and therefore no official
474 cancellation point. But due to similarity with an POSIX interface
475 or due to the implementation it is a cancellation point and
476 therefore not marked with __THROW. */
477 extern int fgetc_unlocked (FILE *__stream
);
478 #endif /* Use MISC. */
481 __BEGIN_NAMESPACE_STD
482 /* Write a character to STREAM.
484 These functions are possible cancellation points and therefore not
487 These functions is a possible cancellation point and therefore not
488 marked with __THROW. */
489 extern int fputc (int __c
, FILE *__stream
);
490 extern int putc (int __c
, FILE *__stream
);
492 /* Write a character to stdout.
494 This function is a possible cancellation point and therefore not
495 marked with __THROW. */
496 extern int putchar (int __c
);
499 /* The C standard explicitly says this can be a macro,
500 so we always do the optimization for it. */
501 #define putc(_ch, _fp) _IO_putc (_ch, _fp)
504 /* Faster version when locking is not necessary.
506 This function is not part of POSIX and therefore no official
507 cancellation point. But due to similarity with an POSIX interface
508 or due to the implementation it is a cancellation point and
509 therefore not marked with __THROW. */
510 extern int fputc_unlocked (int __c
, FILE *__stream
);
511 #endif /* Use MISC. */
513 #if defined __USE_POSIX || defined __USE_MISC
514 /* These are defined in POSIX.1:1996.
516 These functions are possible cancellation points and therefore not
517 marked with __THROW. */
518 extern int putc_unlocked (int __c
, FILE *__stream
);
519 extern int putchar_unlocked (int __c
);
520 #endif /* Use POSIX or MISC. */
523 #if defined __USE_SVID || defined __USE_MISC \
524 || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
525 /* Get a word (int) from STREAM. */
526 extern int getw (FILE *__stream
);
528 /* Write a word (int) to STREAM. */
529 extern int putw (int __w
, FILE *__stream
);
533 __BEGIN_NAMESPACE_STD
534 /* Get a newline-terminated string of finite length from STREAM.
536 This function is a possible cancellation point and therefore not
537 marked with __THROW. */
538 extern char *fgets (char *__restrict __s
, int __n
, FILE *__restrict __stream
)
541 /* Get a newline-terminated string from stdin, removing the newline.
542 DO NOT USE THIS FUNCTION!! There is no limit on how much it will read.
544 This function is a possible cancellation point and therefore not
545 marked with __THROW. */
546 extern char *gets (char *__s
) __wur
;
550 /* This function does the same as `fgets' but does not lock the stream.
552 This function is not part of POSIX and therefore no official
553 cancellation point. But due to similarity with an POSIX interface
554 or due to the implementation it is a cancellation point and
555 therefore not marked with __THROW. */
556 extern char *fgets_unlocked (char *__restrict __s
, int __n
,
557 FILE *__restrict __stream
) __wur
;
562 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
563 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
564 NULL), pointing to *N characters of space. It is realloc'd as
565 necessary. Returns the number of characters read (not including the
566 null terminator), or -1 on error or EOF.
568 These functions are not part of POSIX and therefore no official
569 cancellation point. But due to similarity with an POSIX interface
570 or due to the implementation they are cancellation points and
571 therefore not marked with __THROW. */
572 extern _IO_ssize_t
__getdelim (char **__restrict __lineptr
,
573 size_t *__restrict __n
, int __delimiter
,
574 FILE *__restrict __stream
) __wur
;
575 extern _IO_ssize_t
getdelim (char **__restrict __lineptr
,
576 size_t *__restrict __n
, int __delimiter
,
577 FILE *__restrict __stream
) __wur
;
579 /* Like `getdelim', but reads up to a newline.
581 This function is not part of POSIX and therefore no official
582 cancellation point. But due to similarity with an POSIX interface
583 or due to the implementation it is a cancellation point and
584 therefore not marked with __THROW. */
585 extern _IO_ssize_t
getline (char **__restrict __lineptr
,
586 size_t *__restrict __n
,
587 FILE *__restrict __stream
) __wur
;
591 __BEGIN_NAMESPACE_STD
592 /* Write a string to STREAM.
594 This function is a possible cancellation points and therefore not
595 marked with __THROW. */
596 extern int fputs (__const
char *__restrict __s
, FILE *__restrict __stream
);
598 /* Write a string, followed by a newline, to stdout.
600 This function is a possible cancellation points and therefore not
601 marked with __THROW. */
602 extern int puts (__const
char *__s
);
605 /* Push a character back onto the input buffer of STREAM.
607 This function is a possible cancellation points and therefore not
608 marked with __THROW. */
609 extern int ungetc (int __c
, FILE *__stream
);
612 /* Read chunks of generic data from STREAM.
614 This function is a possible cancellation points and therefore not
615 marked with __THROW. */
616 extern size_t fread (void *__restrict __ptr
, size_t __size
,
617 size_t __n
, FILE *__restrict __stream
) __wur
;
618 /* Write chunks of generic data to STREAM.
620 This function is a possible cancellation points and therefore not
621 marked with __THROW. */
622 extern size_t fwrite (__const
void *__restrict __ptr
, size_t __size
,
623 size_t __n
, FILE *__restrict __s
) __wur
;
627 /* This function does the same as `fputs' but does not lock the stream.
629 This function is 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 it is a cancellation point and
632 therefore not marked with __THROW. */
633 extern int fputs_unlocked (__const
char *__restrict __s
,
634 FILE *__restrict __stream
);
638 /* Faster versions when locking is not necessary.
640 These functions are not part of POSIX and therefore no official
641 cancellation point. But due to similarity with an POSIX interface
642 or due to the implementation they are cancellation points and
643 therefore not marked with __THROW. */
644 extern size_t fread_unlocked (void *__restrict __ptr
, size_t __size
,
645 size_t __n
, FILE *__restrict __stream
) __wur
;
646 extern size_t fwrite_unlocked (__const
void *__restrict __ptr
, size_t __size
,
647 size_t __n
, FILE *__restrict __stream
) __wur
;
651 __BEGIN_NAMESPACE_STD
652 /* Seek to a certain position on STREAM.
654 This function is a possible cancellation point and therefore not
655 marked with __THROW. */
656 extern int fseek (FILE *__stream
, long int __off
, int __whence
);
657 /* Return the current position of STREAM.
659 This function is a possible cancellation point and therefore not
660 marked with __THROW. */
661 extern long int ftell (FILE *__stream
) __wur
;
662 /* Rewind to the beginning of STREAM.
664 This function is a possible cancellation point and therefore not
665 marked with __THROW. */
666 extern void rewind (FILE *__stream
);
669 /* The Single Unix Specification, Version 2, specifies an alternative,
670 more adequate interface for the two functions above which deal with
671 file offset. `long int' is not the right type. These definitions
672 are originally defined in the Large File Support API. */
674 #if defined __USE_LARGEFILE || defined __USE_XOPEN2K
675 # ifndef __USE_FILE_OFFSET64
676 /* Seek to a certain position on STREAM.
678 This function is a possible cancellation point and therefore not
679 marked with __THROW. */
680 extern int fseeko (FILE *__stream
, __off_t __off
, int __whence
);
681 /* Return the current position of STREAM.
683 This function is a possible cancellation point and therefore not
684 marked with __THROW. */
685 extern __off_t
ftello (FILE *__stream
) __wur
;
688 extern int __REDIRECT (fseeko
,
689 (FILE *__stream
, __off64_t __off
, int __whence
),
691 extern __off64_t
__REDIRECT (ftello
, (FILE *__stream
), ftello64
);
693 # define fseeko fseeko64
694 # define ftello ftello64
699 __BEGIN_NAMESPACE_STD
700 #ifndef __USE_FILE_OFFSET64
701 /* Get STREAM's position.
703 This function is a possible cancellation point and therefore not
704 marked with __THROW. */
705 extern int fgetpos (FILE *__restrict __stream
, fpos_t *__restrict __pos
);
706 /* Set STREAM's position.
708 This function is a possible cancellation point and therefore not
709 marked with __THROW. */
710 extern int fsetpos (FILE *__stream
, __const
fpos_t *__pos
);
713 extern int __REDIRECT (fgetpos
, (FILE *__restrict __stream
,
714 fpos_t *__restrict __pos
), fgetpos64
);
715 extern int __REDIRECT (fsetpos
,
716 (FILE *__stream
, __const
fpos_t *__pos
), fsetpos64
);
718 # define fgetpos fgetpos64
719 # define fsetpos fsetpos64
724 #ifdef __USE_LARGEFILE64
725 extern int fseeko64 (FILE *__stream
, __off64_t __off
, int __whence
);
726 extern __off64_t
ftello64 (FILE *__stream
) __wur
;
727 extern int fgetpos64 (FILE *__restrict __stream
, fpos64_t
*__restrict __pos
);
728 extern int fsetpos64 (FILE *__stream
, __const fpos64_t
*__pos
);
731 __BEGIN_NAMESPACE_STD
732 /* Clear the error and EOF indicators for STREAM. */
733 extern void clearerr (FILE *__stream
) __THROW
;
734 /* Return the EOF indicator for STREAM. */
735 extern int feof (FILE *__stream
) __THROW __wur
;
736 /* Return the error indicator for STREAM. */
737 extern int ferror (FILE *__stream
) __THROW __wur
;
741 /* Faster versions when locking is not required. */
742 extern void clearerr_unlocked (FILE *__stream
) __THROW
;
743 extern int feof_unlocked (FILE *__stream
) __THROW __wur
;
744 extern int ferror_unlocked (FILE *__stream
) __THROW __wur
;
748 __BEGIN_NAMESPACE_STD
749 /* Print a message describing the meaning of the value of errno.
751 This function is a possible cancellation point and therefore not
752 marked with __THROW. */
753 extern void perror (__const
char *__s
);
756 /* Provide the declarations for `sys_errlist' and `sys_nerr' if they
757 are available on this system. Even if available, these variables
758 should not be used directly. The `strerror' function provides
759 all the necessary functionality. */
760 #include <bits/sys_errlist.h>
764 /* Return the system file descriptor for STREAM. */
765 extern int fileno (FILE *__stream
) __THROW __wur
;
766 #endif /* Use POSIX. */
769 /* Faster version when locking is not required. */
770 extern int fileno_unlocked (FILE *__stream
) __THROW __wur
;
774 #if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \
776 /* Create a new stream connected to a pipe running the given command.
778 This function is a possible cancellation point and therefore not
779 marked with __THROW. */
780 extern FILE *popen (__const
char *__command
, __const
char *__modes
) __wur
;
782 /* Close a stream opened by popen and return the status of its child.
784 This function is a possible cancellation point and therefore not
785 marked with __THROW. */
786 extern int pclose (FILE *__stream
);
791 /* Return the name of the controlling terminal. */
792 extern char *ctermid (char *__s
) __THROW
;
793 #endif /* Use POSIX. */
797 /* Return the name of the current user. */
798 extern char *cuserid (char *__s
);
799 #endif /* Use X/Open, but not issue 6. */
803 struct obstack
; /* See <obstack.h>. */
805 /* Write formatted output to an obstack. */
806 extern int obstack_printf (struct obstack
*__restrict __obstack
,
807 __const
char *__restrict __format
, ...)
808 __THROW
__attribute__ ((__format__ (__printf__
, 2, 3)));
809 extern int obstack_vprintf (struct obstack
*__restrict __obstack
,
810 __const
char *__restrict __format
,
812 __THROW
__attribute__ ((__format__ (__printf__
, 2, 0)));
813 #endif /* Use GNU. */
816 #if defined __USE_POSIX || defined __USE_MISC
817 /* These are defined in POSIX.1:1996. */
819 /* Acquire ownership of STREAM. */
820 extern void flockfile (FILE *__stream
) __THROW
;
822 /* Try to acquire ownership of STREAM but do not block if it is not
824 extern int ftrylockfile (FILE *__stream
) __THROW __wur
;
826 /* Relinquish the ownership granted for STREAM. */
827 extern void funlockfile (FILE *__stream
) __THROW
;
828 #endif /* POSIX || misc */
830 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
831 /* The X/Open standard requires some functions and variables to be
832 declared here which do not belong into this header. But we have to
833 follow. In GNU mode we don't do this nonsense. */
834 # define __need_getopt
836 #endif /* X/Open, but not issue 6 and not for GNU. */
838 /* If we are compiling with optimizing read this file. It contains
839 several optimizing inline functions and macros. */
840 #ifdef __USE_EXTERN_INLINES
841 # include <bits/stdio.h>
843 #if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
844 # include <bits/stdio2.h>
847 # include <bits/stdio-ldbl.h>
852 #endif /* <stdio.h> included. */
854 #endif /* !_STDIO_H */