fork download
  1. /* Define ISO C stdio on top of C++ iostreams.
  2. Copyright (C) 1991-2018 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4.  
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9.  
  10. The GNU C Library is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. Lesser General Public License for more details.
  14.  
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with the GNU C Library; if not, see
  17. <http://w...content-available-to-author-only...u.org/licenses/>. */
  18.  
  19. /*
  20. * ISO C99 Standard: 7.19 Input/output <stdio.h>
  21. */
  22.  
  23. #ifndef _STDIO_H
  24. #define _STDIO_H 1
  25.  
  26. #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
  27. #include <bits/libc-header-start.h>
  28.  
  29. __BEGIN_DECLS
  30.  
  31. #define __need_size_t
  32. #define __need_NULL
  33. #include <stddef.h>
  34.  
  35. #define __need___va_list
  36. #include <stdarg.h>
  37.  
  38. #include <bits/types.h>
  39. #include <bits/types/__fpos_t.h>
  40. #include <bits/types/__fpos64_t.h>
  41. #include <bits/types/__FILE.h>
  42. #include <bits/types/FILE.h>
  43. #include <bits/types/struct_FILE.h>
  44.  
  45. #ifdef __USE_GNU
  46. # include <bits/types/cookie_io_functions_t.h>
  47. #endif
  48.  
  49. #if defined __USE_XOPEN || defined __USE_XOPEN2K8
  50. # ifdef __GNUC__
  51. # ifndef _VA_LIST_DEFINED
  52. typedef __gnuc_va_list va_list;
  53. # define _VA_LIST_DEFINED
  54. # endif
  55. # else
  56. # include <stdarg.h>
  57. # endif
  58. #endif
  59.  
  60. #if defined __USE_UNIX98 || defined __USE_XOPEN2K
  61. # ifndef __off_t_defined
  62. # ifndef __USE_FILE_OFFSET64
  63. typedef __off_t off_t;
  64. # else
  65. typedef __off64_t off_t;
  66. # endif
  67. # define __off_t_defined
  68. # endif
  69. # if defined __USE_LARGEFILE64 && !defined __off64_t_defined
  70. typedef __off64_t off64_t;
  71. # define __off64_t_defined
  72. # endif
  73. #endif
  74.  
  75. #ifdef __USE_XOPEN2K8
  76. # ifndef __ssize_t_defined
  77. typedef __ssize_t ssize_t;
  78. # define __ssize_t_defined
  79. # endif
  80. #endif
  81.  
  82. /* The type of the second argument to `fgetpos' and `fsetpos'. */
  83. #ifndef __USE_FILE_OFFSET64
  84. typedef __fpos_t fpos_t;
  85. #else
  86. typedef __fpos64_t fpos_t;
  87. #endif
  88. #ifdef __USE_LARGEFILE64
  89. typedef __fpos64_t fpos64_t;
  90. #endif
  91.  
  92. /* The possibilities for the third argument to `setvbuf'. */
  93. #define _IOFBF 0 /* Fully buffered. */
  94. #define _IOLBF 1 /* Line buffered. */
  95. #define _IONBF 2 /* No buffering. */
  96.  
  97.  
  98. /* Default buffer size. */
  99. #define BUFSIZ 8192
  100.  
  101.  
  102. /* The value returned by fgetc and similar functions to indicate the
  103. end of the file. */
  104. #define EOF (-1)
  105.  
  106.  
  107. /* The possibilities for the third argument to `fseek'.
  108. These values should not be changed. */
  109. #define SEEK_SET 0 /* Seek from beginning of file. */
  110. #define SEEK_CUR 1 /* Seek from current position. */
  111. #define SEEK_END 2 /* Seek from end of file. */
  112. #ifdef __USE_GNU
  113. # define SEEK_DATA 3 /* Seek to next data. */
  114. # define SEEK_HOLE 4 /* Seek to next hole. */
  115. #endif
  116.  
  117.  
  118. #if defined __USE_MISC || defined __USE_XOPEN
  119. /* Default path prefix for `tempnam' and `tmpnam'. */
  120. # define P_tmpdir "/tmp"
  121. #endif
  122.  
  123.  
  124. /* Get the values:
  125. L_tmpnam How long an array of chars must be to be passed to `tmpnam'.
  126. TMP_MAX The minimum number of unique filenames generated by tmpnam
  127. (and tempnam when it uses tmpnam's name space),
  128. or tempnam (the two are separate).
  129. L_ctermid How long an array to pass to `ctermid'.
  130. L_cuserid How long an array to pass to `cuserid'.
  131. FOPEN_MAX Minimum number of files that can be open at once.
  132. FILENAME_MAX Maximum length of a filename. */
  133. #include <bits/stdio_lim.h>
  134.  
  135.  
  136. /* Standard streams. */
  137. extern FILE *stdin; /* Standard input stream. */
  138. extern FILE *stdout; /* Standard output stream. */
  139. extern FILE *stderr; /* Standard error output stream. */
  140. /* C89/C99 say they're macros. Make them happy. */
  141. #define stdin stdin
  142. #define stdout stdout
  143. #define stderr stderr
  144.  
  145. /* Remove file FILENAME. */
  146. extern int remove (const char *__filename) __THROW;
  147. /* Rename file OLD to NEW. */
  148. extern int rename (const char *__old, const char *__new) __THROW;
  149.  
  150. #ifdef __USE_ATFILE
  151. /* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */
  152. extern int renameat (int __oldfd, const char *__old, int __newfd,
  153. const char *__new) __THROW;
  154. #endif
  155.  
  156. #ifdef __USE_GNU
  157. /* Flags for renameat2. */
  158. # define RENAME_NOREPLACE (1 << 0)
  159. # define RENAME_EXCHANGE (1 << 1)
  160. # define RENAME_WHITEOUT (1 << 2)
  161.  
  162. /* Rename file OLD relative to OLDFD to NEW relative to NEWFD, with
  163. additional flags. */
  164. extern int renameat2 (int __oldfd, const char *__old, int __newfd,
  165. const char *__new, unsigned int __flags) __THROW;
  166. #endif
  167.  
  168. /* Create a temporary file and open it read/write.
  169.  
  170. This function is a possible cancellation point and therefore not
  171. marked with __THROW. */
  172. #ifndef __USE_FILE_OFFSET64
  173. extern FILE *tmpfile (void) __wur;
  174. #else
  175. # ifdef __REDIRECT
  176. extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) __wur;
  177. # else
  178. # define tmpfile tmpfile64
  179. # endif
  180. #endif
  181.  
  182. #ifdef __USE_LARGEFILE64
  183. extern FILE *tmpfile64 (void) __wur;
  184. #endif
  185.  
  186. /* Generate a temporary filename. */
  187. extern char *tmpnam (char *__s) __THROW __wur;
  188.  
  189. #ifdef __USE_MISC
  190. /* This is the reentrant variant of `tmpnam'. The only difference is
  191. that it does not allow S to be NULL. */
  192. extern char *tmpnam_r (char *__s) __THROW __wur;
  193. #endif
  194.  
  195.  
  196. #if defined __USE_MISC || defined __USE_XOPEN
  197. /* Generate a unique temporary filename using up to five characters of PFX
  198. if it is not NULL. The directory to put this file in is searched for
  199. as follows: First the environment variable "TMPDIR" is checked.
  200. If it contains the name of a writable directory, that directory is used.
  201. If not and if DIR is not NULL, that value is checked. If that fails,
  202. P_tmpdir is tried and finally "/tmp". The storage for the filename
  203. is allocated by `malloc'. */
  204. extern char *tempnam (const char *__dir, const char *__pfx)
  205. __THROW __attribute_malloc__ __wur;
  206. #endif
  207.  
  208.  
  209. /* Close STREAM.
  210.  
  211. This function is a possible cancellation point and therefore not
  212. marked with __THROW. */
  213. extern int fclose (FILE *__stream);
  214. /* Flush STREAM, or all streams if STREAM is NULL.
  215.  
  216. This function is a possible cancellation point and therefore not
  217. marked with __THROW. */
  218. extern int fflush (FILE *__stream);
  219.  
  220. #ifdef __USE_MISC
  221. /* Faster versions when locking is not required.
  222.  
  223. This function is not part of POSIX and therefore no official
  224. cancellation point. But due to similarity with an POSIX interface
  225. or due to the implementation it is a cancellation point and
  226. therefore not marked with __THROW. */
  227. extern int fflush_unlocked (FILE *__stream);
  228. #endif
  229.  
  230. #ifdef __USE_GNU
  231. /* Close all streams.
  232.  
  233. This function is not part of POSIX and therefore no official
  234. cancellation point. But due to similarity with an POSIX interface
  235. or due to the implementation it is a cancellation point and
  236. therefore not marked with __THROW. */
  237. extern int fcloseall (void);
  238. #endif
  239.  
  240.  
  241. #ifndef __USE_FILE_OFFSET64
  242. /* Open a file and create a new stream for it.
  243.  
  244. This function is a possible cancellation point and therefore not
  245. marked with __THROW. */
  246. extern FILE *fopen (const char *__restrict __filename,
  247. const char *__restrict __modes) __wur;
  248. /* Open a file, replacing an existing stream with it.
  249.  
  250. This function is a possible cancellation point and therefore not
  251. marked with __THROW. */
  252. extern FILE *freopen (const char *__restrict __filename,
  253. const char *__restrict __modes,
  254. FILE *__restrict __stream) __wur;
  255. #else
  256. # ifdef __REDIRECT
  257. extern FILE *__REDIRECT (fopen, (const char *__restrict __filename,
  258. const char *__restrict __modes), fopen64)
  259. __wur;
  260. extern FILE *__REDIRECT (freopen, (const char *__restrict __filename,
  261. const char *__restrict __modes,
  262. FILE *__restrict __stream), freopen64)
  263. __wur;
  264. # else
  265. # define fopen fopen64
  266. # define freopen freopen64
  267. # endif
  268. #endif
  269. #ifdef __USE_LARGEFILE64
  270. extern FILE *fopen64 (const char *__restrict __filename,
  271. const char *__restrict __modes) __wur;
  272. extern FILE *freopen64 (const char *__restrict __filename,
  273. const char *__restrict __modes,
  274. FILE *__restrict __stream) __wur;
  275. #endif
  276.  
  277. #ifdef __USE_POSIX
  278. /* Create a new stream that refers to an existing system file descriptor. */
  279. extern FILE *fdopen (int __fd, const char *__modes) __THROW __wur;
  280. #endif
  281.  
  282. #ifdef __USE_GNU
  283. /* Create a new stream that refers to the given magic cookie,
  284. and uses the given functions for input and output. */
  285. extern FILE *fopencookie (void *__restrict __magic_cookie,
  286. const char *__restrict __modes,
  287. cookie_io_functions_t __io_funcs) __THROW __wur;
  288. #endif
  289.  
  290. #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
  291. /* Create a new stream that refers to a memory buffer. */
  292. extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
  293. __THROW __wur;
  294.  
  295. /* Open a stream that writes into a malloc'd buffer that is expanded as
  296. necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
  297. and the number of characters written on fflush or fclose. */
  298. extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur;
  299. #endif
  300.  
  301.  
  302. /* If BUF is NULL, make STREAM unbuffered.
  303. Else make it use buffer BUF, of size BUFSIZ. */
  304. extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
  305. /* Make STREAM use buffering mode MODE.
  306. If BUF is not NULL, use N bytes of it for buffering;
  307. else allocate an internal buffer N bytes long. */
  308. extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
  309. int __modes, size_t __n) __THROW;
  310.  
  311. #ifdef __USE_MISC
  312. /* If BUF is NULL, make STREAM unbuffered.
  313. Else make it use SIZE bytes of BUF for buffering. */
  314. extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
  315. size_t __size) __THROW;
  316.  
  317. /* Make STREAM line-buffered. */
  318. extern void setlinebuf (FILE *__stream) __THROW;
  319. #endif
  320.  
  321.  
  322. /* Write formatted output to STREAM.
  323.  
  324. This function is a possible cancellation point and therefore not
  325. marked with __THROW. */
  326. extern int fprintf (FILE *__restrict __stream,
  327. const char *__restrict __format, ...);
  328. /* Write formatted output to stdout.
  329.  
  330. This function is a possible cancellation point and therefore not
  331. marked with __THROW. */
  332. extern int printf (const char *__restrict __format, ...);
  333. /* Write formatted output to S. */
  334. extern int sprintf (char *__restrict __s,
  335. const char *__restrict __format, ...) __THROWNL;
  336.  
  337. /* Write formatted output to S from argument list ARG.
  338.  
  339. This function is a possible cancellation point and therefore not
  340. marked with __THROW. */
  341. extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
  342. __gnuc_va_list __arg);
  343. /* Write formatted output to stdout from argument list ARG.
  344.  
  345. This function is a possible cancellation point and therefore not
  346. marked with __THROW. */
  347. extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
  348. /* Write formatted output to S from argument list ARG. */
  349. extern int vsprintf (char *__restrict __s, const char *__restrict __format,
  350. __gnuc_va_list __arg) __THROWNL;
  351.  
  352. #if defined __USE_ISOC99 || defined __USE_UNIX98
  353. /* Maximum chars of output to write in MAXLEN. */
  354. extern int snprintf (char *__restrict __s, size_t __maxlen,
  355. const char *__restrict __format, ...)
  356. __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
  357.  
  358. extern int vsnprintf (char *__restrict __s, size_t __maxlen,
  359. const char *__restrict __format, __gnuc_va_list __arg)
  360. __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
  361. #endif
  362.  
  363. #if __GLIBC_USE (LIB_EXT2)
  364. /* Write formatted output to a string dynamically allocated with `malloc'.
  365. Store the address of the string in *PTR. */
  366. extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
  367. __gnuc_va_list __arg)
  368. __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
  369. extern int __asprintf (char **__restrict __ptr,
  370. const char *__restrict __fmt, ...)
  371. __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
  372. extern int asprintf (char **__restrict __ptr,
  373. const char *__restrict __fmt, ...)
  374. __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
  375. #endif
  376.  
  377. #ifdef __USE_XOPEN2K8
  378. /* Write formatted output to a file descriptor. */
  379. extern int vdprintf (int __fd, const char *__restrict __fmt,
  380. __gnuc_va_list __arg)
  381. __attribute__ ((__format__ (__printf__, 2, 0)));
  382. extern int dprintf (int __fd, const char *__restrict __fmt, ...)
  383. __attribute__ ((__format__ (__printf__, 2, 3)));
  384. #endif
  385.  
  386.  
  387. /* Read formatted input from STREAM.
  388.  
  389. This function is a possible cancellation point and therefore not
  390. marked with __THROW. */
  391. extern int fscanf (FILE *__restrict __stream,
  392. const char *__restrict __format, ...) __wur;
  393. /* Read formatted input from stdin.
  394.  
  395. This function is a possible cancellation point and therefore not
  396. marked with __THROW. */
  397. extern int scanf (const char *__restrict __format, ...) __wur;
  398. /* Read formatted input from S. */
  399. extern int sscanf (const char *__restrict __s,
  400. const char *__restrict __format, ...) __THROW;
  401.  
  402. #if defined __USE_ISOC99 && !defined __USE_GNU \
  403. && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
  404. && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
  405. # ifdef __REDIRECT
  406. /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
  407. GNU extension which conflicts with valid %a followed by letter
  408. s, S or [. */
  409. extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
  410. const char *__restrict __format, ...),
  411. __isoc99_fscanf) __wur;
  412. extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
  413. __isoc99_scanf) __wur;
  414. extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
  415. const char *__restrict __format, ...),
  416. __isoc99_sscanf);
  417. # else
  418. extern int __isoc99_fscanf (FILE *__restrict __stream,
  419. const char *__restrict __format, ...) __wur;
  420. extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
  421. extern int __isoc99_sscanf (const char *__restrict __s,
  422. const char *__restrict __format, ...) __THROW;
  423. # define fscanf __isoc99_fscanf
  424. # define scanf __isoc99_scanf
  425. # define sscanf __isoc99_sscanf
  426. # endif
  427. #endif
  428.  
  429. #ifdef __USE_ISOC99
  430. /* Read formatted input from S into argument list ARG.
  431.  
  432. This function is a possible cancellation point and therefore not
  433. marked with __THROW. */
  434. extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
  435. __gnuc_va_list __arg)
  436. __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
  437.  
  438. /* Read formatted input from stdin into argument list ARG.
  439.  
  440. This function is a possible cancellation point and therefore not
  441. marked with __THROW. */
  442. extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
  443. __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
  444.  
  445. /* Read formatted input from S into argument list ARG. */
  446. extern int vsscanf (const char *__restrict __s,
  447. const char *__restrict __format, __gnuc_va_list __arg)
  448. __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
  449.  
  450. # if !defined __USE_GNU \
  451. && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
  452. && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
  453. # ifdef __REDIRECT
  454. /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
  455. GNU extension which conflicts with valid %a followed by letter
  456. s, S or [. */
  457. extern int __REDIRECT (vfscanf,
  458. (FILE *__restrict __s,
  459. const char *__restrict __format, __gnuc_va_list __arg),
  460. __isoc99_vfscanf)
  461. __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
  462. extern int __REDIRECT (vscanf, (const char *__restrict __format,
  463. __gnuc_va_list __arg), __isoc99_vscanf)
  464. __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
  465. extern int __REDIRECT_NTH (vsscanf,
  466. (const char *__restrict __s,
  467. const char *__restrict __format,
  468. __gnuc_va_list __arg), __isoc99_vsscanf)
  469. __attribute__ ((__format__ (__scanf__, 2, 0)));
  470. # else
  471. extern int __isoc99_vfscanf (FILE *__restrict __s,
  472. const char *__restrict __format,
  473. __gnuc_va_list __arg) __wur;
  474. extern int __isoc99_vscanf (const char *__restrict __format,
  475. __gnuc_va_list __arg) __wur;
  476. extern int __isoc99_vsscanf (const char *__restrict __s,
  477. const char *__restrict __format,
  478. __gnuc_va_list __arg) __THROW;
  479. # define vfscanf __isoc99_vfscanf
  480. # define vscanf __isoc99_vscanf
  481. # define vsscanf __isoc99_vsscanf
  482. # endif
  483. # endif
  484. #endif /* Use ISO C9x. */
  485.  
  486.  
  487. /* Read a character from STREAM.
  488.  
  489. These functions are possible cancellation points and therefore not
  490. marked with __THROW. */
  491. extern int fgetc (FILE *__stream);
  492. extern int getc (FILE *__stream);
  493.  
  494. /* Read a character from stdin.
  495.  
  496. This function is a possible cancellation point and therefore not
  497. marked with __THROW. */
  498. extern int getchar (void);
  499.  
  500. #ifdef __USE_POSIX199506
  501. /* These are defined in POSIX.1:1996.
  502.  
  503. These functions are possible cancellation points and therefore not
  504. marked with __THROW. */
  505. extern int getc_unlocked (FILE *__stream);
  506. extern int getchar_unlocked (void);
  507. #endif /* Use POSIX. */
  508.  
  509. #ifdef __USE_MISC
  510. /* Faster version when locking is not necessary.
  511.  
  512. This function is not part of POSIX and therefore no official
  513. cancellation point. But due to similarity with an POSIX interface
  514. or due to the implementation it is a cancellation point and
  515. therefore not marked with __THROW. */
  516. extern int fgetc_unlocked (FILE *__stream);
  517. #endif /* Use MISC. */
  518.  
  519.  
  520. /* Write a character to STREAM.
  521.  
  522. These functions are possible cancellation points and therefore not
  523. marked with __THROW.
  524.  
  525. These functions is a possible cancellation point and therefore not
  526. marked with __THROW. */
  527. extern int fputc (int __c, FILE *__stream);
  528. extern int putc (int __c, FILE *__stream);
  529.  
  530. /* Write a character to stdout.
  531.  
  532. This function is a possible cancellation point and therefore not
  533. marked with __THROW. */
  534. extern int putchar (int __c);
  535.  
  536. #ifdef __USE_MISC
  537. /* Faster version when locking is not necessary.
  538.  
  539. This function is not part of POSIX and therefore no official
  540. cancellation point. But due to similarity with an POSIX interface
  541. or due to the implementation it is a cancellation point and
  542. therefore not marked with __THROW. */
  543. extern int fputc_unlocked (int __c, FILE *__stream);
  544. #endif /* Use MISC. */
  545.  
  546. #ifdef __USE_POSIX199506
  547. /* These are defined in POSIX.1:1996.
  548.  
  549. These functions are possible cancellation points and therefore not
  550. marked with __THROW. */
  551. extern int putc_unlocked (int __c, FILE *__stream);
  552. extern int putchar_unlocked (int __c);
  553. #endif /* Use POSIX. */
  554.  
  555.  
  556. #if defined __USE_MISC \
  557. || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
  558. /* Get a word (int) from STREAM. */
  559. extern int getw (FILE *__stream);
  560.  
  561. /* Write a word (int) to STREAM. */
  562. extern int putw (int __w, FILE *__stream);
  563. #endif
  564.  
  565.  
  566. /* Get a newline-terminated string of finite length from STREAM.
  567.  
  568. This function is a possible cancellation point and therefore not
  569. marked with __THROW. */
  570. extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
  571. __wur;
  572.  
  573. #if __GLIBC_USE (DEPRECATED_GETS)
  574. /* Get a newline-terminated string from stdin, removing the newline.
  575.  
  576. This function is impossible to use safely. It has been officially
  577. removed from ISO C11 and ISO C++14, and we have also removed it
  578. from the _GNU_SOURCE feature list. It remains available when
  579. explicitly using an old ISO C, Unix, or POSIX standard.
  580.  
  581. This function is a possible cancellation point and therefore not
  582. marked with __THROW. */
  583. extern char *gets (char *__s) __wur __attribute_deprecated__;
  584. #endif
  585.  
  586. #ifdef __USE_GNU
  587. /* This function does the same as `fgets' but does not lock the stream.
  588.  
  589. This function is not part of POSIX and therefore no official
  590. cancellation point. But due to similarity with an POSIX interface
  591. or due to the implementation it is a cancellation point and
  592. therefore not marked with __THROW. */
  593. extern char *fgets_unlocked (char *__restrict __s, int __n,
  594. FILE *__restrict __stream) __wur;
  595. #endif
  596.  
  597.  
  598. #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
  599. /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
  600. (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
  601. NULL), pointing to *N characters of space. It is realloc'd as
  602. necessary. Returns the number of characters read (not including the
  603. null terminator), or -1 on error or EOF.
  604.  
  605. These functions are not part of POSIX and therefore no official
  606. cancellation point. But due to similarity with an POSIX interface
  607. or due to the implementation they are cancellation points and
  608. therefore not marked with __THROW. */
  609. extern __ssize_t __getdelim (char **__restrict __lineptr,
  610. size_t *__restrict __n, int __delimiter,
  611. FILE *__restrict __stream) __wur;
  612. extern __ssize_t getdelim (char **__restrict __lineptr,
  613. size_t *__restrict __n, int __delimiter,
  614. FILE *__restrict __stream) __wur;
  615.  
  616. /* Like `getdelim', but reads up to a newline.
  617.  
  618. This function is not part of POSIX and therefore no official
  619. cancellation point. But due to similarity with an POSIX interface
  620. or due to the implementation it is a cancellation point and
  621. therefore not marked with __THROW. */
  622. extern __ssize_t getline (char **__restrict __lineptr,
  623. size_t *__restrict __n,
  624. FILE *__restrict __stream) __wur;
  625. #endif
  626.  
  627.  
  628. /* Write a string to STREAM.
  629.  
  630. This function is a possible cancellation point and therefore not
  631. marked with __THROW. */
  632. extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
  633.  
  634. /* Write a string, followed by a newline, to stdout.
  635.  
  636. This function is a possible cancellation point and therefore not
  637. marked with __THROW. */
  638. extern int puts (const char *__s);
  639.  
  640.  
  641. /* Push a character back onto the input buffer of STREAM.
  642.  
  643. This function is a possible cancellation point and therefore not
  644. marked with __THROW. */
  645. extern int ungetc (int __c, FILE *__stream);
  646.  
  647.  
  648. /* Read chunks of generic data from STREAM.
  649.  
  650. This function is a possible cancellation point and therefore not
  651. marked with __THROW. */
  652. extern size_t fread (void *__restrict __ptr, size_t __size,
  653. size_t __n, FILE *__restrict __stream) __wur;
  654. /* Write chunks of generic data to STREAM.
  655.  
  656. This function is a possible cancellation point and therefore not
  657. marked with __THROW. */
  658. extern size_t fwrite (const void *__restrict __ptr, size_t __size,
  659. size_t __n, FILE *__restrict __s);
  660.  
  661. #ifdef __USE_GNU
  662. /* This function does the same as `fputs' but does not lock the stream.
  663.  
  664. This function is not part of POSIX and therefore no official
  665. cancellation point. But due to similarity with an POSIX interface
  666. or due to the implementation it is a cancellation point and
  667. therefore not marked with __THROW. */
  668. extern int fputs_unlocked (const char *__restrict __s,
  669. FILE *__restrict __stream);
  670. #endif
  671.  
  672. #ifdef __USE_MISC
  673. /* Faster versions when locking is not necessary.
  674.  
  675. These functions are not part of POSIX and therefore no official
  676. cancellation point. But due to similarity with an POSIX interface
  677. or due to the implementation they are cancellation points and
  678. therefore not marked with __THROW. */
  679. extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
  680. size_t __n, FILE *__restrict __stream) __wur;
  681. extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
  682. size_t __n, FILE *__restrict __stream);
  683. #endif
  684.  
  685.  
  686. /* Seek to a certain position on STREAM.
  687.  
  688. This function is a possible cancellation point and therefore not
  689. marked with __THROW. */
  690. extern int fseek (FILE *__stream, long int __off, int __whence);
  691. /* Return the current position of STREAM.
  692.  
  693. This function is a possible cancellation point and therefore not
  694. marked with __THROW. */
  695. extern long int ftell (FILE *__stream) __wur;
  696. /* Rewind to the beginning of STREAM.
  697.  
  698. This function is a possible cancellation point and therefore not
  699. marked with __THROW. */
  700. extern void rewind (FILE *__stream);
  701.  
  702. /* The Single Unix Specification, Version 2, specifies an alternative,
  703. more adequate interface for the two functions above which deal with
  704. file offset. `long int' is not the right type. These definitions
  705. are originally defined in the Large File Support API. */
  706.  
  707. #if defined __USE_LARGEFILE || defined __USE_XOPEN2K
  708. # ifndef __USE_FILE_OFFSET64
  709. /* Seek to a certain position on STREAM.
  710.  
  711. This function is a possible cancellation point and therefore not
  712. marked with __THROW. */
  713. extern int fseeko (FILE *__stream, __off_t __off, int __whence);
  714. /* Return the current position of STREAM.
  715.  
  716. This function is a possible cancellation point and therefore not
  717. marked with __THROW. */
  718. extern __off_t ftello (FILE *__stream) __wur;
  719. # else
  720. # ifdef __REDIRECT
  721. extern int __REDIRECT (fseeko,
  722. (FILE *__stream, __off64_t __off, int __whence),
  723. fseeko64);
  724. extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64);
  725. # else
  726. # define fseeko fseeko64
  727. # define ftello ftello64
  728. # endif
  729. # endif
  730. #endif
  731.  
  732. #ifndef __USE_FILE_OFFSET64
  733. /* Get STREAM's position.
  734.  
  735. This function is a possible cancellation point and therefore not
  736. marked with __THROW. */
  737. extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
  738. /* Set STREAM's position.
  739.  
  740. This function is a possible cancellation point and therefore not
  741. marked with __THROW. */
  742. extern int fsetpos (FILE *__stream, const fpos_t *__pos);
  743. #else
  744. # ifdef __REDIRECT
  745. extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
  746. fpos_t *__restrict __pos), fgetpos64);
  747. extern int __REDIRECT (fsetpos,
  748. (FILE *__stream, const fpos_t *__pos), fsetpos64);
  749. # else
  750. # define fgetpos fgetpos64
  751. # define fsetpos fsetpos64
  752. # endif
  753. #endif
  754.  
  755. #ifdef __USE_LARGEFILE64
  756. extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
  757. extern __off64_t ftello64 (FILE *__stream) __wur;
  758. extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
  759. extern int fsetpos64 (FILE *__stream, const fpos64_t *__pos);
  760. #endif
  761.  
  762. /* Clear the error and EOF indicators for STREAM. */
  763. extern void clearerr (FILE *__stream) __THROW;
  764. /* Return the EOF indicator for STREAM. */
  765. extern int feof (FILE *__stream) __THROW __wur;
  766. /* Return the error indicator for STREAM. */
  767. extern int ferror (FILE *__stream) __THROW __wur;
  768.  
  769. #ifdef __USE_MISC
  770. /* Faster versions when locking is not required. */
  771. extern void clearerr_unlocked (FILE *__stream) __THROW;
  772. extern int feof_unlocked (FILE *__stream) __THROW __wur;
  773. extern int ferror_unlocked (FILE *__stream) __THROW __wur;
  774. #endif
  775.  
  776.  
  777. /* Print a message describing the meaning of the value of errno.
  778.  
  779. This function is a possible cancellation point and therefore not
  780. marked with __THROW. */
  781. extern void perror (const char *__s);
  782.  
  783. /* Provide the declarations for `sys_errlist' and `sys_nerr' if they
  784. are available on this system. Even if available, these variables
  785. should not be used directly. The `strerror' function provides
  786. all the necessary functionality. */
  787. #include <bits/sys_errlist.h>
  788.  
  789.  
  790. #ifdef __USE_POSIX
  791. /* Return the system file descriptor for STREAM. */
  792. extern int fileno (FILE *__stream) __THROW __wur;
  793. #endif /* Use POSIX. */
  794.  
  795. #ifdef __USE_MISC
  796. /* Faster version when locking is not required. */
  797. extern int fileno_unlocked (FILE *__stream) __THROW __wur;
  798. #endif
  799.  
  800.  
  801. #ifdef __USE_POSIX2
  802. /* Create a new stream connected to a pipe running the given command.
  803.  
  804. This function is a possible cancellation point and therefore not
  805. marked with __THROW. */
  806. extern FILE *popen (const char *__command, const char *__modes) __wur;
  807.  
  808. /* Close a stream opened by popen and return the status of its child.
  809.  
  810. This function is a possible cancellation point and therefore not
  811. marked with __THROW. */
  812. extern int pclose (FILE *__stream);
  813. #endif
  814.  
  815.  
  816. #ifdef __USE_POSIX
  817. /* Return the name of the controlling terminal. */
  818. extern char *ctermid (char *__s) __THROW;
  819. #endif /* Use POSIX. */
  820.  
  821.  
  822. #if (defined __USE_XOPEN && !defined __USE_XOPEN2K) || defined __USE_GNU
  823. /* Return the name of the current user. */
  824. extern char *cuserid (char *__s);
  825. #endif /* Use X/Open, but not issue 6. */
  826.  
  827.  
  828. #ifdef __USE_GNU
  829. struct obstack; /* See <obstack.h>. */
  830.  
  831. /* Write formatted output to an obstack. */
  832. extern int obstack_printf (struct obstack *__restrict __obstack,
  833. const char *__restrict __format, ...)
  834. __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
  835. extern int obstack_vprintf (struct obstack *__restrict __obstack,
  836. const char *__restrict __format,
  837. __gnuc_va_list __args)
  838. __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
  839. #endif /* Use GNU. */
  840.  
  841.  
  842. #ifdef __USE_POSIX199506
  843. /* These are defined in POSIX.1:1996. */
  844.  
  845. /* Acquire ownership of STREAM. */
  846. extern void flockfile (FILE *__stream) __THROW;
  847.  
  848. /* Try to acquire ownership of STREAM but do not block if it is not
  849. possible. */
  850. extern int ftrylockfile (FILE *__stream) __THROW __wur;
  851.  
  852. /* Relinquish the ownership granted for STREAM. */
  853. extern void funlockfile (FILE *__stream) __THROW;
  854. #endif /* POSIX */
  855.  
  856. #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
  857. /* X/Open Issues 1-5 required getopt to be declared in this
  858. header. It was removed in Issue 6. GNU follows Issue 6. */
  859. # include <bits/getopt_posix.h>
  860. #endif
  861.  
  862. /* Slow-path routines used by the optimized inline functions in
  863. bits/stdio.h. */
  864. extern int __uflow (FILE *);
  865. extern int __overflow (FILE *, int);
  866.  
  867. /* If we are compiling with optimizing read this file. It contains
  868. several optimizing inline functions and macros. */
  869. #ifdef __USE_EXTERN_INLINES
  870. # include <bits/stdio.h>
  871. #endif
  872. #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
  873. # include <bits/stdio2.h>
  874. #endif
  875. #ifdef __LDBL_COMPAT
  876. # include <bits/stdio-ldbl.h>
  877. #endif
  878.  
  879. __END_DECLS
  880.  
  881. #endif /* <stdio.h> included. */
  882.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty