Back to index

glibc  2.9
stdio.h
Go to the documentation of this file.
00001 /* Define ISO C stdio on top of C++ iostreams.
00002    Copyright (C) 1991, 1994-2007, 2008 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 /*
00021  *     ISO C99 Standard: 7.19 Input/output       <stdio.h>
00022  */
00023 
00024 #ifndef _STDIO_H
00025 
00026 #if !defined __need_FILE && !defined __need___FILE
00027 # define _STDIO_H    1
00028 # include <features.h>
00029 
00030 __BEGIN_DECLS
00031 
00032 # define __need_size_t
00033 # define __need_NULL
00034 # include <stddef.h>
00035 
00036 # include <bits/types.h>
00037 # define __need_FILE
00038 # define __need___FILE
00039 #endif /* Don't need FILE.  */
00040 
00041 
00042 #if !defined __FILE_defined && defined __need_FILE
00043 
00044 /* Define outside of namespace so the C++ is happy.  */
00045 struct _IO_FILE;
00046 
00047 __BEGIN_NAMESPACE_STD
00048 /* The opaque type of streams.  This is the definition used elsewhere.  */
00049 typedef struct _IO_FILE FILE;
00050 __END_NAMESPACE_STD
00051 #if defined __USE_LARGEFILE64 || defined __USE_SVID || defined __USE_POSIX \
00052     || defined __USE_BSD || defined __USE_ISOC99 || defined __USE_XOPEN \
00053     || defined __USE_POSIX2
00054 __USING_NAMESPACE_STD(FILE)
00055 #endif
00056 
00057 # define __FILE_defined     1
00058 #endif /* FILE not defined.  */
00059 #undef __need_FILE
00060 
00061 
00062 #if !defined ____FILE_defined && defined __need___FILE
00063 
00064 /* The opaque type of streams.  This is the definition used elsewhere.  */
00065 typedef struct _IO_FILE __FILE;
00066 
00067 # define ____FILE_defined   1
00068 #endif /* __FILE not defined.  */
00069 #undef __need___FILE
00070 
00071 
00072 #ifdef _STDIO_H
00073 #define _STDIO_USES_IOSTREAM
00074 
00075 #include <libio.h>
00076 
00077 #ifdef __USE_XOPEN
00078 # ifdef __GNUC__
00079 #  ifndef _VA_LIST_DEFINED
00080 typedef _G_va_list va_list;
00081 #   define _VA_LIST_DEFINED
00082 #  endif
00083 # else
00084 #  include <stdarg.h>
00085 # endif
00086 #endif
00087 
00088 /* The type of the second argument to `fgetpos' and `fsetpos'.  */
00089 __BEGIN_NAMESPACE_STD
00090 #ifndef __USE_FILE_OFFSET64
00091 typedef _G_fpos_t fpos_t;
00092 #else
00093 typedef _G_fpos64_t fpos_t;
00094 #endif
00095 __END_NAMESPACE_STD
00096 #ifdef __USE_LARGEFILE64
00097 typedef _G_fpos64_t fpos64_t;
00098 #endif
00099 
00100 /* The possibilities for the third argument to `setvbuf'.  */
00101 #define _IOFBF 0            /* Fully buffered.  */
00102 #define _IOLBF 1            /* Line buffered.  */
00103 #define _IONBF 2            /* No buffering.  */
00104 
00105 
00106 /* Default buffer size.  */
00107 #ifndef BUFSIZ
00108 # define BUFSIZ _IO_BUFSIZ
00109 #endif
00110 
00111 
00112 /* End of file character.
00113    Some things throughout the library rely on this being -1.  */
00114 #ifndef EOF
00115 # define EOF (-1)
00116 #endif
00117 
00118 
00119 /* The possibilities for the third argument to `fseek'.
00120    These values should not be changed.  */
00121 #define SEEK_SET     0      /* Seek from beginning of file.  */
00122 #define SEEK_CUR     1      /* Seek from current position.  */
00123 #define SEEK_END     2      /* Seek from end of file.  */
00124 
00125 
00126 #if defined __USE_SVID || defined __USE_XOPEN
00127 /* Default path prefix for `tempnam' and `tmpnam'.  */
00128 # define P_tmpdir    "/tmp"
00129 #endif
00130 
00131 
00132 /* Get the values:
00133    L_tmpnam   How long an array of chars must be to be passed to `tmpnam'.
00134    TMP_MAX    The minimum number of unique filenames generated by tmpnam
00135               (and tempnam when it uses tmpnam's name space),
00136               or tempnam (the two are separate).
00137    L_ctermid  How long an array to pass to `ctermid'.
00138    L_cuserid  How long an array to pass to `cuserid'.
00139    FOPEN_MAX  Minimum number of files that can be open at once.
00140    FILENAME_MAX      Maximum length of a filename.  */
00141 #include <bits/stdio_lim.h>
00142 
00143 
00144 /* Standard streams.  */
00145 extern struct _IO_FILE *stdin;            /* Standard input stream.  */
00146 extern struct _IO_FILE *stdout;           /* Standard output stream.  */
00147 extern struct _IO_FILE *stderr;           /* Standard error output stream.  */
00148 /* C89/C99 say they're macros.  Make them happy.  */
00149 #define stdin stdin
00150 #define stdout stdout
00151 #define stderr stderr
00152 
00153 __BEGIN_NAMESPACE_STD
00154 /* Remove file FILENAME.  */
00155 extern int remove (__const char *__filename) __THROW;
00156 /* Rename file OLD to NEW.  */
00157 extern int rename (__const char *__old, __const char *__new) __THROW;
00158 __END_NAMESPACE_STD
00159 
00160 #ifdef __USE_ATFILE
00161 /* Rename file OLD relative to OLDFD to NEW relative to NEWFD.  */
00162 extern int renameat (int __oldfd, __const char *__old, int __newfd,
00163                    __const char *__new) __THROW;
00164 #endif
00165 
00166 __BEGIN_NAMESPACE_STD
00167 /* Create a temporary file and open it read/write.
00168 
00169    This function is a possible cancellation points and therefore not
00170    marked with __THROW.  */
00171 #ifndef __USE_FILE_OFFSET64
00172 extern FILE *tmpfile (void) __wur;
00173 #else
00174 # ifdef __REDIRECT
00175 extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) __wur;
00176 # else
00177 #  define tmpfile tmpfile64
00178 # endif
00179 #endif
00180 
00181 #ifdef __USE_LARGEFILE64
00182 extern FILE *tmpfile64 (void) __wur;
00183 #endif
00184 
00185 /* Generate a temporary filename.  */
00186 extern char *tmpnam (char *__s) __THROW __wur;
00187 __END_NAMESPACE_STD
00188 
00189 #ifdef __USE_MISC
00190 /* This is the reentrant variant of `tmpnam'.  The only difference is
00191    that it does not allow S to be NULL.  */
00192 extern char *tmpnam_r (char *__s) __THROW __wur;
00193 #endif
00194 
00195 
00196 #if defined __USE_SVID || defined __USE_XOPEN
00197 /* Generate a unique temporary filename using up to five characters of PFX
00198    if it is not NULL.  The directory to put this file in is searched for
00199    as follows: First the environment variable "TMPDIR" is checked.
00200    If it contains the name of a writable directory, that directory is used.
00201    If not and if DIR is not NULL, that value is checked.  If that fails,
00202    P_tmpdir is tried and finally "/tmp".  The storage for the filename
00203    is allocated by `malloc'.  */
00204 extern char *tempnam (__const char *__dir, __const char *__pfx)
00205      __THROW __attribute_malloc__ __wur;
00206 #endif
00207 
00208 
00209 __BEGIN_NAMESPACE_STD
00210 /* Close STREAM.
00211 
00212    This function is a possible cancellation point and therefore not
00213    marked with __THROW.  */
00214 extern int fclose (FILE *__stream);
00215 /* Flush STREAM, or all streams if STREAM is NULL.
00216 
00217    This function is a possible cancellation point and therefore not
00218    marked with __THROW.  */
00219 extern int fflush (FILE *__stream);
00220 __END_NAMESPACE_STD
00221 
00222 #ifdef __USE_MISC
00223 /* Faster versions when locking is not required.
00224 
00225    This function is not part of POSIX and therefore no official
00226    cancellation point.  But due to similarity with an POSIX interface
00227    or due to the implementation it is a cancellation point and
00228    therefore not marked with __THROW.  */
00229 extern int fflush_unlocked (FILE *__stream);
00230 #endif
00231 
00232 #ifdef __USE_GNU
00233 /* Close all streams.
00234 
00235    This function is not part of POSIX and therefore no official
00236    cancellation point.  But due to similarity with an POSIX interface
00237    or due to the implementation it is a cancellation point and
00238    therefore not marked with __THROW.  */
00239 extern int fcloseall (void);
00240 #endif
00241 
00242 
00243 __BEGIN_NAMESPACE_STD
00244 #ifndef __USE_FILE_OFFSET64
00245 /* Open a file and create a new stream for it.
00246 
00247    This function is a possible cancellation point and therefore not
00248    marked with __THROW.  */
00249 extern FILE *fopen (__const char *__restrict __filename,
00250                   __const char *__restrict __modes) __wur;
00251 /* Open a file, replacing an existing stream with it.
00252 
00253    This function is a possible cancellation point and therefore not
00254    marked with __THROW.  */
00255 extern FILE *freopen (__const char *__restrict __filename,
00256                     __const char *__restrict __modes,
00257                     FILE *__restrict __stream) __wur;
00258 #else
00259 # ifdef __REDIRECT
00260 extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename,
00261                              __const char *__restrict __modes), fopen64)
00262   __wur;
00263 extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
00264                                __const char *__restrict __modes,
00265                                FILE *__restrict __stream), freopen64)
00266   __wur;
00267 # else
00268 #  define fopen fopen64
00269 #  define freopen freopen64
00270 # endif
00271 #endif
00272 __END_NAMESPACE_STD
00273 #ifdef __USE_LARGEFILE64
00274 extern FILE *fopen64 (__const char *__restrict __filename,
00275                     __const char *__restrict __modes) __wur;
00276 extern FILE *freopen64 (__const char *__restrict __filename,
00277                      __const char *__restrict __modes,
00278                      FILE *__restrict __stream) __wur;
00279 #endif
00280 
00281 #ifdef __USE_POSIX
00282 /* Create a new stream that refers to an existing system file descriptor.  */
00283 extern FILE *fdopen (int __fd, __const char *__modes) __THROW __wur;
00284 #endif
00285 
00286 #ifdef __USE_GNU
00287 /* Create a new stream that refers to the given magic cookie,
00288    and uses the given functions for input and output.  */
00289 extern FILE *fopencookie (void *__restrict __magic_cookie,
00290                        __const char *__restrict __modes,
00291                        _IO_cookie_io_functions_t __io_funcs) __THROW __wur;
00292 
00293 /* Create a new stream that refers to a memory buffer.  */
00294 extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes)
00295   __THROW __wur;
00296 
00297 /* Open a stream that writes into a malloc'd buffer that is expanded as
00298    necessary.  *BUFLOC and *SIZELOC are updated with the buffer's location
00299    and the number of characters written on fflush or fclose.  */
00300 extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur;
00301 #endif
00302 
00303 
00304 __BEGIN_NAMESPACE_STD
00305 /* If BUF is NULL, make STREAM unbuffered.
00306    Else make it use buffer BUF, of size BUFSIZ.  */
00307 extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
00308 /* Make STREAM use buffering mode MODE.
00309    If BUF is not NULL, use N bytes of it for buffering;
00310    else allocate an internal buffer N bytes long.  */
00311 extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
00312                   int __modes, size_t __n) __THROW;
00313 __END_NAMESPACE_STD
00314 
00315 #ifdef __USE_BSD
00316 /* If BUF is NULL, make STREAM unbuffered.
00317    Else make it use SIZE bytes of BUF for buffering.  */
00318 extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
00319                      size_t __size) __THROW;
00320 
00321 /* Make STREAM line-buffered.  */
00322 extern void setlinebuf (FILE *__stream) __THROW;
00323 #endif
00324 
00325 
00326 __BEGIN_NAMESPACE_STD
00327 /* Write formatted output to STREAM.
00328 
00329    This function is a possible cancellation point and therefore not
00330    marked with __THROW.  */
00331 extern int fprintf (FILE *__restrict __stream,
00332                   __const char *__restrict __format, ...);
00333 /* Write formatted output to stdout.
00334 
00335    This function is a possible cancellation point and therefore not
00336    marked with __THROW.  */
00337 extern int printf (__const char *__restrict __format, ...);
00338 /* Write formatted output to S.  */
00339 extern int sprintf (char *__restrict __s,
00340                   __const char *__restrict __format, ...) __THROW;
00341 
00342 /* Write formatted output to S from argument list ARG.
00343 
00344    This function is a possible cancellation point and therefore not
00345    marked with __THROW.  */
00346 extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
00347                    _G_va_list __arg);
00348 /* Write formatted output to stdout from argument list ARG.
00349 
00350    This function is a possible cancellation point and therefore not
00351    marked with __THROW.  */
00352 extern int vprintf (__const char *__restrict __format, _G_va_list __arg);
00353 /* Write formatted output to S from argument list ARG.  */
00354 extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
00355                    _G_va_list __arg) __THROW;
00356 __END_NAMESPACE_STD
00357 
00358 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
00359 __BEGIN_NAMESPACE_C99
00360 /* Maximum chars of output to write in MAXLEN.  */
00361 extern int snprintf (char *__restrict __s, size_t __maxlen,
00362                    __const char *__restrict __format, ...)
00363      __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
00364 
00365 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
00366                     __const char *__restrict __format, _G_va_list __arg)
00367      __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
00368 __END_NAMESPACE_C99
00369 #endif
00370 
00371 #ifdef __USE_GNU
00372 /* Write formatted output to a string dynamically allocated with `malloc'.
00373    Store the address of the string in *PTR.  */
00374 extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
00375                     _G_va_list __arg)
00376      __THROW __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
00377 extern int __asprintf (char **__restrict __ptr,
00378                      __const char *__restrict __fmt, ...)
00379      __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
00380 extern int asprintf (char **__restrict __ptr,
00381                    __const char *__restrict __fmt, ...)
00382      __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
00383 
00384 /* Write formatted output to a file descriptor.
00385 
00386    These functions are not part of POSIX and therefore no official
00387    cancellation point.  But due to similarity with an POSIX interface
00388    or due to the implementation they are cancellation points and
00389    therefore not marked with __THROW.  */
00390 extern int vdprintf (int __fd, __const char *__restrict __fmt,
00391                    _G_va_list __arg)
00392      __attribute__ ((__format__ (__printf__, 2, 0)));
00393 extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
00394      __attribute__ ((__format__ (__printf__, 2, 3)));
00395 #endif
00396 
00397 
00398 __BEGIN_NAMESPACE_STD
00399 /* Read formatted input from STREAM.
00400 
00401    This function is a possible cancellation point and therefore not
00402    marked with __THROW.  */
00403 extern int fscanf (FILE *__restrict __stream,
00404                  __const char *__restrict __format, ...) __wur;
00405 /* Read formatted input from stdin.
00406 
00407    This function is a possible cancellation point and therefore not
00408    marked with __THROW.  */
00409 extern int scanf (__const char *__restrict __format, ...) __wur;
00410 /* Read formatted input from S.  */
00411 extern int sscanf (__const char *__restrict __s,
00412                  __const char *__restrict __format, ...) __THROW;
00413 
00414 #if defined __USE_ISOC99 && !defined __USE_GNU \
00415     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
00416     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
00417 # ifdef __REDIRECT
00418 /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
00419    GNU extension which conflicts with valid %a followed by letter
00420    s, S or [.  */
00421 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
00422                             __const char *__restrict __format, ...),
00423                      __isoc99_fscanf) __wur;
00424 extern int __REDIRECT (scanf, (__const char *__restrict __format, ...),
00425                      __isoc99_scanf) __wur;
00426 extern int __REDIRECT (sscanf, (__const char *__restrict __s,
00427                             __const char *__restrict __format, ...),
00428                      __isoc99_sscanf) __THROW;
00429 # else
00430 extern int __isoc99_fscanf (FILE *__restrict __stream,
00431                          __const char *__restrict __format, ...) __wur;
00432 extern int __isoc99_scanf (__const char *__restrict __format, ...) __wur;
00433 extern int __isoc99_sscanf (__const char *__restrict __s,
00434                          __const char *__restrict __format, ...) __THROW;
00435 #  define fscanf __isoc99_fscanf
00436 #  define scanf __isoc99_scanf
00437 #  define sscanf __isoc99_sscanf
00438 # endif
00439 #endif
00440 
00441 __END_NAMESPACE_STD
00442 
00443 #ifdef __USE_ISOC99
00444 __BEGIN_NAMESPACE_C99
00445 /* Read formatted input from S into argument list ARG.
00446 
00447    This function is a possible cancellation point and therefore not
00448    marked with __THROW.  */
00449 extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
00450                   _G_va_list __arg)
00451      __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
00452 
00453 /* Read formatted input from stdin into argument list ARG.
00454 
00455    This function is a possible cancellation point and therefore not
00456    marked with __THROW.  */
00457 extern int vscanf (__const char *__restrict __format, _G_va_list __arg)
00458      __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
00459 
00460 /* Read formatted input from S into argument list ARG.  */
00461 extern int vsscanf (__const char *__restrict __s,
00462                   __const char *__restrict __format, _G_va_list __arg)
00463      __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
00464 
00465 # if !defined __USE_GNU \
00466      && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
00467      && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
00468 #  ifdef __REDIRECT
00469 /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
00470    GNU extension which conflicts with valid %a followed by letter
00471    s, S or [.  */
00472 extern int __REDIRECT (vfscanf,
00473                      (FILE *__restrict __s,
00474                      __const char *__restrict __format, _G_va_list __arg),
00475                      __isoc99_vfscanf)
00476      __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
00477 extern int __REDIRECT (vscanf, (__const char *__restrict __format,
00478                             _G_va_list __arg), __isoc99_vscanf)
00479      __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
00480 extern int __REDIRECT (vsscanf,
00481                      (__const char *__restrict __s,
00482                      __const char *__restrict __format, _G_va_list __arg),
00483                      __isoc99_vsscanf)
00484      __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
00485 #  else
00486 extern int __isoc99_vfscanf (FILE *__restrict __s,
00487                           __const char *__restrict __format,
00488                           _G_va_list __arg) __wur;
00489 extern int __isoc99_vscanf (__const char *__restrict __format,
00490                          _G_va_list __arg) __wur;
00491 extern int __isoc99_vsscanf (__const char *__restrict __s,
00492                           __const char *__restrict __format,
00493                           _G_va_list __arg) __THROW;
00494 #   define vfscanf __isoc99_vfscanf
00495 #   define vscanf __isoc99_vscanf
00496 #   define vsscanf __isoc99_vsscanf
00497 #  endif
00498 # endif
00499 
00500 __END_NAMESPACE_C99
00501 #endif /* Use ISO C9x.  */
00502 
00503 
00504 __BEGIN_NAMESPACE_STD
00505 /* Read a character from STREAM.
00506 
00507    These functions are possible cancellation points and therefore not
00508    marked with __THROW.  */
00509 extern int fgetc (FILE *__stream);
00510 extern int getc (FILE *__stream);
00511 
00512 /* Read a character from stdin.
00513 
00514    This function is a possible cancellation point and therefore not
00515    marked with __THROW.  */
00516 extern int getchar (void);
00517 __END_NAMESPACE_STD
00518 
00519 /* The C standard explicitly says this is a macro, so we always do the
00520    optimization for it.  */
00521 #define getc(_fp) _IO_getc (_fp)
00522 
00523 #if defined __USE_POSIX || defined __USE_MISC
00524 /* These are defined in POSIX.1:1996.
00525 
00526    These functions are possible cancellation points and therefore not
00527    marked with __THROW.  */
00528 extern int getc_unlocked (FILE *__stream);
00529 extern int getchar_unlocked (void);
00530 #endif /* Use POSIX or MISC.  */
00531 
00532 #ifdef __USE_MISC
00533 /* Faster version when locking is not necessary.
00534 
00535    This function is not part of POSIX and therefore no official
00536    cancellation point.  But due to similarity with an POSIX interface
00537    or due to the implementation it is a cancellation point and
00538    therefore not marked with __THROW.  */
00539 extern int fgetc_unlocked (FILE *__stream);
00540 #endif /* Use MISC.  */
00541 
00542 
00543 __BEGIN_NAMESPACE_STD
00544 /* Write a character to STREAM.
00545 
00546    These functions are possible cancellation points and therefore not
00547    marked with __THROW.
00548 
00549    These functions is a possible cancellation point and therefore not
00550    marked with __THROW.  */
00551 extern int fputc (int __c, FILE *__stream);
00552 extern int putc (int __c, FILE *__stream);
00553 
00554 /* Write a character to stdout.
00555 
00556    This function is a possible cancellation point and therefore not
00557    marked with __THROW.  */
00558 extern int putchar (int __c);
00559 __END_NAMESPACE_STD
00560 
00561 /* The C standard explicitly says this can be a macro,
00562    so we always do the optimization for it.  */
00563 #define putc(_ch, _fp) _IO_putc (_ch, _fp)
00564 
00565 #ifdef __USE_MISC
00566 /* Faster version when locking is not necessary.
00567 
00568    This function is not part of POSIX and therefore no official
00569    cancellation point.  But due to similarity with an POSIX interface
00570    or due to the implementation it is a cancellation point and
00571    therefore not marked with __THROW.  */
00572 extern int fputc_unlocked (int __c, FILE *__stream);
00573 #endif /* Use MISC.  */
00574 
00575 #if defined __USE_POSIX || defined __USE_MISC
00576 /* These are defined in POSIX.1:1996.
00577 
00578    These functions are possible cancellation points and therefore not
00579    marked with __THROW.  */
00580 extern int putc_unlocked (int __c, FILE *__stream);
00581 extern int putchar_unlocked (int __c);
00582 #endif /* Use POSIX or MISC.  */
00583 
00584 
00585 #if defined __USE_SVID || defined __USE_MISC \
00586     || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
00587 /* Get a word (int) from STREAM.  */
00588 extern int getw (FILE *__stream);
00589 
00590 /* Write a word (int) to STREAM.  */
00591 extern int putw (int __w, FILE *__stream);
00592 #endif
00593 
00594 
00595 __BEGIN_NAMESPACE_STD
00596 /* Get a newline-terminated string of finite length from STREAM.
00597 
00598    This function is a possible cancellation point and therefore not
00599    marked with __THROW.  */
00600 extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
00601      __wur;
00602 
00603 /* Get a newline-terminated string from stdin, removing the newline.
00604    DO NOT USE THIS FUNCTION!!  There is no limit on how much it will read.
00605 
00606    This function is a possible cancellation point and therefore not
00607    marked with __THROW.  */
00608 extern char *gets (char *__s) __wur;
00609 __END_NAMESPACE_STD
00610 
00611 #ifdef __USE_GNU
00612 /* This function does the same as `fgets' but does not lock the stream.
00613 
00614    This function is not part of POSIX and therefore no official
00615    cancellation point.  But due to similarity with an POSIX interface
00616    or due to the implementation it is a cancellation point and
00617    therefore not marked with __THROW.  */
00618 extern char *fgets_unlocked (char *__restrict __s, int __n,
00619                           FILE *__restrict __stream) __wur;
00620 #endif
00621 
00622 
00623 #ifdef __USE_GNU
00624 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
00625    (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
00626    NULL), pointing to *N characters of space.  It is realloc'd as
00627    necessary.  Returns the number of characters read (not including the
00628    null terminator), or -1 on error or EOF.
00629 
00630    These functions are not part of POSIX and therefore no official
00631    cancellation point.  But due to similarity with an POSIX interface
00632    or due to the implementation they are cancellation points and
00633    therefore not marked with __THROW.  */
00634 extern _IO_ssize_t __getdelim (char **__restrict __lineptr,
00635                             size_t *__restrict __n, int __delimiter,
00636                             FILE *__restrict __stream) __wur;
00637 extern _IO_ssize_t getdelim (char **__restrict __lineptr,
00638                           size_t *__restrict __n, int __delimiter,
00639                           FILE *__restrict __stream) __wur;
00640 
00641 /* Like `getdelim', but reads up to a newline.
00642 
00643    This function is not part of POSIX and therefore no official
00644    cancellation point.  But due to similarity with an POSIX interface
00645    or due to the implementation it is a cancellation point and
00646    therefore not marked with __THROW.  */
00647 extern _IO_ssize_t getline (char **__restrict __lineptr,
00648                          size_t *__restrict __n,
00649                          FILE *__restrict __stream) __wur;
00650 #endif
00651 
00652 
00653 __BEGIN_NAMESPACE_STD
00654 /* Write a string to STREAM.
00655 
00656    This function is a possible cancellation points and therefore not
00657    marked with __THROW.  */
00658 extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
00659 
00660 /* Write a string, followed by a newline, to stdout.
00661 
00662    This function is a possible cancellation points and therefore not
00663    marked with __THROW.  */
00664 extern int puts (__const char *__s);
00665 
00666 
00667 /* Push a character back onto the input buffer of STREAM.
00668 
00669    This function is a possible cancellation points and therefore not
00670    marked with __THROW.  */
00671 extern int ungetc (int __c, FILE *__stream);
00672 
00673 
00674 /* Read chunks of generic data from STREAM.
00675 
00676    This function is a possible cancellation points and therefore not
00677    marked with __THROW.  */
00678 extern size_t fread (void *__restrict __ptr, size_t __size,
00679                    size_t __n, FILE *__restrict __stream) __wur;
00680 /* Write chunks of generic data to STREAM.
00681 
00682    This function is a possible cancellation points and therefore not
00683    marked with __THROW.  */
00684 extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
00685                     size_t __n, FILE *__restrict __s) __wur;
00686 __END_NAMESPACE_STD
00687 
00688 #ifdef __USE_GNU
00689 /* This function does the same as `fputs' but does not lock the stream.
00690 
00691    This function is not part of POSIX and therefore no official
00692    cancellation point.  But due to similarity with an POSIX interface
00693    or due to the implementation it is a cancellation point and
00694    therefore not marked with __THROW.  */
00695 extern int fputs_unlocked (__const char *__restrict __s,
00696                         FILE *__restrict __stream);
00697 #endif
00698 
00699 #ifdef __USE_MISC
00700 /* Faster versions when locking is not necessary.
00701 
00702    These functions are not part of POSIX and therefore no official
00703    cancellation point.  But due to similarity with an POSIX interface
00704    or due to the implementation they are cancellation points and
00705    therefore not marked with __THROW.  */
00706 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
00707                            size_t __n, FILE *__restrict __stream) __wur;
00708 extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
00709                             size_t __n, FILE *__restrict __stream) __wur;
00710 #endif
00711 
00712 
00713 __BEGIN_NAMESPACE_STD
00714 /* Seek to a certain position on STREAM.
00715 
00716    This function is a possible cancellation point and therefore not
00717    marked with __THROW.  */
00718 extern int fseek (FILE *__stream, long int __off, int __whence);
00719 /* Return the current position of STREAM.
00720 
00721    This function is a possible cancellation point and therefore not
00722    marked with __THROW.  */
00723 extern long int ftell (FILE *__stream) __wur;
00724 /* Rewind to the beginning of STREAM.
00725 
00726    This function is a possible cancellation point and therefore not
00727    marked with __THROW.  */
00728 extern void rewind (FILE *__stream);
00729 __END_NAMESPACE_STD
00730 
00731 /* The Single Unix Specification, Version 2, specifies an alternative,
00732    more adequate interface for the two functions above which deal with
00733    file offset.  `long int' is not the right type.  These definitions
00734    are originally defined in the Large File Support API.  */
00735 
00736 #if defined __USE_LARGEFILE || defined __USE_XOPEN2K
00737 # ifndef __USE_FILE_OFFSET64
00738 /* Seek to a certain position on STREAM.
00739 
00740    This function is a possible cancellation point and therefore not
00741    marked with __THROW.  */
00742 extern int fseeko (FILE *__stream, __off_t __off, int __whence);
00743 /* Return the current position of STREAM.
00744 
00745    This function is a possible cancellation point and therefore not
00746    marked with __THROW.  */
00747 extern __off_t ftello (FILE *__stream) __wur;
00748 # else
00749 #  ifdef __REDIRECT
00750 extern int __REDIRECT (fseeko,
00751                      (FILE *__stream, __off64_t __off, int __whence),
00752                      fseeko64);
00753 extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64);
00754 #  else
00755 #   define fseeko fseeko64
00756 #   define ftello ftello64
00757 #  endif
00758 # endif
00759 #endif
00760 
00761 __BEGIN_NAMESPACE_STD
00762 #ifndef __USE_FILE_OFFSET64
00763 /* Get STREAM's position.
00764 
00765    This function is a possible cancellation point and therefore not
00766    marked with __THROW.  */
00767 extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
00768 /* Set STREAM's position.
00769 
00770    This function is a possible cancellation point and therefore not
00771    marked with __THROW.  */
00772 extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
00773 #else
00774 # ifdef __REDIRECT
00775 extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
00776                              fpos_t *__restrict __pos), fgetpos64);
00777 extern int __REDIRECT (fsetpos,
00778                      (FILE *__stream, __const fpos_t *__pos), fsetpos64);
00779 # else
00780 #  define fgetpos fgetpos64
00781 #  define fsetpos fsetpos64
00782 # endif
00783 #endif
00784 __END_NAMESPACE_STD
00785 
00786 #ifdef __USE_LARGEFILE64
00787 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
00788 extern __off64_t ftello64 (FILE *__stream) __wur;
00789 extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
00790 extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos);
00791 #endif
00792 
00793 __BEGIN_NAMESPACE_STD
00794 /* Clear the error and EOF indicators for STREAM.  */
00795 extern void clearerr (FILE *__stream) __THROW;
00796 /* Return the EOF indicator for STREAM.  */
00797 extern int feof (FILE *__stream) __THROW __wur;
00798 /* Return the error indicator for STREAM.  */
00799 extern int ferror (FILE *__stream) __THROW __wur;
00800 __END_NAMESPACE_STD
00801 
00802 #ifdef __USE_MISC
00803 /* Faster versions when locking is not required.  */
00804 extern void clearerr_unlocked (FILE *__stream) __THROW;
00805 extern int feof_unlocked (FILE *__stream) __THROW __wur;
00806 extern int ferror_unlocked (FILE *__stream) __THROW __wur;
00807 #endif
00808 
00809 
00810 __BEGIN_NAMESPACE_STD
00811 /* Print a message describing the meaning of the value of errno.
00812 
00813    This function is a possible cancellation point and therefore not
00814    marked with __THROW.  */
00815 extern void perror (__const char *__s);
00816 __END_NAMESPACE_STD
00817 
00818 /* Provide the declarations for `sys_errlist' and `sys_nerr' if they
00819    are available on this system.  Even if available, these variables
00820    should not be used directly.  The `strerror' function provides
00821    all the necessary functionality.  */
00822 #include <bits/sys_errlist.h>
00823 
00824 
00825 #ifdef __USE_POSIX
00826 /* Return the system file descriptor for STREAM.  */
00827 extern int fileno (FILE *__stream) __THROW __wur;
00828 #endif /* Use POSIX.  */
00829 
00830 #ifdef __USE_MISC
00831 /* Faster version when locking is not required.  */
00832 extern int fileno_unlocked (FILE *__stream) __THROW __wur;
00833 #endif
00834 
00835 
00836 #if (defined __USE_POSIX2 || defined __USE_SVID  || defined __USE_BSD || \
00837      defined __USE_MISC)
00838 /* Create a new stream connected to a pipe running the given command.
00839 
00840    This function is a possible cancellation point and therefore not
00841    marked with __THROW.  */
00842 extern FILE *popen (__const char *__command, __const char *__modes) __wur;
00843 
00844 /* Close a stream opened by popen and return the status of its child.
00845 
00846    This function is a possible cancellation point and therefore not
00847    marked with __THROW.  */
00848 extern int pclose (FILE *__stream);
00849 #endif
00850 
00851 
00852 #ifdef __USE_POSIX
00853 /* Return the name of the controlling terminal.  */
00854 extern char *ctermid (char *__s) __THROW;
00855 #endif /* Use POSIX.  */
00856 
00857 
00858 #ifdef __USE_XOPEN
00859 /* Return the name of the current user.  */
00860 extern char *cuserid (char *__s);
00861 #endif /* Use X/Open, but not issue 6.  */
00862 
00863 
00864 #ifdef __USE_GNU
00865 struct obstack;                    /* See <obstack.h>.  */
00866 
00867 /* Write formatted output to an obstack.  */
00868 extern int obstack_printf (struct obstack *__restrict __obstack,
00869                         __const char *__restrict __format, ...)
00870      __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
00871 extern int obstack_vprintf (struct obstack *__restrict __obstack,
00872                          __const char *__restrict __format,
00873                          _G_va_list __args)
00874      __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
00875 #endif /* Use GNU.  */
00876 
00877 
00878 #if defined __USE_POSIX || defined __USE_MISC
00879 /* These are defined in POSIX.1:1996.  */
00880 
00881 /* Acquire ownership of STREAM.  */
00882 extern void flockfile (FILE *__stream) __THROW;
00883 
00884 /* Try to acquire ownership of STREAM but do not block if it is not
00885    possible.  */
00886 extern int ftrylockfile (FILE *__stream) __THROW __wur;
00887 
00888 /* Relinquish the ownership granted for STREAM.  */
00889 extern void funlockfile (FILE *__stream) __THROW;
00890 #endif /* POSIX || misc */
00891 
00892 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
00893 /* The X/Open standard requires some functions and variables to be
00894    declared here which do not belong into this header.  But we have to
00895    follow.  In GNU mode we don't do this nonsense.  */
00896 # define __need_getopt
00897 # include <getopt.h>
00898 #endif /* X/Open, but not issue 6 and not for GNU.  */
00899 
00900 /* If we are compiling with optimizing read this file.  It contains
00901    several optimizing inline functions and macros.  */
00902 #ifdef __USE_EXTERN_INLINES
00903 # include <bits/stdio.h>
00904 #endif
00905 #if __USE_FORTIFY_LEVEL > 0 && defined __extern_always_inline
00906 # include <bits/stdio2.h>
00907 #endif
00908 #ifdef __LDBL_COMPAT
00909 # include <bits/stdio-ldbl.h>
00910 #endif
00911 
00912 __END_DECLS
00913 
00914 #endif /* <stdio.h> included.  */
00915 
00916 #endif /* !_STDIO_H */