powerpc-cpu add-on update to v0.4.
[glibc.git] / libio / stdio.h
blobc8f2386c3ba3d64ed566b4d2c01184a46f9951d3
1 /* Define ISO C stdio on top of C++ iostreams.
2 Copyright (C) 1991,1994-2004,2005,2006 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
21 * ISO C99 Standard: 7.19 Input/output <stdio.h>
24 #ifndef _STDIO_H
26 #if !defined __need_FILE && !defined __need___FILE
27 # define _STDIO_H 1
28 # include <features.h>
30 __BEGIN_DECLS
32 # define __need_size_t
33 # define __need_NULL
34 # include <stddef.h>
36 # include <bits/types.h>
37 # define __need_FILE
38 # define __need___FILE
39 #endif /* Don't need FILE. */
42 #if !defined __FILE_defined && defined __need_FILE
44 __BEGIN_NAMESPACE_STD
45 /* The opaque type of streams. This is the definition used elsewhere. */
46 typedef struct _IO_FILE FILE;
47 __END_NAMESPACE_STD
48 #if defined __USE_LARGEFILE64 || defined __USE_SVID || defined __USE_POSIX \
49 || defined __USE_BSD || defined __USE_ISOC99 || defined __USE_XOPEN \
50 || defined __USE_POSIX2
51 __USING_NAMESPACE_STD(FILE)
52 #endif
54 # define __FILE_defined 1
55 #endif /* FILE not defined. */
56 #undef __need_FILE
59 #if !defined ____FILE_defined && defined __need___FILE
61 /* The opaque type of streams. This is the definition used elsewhere. */
62 typedef struct _IO_FILE __FILE;
64 # define ____FILE_defined 1
65 #endif /* __FILE not defined. */
66 #undef __need___FILE
69 #ifdef _STDIO_H
70 #define _STDIO_USES_IOSTREAM
72 #include <libio.h>
74 #ifdef __USE_XOPEN
75 # ifdef __GNUC__
76 # ifndef _VA_LIST_DEFINED
77 typedef _G_va_list va_list;
78 # define _VA_LIST_DEFINED
79 # endif
80 # else
81 # include <stdarg.h>
82 # endif
83 #endif
85 /* The type of the second argument to `fgetpos' and `fsetpos'. */
86 __BEGIN_NAMESPACE_STD
87 #ifndef __USE_FILE_OFFSET64
88 typedef _G_fpos_t fpos_t;
89 #else
90 typedef _G_fpos64_t fpos_t;
91 #endif
92 __END_NAMESPACE_STD
93 #ifdef __USE_LARGEFILE64
94 typedef _G_fpos64_t fpos64_t;
95 #endif
97 /* The possibilities for the third argument to `setvbuf'. */
98 #define _IOFBF 0 /* Fully buffered. */
99 #define _IOLBF 1 /* Line buffered. */
100 #define _IONBF 2 /* No buffering. */
103 /* Default buffer size. */
104 #ifndef BUFSIZ
105 # define BUFSIZ _IO_BUFSIZ
106 #endif
109 /* End of file character.
110 Some things throughout the library rely on this being -1. */
111 #ifndef EOF
112 # define EOF (-1)
113 #endif
116 /* The possibilities for the third argument to `fseek'.
117 These values should not be changed. */
118 #define SEEK_SET 0 /* Seek from beginning of file. */
119 #define SEEK_CUR 1 /* Seek from current position. */
120 #define SEEK_END 2 /* Seek from end of file. */
123 #if defined __USE_SVID || defined __USE_XOPEN
124 /* Default path prefix for `tempnam' and `tmpnam'. */
125 # define P_tmpdir "/tmp"
126 #endif
129 /* Get the values:
130 L_tmpnam How long an array of chars must be to be passed to `tmpnam'.
131 TMP_MAX The minimum number of unique filenames generated by tmpnam
132 (and tempnam when it uses tmpnam's name space),
133 or tempnam (the two are separate).
134 L_ctermid How long an array to pass to `ctermid'.
135 L_cuserid How long an array to pass to `cuserid'.
136 FOPEN_MAX Minimum number of files that can be open at once.
137 FILENAME_MAX Maximum length of a filename. */
138 #include <bits/stdio_lim.h>
141 /* Standard streams. */
142 extern struct _IO_FILE *stdin; /* Standard input stream. */
143 extern struct _IO_FILE *stdout; /* Standard output stream. */
144 extern struct _IO_FILE *stderr; /* Standard error output stream. */
145 #ifdef __STDC__
146 /* C89/C99 say they're macros. Make them happy. */
147 #define stdin stdin
148 #define stdout stdout
149 #define stderr stderr
150 #endif
152 __BEGIN_NAMESPACE_STD
153 /* Remove file FILENAME. */
154 extern int remove (__const char *__filename) __THROW;
155 /* Rename file OLD to NEW. */
156 extern int rename (__const char *__old, __const char *__new) __THROW;
157 __END_NAMESPACE_STD
159 #ifdef __USE_ATFILE
160 /* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */
161 extern int renameat (int __oldfd, __const char *__old, int __newfd,
162 __const char *__new) __THROW;
163 #endif
165 __BEGIN_NAMESPACE_STD
166 /* Create a temporary file and open it read/write.
168 This function is a possible cancellation points and therefore not
169 marked with __THROW. */
170 #ifndef __USE_FILE_OFFSET64
171 extern FILE *tmpfile (void) __wur;
172 #else
173 # ifdef __REDIRECT
174 extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) __wur;
175 # else
176 # define tmpfile tmpfile64
177 # endif
178 #endif
180 #ifdef __USE_LARGEFILE64
181 extern FILE *tmpfile64 (void) __wur;
182 #endif
184 /* Generate a temporary filename. */
185 extern char *tmpnam (char *__s) __THROW __wur;
186 __END_NAMESPACE_STD
188 #ifdef __USE_MISC
189 /* This is the reentrant variant of `tmpnam'. The only difference is
190 that it does not allow S to be NULL. */
191 extern char *tmpnam_r (char *__s) __THROW __wur;
192 #endif
195 #if defined __USE_SVID || defined __USE_XOPEN
196 /* Generate a unique temporary filename using up to five characters of PFX
197 if it is not NULL. The directory to put this file in is searched for
198 as follows: First the environment variable "TMPDIR" is checked.
199 If it contains the name of a writable directory, that directory is used.
200 If not and if DIR is not NULL, that value is checked. If that fails,
201 P_tmpdir is tried and finally "/tmp". The storage for the filename
202 is allocated by `malloc'. */
203 extern char *tempnam (__const char *__dir, __const char *__pfx)
204 __THROW __attribute_malloc__ __wur;
205 #endif
208 __BEGIN_NAMESPACE_STD
209 /* Close STREAM.
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.
216 This function is a possible cancellation point and therefore not
217 marked with __THROW. */
218 extern int fflush (FILE *__stream);
219 __END_NAMESPACE_STD
221 #ifdef __USE_MISC
222 /* Faster versions when locking is not required.
224 This function is not part of POSIX and therefore no official
225 cancellation point. But due to similarity with an POSIX interface
226 or due to the implementation it is a cancellation point and
227 therefore not marked with __THROW. */
228 extern int fflush_unlocked (FILE *__stream);
229 #endif
231 #ifdef __USE_GNU
232 /* Close all streams.
234 This function is not part of POSIX and therefore no official
235 cancellation point. But due to similarity with an POSIX interface
236 or due to the implementation it is a cancellation point and
237 therefore not marked with __THROW. */
238 extern int fcloseall (void);
239 #endif
242 __BEGIN_NAMESPACE_STD
243 #ifndef __USE_FILE_OFFSET64
244 /* Open a file and create a new stream for it.
246 This function is a possible cancellation point and therefore not
247 marked with __THROW. */
248 extern FILE *fopen (__const char *__restrict __filename,
249 __const char *__restrict __modes) __wur;
250 /* Open a file, replacing an existing stream with it.
252 This function is a possible cancellation point and therefore not
253 marked with __THROW. */
254 extern FILE *freopen (__const char *__restrict __filename,
255 __const char *__restrict __modes,
256 FILE *__restrict __stream) __wur;
257 #else
258 # ifdef __REDIRECT
259 extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename,
260 __const char *__restrict __modes), fopen64)
261 __wur;
262 extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
263 __const char *__restrict __modes,
264 FILE *__restrict __stream), freopen64)
265 __wur;
266 # else
267 # define fopen fopen64
268 # define freopen freopen64
269 # endif
270 #endif
271 __END_NAMESPACE_STD
272 #ifdef __USE_LARGEFILE64
273 extern FILE *fopen64 (__const char *__restrict __filename,
274 __const char *__restrict __modes) __wur;
275 extern FILE *freopen64 (__const char *__restrict __filename,
276 __const char *__restrict __modes,
277 FILE *__restrict __stream) __wur;
278 #endif
280 #ifdef __USE_POSIX
281 /* Create a new stream that refers to an existing system file descriptor. */
282 extern FILE *fdopen (int __fd, __const char *__modes) __THROW __wur;
283 #endif
285 #ifdef __USE_GNU
286 /* Create a new stream that refers to the given magic cookie,
287 and uses the given functions for input and output. */
288 extern FILE *fopencookie (void *__restrict __magic_cookie,
289 __const char *__restrict __modes,
290 _IO_cookie_io_functions_t __io_funcs) __THROW __wur;
292 /* Create a new stream that refers to a memory buffer. */
293 extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes)
294 __THROW __wur;
296 /* Open a stream that writes into a malloc'd buffer that is expanded as
297 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
298 and the number of characters written on fflush or fclose. */
299 extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur;
300 #endif
303 __BEGIN_NAMESPACE_STD
304 /* If BUF is NULL, make STREAM unbuffered.
305 Else make it use buffer BUF, of size BUFSIZ. */
306 extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
307 /* Make STREAM use buffering mode MODE.
308 If BUF is not NULL, use N bytes of it for buffering;
309 else allocate an internal buffer N bytes long. */
310 extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
311 int __modes, size_t __n) __THROW;
312 __END_NAMESPACE_STD
314 #ifdef __USE_BSD
315 /* If BUF is NULL, make STREAM unbuffered.
316 Else make it use SIZE bytes of BUF for buffering. */
317 extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
318 size_t __size) __THROW;
320 /* Make STREAM line-buffered. */
321 extern void setlinebuf (FILE *__stream) __THROW;
322 #endif
325 __BEGIN_NAMESPACE_STD
326 /* Write formatted output to STREAM.
328 This function is a possible cancellation point and therefore not
329 marked with __THROW. */
330 extern int fprintf (FILE *__restrict __stream,
331 __const char *__restrict __format, ...);
332 /* Write formatted output to stdout.
334 This function is a possible cancellation point and therefore not
335 marked with __THROW. */
336 extern int printf (__const char *__restrict __format, ...);
337 /* Write formatted output to S. */
338 extern int sprintf (char *__restrict __s,
339 __const char *__restrict __format, ...) __THROW;
341 /* Write formatted output to S from argument list ARG.
343 This function is a possible cancellation point and therefore not
344 marked with __THROW. */
345 extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
346 _G_va_list __arg);
347 /* Write formatted output to stdout from argument list ARG.
349 This function is a possible cancellation point and therefore not
350 marked with __THROW. */
351 extern int vprintf (__const char *__restrict __format, _G_va_list __arg);
352 /* Write formatted output to S from argument list ARG. */
353 extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
354 _G_va_list __arg) __THROW;
355 __END_NAMESPACE_STD
357 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
358 __BEGIN_NAMESPACE_C99
359 /* Maximum chars of output to write in MAXLEN. */
360 extern int snprintf (char *__restrict __s, size_t __maxlen,
361 __const char *__restrict __format, ...)
362 __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
364 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
365 __const char *__restrict __format, _G_va_list __arg)
366 __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
367 __END_NAMESPACE_C99
368 #endif
370 #ifdef __USE_GNU
371 /* Write formatted output to a string dynamically allocated with `malloc'.
372 Store the address of the string in *PTR. */
373 extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
374 _G_va_list __arg)
375 __THROW __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
376 extern int __asprintf (char **__restrict __ptr,
377 __const char *__restrict __fmt, ...)
378 __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
379 extern int asprintf (char **__restrict __ptr,
380 __const char *__restrict __fmt, ...)
381 __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
383 /* Write formatted output to a file descriptor.
385 These functions are not part of POSIX and therefore no official
386 cancellation point. But due to similarity with an POSIX interface
387 or due to the implementation they are cancellation points and
388 therefore not marked with __THROW. */
389 extern int vdprintf (int __fd, __const char *__restrict __fmt,
390 _G_va_list __arg)
391 __attribute__ ((__format__ (__printf__, 2, 0)));
392 extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
393 __attribute__ ((__format__ (__printf__, 2, 3)));
394 #endif
397 __BEGIN_NAMESPACE_STD
398 /* Read formatted input from STREAM.
400 This function is a possible cancellation point and therefore not
401 marked with __THROW. */
402 extern int fscanf (FILE *__restrict __stream,
403 __const char *__restrict __format, ...) __wur;
404 /* Read formatted input from stdin.
406 This function is a possible cancellation point and therefore not
407 marked with __THROW. */
408 extern int scanf (__const char *__restrict __format, ...) __wur;
409 /* Read formatted input from S. */
410 extern int sscanf (__const char *__restrict __s,
411 __const char *__restrict __format, ...) __THROW;
412 __END_NAMESPACE_STD
414 #ifdef __USE_ISOC99
415 __BEGIN_NAMESPACE_C99
416 /* Read formatted input from S into argument list ARG.
418 This function is a possible cancellation point and therefore not
419 marked with __THROW. */
420 extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
421 _G_va_list __arg)
422 __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
424 /* Read formatted input from stdin into argument list ARG.
426 This function is a possible cancellation point and therefore not
427 marked with __THROW. */
428 extern int vscanf (__const char *__restrict __format, _G_va_list __arg)
429 __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
431 /* Read formatted input from S into argument list ARG. */
432 extern int vsscanf (__const char *__restrict __s,
433 __const char *__restrict __format, _G_va_list __arg)
434 __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
435 __END_NAMESPACE_C99
436 #endif /* Use ISO C9x. */
439 __BEGIN_NAMESPACE_STD
440 /* Read a character from STREAM.
442 These functions are possible cancellation points and therefore not
443 marked with __THROW. */
444 extern int fgetc (FILE *__stream);
445 extern int getc (FILE *__stream);
447 /* Read a character from stdin.
449 This function is a possible cancellation point and therefore not
450 marked with __THROW. */
451 extern int getchar (void);
452 __END_NAMESPACE_STD
454 /* The C standard explicitly says this is a macro, so we always do the
455 optimization for it. */
456 #define getc(_fp) _IO_getc (_fp)
458 #if defined __USE_POSIX || defined __USE_MISC
459 /* These are defined in POSIX.1:1996.
461 These functions are possible cancellation points and therefore not
462 marked with __THROW. */
463 extern int getc_unlocked (FILE *__stream);
464 extern int getchar_unlocked (void);
465 #endif /* Use POSIX or MISC. */
467 #ifdef __USE_MISC
468 /* Faster version when locking is not necessary.
470 This function is not part of POSIX and therefore no official
471 cancellation point. But due to similarity with an POSIX interface
472 or due to the implementation it is a cancellation point and
473 therefore not marked with __THROW. */
474 extern int fgetc_unlocked (FILE *__stream);
475 #endif /* Use MISC. */
478 __BEGIN_NAMESPACE_STD
479 /* Write a character to STREAM.
481 These functions are possible cancellation points and therefore not
482 marked with __THROW.
484 These functions is a possible cancellation point and therefore not
485 marked with __THROW. */
486 extern int fputc (int __c, FILE *__stream);
487 extern int putc (int __c, FILE *__stream);
489 /* Write a character to stdout.
491 This function is a possible cancellation point and therefore not
492 marked with __THROW. */
493 extern int putchar (int __c);
494 __END_NAMESPACE_STD
496 /* The C standard explicitly says this can be a macro,
497 so we always do the optimization for it. */
498 #define putc(_ch, _fp) _IO_putc (_ch, _fp)
500 #ifdef __USE_MISC
501 /* Faster version when locking is not necessary.
503 This function is not part of POSIX and therefore no official
504 cancellation point. But due to similarity with an POSIX interface
505 or due to the implementation it is a cancellation point and
506 therefore not marked with __THROW. */
507 extern int fputc_unlocked (int __c, FILE *__stream);
508 #endif /* Use MISC. */
510 #if defined __USE_POSIX || defined __USE_MISC
511 /* These are defined in POSIX.1:1996.
513 These functions are possible cancellation points and therefore not
514 marked with __THROW. */
515 extern int putc_unlocked (int __c, FILE *__stream);
516 extern int putchar_unlocked (int __c);
517 #endif /* Use POSIX or MISC. */
520 #if defined __USE_SVID || defined __USE_MISC \
521 || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
522 /* Get a word (int) from STREAM. */
523 extern int getw (FILE *__stream);
525 /* Write a word (int) to STREAM. */
526 extern int putw (int __w, FILE *__stream);
527 #endif
530 __BEGIN_NAMESPACE_STD
531 /* Get a newline-terminated string of finite length from STREAM.
533 This function is a possible cancellation point and therefore not
534 marked with __THROW. */
535 extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
536 __wur;
538 /* Get a newline-terminated string from stdin, removing the newline.
539 DO NOT USE THIS FUNCTION!! There is no limit on how much it will read.
541 This function is a possible cancellation point and therefore not
542 marked with __THROW. */
543 extern char *gets (char *__s) __wur;
544 __END_NAMESPACE_STD
546 #ifdef __USE_GNU
547 /* This function does the same as `fgets' but does not lock the stream.
549 This function is not part of POSIX and therefore no official
550 cancellation point. But due to similarity with an POSIX interface
551 or due to the implementation it is a cancellation point and
552 therefore not marked with __THROW. */
553 extern char *fgets_unlocked (char *__restrict __s, int __n,
554 FILE *__restrict __stream) __wur;
555 #endif
558 #ifdef __USE_GNU
559 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
560 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
561 NULL), pointing to *N characters of space. It is realloc'd as
562 necessary. Returns the number of characters read (not including the
563 null terminator), or -1 on error or EOF.
565 These functions are not part of POSIX and therefore no official
566 cancellation point. But due to similarity with an POSIX interface
567 or due to the implementation they are cancellation points and
568 therefore not marked with __THROW. */
569 extern _IO_ssize_t __getdelim (char **__restrict __lineptr,
570 size_t *__restrict __n, int __delimiter,
571 FILE *__restrict __stream) __wur;
572 extern _IO_ssize_t getdelim (char **__restrict __lineptr,
573 size_t *__restrict __n, int __delimiter,
574 FILE *__restrict __stream) __wur;
576 /* Like `getdelim', but reads up to a newline.
578 This function is not part of POSIX and therefore no official
579 cancellation point. But due to similarity with an POSIX interface
580 or due to the implementation it is a cancellation point and
581 therefore not marked with __THROW. */
582 extern _IO_ssize_t getline (char **__restrict __lineptr,
583 size_t *__restrict __n,
584 FILE *__restrict __stream) __wur;
585 #endif
588 __BEGIN_NAMESPACE_STD
589 /* Write a string to STREAM.
591 This function is a possible cancellation points and therefore not
592 marked with __THROW. */
593 extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
595 /* Write a string, followed by a newline, to stdout.
597 This function is a possible cancellation points and therefore not
598 marked with __THROW. */
599 extern int puts (__const char *__s);
602 /* Push a character back onto the input buffer of STREAM.
604 This function is a possible cancellation points and therefore not
605 marked with __THROW. */
606 extern int ungetc (int __c, FILE *__stream);
609 /* Read chunks of generic data from STREAM.
611 This function is a possible cancellation points and therefore not
612 marked with __THROW. */
613 extern size_t fread (void *__restrict __ptr, size_t __size,
614 size_t __n, FILE *__restrict __stream) __wur;
615 /* Write chunks of generic data to STREAM.
617 This function is a possible cancellation points and therefore not
618 marked with __THROW. */
619 extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
620 size_t __n, FILE *__restrict __s) __wur;
621 __END_NAMESPACE_STD
623 #ifdef __USE_GNU
624 /* This function does the same as `fputs' but does not lock the stream.
626 This function is not part of POSIX and therefore no official
627 cancellation point. But due to similarity with an POSIX interface
628 or due to the implementation it is a cancellation point and
629 therefore not marked with __THROW. */
630 extern int fputs_unlocked (__const char *__restrict __s,
631 FILE *__restrict __stream);
632 #endif
634 #ifdef __USE_MISC
635 /* Faster versions when locking is not necessary.
637 These functions are not part of POSIX and therefore no official
638 cancellation point. But due to similarity with an POSIX interface
639 or due to the implementation they are cancellation points and
640 therefore not marked with __THROW. */
641 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
642 size_t __n, FILE *__restrict __stream) __wur;
643 extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
644 size_t __n, FILE *__restrict __stream) __wur;
645 #endif
648 __BEGIN_NAMESPACE_STD
649 /* Seek to a certain position on STREAM.
651 This function is a possible cancellation point and therefore not
652 marked with __THROW. */
653 extern int fseek (FILE *__stream, long int __off, int __whence);
654 /* Return the current position of STREAM.
656 This function is a possible cancellation point and therefore not
657 marked with __THROW. */
658 extern long int ftell (FILE *__stream) __wur;
659 /* Rewind to the beginning of STREAM.
661 This function is a possible cancellation point and therefore not
662 marked with __THROW. */
663 extern void rewind (FILE *__stream);
664 __END_NAMESPACE_STD
666 /* The Single Unix Specification, Version 2, specifies an alternative,
667 more adequate interface for the two functions above which deal with
668 file offset. `long int' is not the right type. These definitions
669 are originally defined in the Large File Support API. */
671 #if defined __USE_LARGEFILE || defined __USE_XOPEN2K
672 # ifndef __USE_FILE_OFFSET64
673 /* Seek to a certain position on STREAM.
675 This function is a possible cancellation point and therefore not
676 marked with __THROW. */
677 extern int fseeko (FILE *__stream, __off_t __off, int __whence);
678 /* Return the current position of STREAM.
680 This function is a possible cancellation point and therefore not
681 marked with __THROW. */
682 extern __off_t ftello (FILE *__stream) __wur;
683 # else
684 # ifdef __REDIRECT
685 extern int __REDIRECT (fseeko,
686 (FILE *__stream, __off64_t __off, int __whence),
687 fseeko64);
688 extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64);
689 # else
690 # define fseeko fseeko64
691 # define ftello ftello64
692 # endif
693 # endif
694 #endif
696 __BEGIN_NAMESPACE_STD
697 #ifndef __USE_FILE_OFFSET64
698 /* Get STREAM's position.
700 This function is a possible cancellation point and therefore not
701 marked with __THROW. */
702 extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
703 /* Set STREAM's position.
705 This function is a possible cancellation point and therefore not
706 marked with __THROW. */
707 extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
708 #else
709 # ifdef __REDIRECT
710 extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
711 fpos_t *__restrict __pos), fgetpos64);
712 extern int __REDIRECT (fsetpos,
713 (FILE *__stream, __const fpos_t *__pos), fsetpos64);
714 # else
715 # define fgetpos fgetpos64
716 # define fsetpos fsetpos64
717 # endif
718 #endif
719 __END_NAMESPACE_STD
721 #ifdef __USE_LARGEFILE64
722 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
723 extern __off64_t ftello64 (FILE *__stream) __wur;
724 extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
725 extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos);
726 #endif
728 __BEGIN_NAMESPACE_STD
729 /* Clear the error and EOF indicators for STREAM. */
730 extern void clearerr (FILE *__stream) __THROW;
731 /* Return the EOF indicator for STREAM. */
732 extern int feof (FILE *__stream) __THROW __wur;
733 /* Return the error indicator for STREAM. */
734 extern int ferror (FILE *__stream) __THROW __wur;
735 __END_NAMESPACE_STD
737 #ifdef __USE_MISC
738 /* Faster versions when locking is not required. */
739 extern void clearerr_unlocked (FILE *__stream) __THROW;
740 extern int feof_unlocked (FILE *__stream) __THROW __wur;
741 extern int ferror_unlocked (FILE *__stream) __THROW __wur;
742 #endif
745 __BEGIN_NAMESPACE_STD
746 /* Print a message describing the meaning of the value of errno.
748 This function is a possible cancellation point and therefore not
749 marked with __THROW. */
750 extern void perror (__const char *__s);
751 __END_NAMESPACE_STD
753 /* Provide the declarations for `sys_errlist' and `sys_nerr' if they
754 are available on this system. Even if available, these variables
755 should not be used directly. The `strerror' function provides
756 all the necessary functionality. */
757 #include <bits/sys_errlist.h>
760 #ifdef __USE_POSIX
761 /* Return the system file descriptor for STREAM. */
762 extern int fileno (FILE *__stream) __THROW __wur;
763 #endif /* Use POSIX. */
765 #ifdef __USE_MISC
766 /* Faster version when locking is not required. */
767 extern int fileno_unlocked (FILE *__stream) __THROW __wur;
768 #endif
771 #if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \
772 defined __USE_MISC)
773 /* Create a new stream connected to a pipe running the given command.
775 This function is a possible cancellation point and therefore not
776 marked with __THROW. */
777 extern FILE *popen (__const char *__command, __const char *__modes) __wur;
779 /* Close a stream opened by popen and return the status of its child.
781 This function is a possible cancellation point and therefore not
782 marked with __THROW. */
783 extern int pclose (FILE *__stream);
784 #endif
787 #ifdef __USE_POSIX
788 /* Return the name of the controlling terminal. */
789 extern char *ctermid (char *__s) __THROW;
790 #endif /* Use POSIX. */
793 #ifdef __USE_XOPEN
794 /* Return the name of the current user. */
795 extern char *cuserid (char *__s);
796 #endif /* Use X/Open, but not issue 6. */
799 #ifdef __USE_GNU
800 struct obstack; /* See <obstack.h>. */
802 /* Write formatted output to an obstack. */
803 extern int obstack_printf (struct obstack *__restrict __obstack,
804 __const char *__restrict __format, ...)
805 __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
806 extern int obstack_vprintf (struct obstack *__restrict __obstack,
807 __const char *__restrict __format,
808 _G_va_list __args)
809 __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
810 #endif /* Use GNU. */
813 #if defined __USE_POSIX || defined __USE_MISC
814 /* These are defined in POSIX.1:1996. */
816 /* Acquire ownership of STREAM. */
817 extern void flockfile (FILE *__stream) __THROW;
819 /* Try to acquire ownership of STREAM but do not block if it is not
820 possible. */
821 extern int ftrylockfile (FILE *__stream) __THROW __wur;
823 /* Relinquish the ownership granted for STREAM. */
824 extern void funlockfile (FILE *__stream) __THROW;
825 #endif /* POSIX || misc */
827 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
828 /* The X/Open standard requires some functions and variables to be
829 declared here which do not belong into this header. But we have to
830 follow. In GNU mode we don't do this nonsense. */
831 # define __need_getopt
832 # include <getopt.h>
833 #endif /* X/Open, but not issue 6 and not for GNU. */
835 /* If we are compiling with optimizing read this file. It contains
836 several optimizing inline functions and macros. */
837 #ifdef __USE_EXTERN_INLINES
838 # include <bits/stdio.h>
839 #endif
840 #if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
841 # include <bits/stdio2.h>
842 #endif
843 #ifdef __LDBL_COMPAT
844 # include <bits/stdio-ldbl.h>
845 #endif
847 __END_DECLS
849 #endif /* <stdio.h> included. */
851 #endif /* !_STDIO_H */