stdio.h 22 KB

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