Update ChangeLog for BZ 22884 - riscv fmax/fmin
[glibc.git] / libio / stdio.h
blob731f8e56f4c115a1a507b85babaa22b21efb140c
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.
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.
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.
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://www.gnu.org/licenses/>. */
20 * ISO C99 Standard: 7.19 Input/output <stdio.h>
23 #ifndef _STDIO_H
24 #define _STDIO_H 1
26 #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
27 #include <bits/libc-header-start.h>
29 __BEGIN_DECLS
31 #define __need_size_t
32 #define __need_NULL
33 #include <stddef.h>
35 #define __need___va_list
36 #include <stdarg.h>
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>
45 #ifdef __USE_GNU
46 # include <bits/types/cookie_io_functions_t.h>
47 #endif
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
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
75 #ifdef __USE_XOPEN2K8
76 # ifndef __ssize_t_defined
77 typedef __ssize_t ssize_t;
78 # define __ssize_t_defined
79 # endif
80 #endif
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
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. */
98 /* Default buffer size. */
99 #define BUFSIZ 8192
102 /* The value returned by fgetc and similar functions to indicate the
103 end of the file. */
104 #define EOF (-1)
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
118 #if defined __USE_MISC || defined __USE_XOPEN
119 /* Default path prefix for `tempnam' and `tmpnam'. */
120 # define P_tmpdir "/tmp"
121 #endif
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>
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
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;
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
156 /* Create a temporary file and open it read/write.
158 This function is a possible cancellation point and therefore not
159 marked with __THROW. */
160 #ifndef __USE_FILE_OFFSET64
161 extern FILE *tmpfile (void) __wur;
162 #else
163 # ifdef __REDIRECT
164 extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) __wur;
165 # else
166 # define tmpfile tmpfile64
167 # endif
168 #endif
170 #ifdef __USE_LARGEFILE64
171 extern FILE *tmpfile64 (void) __wur;
172 #endif
174 /* Generate a temporary filename. */
175 extern char *tmpnam (char *__s) __THROW __wur;
177 #ifdef __USE_MISC
178 /* This is the reentrant variant of `tmpnam'. The only difference is
179 that it does not allow S to be NULL. */
180 extern char *tmpnam_r (char *__s) __THROW __wur;
181 #endif
184 #if defined __USE_MISC || defined __USE_XOPEN
185 /* Generate a unique temporary filename using up to five characters of PFX
186 if it is not NULL. The directory to put this file in is searched for
187 as follows: First the environment variable "TMPDIR" is checked.
188 If it contains the name of a writable directory, that directory is used.
189 If not and if DIR is not NULL, that value is checked. If that fails,
190 P_tmpdir is tried and finally "/tmp". The storage for the filename
191 is allocated by `malloc'. */
192 extern char *tempnam (const char *__dir, const char *__pfx)
193 __THROW __attribute_malloc__ __wur;
194 #endif
197 /* Close STREAM.
199 This function is a possible cancellation point and therefore not
200 marked with __THROW. */
201 extern int fclose (FILE *__stream);
202 /* Flush STREAM, or all streams if STREAM is NULL.
204 This function is a possible cancellation point and therefore not
205 marked with __THROW. */
206 extern int fflush (FILE *__stream);
208 #ifdef __USE_MISC
209 /* Faster versions when locking is not required.
211 This function is not part of POSIX and therefore no official
212 cancellation point. But due to similarity with an POSIX interface
213 or due to the implementation it is a cancellation point and
214 therefore not marked with __THROW. */
215 extern int fflush_unlocked (FILE *__stream);
216 #endif
218 #ifdef __USE_GNU
219 /* Close all streams.
221 This function is not part of POSIX and therefore no official
222 cancellation point. But due to similarity with an POSIX interface
223 or due to the implementation it is a cancellation point and
224 therefore not marked with __THROW. */
225 extern int fcloseall (void);
226 #endif
229 #ifndef __USE_FILE_OFFSET64
230 /* Open a file and create a new stream for it.
232 This function is a possible cancellation point and therefore not
233 marked with __THROW. */
234 extern FILE *fopen (const char *__restrict __filename,
235 const char *__restrict __modes) __wur;
236 /* Open a file, replacing an existing stream with it.
238 This function is a possible cancellation point and therefore not
239 marked with __THROW. */
240 extern FILE *freopen (const char *__restrict __filename,
241 const char *__restrict __modes,
242 FILE *__restrict __stream) __wur;
243 #else
244 # ifdef __REDIRECT
245 extern FILE *__REDIRECT (fopen, (const char *__restrict __filename,
246 const char *__restrict __modes), fopen64)
247 __wur;
248 extern FILE *__REDIRECT (freopen, (const char *__restrict __filename,
249 const char *__restrict __modes,
250 FILE *__restrict __stream), freopen64)
251 __wur;
252 # else
253 # define fopen fopen64
254 # define freopen freopen64
255 # endif
256 #endif
257 #ifdef __USE_LARGEFILE64
258 extern FILE *fopen64 (const char *__restrict __filename,
259 const char *__restrict __modes) __wur;
260 extern FILE *freopen64 (const char *__restrict __filename,
261 const char *__restrict __modes,
262 FILE *__restrict __stream) __wur;
263 #endif
265 #ifdef __USE_POSIX
266 /* Create a new stream that refers to an existing system file descriptor. */
267 extern FILE *fdopen (int __fd, const char *__modes) __THROW __wur;
268 #endif
270 #ifdef __USE_GNU
271 /* Create a new stream that refers to the given magic cookie,
272 and uses the given functions for input and output. */
273 extern FILE *fopencookie (void *__restrict __magic_cookie,
274 const char *__restrict __modes,
275 cookie_io_functions_t __io_funcs) __THROW __wur;
276 #endif
278 #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
279 /* Create a new stream that refers to a memory buffer. */
280 extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
281 __THROW __wur;
283 /* Open a stream that writes into a malloc'd buffer that is expanded as
284 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
285 and the number of characters written on fflush or fclose. */
286 extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur;
287 #endif
290 /* If BUF is NULL, make STREAM unbuffered.
291 Else make it use buffer BUF, of size BUFSIZ. */
292 extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
293 /* Make STREAM use buffering mode MODE.
294 If BUF is not NULL, use N bytes of it for buffering;
295 else allocate an internal buffer N bytes long. */
296 extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
297 int __modes, size_t __n) __THROW;
299 #ifdef __USE_MISC
300 /* If BUF is NULL, make STREAM unbuffered.
301 Else make it use SIZE bytes of BUF for buffering. */
302 extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
303 size_t __size) __THROW;
305 /* Make STREAM line-buffered. */
306 extern void setlinebuf (FILE *__stream) __THROW;
307 #endif
310 /* Write formatted output to STREAM.
312 This function is a possible cancellation point and therefore not
313 marked with __THROW. */
314 extern int fprintf (FILE *__restrict __stream,
315 const char *__restrict __format, ...);
316 /* Write formatted output to stdout.
318 This function is a possible cancellation point and therefore not
319 marked with __THROW. */
320 extern int printf (const char *__restrict __format, ...);
321 /* Write formatted output to S. */
322 extern int sprintf (char *__restrict __s,
323 const char *__restrict __format, ...) __THROWNL;
325 /* Write formatted output to S from argument list ARG.
327 This function is a possible cancellation point and therefore not
328 marked with __THROW. */
329 extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
330 __gnuc_va_list __arg);
331 /* Write formatted output to stdout from argument list ARG.
333 This function is a possible cancellation point and therefore not
334 marked with __THROW. */
335 extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
336 /* Write formatted output to S from argument list ARG. */
337 extern int vsprintf (char *__restrict __s, const char *__restrict __format,
338 __gnuc_va_list __arg) __THROWNL;
340 #if defined __USE_ISOC99 || defined __USE_UNIX98
341 /* Maximum chars of output to write in MAXLEN. */
342 extern int snprintf (char *__restrict __s, size_t __maxlen,
343 const char *__restrict __format, ...)
344 __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
346 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
347 const char *__restrict __format, __gnuc_va_list __arg)
348 __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
349 #endif
351 #if __GLIBC_USE (LIB_EXT2)
352 /* Write formatted output to a string dynamically allocated with `malloc'.
353 Store the address of the string in *PTR. */
354 extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
355 __gnuc_va_list __arg)
356 __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
357 extern int __asprintf (char **__restrict __ptr,
358 const char *__restrict __fmt, ...)
359 __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
360 extern int asprintf (char **__restrict __ptr,
361 const char *__restrict __fmt, ...)
362 __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
363 #endif
365 #ifdef __USE_XOPEN2K8
366 /* Write formatted output to a file descriptor. */
367 extern int vdprintf (int __fd, const char *__restrict __fmt,
368 __gnuc_va_list __arg)
369 __attribute__ ((__format__ (__printf__, 2, 0)));
370 extern int dprintf (int __fd, const char *__restrict __fmt, ...)
371 __attribute__ ((__format__ (__printf__, 2, 3)));
372 #endif
375 /* Read formatted input from STREAM.
377 This function is a possible cancellation point and therefore not
378 marked with __THROW. */
379 extern int fscanf (FILE *__restrict __stream,
380 const char *__restrict __format, ...) __wur;
381 /* Read formatted input from stdin.
383 This function is a possible cancellation point and therefore not
384 marked with __THROW. */
385 extern int scanf (const char *__restrict __format, ...) __wur;
386 /* Read formatted input from S. */
387 extern int sscanf (const char *__restrict __s,
388 const char *__restrict __format, ...) __THROW;
390 #if defined __USE_ISOC99 && !defined __USE_GNU \
391 && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
392 && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
393 # ifdef __REDIRECT
394 /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
395 GNU extension which conflicts with valid %a followed by letter
396 s, S or [. */
397 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
398 const char *__restrict __format, ...),
399 __isoc99_fscanf) __wur;
400 extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
401 __isoc99_scanf) __wur;
402 extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
403 const char *__restrict __format, ...),
404 __isoc99_sscanf);
405 # else
406 extern int __isoc99_fscanf (FILE *__restrict __stream,
407 const char *__restrict __format, ...) __wur;
408 extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
409 extern int __isoc99_sscanf (const char *__restrict __s,
410 const char *__restrict __format, ...) __THROW;
411 # define fscanf __isoc99_fscanf
412 # define scanf __isoc99_scanf
413 # define sscanf __isoc99_sscanf
414 # endif
415 #endif
417 #ifdef __USE_ISOC99
418 /* Read formatted input from S into argument list ARG.
420 This function is a possible cancellation point and therefore not
421 marked with __THROW. */
422 extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
423 __gnuc_va_list __arg)
424 __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
426 /* Read formatted input from stdin into argument list ARG.
428 This function is a possible cancellation point and therefore not
429 marked with __THROW. */
430 extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
431 __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
433 /* Read formatted input from S into argument list ARG. */
434 extern int vsscanf (const char *__restrict __s,
435 const char *__restrict __format, __gnuc_va_list __arg)
436 __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
438 # if !defined __USE_GNU \
439 && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
440 && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
441 # ifdef __REDIRECT
442 /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
443 GNU extension which conflicts with valid %a followed by letter
444 s, S or [. */
445 extern int __REDIRECT (vfscanf,
446 (FILE *__restrict __s,
447 const char *__restrict __format, __gnuc_va_list __arg),
448 __isoc99_vfscanf)
449 __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
450 extern int __REDIRECT (vscanf, (const char *__restrict __format,
451 __gnuc_va_list __arg), __isoc99_vscanf)
452 __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
453 extern int __REDIRECT_NTH (vsscanf,
454 (const char *__restrict __s,
455 const char *__restrict __format,
456 __gnuc_va_list __arg), __isoc99_vsscanf)
457 __attribute__ ((__format__ (__scanf__, 2, 0)));
458 # else
459 extern int __isoc99_vfscanf (FILE *__restrict __s,
460 const char *__restrict __format,
461 __gnuc_va_list __arg) __wur;
462 extern int __isoc99_vscanf (const char *__restrict __format,
463 __gnuc_va_list __arg) __wur;
464 extern int __isoc99_vsscanf (const char *__restrict __s,
465 const char *__restrict __format,
466 __gnuc_va_list __arg) __THROW;
467 # define vfscanf __isoc99_vfscanf
468 # define vscanf __isoc99_vscanf
469 # define vsscanf __isoc99_vsscanf
470 # endif
471 # endif
472 #endif /* Use ISO C9x. */
475 /* Read a character from STREAM.
477 These functions are possible cancellation points and therefore not
478 marked with __THROW. */
479 extern int fgetc (FILE *__stream);
480 extern int getc (FILE *__stream);
482 /* Read a character from stdin.
484 This function is a possible cancellation point and therefore not
485 marked with __THROW. */
486 extern int getchar (void);
488 #ifdef __USE_POSIX199506
489 /* These are defined in POSIX.1:1996.
491 These functions are possible cancellation points and therefore not
492 marked with __THROW. */
493 extern int getc_unlocked (FILE *__stream);
494 extern int getchar_unlocked (void);
495 #endif /* Use POSIX. */
497 #ifdef __USE_MISC
498 /* Faster version when locking is not necessary.
500 This function is not part of POSIX and therefore no official
501 cancellation point. But due to similarity with an POSIX interface
502 or due to the implementation it is a cancellation point and
503 therefore not marked with __THROW. */
504 extern int fgetc_unlocked (FILE *__stream);
505 #endif /* Use MISC. */
508 /* Write a character to STREAM.
510 These functions are possible cancellation points and therefore not
511 marked with __THROW.
513 These functions is a possible cancellation point and therefore not
514 marked with __THROW. */
515 extern int fputc (int __c, FILE *__stream);
516 extern int putc (int __c, FILE *__stream);
518 /* Write a character to stdout.
520 This function is a possible cancellation point and therefore not
521 marked with __THROW. */
522 extern int putchar (int __c);
524 #ifdef __USE_MISC
525 /* Faster version when locking is not necessary.
527 This function is not part of POSIX and therefore no official
528 cancellation point. But due to similarity with an POSIX interface
529 or due to the implementation it is a cancellation point and
530 therefore not marked with __THROW. */
531 extern int fputc_unlocked (int __c, FILE *__stream);
532 #endif /* Use MISC. */
534 #ifdef __USE_POSIX199506
535 /* These are defined in POSIX.1:1996.
537 These functions are possible cancellation points and therefore not
538 marked with __THROW. */
539 extern int putc_unlocked (int __c, FILE *__stream);
540 extern int putchar_unlocked (int __c);
541 #endif /* Use POSIX. */
544 #if defined __USE_MISC \
545 || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
546 /* Get a word (int) from STREAM. */
547 extern int getw (FILE *__stream);
549 /* Write a word (int) to STREAM. */
550 extern int putw (int __w, FILE *__stream);
551 #endif
554 /* Get a newline-terminated string of finite length from STREAM.
556 This function is a possible cancellation point and therefore not
557 marked with __THROW. */
558 extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
559 __wur;
561 #if __GLIBC_USE (DEPRECATED_GETS)
562 /* Get a newline-terminated string from stdin, removing the newline.
564 This function is impossible to use safely. It has been officially
565 removed from ISO C11 and ISO C++14, and we have also removed it
566 from the _GNU_SOURCE feature list. It remains available when
567 explicitly using an old ISO C, Unix, or POSIX standard.
569 This function is a possible cancellation point and therefore not
570 marked with __THROW. */
571 extern char *gets (char *__s) __wur __attribute_deprecated__;
572 #endif
574 #ifdef __USE_GNU
575 /* This function does the same as `fgets' but does not lock the stream.
577 This function is not part of POSIX and therefore no official
578 cancellation point. But due to similarity with an POSIX interface
579 or due to the implementation it is a cancellation point and
580 therefore not marked with __THROW. */
581 extern char *fgets_unlocked (char *__restrict __s, int __n,
582 FILE *__restrict __stream) __wur;
583 #endif
586 #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2)
587 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
588 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
589 NULL), pointing to *N characters of space. It is realloc'd as
590 necessary. Returns the number of characters read (not including the
591 null terminator), or -1 on error or EOF.
593 These functions are not part of POSIX and therefore no official
594 cancellation point. But due to similarity with an POSIX interface
595 or due to the implementation they are cancellation points and
596 therefore not marked with __THROW. */
597 extern __ssize_t __getdelim (char **__restrict __lineptr,
598 size_t *__restrict __n, int __delimiter,
599 FILE *__restrict __stream) __wur;
600 extern __ssize_t getdelim (char **__restrict __lineptr,
601 size_t *__restrict __n, int __delimiter,
602 FILE *__restrict __stream) __wur;
604 /* Like `getdelim', but reads up to a newline.
606 This function is not part of POSIX and therefore no official
607 cancellation point. But due to similarity with an POSIX interface
608 or due to the implementation it is a cancellation point and
609 therefore not marked with __THROW. */
610 extern __ssize_t getline (char **__restrict __lineptr,
611 size_t *__restrict __n,
612 FILE *__restrict __stream) __wur;
613 #endif
616 /* Write a string to STREAM.
618 This function is a possible cancellation point and therefore not
619 marked with __THROW. */
620 extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
622 /* Write a string, followed by a newline, to stdout.
624 This function is a possible cancellation point and therefore not
625 marked with __THROW. */
626 extern int puts (const char *__s);
629 /* Push a character back onto the input buffer of STREAM.
631 This function is a possible cancellation point and therefore not
632 marked with __THROW. */
633 extern int ungetc (int __c, FILE *__stream);
636 /* Read chunks of generic data from STREAM.
638 This function is a possible cancellation point and therefore not
639 marked with __THROW. */
640 extern size_t fread (void *__restrict __ptr, size_t __size,
641 size_t __n, FILE *__restrict __stream) __wur;
642 /* Write chunks of generic data to STREAM.
644 This function is a possible cancellation point and therefore not
645 marked with __THROW. */
646 extern size_t fwrite (const void *__restrict __ptr, size_t __size,
647 size_t __n, FILE *__restrict __s);
649 #ifdef __USE_GNU
650 /* This function does the same as `fputs' but does not lock the stream.
652 This function is not part of POSIX and therefore no official
653 cancellation point. But due to similarity with an POSIX interface
654 or due to the implementation it is a cancellation point and
655 therefore not marked with __THROW. */
656 extern int fputs_unlocked (const char *__restrict __s,
657 FILE *__restrict __stream);
658 #endif
660 #ifdef __USE_MISC
661 /* Faster versions when locking is not necessary.
663 These functions are not part of POSIX and therefore no official
664 cancellation point. But due to similarity with an POSIX interface
665 or due to the implementation they are cancellation points and
666 therefore not marked with __THROW. */
667 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
668 size_t __n, FILE *__restrict __stream) __wur;
669 extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
670 size_t __n, FILE *__restrict __stream);
671 #endif
674 /* Seek to a certain position on STREAM.
676 This function is a possible cancellation point and therefore not
677 marked with __THROW. */
678 extern int fseek (FILE *__stream, long int __off, int __whence);
679 /* Return the current position of STREAM.
681 This function is a possible cancellation point and therefore not
682 marked with __THROW. */
683 extern long int ftell (FILE *__stream) __wur;
684 /* Rewind to the beginning of STREAM.
686 This function is a possible cancellation point and therefore not
687 marked with __THROW. */
688 extern void rewind (FILE *__stream);
690 /* The Single Unix Specification, Version 2, specifies an alternative,
691 more adequate interface for the two functions above which deal with
692 file offset. `long int' is not the right type. These definitions
693 are originally defined in the Large File Support API. */
695 #if defined __USE_LARGEFILE || defined __USE_XOPEN2K
696 # ifndef __USE_FILE_OFFSET64
697 /* Seek to a certain position on STREAM.
699 This function is a possible cancellation point and therefore not
700 marked with __THROW. */
701 extern int fseeko (FILE *__stream, __off_t __off, int __whence);
702 /* Return the current position of STREAM.
704 This function is a possible cancellation point and therefore not
705 marked with __THROW. */
706 extern __off_t ftello (FILE *__stream) __wur;
707 # else
708 # ifdef __REDIRECT
709 extern int __REDIRECT (fseeko,
710 (FILE *__stream, __off64_t __off, int __whence),
711 fseeko64);
712 extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64);
713 # else
714 # define fseeko fseeko64
715 # define ftello ftello64
716 # endif
717 # endif
718 #endif
720 #ifndef __USE_FILE_OFFSET64
721 /* Get STREAM's position.
723 This function is a possible cancellation point and therefore not
724 marked with __THROW. */
725 extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
726 /* Set STREAM's position.
728 This function is a possible cancellation point and therefore not
729 marked with __THROW. */
730 extern int fsetpos (FILE *__stream, const fpos_t *__pos);
731 #else
732 # ifdef __REDIRECT
733 extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
734 fpos_t *__restrict __pos), fgetpos64);
735 extern int __REDIRECT (fsetpos,
736 (FILE *__stream, const fpos_t *__pos), fsetpos64);
737 # else
738 # define fgetpos fgetpos64
739 # define fsetpos fsetpos64
740 # endif
741 #endif
743 #ifdef __USE_LARGEFILE64
744 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
745 extern __off64_t ftello64 (FILE *__stream) __wur;
746 extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
747 extern int fsetpos64 (FILE *__stream, const fpos64_t *__pos);
748 #endif
750 /* Clear the error and EOF indicators for STREAM. */
751 extern void clearerr (FILE *__stream) __THROW;
752 /* Return the EOF indicator for STREAM. */
753 extern int feof (FILE *__stream) __THROW __wur;
754 /* Return the error indicator for STREAM. */
755 extern int ferror (FILE *__stream) __THROW __wur;
757 #ifdef __USE_MISC
758 /* Faster versions when locking is not required. */
759 extern void clearerr_unlocked (FILE *__stream) __THROW;
760 extern int feof_unlocked (FILE *__stream) __THROW __wur;
761 extern int ferror_unlocked (FILE *__stream) __THROW __wur;
762 #endif
765 /* Print a message describing the meaning of the value of errno.
767 This function is a possible cancellation point and therefore not
768 marked with __THROW. */
769 extern void perror (const char *__s);
771 /* Provide the declarations for `sys_errlist' and `sys_nerr' if they
772 are available on this system. Even if available, these variables
773 should not be used directly. The `strerror' function provides
774 all the necessary functionality. */
775 #include <bits/sys_errlist.h>
778 #ifdef __USE_POSIX
779 /* Return the system file descriptor for STREAM. */
780 extern int fileno (FILE *__stream) __THROW __wur;
781 #endif /* Use POSIX. */
783 #ifdef __USE_MISC
784 /* Faster version when locking is not required. */
785 extern int fileno_unlocked (FILE *__stream) __THROW __wur;
786 #endif
789 #ifdef __USE_POSIX2
790 /* Create a new stream connected to a pipe running the given command.
792 This function is a possible cancellation point and therefore not
793 marked with __THROW. */
794 extern FILE *popen (const char *__command, const char *__modes) __wur;
796 /* Close a stream opened by popen and return the status of its child.
798 This function is a possible cancellation point and therefore not
799 marked with __THROW. */
800 extern int pclose (FILE *__stream);
801 #endif
804 #ifdef __USE_POSIX
805 /* Return the name of the controlling terminal. */
806 extern char *ctermid (char *__s) __THROW;
807 #endif /* Use POSIX. */
810 #if (defined __USE_XOPEN && !defined __USE_XOPEN2K) || defined __USE_GNU
811 /* Return the name of the current user. */
812 extern char *cuserid (char *__s);
813 #endif /* Use X/Open, but not issue 6. */
816 #ifdef __USE_GNU
817 struct obstack; /* See <obstack.h>. */
819 /* Write formatted output to an obstack. */
820 extern int obstack_printf (struct obstack *__restrict __obstack,
821 const char *__restrict __format, ...)
822 __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
823 extern int obstack_vprintf (struct obstack *__restrict __obstack,
824 const char *__restrict __format,
825 __gnuc_va_list __args)
826 __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
827 #endif /* Use GNU. */
830 #ifdef __USE_POSIX199506
831 /* These are defined in POSIX.1:1996. */
833 /* Acquire ownership of STREAM. */
834 extern void flockfile (FILE *__stream) __THROW;
836 /* Try to acquire ownership of STREAM but do not block if it is not
837 possible. */
838 extern int ftrylockfile (FILE *__stream) __THROW __wur;
840 /* Relinquish the ownership granted for STREAM. */
841 extern void funlockfile (FILE *__stream) __THROW;
842 #endif /* POSIX */
844 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
845 /* X/Open Issues 1-5 required getopt to be declared in this
846 header. It was removed in Issue 6. GNU follows Issue 6. */
847 # include <bits/getopt_posix.h>
848 #endif
850 /* Slow-path routines used by the optimized inline functions in
851 bits/stdio.h. */
852 extern int __uflow (FILE *);
853 extern int __overflow (FILE *, int);
855 /* If we are compiling with optimizing read this file. It contains
856 several optimizing inline functions and macros. */
857 #ifdef __USE_EXTERN_INLINES
858 # include <bits/stdio.h>
859 #endif
860 #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
861 # include <bits/stdio2.h>
862 #endif
863 #ifdef __LDBL_COMPAT
864 # include <bits/stdio-ldbl.h>
865 #endif
867 __END_DECLS
869 #endif /* <stdio.h> included. */