stdio.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. /* Define ISO C stdio on top of C++ iostreams.
  2. Copyright (C) 1991, 1994-1999, 2000, 2001 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. /*
  17. * ISO C99 Standard: 7.19 Input/output <stdio.h>
  18. */
  19. #ifndef _STDIO_H
  20. #if !defined __need_FILE && !defined __need___FILE
  21. # define _STDIO_H 1
  22. # include <features.h>
  23. __BEGIN_DECLS
  24. # define __need_size_t
  25. # define __need_NULL
  26. # include <stddef.h>
  27. # include <bits/types.h>
  28. # define __need_FILE
  29. # define __need___FILE
  30. #endif /* Don't need FILE. */
  31. #include <sys/types.h>
  32. #if !defined __FILE_defined && defined __need_FILE
  33. /* The opaque type of streams. This is the definition used elsewhere. */
  34. /* when you add or change fields here, be sure to change the initialization
  35. * in stdio_init and fopen */
  36. struct _IO_FILE {
  37. unsigned char *bufpos; /* the next byte to write to or read from */
  38. unsigned char *bufread; /* the end of data returned by last read() */
  39. unsigned char *bufwrite; /* 1 + highest address writable by macro */
  40. unsigned char *bufstart; /* the start of the buffer */
  41. unsigned char *bufend; /* the end of the buffer; ie the byte after the last
  42. malloc()ed byte */
  43. struct _IO_FILE * next;
  44. int fd; /* the file descriptor associated with the stream */
  45. unsigned char mode;
  46. unsigned char ungot;
  47. char unbuf[2]; /* The buffer for 'unbuffered' streams */
  48. };
  49. typedef struct _IO_FILE FILE;
  50. # define __FILE_defined 1
  51. #endif /* FILE not defined. */
  52. #undef __need_FILE
  53. #if !defined ____FILE_defined && defined __need___FILE
  54. /* The opaque type of streams. This is the definition used elsewhere. */
  55. typedef struct _IO_FILE __FILE;
  56. # define ____FILE_defined 1
  57. #endif /* __FILE not defined. */
  58. #undef __need___FILE
  59. #ifdef _STDIO_H
  60. #undef _STDIO_USES_IOSTREAM
  61. #include <stdarg.h>
  62. typedef va_list _G_va_list;
  63. /* The type of the second argument to `fgetpos' and `fsetpos'. */
  64. #ifndef __USE_FILE_OFFSET64
  65. typedef __off_t fpos_t;
  66. #else
  67. typedef __off64_t fpos_t;
  68. #endif
  69. #ifdef __USE_LARGEFILE64
  70. typedef __off64_t fpos64_t;
  71. #endif
  72. /* The possibilities for the third argument to `setvbuf'. */
  73. #define _IOFBF 0 /* Fully buffered. */
  74. #define _IOLBF 1 /* Line buffered. */
  75. #define _IONBF 2 /* No buffering. */
  76. /* Possible states for a file stream -- internal use only */
  77. #define __MODE_BUF 0x03 /* Modal buffering dependent on isatty */
  78. #define __MODE_FREEBUF 0x04 /* Buffer allocated by stdio code, can free */
  79. #define __MODE_FREEFIL 0x08 /* FILE allocated by stdio code, can free */
  80. #define __MODE_UNGOT 0x10 /* Buffer has been polluted by ungetc */
  81. #define __MODE_TIED 0x20 /* FILE is tied with stdin/stdout */
  82. #define __MODE_EOF 0x40 /* EOF status */
  83. #define __MODE_ERR 0x80 /* Error status */
  84. /* Default buffer size. */
  85. #ifndef BUFSIZ
  86. # define BUFSIZ (512)
  87. #endif
  88. /* End of file character.
  89. Some things throughout the library rely on this being -1. */
  90. #ifndef EOF
  91. # define EOF (-1)
  92. #endif
  93. /* The possibilities for the third argument to `fseek'.
  94. These values should not be changed. */
  95. #define SEEK_SET 0 /* Seek from beginning of file. */
  96. #define SEEK_CUR 1 /* Seek from current position. */
  97. #define SEEK_END 2 /* Seek from end of file. */
  98. #if defined __USE_SVID || defined __USE_XOPEN
  99. /* Default path prefix for `tempnam' and `tmpnam'. */
  100. # define P_tmpdir "/tmp"
  101. #endif
  102. /* Get the values:
  103. L_tmpnam How long an array of chars must be to be passed to `tmpnam'.
  104. TMP_MAX The minimum number of unique filenames generated by tmpnam
  105. (and tempnam when it uses tmpnam's name space),
  106. or tempnam (the two are separate).
  107. L_ctermid How long an array to pass to `ctermid'.
  108. L_cuserid How long an array to pass to `cuserid'.
  109. FOPEN_MAX Minimum number of files that can be open at once.
  110. FILENAME_MAX Maximum length of a filename. */
  111. #include <bits/stdio_lim.h>
  112. /* Standard streams. */
  113. extern FILE *stdin; /* Standard input stream. */
  114. extern FILE *stdout; /* Standard output stream. */
  115. extern FILE *stderr; /* Standard error output stream. */
  116. /* C89/C99 say they're macros. Make them happy. */
  117. #define stdin stdin
  118. #define stdout stdout
  119. #define stderr stderr
  120. /* Remove file FILENAME. */
  121. extern int remove (__const char *__filename) __THROW;
  122. /* Rename file OLD to NEW. */
  123. extern int rename (__const char *__old, __const char *__new) __THROW;
  124. /* Create a temporary file and open it read/write. */
  125. #ifndef __USE_FILE_OFFSET64
  126. extern FILE *tmpfile (void) __THROW;
  127. #else
  128. # ifdef __REDIRECT
  129. extern FILE *__REDIRECT (tmpfile, (void) __THROW, tmpfile64);
  130. # else
  131. # define tmpfile tmpfile64
  132. # endif
  133. #endif
  134. #ifdef __USE_LARGEFILE64
  135. extern FILE *tmpfile64 (void) __THROW;
  136. #endif
  137. /* Generate a temporary filename. */
  138. extern char *tmpnam (char *__s) __THROW;
  139. #ifdef __USE_MISC
  140. /* This is the reentrant variant of `tmpnam'. The only difference is
  141. that it does not allow S to be NULL. */
  142. extern char *tmpnam_r (char *__s) __THROW;
  143. #endif
  144. #if defined __USE_SVID || defined __USE_XOPEN
  145. /* Generate a unique temporary filename using up to five characters of PFX
  146. if it is not NULL. The directory to put this file in is searched for
  147. as follows: First the environment variable "TMPDIR" is checked.
  148. If it contains the name of a writable directory, that directory is used.
  149. If not and if DIR is not NULL, that value is checked. If that fails,
  150. P_tmpdir is tried and finally "/tmp". The storage for the filename
  151. is allocated by `malloc'. */
  152. extern char *tempnam (__const char *__dir, __const char *__pfx)
  153. __THROW __attribute_malloc__;
  154. #endif
  155. /* Close STREAM. */
  156. extern int fclose (FILE *__stream) __THROW;
  157. /* Flush STREAM, or all streams if STREAM is NULL. */
  158. extern int fflush (FILE *__stream) __THROW;
  159. #ifdef __USE_MISC
  160. /* Faster versions when locking is not required. */
  161. extern int fflush_unlocked (FILE *__stream) __THROW;
  162. #endif
  163. #if 0
  164. //#ifdef __USE_GNU
  165. /* Close all streams. */
  166. extern int fcloseall (void) __THROW;
  167. #endif
  168. #ifndef __USE_FILE_OFFSET64
  169. /* Open a file and create a new stream for it. */
  170. extern FILE *fopen (__const char *__restrict __filename,
  171. __const char *__restrict __modes) __THROW;
  172. /* Open a file, replacing an existing stream with it. */
  173. extern FILE *freopen (__const char *__restrict __filename,
  174. __const char *__restrict __modes,
  175. FILE *__restrict __stream) __THROW;
  176. #else
  177. # ifdef __REDIRECT
  178. extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename,
  179. __const char *__restrict __modes) __THROW,
  180. fopen64);
  181. extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
  182. __const char *__restrict __modes,
  183. FILE *__restrict __stream) __THROW,
  184. freopen64);
  185. # else
  186. # define fopen fopen64
  187. # define freopen freopen64
  188. # endif
  189. #endif
  190. #ifdef __USE_LARGEFILE64
  191. extern FILE *fopen64 (__const char *__restrict __filename,
  192. __const char *__restrict __modes) __THROW;
  193. extern FILE *freopen64 (__const char *__restrict __filename,
  194. __const char *__restrict __modes,
  195. FILE *__restrict __stream) __THROW;
  196. #endif
  197. #ifdef __USE_POSIX
  198. /* Create a new stream that refers to an existing system file descriptor. */
  199. extern FILE *fdopen (int __fd, __const char *__modes) __THROW;
  200. #endif
  201. #if 0
  202. //#ifdef __USE_GNU
  203. /* Create a new stream that refers to the given magic cookie,
  204. and uses the given functions for input and output. */
  205. extern FILE *fopencookie (void *__restrict __magic_cookie,
  206. __const char *__restrict __modes,
  207. _IO_cookie_io_functions_t __io_funcs) __THROW;
  208. /* Create a new stream that refers to a memory buffer. */
  209. extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW;
  210. /* Open a stream that writes into a malloc'd buffer that is expanded as
  211. necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
  212. and the number of characters written on fflush or fclose. */
  213. extern FILE *open_memstream (char **__restrict __bufloc,
  214. size_t *__restrict __sizeloc) __THROW;
  215. #endif
  216. /* If BUF is NULL, make STREAM unbuffered.
  217. Else make it use buffer BUF, of size BUFSIZ. */
  218. extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
  219. /* Make STREAM use buffering mode MODE.
  220. If BUF is not NULL, use N bytes of it for buffering;
  221. else allocate an internal buffer N bytes long. */
  222. extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
  223. int __modes, size_t __n) __THROW;
  224. #ifdef __USE_BSD
  225. /* If BUF is NULL, make STREAM unbuffered.
  226. Else make it use SIZE bytes of BUF for buffering. */
  227. extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
  228. size_t __size) __THROW;
  229. /* Make STREAM line-buffered. */
  230. extern void setlinebuf (FILE *__stream) __THROW;
  231. #endif
  232. /* Write formatted output to STREAM. */
  233. extern int fprintf (FILE *__restrict __stream,
  234. __const char *__restrict __format, ...) __THROW;
  235. /* Write formatted output to stdout. */
  236. extern int printf (__const char *__restrict __format, ...) __THROW;
  237. /* Write formatted output to S. */
  238. extern int sprintf (char *__restrict __s,
  239. __const char *__restrict __format, ...) __THROW;
  240. /* Write formatted output to S from argument list ARG. */
  241. extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
  242. _G_va_list __arg) __THROW;
  243. /* Write formatted output to stdout from argument list ARG. */
  244. extern int vprintf (__const char *__restrict __format, _G_va_list __arg)
  245. __THROW;
  246. /* Write formatted output to S from argument list ARG. */
  247. extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
  248. _G_va_list __arg) __THROW;
  249. #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
  250. /* Maximum chars of output to write in MAXLEN. */
  251. extern int snprintf (char *__restrict __s, size_t __maxlen,
  252. __const char *__restrict __format, ...)
  253. __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
  254. extern int vsnprintf (char *__restrict __s, size_t __maxlen,
  255. __const char *__restrict __format, _G_va_list __arg)
  256. __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
  257. #endif
  258. #ifdef __USE_GNU
  259. /* Write formatted output to a string dynamically allocated with `malloc'.
  260. Store the address of the string in *PTR. */
  261. extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
  262. _G_va_list __arg)
  263. __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
  264. extern int __asprintf (char **__restrict __ptr,
  265. __const char *__restrict __fmt, ...)
  266. __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
  267. extern int asprintf (char **__restrict __ptr,
  268. __const char *__restrict __fmt, ...)
  269. __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
  270. /* Write formatted output to a file descriptor. */
  271. extern int vdprintf (int __fd, __const char *__restrict __fmt,
  272. _G_va_list __arg)
  273. __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
  274. extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
  275. __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
  276. #endif
  277. /* Read formatted input from STREAM. */
  278. extern int fscanf (FILE *__restrict __stream,
  279. __const char *__restrict __format, ...) __THROW;
  280. /* Read formatted input from stdin. */
  281. extern int scanf (__const char *__restrict __format, ...) __THROW;
  282. /* Read formatted input from S. */
  283. extern int sscanf (__const char *__restrict __s,
  284. __const char *__restrict __format, ...) __THROW;
  285. #ifdef __USE_ISOC99
  286. /* Read formatted input from S into argument list ARG. */
  287. extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
  288. _G_va_list __arg)
  289. __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
  290. /* Read formatted input from stdin into argument list ARG. */
  291. extern int vscanf (__const char *__restrict __format, _G_va_list __arg)
  292. __THROW __attribute__ ((__format__ (__scanf__, 1, 0)));
  293. /* Read formatted input from S into argument list ARG. */
  294. extern int vsscanf (__const char *__restrict __s,
  295. __const char *__restrict __format, _G_va_list __arg)
  296. __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
  297. #endif /* Use ISO C9x. */
  298. /* Read a character from STREAM. */
  299. extern int fgetc (FILE *__stream) __THROW;
  300. extern int getc (FILE *__stream) __THROW;
  301. /* Read a character from stdin. */
  302. extern int getchar (void) __THROW;
  303. /* The C standard explicitly says this is a macro, so we always do the
  304. optimization for it. */
  305. #define getc(stream) \
  306. (((stream)->bufpos >= (stream)->bufread) ? fgetc(stream): \
  307. (*(stream)->bufpos++))
  308. /* getchar() is equivalent to getc(stdin). Since getc is a macro,
  309. * that means that getchar() should be a macro too... */
  310. #define getchar() getc(stdin)
  311. #if defined __USE_POSIX || defined __USE_MISC
  312. /* These are defined in POSIX.1:1996. */
  313. extern int getc_unlocked (FILE *__stream) __THROW;
  314. extern int getchar_unlocked (void) __THROW;
  315. #endif /* Use POSIX or MISC. */
  316. #ifdef __USE_MISC
  317. /* Faster version when locking is not necessary. */
  318. extern int fgetc_unlocked (FILE *__stream) __THROW;
  319. #endif /* Use MISC. */
  320. /* Write a character to STREAM. */
  321. extern int fputc (int __c, FILE *__stream) __THROW;
  322. extern int putc (int __c, FILE *__stream) __THROW;
  323. /* Write a character to stdout. */
  324. extern int putchar (int __c) __THROW;
  325. /* The C standard explicitly says this can be a macro,
  326. so we always do the optimization for it. */
  327. #define putc(c, stream) \
  328. (((stream)->bufpos >= (stream)->bufwrite) ? fputc((c), (stream)) \
  329. : (unsigned char) (*(stream)->bufpos++ = (c)) )
  330. /* putchar() is equivalent to putc(c,stdout). Since putc is a macro,
  331. * that means that putchar() should be a macro too... */
  332. #define putchar(c) putc((c), stdout)
  333. #ifdef __USE_MISC
  334. /* Faster version when locking is not necessary. */
  335. extern int fputc_unlocked (int __c, FILE *__stream) __THROW;
  336. #endif /* Use MISC. */
  337. #if defined __USE_POSIX || defined __USE_MISC
  338. /* These are defined in POSIX.1:1996. */
  339. extern int putc_unlocked (int __c, FILE *__stream) __THROW;
  340. extern int putchar_unlocked (int __c) __THROW;
  341. #endif /* Use POSIX or MISC. */
  342. #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
  343. /* Get a word (int) from STREAM. */
  344. extern int getw (FILE *__stream) __THROW;
  345. /* Write a word (int) to STREAM. */
  346. extern int putw (int __w, FILE *__stream) __THROW;
  347. #endif
  348. /* Get a newline-terminated string of finite length from STREAM. */
  349. extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
  350. __THROW;
  351. #if 0
  352. //#ifdef __USE_GNU
  353. /* This function does the same as `fgets' but does not lock the stream. */
  354. extern char *fgets_unlocked (char *__restrict __s, int __n,
  355. FILE *__restrict __stream) __THROW;
  356. #endif
  357. /* Get a newline-terminated string from stdin, removing the newline.
  358. DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. */
  359. extern char *gets (char *__s) __THROW;
  360. #ifdef __USE_GNU
  361. /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
  362. (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
  363. NULL), pointing to *N characters of space. It is realloc'd as
  364. necessary. Returns the number of characters read (not including the
  365. null terminator), or -1 on error or EOF. */
  366. extern ssize_t __getdelim (char **__restrict __lineptr,
  367. size_t *__restrict __n, int __delimiter,
  368. FILE *__restrict __stream) __THROW;
  369. extern ssize_t getdelim (char **__restrict __lineptr,
  370. size_t *__restrict __n, int __delimiter,
  371. FILE *__restrict __stream) __THROW;
  372. /* Like `getdelim', but reads up to a newline. */
  373. extern ssize_t getline (char **__restrict __lineptr,
  374. size_t *__restrict __n,
  375. FILE *__restrict __stream) __THROW;
  376. #endif
  377. /* Write a string to STREAM. */
  378. extern int fputs (__const char *__restrict __s, FILE *__restrict __stream)
  379. __THROW;
  380. #if 0
  381. //#ifdef __USE_GNU
  382. /* This function does the same as `fputs' but does not lock the stream. */
  383. extern int fputs_unlocked (__const char *__restrict __s,
  384. FILE *__restrict __stream) __THROW;
  385. #endif
  386. /* Write a string, followed by a newline, to stdout. */
  387. extern int puts (__const char *__s) __THROW;
  388. /* Push a character back onto the input buffer of STREAM. */
  389. extern int ungetc (int __c, FILE *__stream) __THROW;
  390. /* Read chunks of generic data from STREAM. */
  391. extern size_t fread (void *__restrict __ptr, size_t __size,
  392. size_t __n, FILE *__restrict __stream) __THROW;
  393. /* Write chunks of generic data to STREAM. */
  394. extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
  395. size_t __n, FILE *__restrict __s) __THROW;
  396. #ifdef __USE_MISC
  397. /* Faster versions when locking is not necessary. */
  398. extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
  399. size_t __n, FILE *__restrict __stream) __THROW;
  400. extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
  401. size_t __n, FILE *__restrict __stream) __THROW;
  402. #endif
  403. /* Seek to a certain position on STREAM. */
  404. extern int fseek (FILE *__stream, long int __off, int __whence) __THROW;
  405. /* Return the current position of STREAM. */
  406. extern long int ftell (FILE *__stream) __THROW;
  407. /* Rewind to the beginning of STREAM. */
  408. extern void rewind (FILE *__stream) __THROW;
  409. /* The Single Unix Specification, Version 2, specifies an alternative,
  410. more adequate interface for the two functions above which deal with
  411. file offset. `long int' is not the right type. These definitions
  412. are originally defined in the Large File Support API. */
  413. #ifndef __USE_FILE_OFFSET64
  414. # ifdef __USE_LARGEFILE
  415. /* Seek to a certain position on STREAM. */
  416. extern int fseeko (FILE *__stream, __off_t __off, int __whence) __THROW;
  417. /* Return the current position of STREAM. */
  418. extern __off_t ftello (FILE *__stream) __THROW;
  419. # endif
  420. /* Get STREAM's position. */
  421. extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos)
  422. __THROW;
  423. /* Set STREAM's position. */
  424. extern int fsetpos (FILE *__stream, __const fpos_t *__pos) __THROW;
  425. #else
  426. # ifdef __REDIRECT
  427. # ifdef __USE_LARGEFILE
  428. extern int __REDIRECT (fseeko,
  429. (FILE *__stream, __off64_t __off, int __whence) __THROW,
  430. fseeko64);
  431. extern __off64_t __REDIRECT (ftello, (FILE *__stream) __THROW, ftello64);
  432. # endif
  433. extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
  434. fpos_t *__restrict __pos) __THROW, fgetpos64);
  435. extern int __REDIRECT (fsetpos,
  436. (FILE *__stream, __const fpos_t *__pos) __THROW,
  437. fsetpos64);
  438. # else
  439. # ifdef __USE_LARGEFILE
  440. # define fseeko fseeko64
  441. # define ftello ftello64
  442. # endif
  443. # define fgetpos fgetpos64
  444. # define fsetpos fsetpos64
  445. # endif
  446. #endif
  447. #ifdef __USE_LARGEFILE64
  448. extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence) __THROW;
  449. extern __off64_t ftello64 (FILE *__stream) __THROW;
  450. extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos)
  451. __THROW;
  452. extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos) __THROW;
  453. #endif
  454. /* Clear the error and EOF indicators for STREAM. */
  455. extern void clearerr (FILE *__stream) __THROW;
  456. /* Return the EOF indicator for STREAM. */
  457. extern int feof (FILE *__stream) __THROW;
  458. /* Return the error indicator for STREAM. */
  459. extern int ferror (FILE *__stream) __THROW;
  460. #ifdef __USE_MISC
  461. /* Faster versions when locking is not required. */
  462. extern void clearerr_unlocked (FILE *__stream) __THROW;
  463. extern int feof_unlocked (FILE *__stream) __THROW;
  464. extern int ferror_unlocked (FILE *__stream) __THROW;
  465. #endif
  466. /* Print a message describing the meaning of the value of errno. */
  467. extern void perror (__const char *__s) __THROW;
  468. /* These variables normally should not be used directly. The `strerror'
  469. function provides all the needed functionality. */
  470. #ifdef __USE_BSD
  471. extern int sys_nerr;
  472. extern __const char *__const sys_errlist[];
  473. #endif
  474. #if 0
  475. //#ifdef __USE_GNU
  476. extern int _sys_nerr;
  477. extern __const char *__const _sys_errlist[];
  478. #endif
  479. #ifdef __USE_POSIX
  480. /* Return the system file descriptor for STREAM. */
  481. extern int fileno (FILE *__stream) __THROW;
  482. /* Only use the macro below if you know fp is a valid FILE for a valid fd. */
  483. #define __fileno(fp) ((fp)->fd)
  484. #endif /* Use POSIX. */
  485. #ifdef __USE_MISC
  486. /* Faster version when locking is not required. */
  487. extern int fileno_unlocked (FILE *__stream) __THROW;
  488. #endif
  489. #if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \
  490. defined __USE_MISC)
  491. /* Create a new stream connected to a pipe running the given command. */
  492. extern FILE *popen (__const char *__command, __const char *__modes) __THROW;
  493. /* Close a stream opened by popen and return the status of its child. */
  494. extern int pclose (FILE *__stream) __THROW;
  495. #endif
  496. #ifdef __USE_POSIX
  497. /* Return the name of the controlling terminal. */
  498. extern char *ctermid (char *__s) __THROW;
  499. #endif /* Use POSIX. */
  500. #ifdef __USE_XOPEN
  501. /* Return the name of the current user. */
  502. extern char *cuserid (char *__s) __THROW;
  503. #endif /* Use X/Open, but not issue 6. */
  504. #if 0
  505. //#ifdef __USE_GNU
  506. struct obstack; /* See <obstack.h>. */
  507. /* Write formatted output to an obstack. */
  508. extern int obstack_printf (struct obstack *__restrict __obstack,
  509. __const char *__restrict __format, ...) __THROW;
  510. extern int obstack_vprintf (struct obstack *__restrict __obstack,
  511. __const char *__restrict __format,
  512. _G_va_list __args) __THROW;
  513. #endif /* Use GNU. */
  514. #if defined __USE_POSIX || defined __USE_MISC
  515. /* These are defined in POSIX.1:1996. */
  516. /* Acquire ownership of STREAM. */
  517. extern void flockfile (FILE *__stream) __THROW;
  518. /* Try to acquire ownership of STREAM but do not block if it is not
  519. possible. */
  520. extern int ftrylockfile (FILE *__stream) __THROW;
  521. /* Relinquish the ownership granted for STREAM. */
  522. extern void funlockfile (FILE *__stream) __THROW;
  523. #endif /* POSIX || misc */
  524. #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
  525. /* The X/Open standard requires some functions and variables to be
  526. declared here which do not belong into this header. But we have to
  527. follow. In GNU mode we don't do this nonsense. */
  528. # define __need_getopt
  529. # include <getopt.h>
  530. #endif /* X/Open, but not issue 6 and not for GNU. */
  531. /* If we are compiling with optimizing read this file. It contains
  532. several optimizing inline functions and macros. */
  533. #ifdef __USE_EXTERN_INLINES
  534. # include <bits/stdio.h>
  535. #endif
  536. __END_DECLS
  537. #endif /* <stdio.h> included. */
  538. #endif /* !_STDIO_H */