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 __BEGIN_NAMESPACE_STD
152 /* Create a temporary file and open it read/write.
154 This function is a possible cancellation points and therefore not
155 marked with __THROW. */
156 #ifndef __USE_FILE_OFFSET64
157 extern FILE *tmpfile (void);
160 extern FILE *__REDIRECT (tmpfile, (void), tmpfile64);
162 # define tmpfile tmpfile64
166 #ifdef __USE_LARGEFILE64
167 extern FILE *tmpfile64 (void);
170 /* Generate a temporary filename. */
171 extern char *tmpnam (char *__s) __THROW;
175 /* This is the reentrant variant of `tmpnam'. The only difference is
176 that it does not allow S to be NULL. */
177 extern char *tmpnam_r (char *__s) __THROW;
181 #if defined __USE_SVID || defined __USE_XOPEN
182 /* Generate a unique temporary filename using up to five characters of PFX
183 if it is not NULL. The directory to put this file in is searched for
184 as follows: First the environment variable "TMPDIR" is checked.
185 If it contains the name of a writable directory, that directory is used.
186 If not and if DIR is not NULL, that value is checked. If that fails,
187 P_tmpdir is tried and finally "/tmp". The storage for the filename
188 is allocated by `malloc'. */
189 extern char *tempnam (__const char *__dir, __const char *__pfx)
190 __THROW __attribute_malloc__;
194 __BEGIN_NAMESPACE_STD
197 This function is a possible cancellation point and therefore not
198 marked with __THROW. */
199 extern int fclose (FILE *__stream);
200 /* Flush STREAM, or all streams if STREAM is NULL.
202 This function is a possible cancellation point and therefore not
203 marked with __THROW. */
204 extern int fflush (FILE *__stream);
208 /* Faster versions when locking is not required.
210 This function is not part of POSIX and therefore no official
211 cancellation point. But due to similarity with an POSIX interface
212 or due to the implementation it is a cancellation point and
213 therefore not marked with __THROW. */
214 extern int fflush_unlocked (FILE *__stream);
218 /* Close all streams.
220 This function is not part of POSIX and therefore no official
221 cancellation point. But due to similarity with an POSIX interface
222 or due to the implementation it is a cancellation point and
223 therefore not marked with __THROW. */
224 extern int fcloseall (void);
228 __BEGIN_NAMESPACE_STD
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);
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);
245 extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename,
246 __const char *__restrict __modes), fopen64);
247 extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
248 __const char *__restrict __modes,
249 FILE *__restrict __stream), freopen64);
251 # define fopen fopen64
252 # define freopen freopen64
256 #ifdef __USE_LARGEFILE64
257 extern FILE *fopen64 (__const char *__restrict __filename,
258 __const char *__restrict __modes);
259 extern FILE *freopen64 (__const char *__restrict __filename,
260 __const char *__restrict __modes,
261 FILE *__restrict __stream);
265 /* Create a new stream that refers to an existing system file descriptor. */
266 extern FILE *fdopen (int __fd, __const char *__modes) __THROW;
270 #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
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 _IO_cookie_io_functions_t __io_funcs) __THROW;
277 /* Create a new stream that refers to a memory buffer. */
278 extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW;
280 /* Open a stream that writes into a malloc'd buffer that is expanded as
281 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
282 and the number of characters written on fflush or fclose. */
283 extern FILE *open_memstream (char **__restrict __bufloc,
284 size_t *__restrict __sizeloc) __THROW;
289 __BEGIN_NAMESPACE_STD
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;
301 /* If BUF is NULL, make STREAM unbuffered.
302 Else make it use SIZE bytes of BUF for buffering. */
303 extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
304 size_t __size) __THROW;
306 /* Make STREAM line-buffered. */
307 extern void setlinebuf (FILE *__stream) __THROW;
311 __BEGIN_NAMESPACE_STD
312 /* Write formatted output to STREAM.
314 This function is a possible cancellation point and therefore not
315 marked with __THROW. */
316 extern int fprintf (FILE *__restrict __stream,
317 __const char *__restrict __format, ...);
318 /* Write formatted output to stdout.
320 This function is a possible cancellation point and therefore not
321 marked with __THROW. */
322 extern int printf (__const char *__restrict __format, ...);
323 /* Write formatted output to S. */
324 extern int sprintf (char *__restrict __s,
325 __const char *__restrict __format, ...) __THROW;
327 /* Write formatted output to S from argument list ARG.
329 This function is a possible cancellation point and therefore not
330 marked with __THROW. */
331 extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
332 __gnuc_va_list __arg);
333 /* Write formatted output to stdout from argument list ARG.
335 This function is a possible cancellation point and therefore not
336 marked with __THROW. */
337 extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
338 /* Write formatted output to S from argument list ARG. */
339 extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
340 __gnuc_va_list __arg) __THROW;
343 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
344 __BEGIN_NAMESPACE_C99
345 /* Maximum chars of output to write in MAXLEN. */
346 extern int snprintf (char *__restrict __s, size_t __maxlen,
347 __const char *__restrict __format, ...)
348 __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
350 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
351 __const char *__restrict __format, __gnuc_va_list __arg)
352 __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
357 /* Write formatted output to a string dynamically allocated with `malloc'.
358 Store the address of the string in *PTR. */
359 extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
360 __gnuc_va_list __arg)
361 __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
362 extern int __asprintf (char **__restrict __ptr,
363 __const char *__restrict __fmt, ...)
364 __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
365 extern int asprintf (char **__restrict __ptr,
366 __const char *__restrict __fmt, ...)
367 __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
369 /* Write formatted output to a file descriptor.
371 These functions are not part of POSIX and therefore no official
372 cancellation point. But due to similarity with an POSIX interface
373 or due to the implementation they are cancellation points and
374 therefore not marked with __THROW. */
375 extern int vdprintf (int __fd, __const char *__restrict __fmt,
376 __gnuc_va_list __arg)
377 __attribute__ ((__format__ (__printf__, 2, 0)));
378 extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
379 __attribute__ ((__format__ (__printf__, 2, 3)));
383 __BEGIN_NAMESPACE_STD
384 /* Read formatted input from STREAM.
386 This function is a possible cancellation point and therefore not
387 marked with __THROW. */
388 extern int fscanf (FILE *__restrict __stream,
389 __const char *__restrict __format, ...);
390 /* Read formatted input from stdin.
392 This function is a possible cancellation point and therefore not
393 marked with __THROW. */
394 extern int scanf (__const char *__restrict __format, ...);
395 /* Read formatted input from S. */
396 extern int sscanf (__const char *__restrict __s,
397 __const char *__restrict __format, ...) __THROW;
401 __BEGIN_NAMESPACE_C99
402 /* Read formatted input from S into argument list ARG.
404 This function is a possible cancellation point and therefore not
405 marked with __THROW. */
406 extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
407 __gnuc_va_list __arg)
408 __attribute__ ((__format__ (__scanf__, 2, 0)));
410 /* Read formatted input from stdin into argument list ARG.
412 This function is a possible cancellation point and therefore not
413 marked with __THROW. */
414 extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg)
415 __attribute__ ((__format__ (__scanf__, 1, 0)));
417 /* Read formatted input from S into argument list ARG. */
418 extern int vsscanf (__const char *__restrict __s,
419 __const char *__restrict __format, __gnuc_va_list __arg)
420 __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
422 #endif /* Use ISO C9x. */
425 __BEGIN_NAMESPACE_STD
426 /* Read a character from STREAM.
428 These functions are possible cancellation points and therefore not
429 marked with __THROW. */
430 extern int fgetc (FILE *__stream);
431 extern int getc (FILE *__stream);
433 /* Read a character from stdin.
435 This function is a possible cancellation point and therefore not
436 marked with __THROW. */
437 extern int getchar (void);
440 /* The C standard explicitly says this is a macro, so we always do the
441 optimization for it. */
442 #define getc(_fp) __GETC(_fp)
444 #if defined __USE_POSIX || defined __USE_MISC
445 /* These are defined in POSIX.1:1996.
447 These functions are possible cancellation points and therefore not
448 marked with __THROW. */
449 extern int getc_unlocked (FILE *__stream);
450 extern int getchar_unlocked (void);
452 /* SUSv3 allows getc_unlocked to be a macro */
453 #define getc_unlocked(_fp) __GETC_UNLOCKED(_fp)
454 #endif /* Use POSIX or MISC. */
457 /* Faster version when locking is not necessary.
459 This function is not part of POSIX and therefore no official
460 cancellation point. But due to similarity with an POSIX interface
461 or due to the implementation it is a cancellation point and
462 therefore not marked with __THROW. */
463 extern int fgetc_unlocked (FILE *__stream);
464 #endif /* Use MISC. */
467 __BEGIN_NAMESPACE_STD
468 /* Write a character to STREAM.
470 These functions are possible cancellation points and therefore not
473 These functions is a possible cancellation point and therefore not
474 marked with __THROW. */
475 extern int fputc (int __c, FILE *__stream);
476 extern int putc (int __c, FILE *__stream);
478 /* Write a character to stdout.
480 This function is a possible cancellation point and therefore not
481 marked with __THROW. */
482 extern int putchar (int __c);
485 /* The C standard explicitly says this can be a macro,
486 so we always do the optimization for it. */
487 #define putc(_ch, _fp) __PUTC(_ch, _fp)
490 /* Faster version when locking is not necessary.
492 This function is not part of POSIX and therefore no official
493 cancellation point. But due to similarity with an POSIX interface
494 or due to the implementation it is a cancellation point and
495 therefore not marked with __THROW. */
496 extern int fputc_unlocked (int __c, FILE *__stream);
497 #endif /* Use MISC. */
499 #if defined __USE_POSIX || defined __USE_MISC
500 /* These are defined in POSIX.1:1996.
502 These functions are possible cancellation points and therefore not
503 marked with __THROW. */
504 extern int putc_unlocked (int __c, FILE *__stream);
505 extern int putchar_unlocked (int __c);
507 /* SUSv3 allows putc_unlocked to be a macro */
508 #define putc_unlocked(_ch, _fp) __PUTC_UNLOCKED(_ch, _fp)
509 #endif /* Use POSIX or MISC. */
512 #if defined __USE_SVID || defined __USE_MISC \
513 || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
514 /* Get a word (int) from STREAM. */
515 extern int getw (FILE *__stream);
517 /* Write a word (int) to STREAM. */
518 extern int putw (int __w, FILE *__stream);
522 __BEGIN_NAMESPACE_STD
523 /* Get a newline-terminated string of finite length from STREAM.
525 This function is a possible cancellation point and therefore not
526 marked with __THROW. */
527 extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream);
529 /* Get a newline-terminated string from stdin, removing the newline.
530 DO NOT USE THIS FUNCTION!! There is no limit on how much it will read.
532 This function is a possible cancellation point and therefore not
533 marked with __THROW. */
534 extern char *gets (char *__s);
538 /* This function does the same as `fgets' but does not lock the stream.
540 This function is not part of POSIX and therefore no official
541 cancellation point. But due to similarity with an POSIX interface
542 or due to the implementation it is a cancellation point and
543 therefore not marked with __THROW. */
544 extern char *fgets_unlocked (char *__restrict __s, int __n,
545 FILE *__restrict __stream);
550 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
551 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
552 NULL), pointing to *N characters of space. It is realloc'd as
553 necessary. Returns the number of characters read (not including the
554 null terminator), or -1 on error or EOF.
556 These functions are 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 they are cancellation points and
559 therefore not marked with __THROW. */
560 extern __ssize_t __getdelim (char **__restrict __lineptr,
561 size_t *__restrict __n, int __delimiter,
562 FILE *__restrict __stream);
563 extern __ssize_t getdelim (char **__restrict __lineptr,
564 size_t *__restrict __n, int __delimiter,
565 FILE *__restrict __stream);
567 /* Like `getdelim', but reads up to a newline.
569 This function is not part of POSIX and therefore no official
570 cancellation point. But due to similarity with an POSIX interface
571 or due to the implementation it is a cancellation point and
572 therefore not marked with __THROW. */
573 extern __ssize_t getline (char **__restrict __lineptr,
574 size_t *__restrict __n,
575 FILE *__restrict __stream);
579 __BEGIN_NAMESPACE_STD
580 /* Write a string to STREAM.
582 This function is a possible cancellation points and therefore not
583 marked with __THROW. */
584 extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
586 /* Write a string, followed by a newline, to stdout.
588 This function is a possible cancellation points and therefore not
589 marked with __THROW. */
590 extern int puts (__const char *__s);
593 /* Push a character back onto the input buffer of STREAM.
595 This function is a possible cancellation points and therefore not
596 marked with __THROW. */
597 extern int ungetc (int __c, FILE *__stream);
600 /* Read chunks of generic data from STREAM.
602 This function is a possible cancellation points and therefore not
603 marked with __THROW. */
604 extern size_t fread (void *__restrict __ptr, size_t __size,
605 size_t __n, FILE *__restrict __stream);
606 /* Write chunks of generic data to STREAM.
608 This function is a possible cancellation points and therefore not
609 marked with __THROW. */
610 extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
611 size_t __n, FILE *__restrict __s);
615 /* This function does the same as `fputs' but does not lock the stream.
617 This function is not part of POSIX and therefore no official
618 cancellation point. But due to similarity with an POSIX interface
619 or due to the implementation it is a cancellation point and
620 therefore not marked with __THROW. */
621 extern int fputs_unlocked (__const char *__restrict __s,
622 FILE *__restrict __stream);
626 /* Faster versions when locking is not necessary.
628 These functions are not part of POSIX and therefore no official
629 cancellation point. But due to similarity with an POSIX interface
630 or due to the implementation they are cancellation points and
631 therefore not marked with __THROW. */
632 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
633 size_t __n, FILE *__restrict __stream);
634 extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
635 size_t __n, FILE *__restrict __stream);
639 __BEGIN_NAMESPACE_STD
640 /* Seek to a certain position on STREAM.
642 This function is a possible cancellation point and therefore not
643 marked with __THROW. */
644 extern int fseek (FILE *__stream, long int __off, int __whence);
645 /* Return the current position of STREAM.
647 This function is a possible cancellation point and therefore not
648 marked with __THROW. */
649 extern long int ftell (FILE *__stream);
650 /* Rewind to the beginning of STREAM.
652 This function is a possible cancellation point and therefore not
653 marked with __THROW. */
654 extern void rewind (FILE *__stream);
657 /* The Single Unix Specification, Version 2, specifies an alternative,
658 more adequate interface for the two functions above which deal with
659 file offset. `long int' is not the right type. These definitions
660 are originally defined in the Large File Support API. */
662 #if defined __USE_LARGEFILE || defined __USE_XOPEN2K
663 # ifndef __USE_FILE_OFFSET64
664 /* Seek to a certain position on STREAM.
666 This function is a possible cancellation point and therefore not
667 marked with __THROW. */
668 extern int fseeko (FILE *__stream, __off_t __off, int __whence);
669 /* Return the current position of STREAM.
671 This function is a possible cancellation point and therefore not
672 marked with __THROW. */
673 extern __off_t ftello (FILE *__stream);
676 extern int __REDIRECT (fseeko,
677 (FILE *__stream, __off64_t __off, int __whence),
679 extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64);
681 # define fseeko fseeko64
682 # define ftello ftello64
687 __BEGIN_NAMESPACE_STD
688 #ifndef __USE_FILE_OFFSET64
689 /* Get STREAM's position.
691 This function is a possible cancellation point and therefore not
692 marked with __THROW. */
693 extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
694 /* Set STREAM's position.
696 This function is a possible cancellation point and therefore not
697 marked with __THROW. */
698 extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
701 extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
702 fpos_t *__restrict __pos), fgetpos64);
703 extern int __REDIRECT (fsetpos,
704 (FILE *__stream, __const fpos_t *__pos), fsetpos64);
706 # define fgetpos fgetpos64
707 # define fsetpos fsetpos64
712 #ifdef __USE_LARGEFILE64
713 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
714 extern __off64_t ftello64 (FILE *__stream);
715 extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
716 extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos);
719 __BEGIN_NAMESPACE_STD
720 /* Clear the error and EOF indicators for STREAM. */
721 extern void clearerr (FILE *__stream) __THROW;
722 /* Return the EOF indicator for STREAM. */
723 extern int feof (FILE *__stream) __THROW;
724 /* Return the error indicator for STREAM. */
725 extern int ferror (FILE *__stream) __THROW;
729 /* Faster versions when locking is not required. */
730 extern void clearerr_unlocked (FILE *__stream) __THROW;
731 extern int feof_unlocked (FILE *__stream) __THROW;
732 extern int ferror_unlocked (FILE *__stream) __THROW;
736 __BEGIN_NAMESPACE_STD
737 /* Print a message describing the meaning of the value of errno.
739 This function is a possible cancellation point and therefore not
740 marked with __THROW. */
741 extern void perror (__const char *__s);
744 #ifdef __UCLIBC_HAS_SYS_ERRLIST__
745 /* These variables normally should not be used directly. The `strerror'
746 function provides all the needed functionality. */
749 extern __const char *__const sys_errlist[];
751 #endif /* __UCLIBC_HAS_SYS_ERRLIST__ */
755 /* Return the system file descriptor for STREAM. */
756 extern int fileno (FILE *__stream) __THROW;
757 #endif /* Use POSIX. */
760 /* Faster version when locking is not required. */
761 extern int fileno_unlocked (FILE *__stream) __THROW;
765 #if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \
767 /* Create a new stream connected to a pipe running the given command.
769 This function is a possible cancellation point and therefore not
770 marked with __THROW. */
771 extern FILE *popen (__const char *__command, __const char *__modes);
773 /* Close a stream opened by popen and return the status of its child.
775 This function is a possible cancellation point and therefore not
776 marked with __THROW. */
777 extern int pclose (FILE *__stream);
782 /* Return the name of the controlling terminal. */
783 extern char *ctermid (char *__s) __THROW;
784 #endif /* Use POSIX. */
788 /* Return the name of the current user. */
789 extern char *cuserid (char *__s);
790 #endif /* Use X/Open, but not issue 6. */
794 struct obstack; /* See <obstack.h>. */
796 /* Write formatted output to an obstack. */
797 extern int obstack_printf (struct obstack *__restrict __obstack,
798 __const char *__restrict __format, ...)
799 __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
800 extern int obstack_vprintf (struct obstack *__restrict __obstack,
801 __const char *__restrict __format,
802 __gnuc_va_list __args)
803 __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
804 #endif /* Use GNU. */
807 #if defined __USE_POSIX || defined __USE_MISC
808 /* These are defined in POSIX.1:1996. */
810 /* Acquire ownership of STREAM. */
811 extern void flockfile (FILE *__stream) __THROW;
813 /* Try to acquire ownership of STREAM but do not block if it is not
815 extern int ftrylockfile (FILE *__stream) __THROW;
817 /* Relinquish the ownership granted for STREAM. */
818 extern void funlockfile (FILE *__stream) __THROW;
819 #endif /* POSIX || misc */
821 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
822 /* The X/Open standard requires some functions and variables to be
823 declared here which do not belong into this header. But we have to
824 follow. In GNU mode we don't do this nonsense. */
825 # define __need_getopt
826 # include <bits/getopt.h>
827 #endif /* X/Open, but not issue 6 and not for GNU. */
829 /* If we are compiling with optimizing read this file. It contains
830 several optimizing inline functions and macros. */
831 #define fgetc(_fp) __FGETC(_fp)
832 #define fputc(_ch, _fp) __FPUTC(_ch, _fp)
835 #define fgetc_unlocked(_fp) __FGETC_UNLOCKED(_fp)
836 #define fputc_unlocked(_ch, _fp) __FPUTC_UNLOCKED(_ch, _fp)
839 #define getchar() __GETC(__stdin)
840 #define putchar(_ch) __PUTC((_ch), __stdout)
842 #if defined __USE_POSIX || defined __USE_MISC
843 #define getchar_unlocked() __GETC_UNLOCKED(__stdin)
844 #define putchar_unlocked(_ch) __PUTC_UNLOCKED((_ch), __stdout)
847 /* Clear the error and EOF indicators for STREAM. */
848 #define clearerr(_fp) __CLEARERR(_fp)
849 #define feof(_fp) __FEOF(_fp)
850 #define ferror(_fp) __FERROR(_fp)
853 #define clearerr_unlocked(_fp) __CLEARERR_UNLOCKED(_fp)
854 #define feof_unlocked(_fp) __FEOF_UNLOCKED(_fp)
855 #define ferror_unlocked(_fp) __FERROR_UNLOCKED(_fp)
860 #endif /* <stdio.h> included. */
862 #endif /* !_STDIO_H */