stdio.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  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. #define getc(_fp) __GETC(_fp)
  287. #if defined __USE_POSIX || defined __USE_MISC
  288. /* These are defined in POSIX.1:1996. */
  289. extern int getc_unlocked (FILE *__stream) __THROW;
  290. extern int getchar_unlocked (void) __THROW;
  291. #endif /* Use POSIX or MISC. */
  292. #ifdef __USE_MISC
  293. /* Faster version when locking is not necessary. */
  294. extern int fgetc_unlocked (FILE *__stream) __THROW;
  295. #endif /* Use MISC. */
  296. /* Write a character to STREAM. */
  297. extern int fputc (int __c, FILE *__stream) __THROW;
  298. extern int putc (int __c, FILE *__stream) __THROW;
  299. /* Write a character to stdout. */
  300. extern int putchar (int __c) __THROW;
  301. /* The C standard explicitly says this can be a macro,
  302. so we always do the optimization for it. */
  303. #define putc(_ch, _fp) __PUTC(_ch, _fp)
  304. #ifdef __USE_MISC
  305. /* Faster version when locking is not necessary. */
  306. extern int fputc_unlocked (int __c, FILE *__stream) __THROW;
  307. #endif /* Use MISC. */
  308. #if defined __USE_POSIX || defined __USE_MISC
  309. /* These are defined in POSIX.1:1996. */
  310. extern int putc_unlocked (int __c, FILE *__stream) __THROW;
  311. extern int putchar_unlocked (int __c) __THROW;
  312. #endif /* Use POSIX or MISC. */
  313. #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
  314. /* Get a word (int) from STREAM. */
  315. extern int getw (FILE *__stream) __THROW;
  316. /* Write a word (int) to STREAM. */
  317. extern int putw (int __w, FILE *__stream) __THROW;
  318. #endif
  319. /* Get a newline-terminated string of finite length from STREAM. */
  320. extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
  321. __THROW;
  322. #ifdef __USE_GNU
  323. /* This function does the same as `fgets' but does not lock the stream. */
  324. extern char *fgets_unlocked (char *__restrict __s, int __n,
  325. FILE *__restrict __stream) __THROW;
  326. #endif
  327. /* Get a newline-terminated string from stdin, removing the newline.
  328. DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. */
  329. extern char *gets (char *__s) __THROW;
  330. #ifdef __USE_GNU
  331. /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
  332. (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
  333. NULL), pointing to *N characters of space. It is realloc'd as
  334. necessary. Returns the number of characters read (not including the
  335. null terminator), or -1 on error or EOF. */
  336. extern __ssize_t __getdelim (char **__restrict __lineptr,
  337. size_t *__restrict __n, int __delimiter,
  338. FILE *__restrict __stream) __THROW;
  339. extern __ssize_t getdelim (char **__restrict __lineptr,
  340. size_t *__restrict __n, int __delimiter,
  341. FILE *__restrict __stream) __THROW;
  342. /* Like `getdelim', but reads up to a newline. */
  343. extern __ssize_t getline (char **__restrict __lineptr,
  344. size_t *__restrict __n,
  345. FILE *__restrict __stream) __THROW;
  346. #endif
  347. /* Write a string to STREAM. */
  348. extern int fputs (__const char *__restrict __s, FILE *__restrict __stream)
  349. __THROW;
  350. #ifdef __USE_GNU
  351. /* This function does the same as `fputs' but does not lock the stream. */
  352. extern int fputs_unlocked (__const char *__restrict __s,
  353. FILE *__restrict __stream) __THROW;
  354. #endif
  355. /* Write a string, followed by a newline, to stdout. */
  356. extern int puts (__const char *__s) __THROW;
  357. /* Push a character back onto the input buffer of STREAM. */
  358. extern int ungetc (int __c, FILE *__stream) __THROW;
  359. /* Read chunks of generic data from STREAM. */
  360. extern size_t fread (void *__restrict __ptr, size_t __size,
  361. size_t __n, FILE *__restrict __stream) __THROW;
  362. /* Write chunks of generic data to STREAM. */
  363. extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
  364. size_t __n, FILE *__restrict __s) __THROW;
  365. #ifdef __USE_MISC
  366. /* Faster versions when locking is not necessary. */
  367. extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
  368. size_t __n, FILE *__restrict __stream) __THROW;
  369. extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
  370. size_t __n, FILE *__restrict __stream) __THROW;
  371. #endif
  372. /* Seek to a certain position on STREAM. */
  373. extern int fseek (FILE *__stream, long int __off, int __whence) __THROW;
  374. /* Return the current position of STREAM. */
  375. extern long int ftell (FILE *__stream) __THROW;
  376. /* Rewind to the beginning of STREAM. */
  377. extern void rewind (FILE *__stream) __THROW;
  378. /* The Single Unix Specification, Version 2, specifies an alternative,
  379. more adequate interface for the two functions above which deal with
  380. file offset. `long int' is not the right type. These definitions
  381. are originally defined in the Large File Support API. */
  382. #ifndef __USE_FILE_OFFSET64
  383. # ifdef __USE_LARGEFILE
  384. /* Seek to a certain position on STREAM. */
  385. extern int fseeko (FILE *__stream, __off_t __off, int __whence) __THROW;
  386. /* Return the current position of STREAM. */
  387. extern __off_t ftello (FILE *__stream) __THROW;
  388. # endif
  389. /* Get STREAM's position. */
  390. extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos)
  391. __THROW;
  392. /* Set STREAM's position. */
  393. extern int fsetpos (FILE *__stream, __const fpos_t *__pos) __THROW;
  394. #else
  395. # ifdef __REDIRECT
  396. # ifdef __USE_LARGEFILE
  397. extern int __REDIRECT (fseeko,
  398. (FILE *__stream, __off64_t __off, int __whence) __THROW,
  399. fseeko64);
  400. extern __off64_t __REDIRECT (ftello, (FILE *__stream) __THROW, ftello64);
  401. # endif
  402. extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
  403. fpos_t *__restrict __pos) __THROW, fgetpos64);
  404. extern int __REDIRECT (fsetpos,
  405. (FILE *__stream, __const fpos_t *__pos) __THROW,
  406. fsetpos64);
  407. # else
  408. # ifdef __USE_LARGEFILE
  409. # define fseeko fseeko64
  410. # define ftello ftello64
  411. # endif
  412. # define fgetpos fgetpos64
  413. # define fsetpos fsetpos64
  414. # endif
  415. #endif
  416. #ifdef __USE_LARGEFILE64
  417. extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence) __THROW;
  418. extern __off64_t ftello64 (FILE *__stream) __THROW;
  419. extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos)
  420. __THROW;
  421. extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos) __THROW;
  422. #endif
  423. /* Clear the error and EOF indicators for STREAM. */
  424. extern void clearerr (FILE *__stream) __THROW;
  425. /* Return the EOF indicator for STREAM. */
  426. extern int feof (FILE *__stream) __THROW;
  427. /* Return the error indicator for STREAM. */
  428. extern int ferror (FILE *__stream) __THROW;
  429. #ifdef __USE_MISC
  430. /* Faster versions when locking is not required. */
  431. extern void clearerr_unlocked (FILE *__stream) __THROW;
  432. extern int feof_unlocked (FILE *__stream) __THROW;
  433. extern int ferror_unlocked (FILE *__stream) __THROW;
  434. #endif
  435. /* Print a message describing the meaning of the value of errno. */
  436. extern void perror (__const char *__s) __THROW;
  437. /* These variables normally should not be used directly. The `strerror'
  438. function provides all the needed functionality. */
  439. #ifdef __USE_BSD
  440. extern int sys_nerr;
  441. extern __const char *__const sys_errlist[];
  442. #endif
  443. #if 0
  444. /* #ifdef __USE_GNU */
  445. extern int _sys_nerr;
  446. extern __const char *__const _sys_errlist[];
  447. #endif
  448. #ifdef __USE_POSIX
  449. /* Return the system file descriptor for STREAM. */
  450. extern int fileno (FILE *__stream) __THROW;
  451. #endif /* Use POSIX. */
  452. #ifdef __USE_MISC
  453. /* Faster version when locking is not required. */
  454. extern int fileno_unlocked (FILE *__stream) __THROW;
  455. #endif
  456. #if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \
  457. defined __USE_MISC)
  458. /* Create a new stream connected to a pipe running the given command. */
  459. extern FILE *popen (__const char *__command, __const char *__modes) __THROW;
  460. /* Close a stream opened by popen and return the status of its child. */
  461. extern int pclose (FILE *__stream) __THROW;
  462. #endif
  463. #ifdef __USE_POSIX
  464. /* Return the name of the controlling terminal. */
  465. extern char *ctermid (char *__s) __THROW;
  466. #endif /* Use POSIX. */
  467. #ifdef __USE_XOPEN
  468. /* Return the name of the current user. */
  469. extern char *cuserid (char *__s) __THROW;
  470. #endif /* Use X/Open, but not issue 6. */
  471. #if 0
  472. /* #ifdef __USE_GNU */
  473. struct obstack; /* See <obstack.h>. */
  474. /* Write formatted output to an obstack. */
  475. extern int obstack_printf (struct obstack *__restrict __obstack,
  476. __const char *__restrict __format, ...) __THROW;
  477. extern int obstack_vprintf (struct obstack *__restrict __obstack,
  478. __const char *__restrict __format,
  479. __gnuc_va_list __args) __THROW;
  480. #endif /* Use GNU. */
  481. #if (defined __USE_POSIX || defined __USE_MISC) && defined __UCLIBC_HAS_THREADS__
  482. /* These are defined in POSIX.1:1996. */
  483. /* Acquire ownership of STREAM. */
  484. extern void flockfile (FILE *__stream) __THROW;
  485. /* Try to acquire ownership of STREAM but do not block if it is not
  486. possible. */
  487. extern int ftrylockfile (FILE *__stream) __THROW;
  488. /* Relinquish the ownership granted for STREAM. */
  489. extern void funlockfile (FILE *__stream) __THROW;
  490. #endif /* POSIX || misc */
  491. #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
  492. /* The X/Open standard requires some functions and variables to be
  493. declared here which do not belong into this header. But we have to
  494. follow. In GNU mode we don't do this nonsense. */
  495. # define __need_getopt
  496. # include <getopt.h>
  497. #endif /* X/Open, but not issue 6 and not for GNU. */
  498. /* If we are compiling with optimizing read this file. It contains
  499. several optimizing inline functions and macros. */
  500. #if 0
  501. /* #ifdef __USE_EXTERN_INLINES */
  502. # include <bits/stdio.h>
  503. #endif
  504. __END_DECLS
  505. #endif /* <stdio.h> included. */
  506. #endif /* !_STDIO_H */