Update.
[glibc.git] / libio / stdio.h
blobeb0d98d7d2a5bf932a4838404bb6ce5ad8384967
1 /* Define ISO C stdio on top of C++ iostreams.
2 Copyright (C) 1991, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
20 * ISO C Standard: 4.9 INPUT/OUTPUT <stdio.h>
23 #ifndef _STDIO_H
25 #ifndef __need_FILE
26 # define _STDIO_H 1
27 # include <features.h>
29 __BEGIN_DECLS
31 # define __need_size_t
32 # define __need_NULL
33 # include <stddef.h>
35 # ifndef __USE_XOPEN
36 # define __need___va_list
37 # endif
38 # include <stdarg.h>
40 # include <bits/types.h>
41 #endif /* Don't need FILE. */
42 #undef __need_FILE
45 #ifndef __FILE_defined
47 /* The opaque type of streams. */
48 typedef struct _IO_FILE FILE;
50 # define __FILE_defined 1
51 #endif /* FILE not defined. */
54 #ifdef _STDIO_H
55 #define _STDIO_USES_IOSTREAM
57 #include <libio.h>
59 #ifdef __cplusplus
60 # define __STDIO_INLINE inline
61 #else
62 # define __STDIO_INLINE extern __inline
63 #endif
65 /* The type of the second argument to `fgetpos' and `fsetpos'. */
66 #ifndef __USE_FILE_OFFSET64
67 typedef _G_fpos_t fpos_t;
68 #else
69 typedef _G_fpos64_t fpos_t;
70 #endif
71 #ifdef __USE_LARGEFILE64
72 typedef _G_fpos64_t fpos64_t;
73 #endif
75 /* Generate a unique file name (and possibly open it with mode "w+b"). */
76 extern char *__stdio_gen_tempname __P ((char *__buf, size_t __bufsize,
77 __const char *__dir,
78 __const char *__pfx,
79 int __dir_search,
80 size_t *__lenptr,
81 FILE **__streamptr,
82 int __large_file));
85 /* Print out MESSAGE on the error output and abort. */
86 extern void __libc_fatal __P ((__const char *__message))
87 __attribute__ ((__noreturn__));
90 /* The possibilities for the third argument to `setvbuf'. */
91 #define _IOFBF 0 /* Fully buffered. */
92 #define _IOLBF 1 /* Line buffered. */
93 #define _IONBF 2 /* No buffering. */
96 /* Default buffer size. */
97 #ifndef BUFSIZ
98 # define BUFSIZ _IO_BUFSIZ
99 #endif
102 /* End of file character.
103 Some things throughout the library rely on this being -1. */
104 #ifndef EOF
105 # define EOF (-1)
106 #endif
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"
119 #endif
122 /* Get the values:
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. */
140 /* Remove file FILENAME. */
141 extern int remove __P ((__const char *__filename));
142 /* Rename file OLD to NEW. */
143 extern int rename __P ((__const char *__old, __const char *__new));
146 /* Create a temporary file and open it read/write. */
147 #ifndef __USE_FILE_OFFSET64
148 extern FILE *tmpfile __P ((void));
149 #else
150 # ifdef __REDIRECT
151 extern FILE *__REDIRECT (tmpfile, __P ((void)), tmpfile64);
152 # else
153 # define tmpfile tmpfile64
154 # endif
155 #endif
156 #ifdef __USE_LARGEFILE64
157 extern FILE *tmpfile64 __P ((void));
158 #endif
159 /* Generate a temporary filename. */
160 extern char *tmpnam __P ((char *__s));
162 #ifdef __USE_MISC
163 /* This is the reentrant variant of `tmpnam'. The only difference is
164 that it does not allow S to be NULL. */
165 extern char *tmpnam_r __P ((char *__s));
166 #endif
169 #if defined __USE_SVID || defined __USE_XOPEN
170 /* Generate a unique temporary filename using up to five characters of PFX
171 if it is not NULL. The directory to put this file in is searched for
172 as follows: First the environment variable "TMPDIR" is checked.
173 If it contains the name of a writable directory, that directory is used.
174 If not and if DIR is not NULL, that value is checked. If that fails,
175 P_tmpdir is tried and finally "/tmp". The storage for the filename
176 is allocated by `malloc'. */
177 extern char *tempnam __P ((__const char *__dir, __const char *__pfx));
178 #endif
181 /* Close STREAM. */
182 extern int fclose __P ((FILE *__stream));
183 /* Flush STREAM, or all streams if STREAM is NULL. */
184 extern int fflush __P ((FILE *__stream));
186 #ifdef __USE_MISC
187 /* Faster versions when locking is not required. */
188 extern int fflush_unlocked __P ((FILE *__stream));
189 #endif
191 #ifdef __USE_GNU
192 /* Close all streams. */
193 extern int __fcloseall __P ((void));
194 extern int fcloseall __P ((void));
195 #endif
198 #ifndef __USE_FILE_OFFSET64
199 /* Open a file and create a new stream for it. */
200 extern FILE *fopen __P ((__const char *__restrict __filename,
201 __const char *__restrict __modes));
202 /* Open a file, replacing an existing stream with it. */
203 extern FILE *freopen __P ((__const char *__restrict __filename,
204 __const char *__restrict __modes,
205 FILE *__restrict __stream));
206 #else
207 # ifdef __REDIRECT
208 extern FILE *__REDIRECT (fopen, __P ((__const char *__restrict __filename,
209 __const char *__restrict __modes)),
210 fopen64);
211 extern FILE *__REDIRECT (freopen, __P ((__const char *__restrict __filename,
212 __const char *__restrict __modes,
213 FILE *__restrict __stream)),
214 freopen64);
215 # else
216 # define fopen fopen64
217 # define freopen freopen64
218 # endif
219 #endif
220 #ifdef __USE_LARGEFILE64
221 extern FILE *fopen64 __P ((__const char *__restrict __filename,
222 __const char *__restrict __modes));
223 extern FILE *freopen64 __P ((__const char *__restrict __filename,
224 __const char *__restrict __modes,
225 FILE *__restrict __stream));
226 #endif
228 #ifdef __USE_POSIX
229 /* Create a new stream that refers to an existing system file descriptor. */
230 extern FILE *fdopen __P ((int __fd, __const char *__modes));
231 #endif
233 #ifdef __USE_GNU
234 /* Create a new stream that refers to the given magic cookie,
235 and uses the given functions for input and output. */
236 extern FILE *fopencookie __P ((void *__magic_cookie, __const char *__modes,
237 _IO_cookie_io_functions_t __io_funcs));
239 /* Open a stream that writes into a malloc'd buffer that is expanded as
240 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
241 and the number of characters written on fflush or fclose. */
242 extern FILE *open_memstream __P ((char **__bufloc, size_t *__sizeloc));
243 #endif
246 /* If BUF is NULL, make STREAM unbuffered.
247 Else make it use buffer BUF, of size BUFSIZ. */
248 extern void setbuf __P ((FILE *__restrict __stream, char *__restrict __buf));
249 /* Make STREAM use buffering mode MODE.
250 If BUF is not NULL, use N bytes of it for buffering;
251 else allocate an internal buffer N bytes long. */
252 extern int setvbuf __P ((FILE *__restrict __stream, char *__restrict __buf,
253 int __modes, size_t __n));
255 #ifdef __USE_BSD
256 /* If BUF is NULL, make STREAM unbuffered.
257 Else make it use SIZE bytes of BUF for buffering. */
258 extern void setbuffer __P ((FILE *__stream, char *__buf, size_t __size));
260 /* Make STREAM line-buffered. */
261 extern void setlinebuf __P ((FILE *__stream));
262 #endif
265 /* Write formatted output to STREAM. */
266 extern int fprintf __P ((FILE *__restrict __stream,
267 __const char *__restrict __format, ...));
268 /* Write formatted output to stdout. */
269 extern int printf __P ((__const char *__restrict __format, ...));
270 /* Write formatted output to S. */
271 extern int sprintf __P ((char *__restrict __s,
272 __const char *__restrict __format, ...));
274 /* Write formatted output to S from argument list ARG. */
275 extern int vfprintf __P ((FILE *__restrict __s,
276 __const char *__restrict __format,
277 _G_va_list __arg));
278 /* Write formatted output to stdout from argument list ARG. */
279 extern int vprintf __P ((__const char *__restrict __format,
280 _G_va_list __arg));
281 /* Write formatted output to S from argument list ARG. */
282 extern int vsprintf __P ((char *__restrict __s,
283 __const char *__restrict __format,
284 _G_va_list __arg));
286 #ifdef __OPTIMIZE__
287 __STDIO_INLINE int
288 vprintf (__const char *__restrict __fmt, _G_va_list __arg)
290 return vfprintf (stdout, __fmt, __arg);
292 #endif /* Optimizing. */
294 #if defined __USE_BSD || defined __USE_ISOC9X || defined __USE_UNIX98
295 /* Maximum chars of output to write in MAXLEN. */
296 extern int __snprintf __P ((char *__restrict __s, size_t __maxlen,
297 __const char *__restrict __format, ...))
298 __attribute__ ((__format__ (__printf__, 3, 4)));
299 extern int snprintf __P ((char *__restrict __s, size_t __maxlen,
300 __const char *__restrict __format, ...))
301 __attribute__ ((__format__ (__printf__, 3, 4)));
303 extern int __vsnprintf __P ((char *__restrict __s, size_t __maxlen,
304 __const char *__restrict __format,
305 _G_va_list __arg))
306 __attribute__ ((__format__ (__printf__, 3, 0)));
307 extern int vsnprintf __P ((char *__restrict __s, size_t __maxlen,
308 __const char *__restrict __format,
309 _G_va_list __arg))
310 __attribute__ ((__format__ (__printf__, 3, 0)));
311 #endif
313 #ifdef __USE_GNU
314 /* Write formatted output to a string dynamically allocated with `malloc'.
315 Store the address of the string in *PTR. */
316 extern int vasprintf __P ((char **__restrict __ptr,
317 __const char *__restrict __f, _G_va_list __arg))
318 __attribute__ ((__format__ (__printf__, 2, 0)));
319 extern int __asprintf __P ((char **__restrict __ptr,
320 __const char *__restrict __fmt, ...))
321 __attribute__ ((__format__ (__printf__, 2, 3)));
322 extern int asprintf __P ((char **__restrict __ptr,
323 __const char *__restrict __fmt, ...))
324 __attribute__ ((__format__ (__printf__, 2, 3)));
326 /* Write formatted output to a file descriptor. */
327 extern int vdprintf __P ((int __fd, __const char *__restrict __fmt,
328 _G_va_list __arg))
329 __attribute__ ((__format__ (__printf__, 2, 0)));
330 extern int dprintf __P ((int __fd, __const char *__restrict __fmt, ...))
331 __attribute__ ((__format__ (__printf__, 2, 3)));
332 #endif
335 /* Read formatted input from STREAM. */
336 extern int fscanf __P ((FILE *__restrict __stream,
337 __const char *__restrict __format, ...));
338 /* Read formatted input from stdin. */
339 extern int scanf __P ((__const char *__restrict __format, ...));
340 /* Read formatted input from S. */
341 extern int sscanf __P ((__const char *__restrict __s,
342 __const char *__restrict __format, ...));
344 #ifdef __USE_GNU
345 /* Read formatted input from S into argument list ARG. */
346 extern int __vfscanf __P ((FILE *__restrict __s,
347 __const char *__restrict __format,
348 _G_va_list __arg))
349 __attribute__ ((__format__ (__scanf__, 2, 0)));
350 extern int vfscanf __P ((FILE *__restrict __s,
351 __const char *__restrict __format,
352 _G_va_list __arg))
353 __attribute__ ((__format__ (__scanf__, 2, 0)));
355 /* Read formatted input from stdin into argument list ARG. */
356 extern int __vscanf __P ((__const char *__restrict __format,
357 _G_va_list __arg))
358 __attribute__ ((__format__ (__scanf__, 1, 0)));
359 extern int vscanf __P ((__const char *__restrict __format, _G_va_list __arg))
360 __attribute__ ((__format__ (__scanf__, 1, 0)));
362 /* Read formatted input from S into argument list ARG. */
363 extern int __vsscanf __P ((__const char *__restrict __s,
364 __const char *__restrict __format,
365 _G_va_list __arg))
366 __attribute__ ((__format__ (__scanf__, 2, 0)));
367 extern int vsscanf __P ((__const char *__restrict __s,
368 __const char *__restrict __format,
369 _G_va_list __arg))
370 __attribute__ ((__format__ (__scanf__, 2, 0)));
371 #endif /* Use GNU. */
374 /* Read a character from STREAM. */
375 extern int fgetc __P ((FILE *__stream));
376 extern int getc __P ((FILE *__stream));
378 /* Read a character from stdin. */
379 extern int getchar __P ((void));
381 /* The C standard explicitly says this is a macro, so we always do the
382 optimization for it. */
383 #define getc(_fp) _IO_getc (_fp)
385 #ifdef __OPTIMIZE__
386 __STDIO_INLINE int
387 getchar (void)
389 return _IO_getc (stdin);
391 #endif /* Optimizing. */
393 #if defined __USE_POSIX || defined __USE_MISC
394 /* These are defined in POSIX.1:1996. */
395 extern int getc_unlocked __P ((FILE *__stream));
396 extern int getchar_unlocked __P ((void));
398 # ifdef __OPTIMIZE__
399 __STDIO_INLINE int
400 getc_unlocked (FILE *__fp)
402 return _IO_getc_unlocked (__fp);
405 __STDIO_INLINE int
406 getchar_unlocked (void)
408 return _IO_getc_unlocked (stdin);
410 # endif /* Optimizing. */
411 #endif /* Use POSIX or MISC. */
414 /* Write a character to STREAM. */
415 extern int fputc __P ((int __c, FILE *__stream));
416 extern int putc __P ((int __c, FILE *__stream));
418 /* Write a character to stdout. */
419 extern int putchar __P ((int __c));
421 /* The C standard explicitly says this can be a macro,
422 so we always do the optimization for it. */
423 #define putc(_ch, _fp) _IO_putc (_ch, _fp)
425 #ifdef __OPTIMIZE__
426 __STDIO_INLINE int
427 putchar (int __c)
429 return _IO_putc (__c, stdout);
431 #endif
433 #ifdef __USE_MISC
434 /* Faster version when locking is not necessary. */
435 extern int fputc_unlocked __P ((int __c, FILE *__stream));
437 # ifdef __OPTIMIZE__
438 __STDIO_INLINE int
439 fputc_unlocked (int __c, FILE *__stream)
441 return _IO_putc_unlocked (__c, __stream);
443 # endif /* Optimizing. */
444 #endif /* Use MISC. */
446 #if defined __USE_POSIX || defined __USE_MISC
447 /* These are defined in POSIX.1:1996. */
448 extern int putc_unlocked __P ((int __c, FILE *__stream));
449 extern int putchar_unlocked __P ((int __c));
451 # ifdef __OPTIMIZE__
452 __STDIO_INLINE int
453 putc_unlocked (int __c, FILE *__stream)
455 return _IO_putc_unlocked (__c, __stream);
458 __STDIO_INLINE int
459 putchar_unlocked (int __c)
461 return _IO_putc_unlocked (__c, stdout);
463 # endif /* Optimizing. */
464 #endif /* Use POSIX or MISc. */
467 #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
468 /* Get a word (int) from STREAM. */
469 extern int getw __P ((FILE *__stream));
471 /* Write a word (int) to STREAM. */
472 extern int putw __P ((int __w, FILE *__stream));
473 #endif
476 /* Get a newline-terminated string of finite length from STREAM. */
477 extern char *fgets __P ((char *__restrict __s, int __n,
478 FILE *__restrict __stream));
480 #ifdef __USE_GNU
481 /* This function does the same as `fgets' but does not lock the stream. */
482 extern char *fgets_unlocked __P ((char *__restrict __s, int __n,
483 FILE *__restrict __stream));
484 #endif
486 /* Get a newline-terminated string from stdin, removing the newline.
487 DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. */
488 extern char *gets __P ((char *__s));
491 #ifdef __USE_GNU
492 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
493 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
494 NULL), pointing to *N characters of space. It is realloc'd as
495 necessary. Returns the number of characters read (not including the
496 null terminator), or -1 on error or EOF. */
497 _IO_ssize_t __getdelim __P ((char **__lineptr, size_t *__n,
498 int __delimiter, FILE *__stream));
499 _IO_ssize_t getdelim __P ((char **__lineptr, size_t *__n,
500 int __delimiter, FILE *__stream));
502 /* Like `getdelim', but reads up to a newline. */
503 _IO_ssize_t __getline __P ((char **__lineptr, size_t *__n, FILE *__stream));
504 _IO_ssize_t getline __P ((char **__lineptr, size_t *__n, FILE *__stream));
506 # ifdef __OPTIMIZE__
507 __STDIO_INLINE _IO_ssize_t
508 getline (char **__lineptr, size_t *__n, FILE *__stream)
510 return __getdelim (__lineptr, __n, '\n', __stream);
512 # endif /* Optimizing. */
513 #endif
516 /* Write a string to STREAM. */
517 extern int fputs __P ((__const char *__restrict __s,
518 FILE *__restrict __stream));
519 /* Write a string, followed by a newline, to stdout. */
520 extern int puts __P ((__const char *__s));
523 /* Push a character back onto the input buffer of STREAM. */
524 extern int ungetc __P ((int __c, FILE *__stream));
527 /* Read chunks of generic data from STREAM. */
528 extern size_t fread __P ((void *__restrict __ptr, size_t __size,
529 size_t __n, FILE *__restrict __stream));
530 /* Write chunks of generic data to STREAM. */
531 extern size_t fwrite __P ((__const void *__restrict __ptr, size_t __size,
532 size_t __n, FILE *__restrict __s));
534 #ifdef __USE_MISC
535 /* Faster versions when locking is not necessary. */
536 extern size_t fread_unlocked __P ((void *__restrict __ptr, size_t __size,
537 size_t __n, FILE *__restrict __stream));
538 extern size_t fwrite_unlocked __P ((__const void *__restrict __ptr,
539 size_t __size, size_t __n,
540 FILE *__restrict __stream));
541 #endif
544 /* Seek to a certain position on STREAM. */
545 extern int fseek __P ((FILE *__stream, long int __off, int __whence));
546 /* Return the current position of STREAM. */
547 extern long int ftell __P ((FILE *__stream));
548 /* Rewind to the beginning of STREAM. */
549 extern void rewind __P ((FILE *__stream));
551 #if (defined __USE_LARGEFILE || defined __USE_LARGEFILE64 \
552 || defined __USE_FILE_OFFSET64)
553 /* The Single Unix Specification, Version 2, specifies an alternative,
554 more adequate interface for the two functions above which deal with
555 file offset. `long int' is not the right type. These definitions
556 are originally defined in the Large File Support API. */
558 /* Types needed in these functions. */
559 # ifndef off_t
560 # ifndef __USE_FILE_OFFSET64
561 typedef __off_t off_t;
562 # else
563 typedef __off64_t off_t;
564 # endif
565 # define off_t off_t
566 # endif
568 # if defined __USE_LARGEFILE64 && !defined off64_t
569 typedef __off64_t off64_t;
570 # define off64_t off64_t
571 # endif
574 # ifndef __USE_FILE_OFFSET64
575 /* Seek to a certain position on STREAM. */
576 extern int fseeko __P ((FILE *__stream, __off_t __off, int __whence));
577 /* Return the current position of STREAM. */
578 extern __off_t ftello __P ((FILE *__stream));
579 /* Get STREAM's position. */
580 extern int fgetpos __P ((FILE *__restrict __stream,
581 fpos_t *__restrict __pos));
582 /* Set STREAM's position. */
583 extern int fsetpos __P ((FILE *__stream, __const fpos_t *__pos));
584 # else
585 # ifdef __REDIRECT
586 extern int __REDIRECT (fseeko,
587 __P ((FILE *__stream, __off64_t __off, int __whence)),
588 fseeko64);
589 extern __off64_t __REDIRECT (ftello, __P ((FILE *__stream)), ftello64);
590 extern int __REDIRECT (fgetpos, __P ((FILE *__restrict __stream,
591 fpos_t *__restrict __pos)), fgetpos64);
592 extern int __REDIRECT (fsetpos, __P ((FILE *__stream, __const fpos_t *__pos)),
593 fsetpos64);
594 # else
595 # define fseeko fseeko64
596 # define ftello ftello64
597 # define fgetpos fgetpos64
598 # define fsetpos fsetpos64
599 # endif
600 # endif
602 # ifdef __USE_LARGEFILE64
603 extern int fseeko64 __P ((FILE *__stream, __off64_t __off, int __whence));
604 extern __off64_t ftello64 __P ((FILE *__stream));
605 extern int fgetpos64 __P ((FILE *__restrict __stream,
606 fpos64_t *__restrict __pos));
607 extern int fsetpos64 __P ((FILE *__stream, __const fpos64_t *__pos));
608 # endif
609 #endif
611 /* Clear the error and EOF indicators for STREAM. */
612 extern void clearerr __P ((FILE *__stream));
613 /* Return the EOF indicator for STREAM. */
614 extern int feof __P ((FILE *__stream));
615 /* Return the error indicator for STREAM. */
616 extern int ferror __P ((FILE *__stream));
618 #ifdef __USE_MISC
619 /* Faster versions when locking is not required. */
620 extern void clearerr_unlocked __P ((FILE *__stream));
621 extern int feof_unlocked __P ((FILE *__stream));
622 extern int ferror_unlocked __P ((FILE *__stream));
624 # ifdef __OPTIMIZE__
625 __STDIO_INLINE int
626 feof_unlocked (FILE *__stream)
628 return _IO_feof_unlocked (__stream);
631 __STDIO_INLINE int
632 ferror_unlocked (FILE *__stream)
634 return _IO_ferror_unlocked (__stream);
636 # endif /* Optimizing. */
637 #endif
640 /* Print a message describing the meaning of the value of errno. */
641 extern void perror __P ((__const char *__s));
643 /* These variables normally should not be used directly. The `strerror'
644 function provides all the needed functionality. */
645 #ifdef __USE_BSD
646 extern int sys_nerr;
647 extern __const char *__const sys_errlist[];
648 #endif
649 #ifdef __USE_GNU
650 extern int _sys_nerr;
651 extern __const char *__const _sys_errlist[];
652 #endif
655 #ifdef __USE_POSIX
656 /* Return the system file descriptor for STREAM. */
657 extern int fileno __P ((FILE *__stream));
658 #endif /* Use POSIX. */
660 #ifdef __USE_MISC
661 /* Faster version when locking is not required. */
662 extern int fileno_unlocked __P ((FILE *__stream));
663 #endif
666 #if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \
667 defined __USE_MISC)
668 /* Create a new stream connected to a pipe running the given command. */
669 extern FILE *popen __P ((__const char *__command, __const char *__modes));
671 /* Close a stream opened by popen and return the status of its child. */
672 extern int pclose __P ((FILE *__stream));
673 #endif
676 #ifdef __USE_POSIX
677 /* Return the name of the controlling terminal. */
678 extern char *ctermid __P ((char *__s));
679 #endif /* Use POSIX. */
682 #ifdef __USE_XOPEN
683 /* Return the name of the current user. */
684 extern char *cuserid __P ((char *__s));
685 #endif /* Use X/Open. */
688 #ifdef __USE_GNU
689 struct obstack; /* See <obstack.h>. */
691 /* Write formatted output to an obstack. */
692 extern int obstack_printf __P ((struct obstack *__obstack,
693 __const char *__format, ...));
694 extern int obstack_vprintf __P ((struct obstack *__obstack,
695 __const char *__format,
696 _G_va_list __args));
697 #endif /* Use GNU. */
700 #if defined __USE_POSIX || defined __USE_MISC
701 /* These are defined in POSIX.1:1996. */
703 /* Acquire ownership of STREAM. */
704 extern void flockfile __P ((FILE *__stream));
706 /* Try to acquire ownership of STREAM but do not block if it is not
707 possible. */
708 extern int ftrylockfile __P ((FILE *__stream));
710 /* Relinquish the ownership granted for STREAM. */
711 extern void funlockfile __P ((FILE *__stream));
712 #endif /* POSIX || misc */
714 #if defined __USE_XOPEN && !defined __USE_GNU
715 /* The X/Open standard requires some functions and variables to be
716 declared here which do not belong into this header. But we have to
717 follow. In GNU mode we don't do this nonsense. */
719 /* For more information on these symbols look in <getopt.h>. */
720 extern char *optarg;
721 extern int optind;
722 extern int opterr;
723 extern int optopt;
725 extern int getopt __P ((int __argc, char *__const *__argv,
726 __const char *__shortopts));
727 #endif
729 __END_DECLS
731 /* Define helper macro. */
732 #undef __STDIO_INLINE
734 #endif /* <stdio.h> included. */
736 #endif /* !_STDIO_H */