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