2 Copyright (C) 1991,1994-2002,2003,2004 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
21 * ISO C99 Standard: 7.19 Input/output <stdio.h>
26 #if !defined __need_FILE && !defined __need___FILE
28 # include <features.h>
32 # define __need_size_t
36 # include <bits/types.h>
38 # define __need___FILE
39 #endif /* Don't need FILE. */
42 #if !defined __FILE_defined && defined __need_FILE
45 /* The opaque type of streams. This is the definition used elsewhere. */
46 typedef struct __STDIO_FILE_STRUCT
FILE;
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)
54 # define __FILE_defined 1
55 #endif /* FILE not defined. */
59 #if !defined ____FILE_defined && defined __need___FILE
61 /* The opaque type of streams. This is the definition used elsewhere. */
62 typedef struct __STDIO_FILE_STRUCT __FILE
;
64 # define ____FILE_defined 1
65 #endif /* __FILE not defined. */
70 #undef _STDIO_USES_IOSTREAM
72 #include <bits/uClibc_stdio.h>
74 /* This define avoids name pollution if we're using GNU stdarg.h */
75 # define __need___va_list
78 /* The type of the second argument to `fgetpos' and `fsetpos'. */
80 #ifndef __USE_FILE_OFFSET64
81 typedef __STDIO_fpos_t
fpos_t;
83 typedef __STDIO_fpos64_t
fpos_t;
86 #ifdef __USE_LARGEFILE64
87 typedef __STDIO_fpos64_t fpos64_t
;
90 /* The possibilities for the third argument to `setvbuf'. */
91 #define _IOFBF __STDIO_IOFBF /* Fully buffered. */
92 #define _IOLBF __STDIO_IOLBF /* Line buffered. */
93 #define _IONBF __STDIO_IONBF /* No buffering. */
96 /* Default buffer size. */
98 # define BUFSIZ __STDIO_BUFSIZ
102 /* End of file character.
103 Some things throughout the library rely on this being -1. */
109 /* The possibilities for the third argument to `fseek'.
110 These values should not be changed. */
111 #define SEEK_SET 0 /* Seek from beginning of file. */
112 #define SEEK_CUR 1 /* Seek from current position. */
113 #define SEEK_END 2 /* Seek from end of file. */
116 #if defined __USE_SVID || defined __USE_XOPEN
117 /* Default path prefix for `tempnam' and `tmpnam'. */
118 # define P_tmpdir "/tmp"
123 L_tmpnam How long an array of chars must be to be passed to `tmpnam'.
124 TMP_MAX The minimum number of unique filenames generated by tmpnam
125 (and tempnam when it uses tmpnam's name space),
126 or tempnam (the two are separate).
127 L_ctermid How long an array to pass to `ctermid'.
128 L_cuserid How long an array to pass to `cuserid'.
129 FOPEN_MAX Minimum number of files that can be open at once.
130 FILENAME_MAX Maximum length of a filename. */
131 #include <bits/stdio_lim.h>
134 /* Standard streams. */
135 extern FILE *stdin
; /* Standard input stream. */
136 extern FILE *stdout
; /* Standard output stream. */
137 extern FILE *stderr
; /* Standard error output stream. */
138 /* C89/C99 say they're macros. Make them happy. */
140 #define stdout stdout
141 #define stderr stderr
143 __BEGIN_NAMESPACE_STD
144 /* Remove file FILENAME. */
145 extern int remove (__const
char *__filename
) __THROW
;
146 /* Rename file OLD to NEW. */
147 extern int rename (__const
char *__old
, __const
char *__new
) __THROW
;
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
;
156 __BEGIN_NAMESPACE_STD
157 /* Create a temporary file and open it read/write.
159 This function is a possible cancellation points and therefore not
160 marked with __THROW. */
161 #ifndef __USE_FILE_OFFSET64
162 extern FILE *tmpfile (void) __wur
;
165 extern FILE *__REDIRECT (tmpfile
, (void), tmpfile64
) __wur
;
167 # define tmpfile tmpfile64
171 #ifdef __USE_LARGEFILE64
172 extern FILE *tmpfile64 (void) __wur
;
175 /* Generate a temporary filename. */
176 extern char *tmpnam (char *__s
) __THROW __wur
;
180 /* This is the reentrant variant of `tmpnam'. The only difference is
181 that it does not allow S to be NULL. */
182 extern char *tmpnam_r (char *__s
) __THROW __wur
;
186 #if defined __USE_SVID || defined __USE_XOPEN
187 /* Generate a unique temporary filename using up to five characters of PFX
188 if it is not NULL. The directory to put this file in is searched for
189 as follows: First the environment variable "TMPDIR" is checked.
190 If it contains the name of a writable directory, that directory is used.
191 If not and if DIR is not NULL, that value is checked. If that fails,
192 P_tmpdir is tried and finally "/tmp". The storage for the filename
193 is allocated by `malloc'. */
194 extern char *tempnam (__const
char *__dir
, __const
char *__pfx
)
195 __THROW __attribute_malloc__ __wur
;
199 __BEGIN_NAMESPACE_STD
202 This function is a possible cancellation point and therefore not
203 marked with __THROW. */
204 extern int fclose (FILE *__stream
);
205 /* Flush STREAM, or all streams if STREAM is NULL.
207 This function is a possible cancellation point and therefore not
208 marked with __THROW. */
209 extern int fflush (FILE *__stream
);
213 /* Faster versions when locking is not required.
215 This function is not part of POSIX and therefore no official
216 cancellation point. But due to similarity with an POSIX interface
217 or due to the implementation it is a cancellation point and
218 therefore not marked with __THROW. */
219 extern int fflush_unlocked (FILE *__stream
);
223 /* Close all streams.
225 This function is not part of POSIX and therefore no official
226 cancellation point. But due to similarity with an POSIX interface
227 or due to the implementation it is a cancellation point and
228 therefore not marked with __THROW. */
229 extern int fcloseall (void);
233 __BEGIN_NAMESPACE_STD
234 #ifndef __USE_FILE_OFFSET64
235 /* Open a file and create a new stream for it.
237 This function is a possible cancellation point and therefore not
238 marked with __THROW. */
239 extern FILE *fopen (__const
char *__restrict __filename
,
240 __const
char *__restrict __modes
) __wur
;
241 /* Open a file, replacing an existing stream with it.
243 This function is a possible cancellation point and therefore not
244 marked with __THROW. */
245 extern FILE *freopen (__const
char *__restrict __filename
,
246 __const
char *__restrict __modes
,
247 FILE *__restrict __stream
) __wur
;
250 extern FILE *__REDIRECT (fopen
, (__const
char *__restrict __filename
,
251 __const
char *__restrict __modes
), fopen64
)
253 extern FILE *__REDIRECT (freopen
, (__const
char *__restrict __filename
,
254 __const
char *__restrict __modes
,
255 FILE *__restrict __stream
), freopen64
)
258 # define fopen fopen64
259 # define freopen freopen64
263 #ifdef __USE_LARGEFILE64
264 extern FILE *fopen64 (__const
char *__restrict __filename
,
265 __const
char *__restrict __modes
) __wur
;
266 extern FILE *freopen64 (__const
char *__restrict __filename
,
267 __const
char *__restrict __modes
,
268 FILE *__restrict __stream
) __wur
;
272 /* Create a new stream that refers to an existing system file descriptor. */
273 extern FILE *fdopen (int __fd
, __const
char *__modes
) __THROW __wur
;
277 #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
278 /* Create a new stream that refers to the given magic cookie,
279 and uses the given functions for input and output. */
280 extern FILE *fopencookie (void *__restrict __magic_cookie
,
281 __const
char *__restrict __modes
,
282 _IO_cookie_io_functions_t __io_funcs
) __THROW __wur
;
284 /* Create a new stream that refers to a memory buffer. */
285 extern FILE *fmemopen (void *__s
, size_t __len
, __const
char *__modes
)
288 /* Open a stream that writes into a malloc'd buffer that is expanded as
289 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
290 and the number of characters written on fflush or fclose. */
291 extern FILE *open_memstream (char **__restrict __bufloc
,
292 size_t *__restrict __sizeloc
) __THROW __wur
;
297 __BEGIN_NAMESPACE_STD
298 /* If BUF is NULL, make STREAM unbuffered.
299 Else make it use buffer BUF, of size BUFSIZ. */
300 extern void setbuf (FILE *__restrict __stream
, char *__restrict __buf
) __THROW
;
301 /* Make STREAM use buffering mode MODE.
302 If BUF is not NULL, use N bytes of it for buffering;
303 else allocate an internal buffer N bytes long. */
304 extern int setvbuf (FILE *__restrict __stream
, char *__restrict __buf
,
305 int __modes
, size_t __n
) __THROW
;
309 /* If BUF is NULL, make STREAM unbuffered.
310 Else make it use SIZE bytes of BUF for buffering. */
311 extern void setbuffer (FILE *__restrict __stream
, char *__restrict __buf
,
312 size_t __size
) __THROW
;
314 /* Make STREAM line-buffered. */
315 extern void setlinebuf (FILE *__stream
) __THROW
;
319 __BEGIN_NAMESPACE_STD
320 /* Write formatted output to STREAM.
322 This function is a possible cancellation point and therefore not
323 marked with __THROW. */
324 extern int fprintf (FILE *__restrict __stream
,
325 __const
char *__restrict __format
, ...);
326 /* Write formatted output to stdout.
328 This function is a possible cancellation point and therefore not
329 marked with __THROW. */
330 extern int printf (__const
char *__restrict __format
, ...);
331 /* Write formatted output to S. */
332 extern int sprintf (char *__restrict __s
,
333 __const
char *__restrict __format
, ...)
334 __THROW
__attribute__ ((__format__ (__printf__
, 2, 3)));
336 /* Write formatted output to S from argument list ARG.
338 This function is a possible cancellation point and therefore not
339 marked with __THROW. */
340 extern int vfprintf (FILE *__restrict __s
, __const
char *__restrict __format
,
341 __gnuc_va_list __arg
);
342 /* Write formatted output to stdout from argument list ARG.
344 This function is a possible cancellation point and therefore not
345 marked with __THROW. */
346 extern int vprintf (__const
char *__restrict __format
, __gnuc_va_list __arg
);
347 /* Write formatted output to S from argument list ARG. */
348 extern int vsprintf (char *__restrict __s
, __const
char *__restrict __format
,
349 __gnuc_va_list __arg
)
350 __THROW
__attribute__ ((__format__ (__printf__
, 2, 0)));
353 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
354 __BEGIN_NAMESPACE_C99
355 /* Maximum chars of output to write in MAXLEN. */
356 extern int snprintf (char *__restrict __s
, size_t __maxlen
,
357 __const
char *__restrict __format
, ...)
358 __THROW
__attribute__ ((__format__ (__printf__
, 3, 4)));
360 extern int vsnprintf (char *__restrict __s
, size_t __maxlen
,
361 __const
char *__restrict __format
, __gnuc_va_list __arg
)
362 __THROW
__attribute__ ((__format__ (__printf__
, 3, 0)));
367 /* Write formatted output to a string dynamically allocated with `malloc'.
368 Store the address of the string in *PTR. */
369 extern int vasprintf (char **__restrict __ptr
, __const
char *__restrict __f
,
370 __gnuc_va_list __arg
)
371 __THROW
__attribute__ ((__format__ (__printf__
, 2, 0))) __wur
;
372 #if 0 /* uClibc: disabled */
373 extern int __asprintf (char **__restrict __ptr
,
374 __const
char *__restrict __fmt
, ...)
375 __THROW
__attribute__ ((__format__ (__printf__
, 2, 3))) __wur
;
377 extern int asprintf (char **__restrict __ptr
,
378 __const
char *__restrict __fmt
, ...)
379 __THROW
__attribute__ ((__format__ (__printf__
, 2, 3))) __wur
;
381 /* Write formatted output to a file descriptor.
383 These functions are not part of POSIX and therefore no official
384 cancellation point. But due to similarity with an POSIX interface
385 or due to the implementation they are cancellation points and
386 therefore not marked with __THROW. */
387 extern int vdprintf (int __fd
, __const
char *__restrict __fmt
,
388 __gnuc_va_list __arg
)
389 __attribute__ ((__format__ (__printf__
, 2, 0)));
390 extern int dprintf (int __fd
, __const
char *__restrict __fmt
, ...)
391 __attribute__ ((__format__ (__printf__
, 2, 3)));
395 __BEGIN_NAMESPACE_STD
396 /* Read formatted input from STREAM.
398 This function is a possible cancellation point and therefore not
399 marked with __THROW. */
400 extern int fscanf (FILE *__restrict __stream
,
401 __const
char *__restrict __format
, ...)
402 __attribute__ ((__format__ (__scanf__
, 2, 3))) __wur
;
403 /* Read formatted input from stdin.
405 This function is a possible cancellation point and therefore not
406 marked with __THROW. */
407 extern int scanf (__const
char *__restrict __format
, ...)
408 __attribute__ ((__format__ (__scanf__
, 1, 2))) __wur
;
409 /* Read formatted input from S. */
410 extern int sscanf (__const
char *__restrict __s
,
411 __const
char *__restrict __format
, ...)
412 __THROW
__attribute__ ((__format__ (__scanf__
, 2, 3)));
416 __BEGIN_NAMESPACE_C99
417 /* Read formatted input from S into argument list ARG.
419 This function is a possible cancellation point and therefore not
420 marked with __THROW. */
421 extern int vfscanf (FILE *__restrict __s
, __const
char *__restrict __format
,
422 __gnuc_va_list __arg
)
423 __attribute__ ((__format__ (__scanf__
, 2, 0))) __wur
;
425 /* Read formatted input from stdin into argument list ARG.
427 This function is a possible cancellation point and therefore not
428 marked with __THROW. */
429 extern int vscanf (__const
char *__restrict __format
, __gnuc_va_list __arg
)
430 __attribute__ ((__format__ (__scanf__
, 1, 0))) __wur
;
432 /* Read formatted input from S into argument list ARG. */
433 extern int vsscanf (__const
char *__restrict __s
,
434 __const
char *__restrict __format
, __gnuc_va_list __arg
)
435 __THROW
__attribute__ ((__format__ (__scanf__
, 2, 0)));
437 #endif /* Use ISO C9x. */
440 __BEGIN_NAMESPACE_STD
441 /* Read a character from STREAM.
443 These functions are possible cancellation points and therefore not
444 marked with __THROW. */
445 extern int fgetc (FILE *__stream
);
446 extern int getc (FILE *__stream
);
448 /* Read a character from stdin.
450 This function is a possible cancellation point and therefore not
451 marked with __THROW. */
452 extern int getchar (void);
455 /* The C standard explicitly says this is a macro, so we always do the
456 optimization for it. */
457 #define getc(_fp) __GETC(_fp)
459 #if defined __USE_POSIX || defined __USE_MISC
460 /* These are defined in POSIX.1:1996.
462 These functions are possible cancellation points and therefore not
463 marked with __THROW. */
464 extern int getc_unlocked (FILE *__stream
);
465 extern int getchar_unlocked (void);
467 /* SUSv3 allows getc_unlocked to be a macro */
468 #define getc_unlocked(_fp) __GETC_UNLOCKED(_fp)
469 #endif /* Use POSIX or MISC. */
472 /* Faster version when locking is not necessary.
474 This function is not part of POSIX and therefore no official
475 cancellation point. But due to similarity with an POSIX interface
476 or due to the implementation it is a cancellation point and
477 therefore not marked with __THROW. */
478 extern int fgetc_unlocked (FILE *__stream
);
479 #endif /* Use MISC. */
482 __BEGIN_NAMESPACE_STD
483 /* Write a character to STREAM.
485 These functions are possible cancellation points and therefore not
488 These functions is a possible cancellation point and therefore not
489 marked with __THROW. */
490 extern int fputc (int __c
, FILE *__stream
);
491 extern int putc (int __c
, FILE *__stream
);
493 /* Write a character to stdout.
495 This function is a possible cancellation point and therefore not
496 marked with __THROW. */
497 extern int putchar (int __c
);
500 /* The C standard explicitly says this can be a macro,
501 so we always do the optimization for it. */
502 #define putc(_ch, _fp) __PUTC(_ch, _fp)
505 /* Faster version when locking is not necessary.
507 This function is not part of POSIX and therefore no official
508 cancellation point. But due to similarity with an POSIX interface
509 or due to the implementation it is a cancellation point and
510 therefore not marked with __THROW. */
511 extern int fputc_unlocked (int __c
, FILE *__stream
);
512 #endif /* Use MISC. */
514 #if defined __USE_POSIX || defined __USE_MISC
515 /* These are defined in POSIX.1:1996.
517 These functions are possible cancellation points and therefore not
518 marked with __THROW. */
519 extern int putc_unlocked (int __c
, FILE *__stream
);
520 extern int putchar_unlocked (int __c
);
522 /* SUSv3 allows putc_unlocked to be a macro */
523 #define putc_unlocked(_ch, _fp) __PUTC_UNLOCKED(_ch, _fp)
524 #endif /* Use POSIX or MISC. */
527 #if defined __USE_SVID || defined __USE_MISC \
528 || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
529 /* Get a word (int) from STREAM. */
530 extern int getw (FILE *__stream
);
532 /* Write a word (int) to STREAM. */
533 extern int putw (int __w
, FILE *__stream
);
537 __BEGIN_NAMESPACE_STD
538 /* Get a newline-terminated string of finite length from STREAM.
540 This function is a possible cancellation point and therefore not
541 marked with __THROW. */
542 extern char *fgets (char *__restrict __s
, int __n
, FILE *__restrict __stream
)
545 /* Get a newline-terminated string from stdin, removing the newline.
546 DO NOT USE THIS FUNCTION!! There is no limit on how much it will read.
548 This function is a possible cancellation point and therefore not
549 marked with __THROW. */
550 extern char *gets (char *__s
) __wur
;
554 /* This function does the same as `fgets' but does not lock the stream.
556 This function is not part of POSIX and therefore no official
557 cancellation point. But due to similarity with an POSIX interface
558 or due to the implementation it is a cancellation point and
559 therefore not marked with __THROW. */
560 extern char *fgets_unlocked (char *__restrict __s
, int __n
,
561 FILE *__restrict __stream
) __wur
;
566 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
567 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
568 NULL), pointing to *N characters of space. It is realloc'd as
569 necessary. Returns the number of characters read (not including the
570 null terminator), or -1 on error or EOF.
572 These functions are not part of POSIX and therefore no official
573 cancellation point. But due to similarity with an POSIX interface
574 or due to the implementation they are cancellation points and
575 therefore not marked with __THROW. */
576 #if 0 /* uClibc: disabled */
577 extern __ssize_t
__getdelim (char **__restrict __lineptr
,
578 size_t *__restrict __n
, int __delimiter
,
579 FILE *__restrict __stream
) __wur
;
581 extern __ssize_t
getdelim (char **__restrict __lineptr
,
582 size_t *__restrict __n
, int __delimiter
,
583 FILE *__restrict __stream
) __wur
;
585 /* Like `getdelim', but reads up to a newline.
587 This function is not part of POSIX and therefore no official
588 cancellation point. But due to similarity with an POSIX interface
589 or due to the implementation it is a cancellation point and
590 therefore not marked with __THROW. */
591 extern __ssize_t
getline (char **__restrict __lineptr
,
592 size_t *__restrict __n
,
593 FILE *__restrict __stream
) __wur
;
597 __BEGIN_NAMESPACE_STD
598 /* Write a string to STREAM.
600 This function is a possible cancellation points and therefore not
601 marked with __THROW. */
602 extern int fputs (__const
char *__restrict __s
, FILE *__restrict __stream
);
604 /* Write a string, followed by a newline, to stdout.
606 This function is a possible cancellation points and therefore not
607 marked with __THROW. */
608 extern int puts (__const
char *__s
);
611 /* Push a character back onto the input buffer of STREAM.
613 This function is a possible cancellation points and therefore not
614 marked with __THROW. */
615 extern int ungetc (int __c
, FILE *__stream
);
618 /* Read chunks of generic data from STREAM.
620 This function is a possible cancellation points and therefore not
621 marked with __THROW. */
622 extern size_t fread (void *__restrict __ptr
, size_t __size
,
623 size_t __n
, FILE *__restrict __stream
) __wur
;
624 /* Write chunks of generic data to STREAM.
626 This function is a possible cancellation points and therefore not
627 marked with __THROW. */
628 extern size_t fwrite (__const
void *__restrict __ptr
, size_t __size
,
629 size_t __n
, FILE *__restrict __s
) __wur
;
633 /* This function does the same as `fputs' but does not lock the stream.
635 This function is not part of POSIX and therefore no official
636 cancellation point. But due to similarity with an POSIX interface
637 or due to the implementation it is a cancellation point and
638 therefore not marked with __THROW. */
639 extern int fputs_unlocked (__const
char *__restrict __s
,
640 FILE *__restrict __stream
);
644 /* Faster versions when locking is not necessary.
646 These functions are not part of POSIX and therefore no official
647 cancellation point. But due to similarity with an POSIX interface
648 or due to the implementation they are cancellation points and
649 therefore not marked with __THROW. */
650 extern size_t fread_unlocked (void *__restrict __ptr
, size_t __size
,
651 size_t __n
, FILE *__restrict __stream
) __wur
;
652 extern size_t fwrite_unlocked (__const
void *__restrict __ptr
, size_t __size
,
653 size_t __n
, FILE *__restrict __stream
) __wur
;
657 __BEGIN_NAMESPACE_STD
658 /* Seek to a certain position on STREAM.
660 This function is a possible cancellation point and therefore not
661 marked with __THROW. */
662 extern int fseek (FILE *__stream
, long int __off
, int __whence
);
663 /* Return the current position of STREAM.
665 This function is a possible cancellation point and therefore not
666 marked with __THROW. */
667 extern long int ftell (FILE *__stream
) __wur
;
668 /* Rewind to the beginning of STREAM.
670 This function is a possible cancellation point and therefore not
671 marked with __THROW. */
672 extern void rewind (FILE *__stream
);
675 /* The Single Unix Specification, Version 2, specifies an alternative,
676 more adequate interface for the two functions above which deal with
677 file offset. `long int' is not the right type. These definitions
678 are originally defined in the Large File Support API. */
680 #if defined __USE_LARGEFILE || defined __USE_XOPEN2K
681 # ifndef __USE_FILE_OFFSET64
682 /* Seek to a certain position on STREAM.
684 This function is a possible cancellation point and therefore not
685 marked with __THROW. */
686 extern int fseeko (FILE *__stream
, __off_t __off
, int __whence
);
687 /* Return the current position of STREAM.
689 This function is a possible cancellation point and therefore not
690 marked with __THROW. */
691 extern __off_t
ftello (FILE *__stream
) __wur
;
694 extern int __REDIRECT (fseeko
,
695 (FILE *__stream
, __off64_t __off
, int __whence
),
697 extern __off64_t
__REDIRECT (ftello
, (FILE *__stream
), ftello64
);
699 # define fseeko fseeko64
700 # define ftello ftello64
705 __BEGIN_NAMESPACE_STD
706 #ifndef __USE_FILE_OFFSET64
707 /* Get STREAM's position.
709 This function is a possible cancellation point and therefore not
710 marked with __THROW. */
711 extern int fgetpos (FILE *__restrict __stream
, fpos_t *__restrict __pos
);
712 /* Set STREAM's position.
714 This function is a possible cancellation point and therefore not
715 marked with __THROW. */
716 extern int fsetpos (FILE *__stream
, __const
fpos_t *__pos
);
719 extern int __REDIRECT (fgetpos
, (FILE *__restrict __stream
,
720 fpos_t *__restrict __pos
), fgetpos64
);
721 extern int __REDIRECT (fsetpos
,
722 (FILE *__stream
, __const
fpos_t *__pos
), fsetpos64
);
724 # define fgetpos fgetpos64
725 # define fsetpos fsetpos64
730 #ifdef __USE_LARGEFILE64
731 extern int fseeko64 (FILE *__stream
, __off64_t __off
, int __whence
);
732 extern __off64_t
ftello64 (FILE *__stream
) __wur
;
733 extern int fgetpos64 (FILE *__restrict __stream
, fpos64_t
*__restrict __pos
);
734 extern int fsetpos64 (FILE *__stream
, __const fpos64_t
*__pos
);
737 __BEGIN_NAMESPACE_STD
738 /* Clear the error and EOF indicators for STREAM. */
739 extern void clearerr (FILE *__stream
) __THROW
;
740 /* Return the EOF indicator for STREAM. */
741 extern int feof (FILE *__stream
) __THROW __wur
;
742 /* Return the error indicator for STREAM. */
743 extern int ferror (FILE *__stream
) __THROW __wur
;
747 /* Faster versions when locking is not required. */
748 extern void clearerr_unlocked (FILE *__stream
) __THROW
;
749 extern int feof_unlocked (FILE *__stream
) __THROW __wur
;
750 extern int ferror_unlocked (FILE *__stream
) __THROW __wur
;
754 __BEGIN_NAMESPACE_STD
755 /* Print a message describing the meaning of the value of errno.
757 This function is a possible cancellation point and therefore not
758 marked with __THROW. */
759 extern void perror (__const
char *__s
);
762 #ifdef __UCLIBC_HAS_SYS_ERRLIST__
763 /* These variables normally should not be used directly. The `strerror'
764 function provides all the needed functionality. */
767 extern __const
char *__const sys_errlist
[];
769 #endif /* __UCLIBC_HAS_SYS_ERRLIST__ */
773 /* Return the system file descriptor for STREAM. */
774 extern int fileno (FILE *__stream
) __THROW __wur
;
775 #endif /* Use POSIX. */
778 /* Faster version when locking is not required. */
779 extern int fileno_unlocked (FILE *__stream
) __THROW __wur
;
783 #if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \
785 /* Create a new stream connected to a pipe running the given command.
787 This function is a possible cancellation point and therefore not
788 marked with __THROW. */
789 extern FILE *popen (__const
char *__command
, __const
char *__modes
) __wur
;
791 /* Close a stream opened by popen and return the status of its child.
793 This function is a possible cancellation point and therefore not
794 marked with __THROW. */
795 extern int pclose (FILE *__stream
);
800 /* Return the name of the controlling terminal. */
801 extern char *ctermid (char *__s
) __THROW
;
802 #endif /* Use POSIX. */
806 /* Return the name of the current user. */
807 extern char *cuserid (char *__s
);
808 #endif /* Use X/Open, but not issue 6. */
811 #if 0 /* def __USE_GNU uClibc note: not supported */
812 struct obstack
; /* See <obstack.h>. */
814 /* Write formatted output to an obstack. */
815 extern int obstack_printf (struct obstack
*__restrict __obstack
,
816 __const
char *__restrict __format
, ...)
817 __THROW
__attribute__ ((__format__ (__printf__
, 2, 3)));
818 extern int obstack_vprintf (struct obstack
*__restrict __obstack
,
819 __const
char *__restrict __format
,
820 __gnuc_va_list __args
)
821 __THROW
__attribute__ ((__format__ (__printf__
, 2, 0)));
822 #endif /* Use GNU. */
825 #if defined __USE_POSIX || defined __USE_MISC
826 /* These are defined in POSIX.1:1996. */
828 /* Acquire ownership of STREAM. */
829 extern void flockfile (FILE *__stream
) __THROW
;
831 /* Try to acquire ownership of STREAM but do not block if it is not
833 extern int ftrylockfile (FILE *__stream
) __THROW __wur
;
835 /* Relinquish the ownership granted for STREAM. */
836 extern void funlockfile (FILE *__stream
) __THROW
;
837 #endif /* POSIX || misc */
839 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
840 /* The X/Open standard requires some functions and variables to be
841 declared here which do not belong into this header. But we have to
842 follow. In GNU mode we don't do this nonsense. */
843 # define __need_getopt
844 # include <bits/getopt.h>
845 #endif /* X/Open, but not issue 6 and not for GNU. */
847 /* If we are compiling with optimizing read this file. It contains
848 several optimizing inline functions and macros. */
849 #define fgetc(_fp) __FGETC(_fp)
850 #define fputc(_ch, _fp) __FPUTC(_ch, _fp)
853 #define fgetc_unlocked(_fp) __FGETC_UNLOCKED(_fp)
854 #define fputc_unlocked(_ch, _fp) __FPUTC_UNLOCKED(_ch, _fp)
857 #ifndef __STDIO_GETC_MACRO
858 #define __stdin stdin
860 #define getchar() __GETC(__stdin)
862 #ifndef __STDIO_PUTC_MACRO
863 #define __stdout stdout
865 #define putchar(_ch) __PUTC((_ch), __stdout)
867 #if defined __USE_POSIX || defined __USE_MISC
868 #define getchar_unlocked() __GETC_UNLOCKED(__stdin)
869 #define putchar_unlocked(_ch) __PUTC_UNLOCKED((_ch), __stdout)
872 /* Clear the error and EOF indicators for STREAM. */
873 #define clearerr(_fp) __CLEARERR(_fp)
874 #define feof(_fp) __FEOF(_fp)
875 #define ferror(_fp) __FERROR(_fp)
878 #define clearerr_unlocked(_fp) __CLEARERR_UNLOCKED(_fp)
879 #define feof_unlocked(_fp) __FEOF_UNLOCKED(_fp)
880 #define ferror_unlocked(_fp) __FERROR_UNLOCKED(_fp)
885 #endif /* <stdio.h> included. */
887 #endif /* !_STDIO_H */