Update.
[glibc.git] / libio / stdio.h
blobe7b167d8485434247585dc0d7236c98be7c229b1
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). */
76 extern int __path_search __P ((char *__tmpl, size_t __tmpl_len,
77 __const char *__dir,
78 __const char *__pfx));
80 extern int __gen_tempname __P ((char *__tmpl, int __openit, int __large_file));
82 /* Print out MESSAGE on the error output and abort. */
83 extern void __libc_fatal __P ((__const char *__message))
84 __attribute__ ((__noreturn__));
87 /* The possibilities for the third argument to `setvbuf'. */
88 #define _IOFBF 0 /* Fully buffered. */
89 #define _IOLBF 1 /* Line buffered. */
90 #define _IONBF 2 /* No buffering. */
93 /* Default buffer size. */
94 #ifndef BUFSIZ
95 # define BUFSIZ _IO_BUFSIZ
96 #endif
99 /* End of file character.
100 Some things throughout the library rely on this being -1. */
101 #ifndef EOF
102 # define EOF (-1)
103 #endif
106 /* The possibilities for the third argument to `fseek'.
107 These values should not be changed. */
108 #define SEEK_SET 0 /* Seek from beginning of file. */
109 #define SEEK_CUR 1 /* Seek from current position. */
110 #define SEEK_END 2 /* Seek from end of file. */
113 #if defined __USE_SVID || defined __USE_XOPEN
114 /* Default path prefix for `tempnam' and `tmpnam'. */
115 # define P_tmpdir "/tmp"
116 #endif
119 /* Get the values:
120 L_tmpnam How long an array of chars must be to be passed to `tmpnam'.
121 TMP_MAX The minimum number of unique filenames generated by tmpnam
122 (and tempnam when it uses tmpnam's name space),
123 or tempnam (the two are separate).
124 L_ctermid How long an array to pass to `ctermid'.
125 L_cuserid How long an array to pass to `cuserid'.
126 FOPEN_MAX Minimum number of files that can be open at once.
127 FILENAME_MAX Maximum length of a filename. */
128 #include <bits/stdio_lim.h>
131 /* Standard streams. */
132 extern FILE *stdin; /* Standard input stream. */
133 extern FILE *stdout; /* Standard output stream. */
134 extern FILE *stderr; /* Standard error output stream. */
137 /* Remove file FILENAME. */
138 extern int remove __P ((__const char *__filename));
139 /* Rename file OLD to NEW. */
140 extern int rename __P ((__const char *__old, __const char *__new));
143 /* Create a temporary file and open it read/write. */
144 #ifndef __USE_FILE_OFFSET64
145 extern FILE *tmpfile __P ((void));
146 #else
147 # ifdef __REDIRECT
148 extern FILE *__REDIRECT (tmpfile, __P ((void)), tmpfile64);
149 # else
150 # define tmpfile tmpfile64
151 # endif
152 #endif
153 #ifdef __USE_LARGEFILE64
154 extern FILE *tmpfile64 __P ((void));
155 #endif
156 /* Generate a temporary filename. */
157 extern char *tmpnam __P ((char *__s));
159 #ifdef __USE_MISC
160 /* This is the reentrant variant of `tmpnam'. The only difference is
161 that it does not allow S to be NULL. */
162 extern char *tmpnam_r __P ((char *__s));
163 #endif
166 #if defined __USE_SVID || defined __USE_XOPEN
167 /* Generate a unique temporary filename using up to five characters of PFX
168 if it is not NULL. The directory to put this file in is searched for
169 as follows: First the environment variable "TMPDIR" is checked.
170 If it contains the name of a writable directory, that directory is used.
171 If not and if DIR is not NULL, that value is checked. If that fails,
172 P_tmpdir is tried and finally "/tmp". The storage for the filename
173 is allocated by `malloc'. */
174 extern char *tempnam __P ((__const char *__dir, __const char *__pfx));
175 #endif
178 /* Close STREAM. */
179 extern int fclose __P ((FILE *__stream));
180 /* Flush STREAM, or all streams if STREAM is NULL. */
181 extern int fflush __P ((FILE *__stream));
183 #ifdef __USE_MISC
184 /* Faster versions when locking is not required. */
185 extern int fflush_unlocked __P ((FILE *__stream));
186 #endif
188 #ifdef __USE_GNU
189 /* Close all streams. */
190 extern int fcloseall __P ((void));
191 #endif
194 #ifndef __USE_FILE_OFFSET64
195 /* Open a file and create a new stream for it. */
196 extern FILE *fopen __P ((__const char *__restrict __filename,
197 __const char *__restrict __modes));
198 /* Open a file, replacing an existing stream with it. */
199 extern FILE *freopen __P ((__const char *__restrict __filename,
200 __const char *__restrict __modes,
201 FILE *__restrict __stream));
202 #else
203 # ifdef __REDIRECT
204 extern FILE *__REDIRECT (fopen, __P ((__const char *__restrict __filename,
205 __const char *__restrict __modes)),
206 fopen64);
207 extern FILE *__REDIRECT (freopen, __P ((__const char *__restrict __filename,
208 __const char *__restrict __modes,
209 FILE *__restrict __stream)),
210 freopen64);
211 # else
212 # define fopen fopen64
213 # define freopen freopen64
214 # endif
215 #endif
216 #ifdef __USE_LARGEFILE64
217 extern FILE *fopen64 __P ((__const char *__restrict __filename,
218 __const char *__restrict __modes));
219 extern FILE *freopen64 __P ((__const char *__restrict __filename,
220 __const char *__restrict __modes,
221 FILE *__restrict __stream));
222 #endif
224 #ifdef __USE_POSIX
225 /* Create a new stream that refers to an existing system file descriptor. */
226 extern FILE *fdopen __P ((int __fd, __const char *__modes));
227 #endif
229 #ifdef __USE_GNU
230 /* Create a new stream that refers to the given magic cookie,
231 and uses the given functions for input and output. */
232 extern FILE *fopencookie __P ((void *__magic_cookie, __const char *__modes,
233 _IO_cookie_io_functions_t __io_funcs));
235 /* Open a stream that writes into a malloc'd buffer that is expanded as
236 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
237 and the number of characters written on fflush or fclose. */
238 extern FILE *open_memstream __P ((char **__bufloc, size_t *__sizeloc));
239 #endif
242 /* If BUF is NULL, make STREAM unbuffered.
243 Else make it use buffer BUF, of size BUFSIZ. */
244 extern void setbuf __P ((FILE *__restrict __stream, char *__restrict __buf));
245 /* Make STREAM use buffering mode MODE.
246 If BUF is not NULL, use N bytes of it for buffering;
247 else allocate an internal buffer N bytes long. */
248 extern int setvbuf __P ((FILE *__restrict __stream, char *__restrict __buf,
249 int __modes, size_t __n));
251 #ifdef __USE_BSD
252 /* If BUF is NULL, make STREAM unbuffered.
253 Else make it use SIZE bytes of BUF for buffering. */
254 extern void setbuffer __P ((FILE *__stream, char *__buf, size_t __size));
256 /* Make STREAM line-buffered. */
257 extern void setlinebuf __P ((FILE *__stream));
258 #endif
261 /* Write formatted output to STREAM. */
262 extern int fprintf __P ((FILE *__restrict __stream,
263 __const char *__restrict __format, ...));
264 /* Write formatted output to stdout. */
265 extern int printf __P ((__const char *__restrict __format, ...));
266 /* Write formatted output to S. */
267 extern int sprintf __P ((char *__restrict __s,
268 __const char *__restrict __format, ...));
270 /* Write formatted output to S from argument list ARG. */
271 extern int vfprintf __P ((FILE *__restrict __s,
272 __const char *__restrict __format,
273 _G_va_list __arg));
274 /* Write formatted output to stdout from argument list ARG. */
275 extern int vprintf __P ((__const char *__restrict __format,
276 _G_va_list __arg));
277 /* Write formatted output to S from argument list ARG. */
278 extern int vsprintf __P ((char *__restrict __s,
279 __const char *__restrict __format,
280 _G_va_list __arg));
282 #if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__
283 __STDIO_INLINE int
284 vprintf (__const char *__restrict __fmt, _G_va_list __arg)
286 return vfprintf (stdout, __fmt, __arg);
288 #endif /* Optimizing. */
290 #if defined __USE_BSD || defined __USE_ISOC9X || defined __USE_UNIX98
291 /* Maximum chars of output to write in MAXLEN. */
292 extern int snprintf __P ((char *__restrict __s, size_t __maxlen,
293 __const char *__restrict __format, ...))
294 __attribute__ ((__format__ (__printf__, 3, 4)));
296 extern int __vsnprintf __P ((char *__restrict __s, size_t __maxlen,
297 __const char *__restrict __format,
298 _G_va_list __arg))
299 __attribute__ ((__format__ (__printf__, 3, 0)));
300 extern int vsnprintf __P ((char *__restrict __s, size_t __maxlen,
301 __const char *__restrict __format,
302 _G_va_list __arg))
303 __attribute__ ((__format__ (__printf__, 3, 0)));
304 #endif
306 #ifdef __USE_GNU
307 /* Write formatted output to a string dynamically allocated with `malloc'.
308 Store the address of the string in *PTR. */
309 extern int vasprintf __P ((char **__restrict __ptr,
310 __const char *__restrict __f, _G_va_list __arg))
311 __attribute__ ((__format__ (__printf__, 2, 0)));
312 extern int __asprintf __P ((char **__restrict __ptr,
313 __const char *__restrict __fmt, ...))
314 __attribute__ ((__format__ (__printf__, 2, 3)));
315 extern int asprintf __P ((char **__restrict __ptr,
316 __const char *__restrict __fmt, ...))
317 __attribute__ ((__format__ (__printf__, 2, 3)));
319 /* Write formatted output to a file descriptor. */
320 extern int vdprintf __P ((int __fd, __const char *__restrict __fmt,
321 _G_va_list __arg))
322 __attribute__ ((__format__ (__printf__, 2, 0)));
323 extern int dprintf __P ((int __fd, __const char *__restrict __fmt, ...))
324 __attribute__ ((__format__ (__printf__, 2, 3)));
325 #endif
328 /* Read formatted input from STREAM. */
329 extern int fscanf __P ((FILE *__restrict __stream,
330 __const char *__restrict __format, ...));
331 /* Read formatted input from stdin. */
332 extern int scanf __P ((__const char *__restrict __format, ...));
333 /* Read formatted input from S. */
334 extern int sscanf __P ((__const char *__restrict __s,
335 __const char *__restrict __format, ...));
337 #ifdef __USE_GNU
338 /* Read formatted input from S into argument list ARG. */
339 extern int vfscanf __P ((FILE *__restrict __s,
340 __const char *__restrict __format,
341 _G_va_list __arg))
342 __attribute__ ((__format__ (__scanf__, 2, 0)));
344 /* Read formatted input from stdin into argument list ARG. */
345 extern int vscanf __P ((__const char *__restrict __format, _G_va_list __arg))
346 __attribute__ ((__format__ (__scanf__, 1, 0)));
348 /* Read formatted input from S into argument list ARG. */
349 extern int __vsscanf __P ((__const char *__restrict __s,
350 __const char *__restrict __format,
351 _G_va_list __arg))
352 __attribute__ ((__format__ (__scanf__, 2, 0)));
353 extern int vsscanf __P ((__const char *__restrict __s,
354 __const char *__restrict __format,
355 _G_va_list __arg))
356 __attribute__ ((__format__ (__scanf__, 2, 0)));
357 #endif /* Use GNU. */
360 /* Read a character from STREAM. */
361 extern int fgetc __P ((FILE *__stream));
362 extern int getc __P ((FILE *__stream));
364 /* Read a character from stdin. */
365 extern int getchar __P ((void));
367 /* The C standard explicitly says this is a macro, so we always do the
368 optimization for it. */
369 #define getc(_fp) _IO_getc (_fp)
371 #if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__
372 __STDIO_INLINE int
373 getchar (void)
375 return _IO_getc (stdin);
377 #endif /* Optimizing. */
379 #if defined __USE_POSIX || defined __USE_MISC
380 /* These are defined in POSIX.1:1996. */
381 extern int getc_unlocked __P ((FILE *__stream));
382 extern int getchar_unlocked __P ((void));
384 # ifdef __OPTIMIZE__
385 __STDIO_INLINE int
386 getc_unlocked (FILE *__fp)
388 return _IO_getc_unlocked (__fp);
391 __STDIO_INLINE int
392 getchar_unlocked (void)
394 return _IO_getc_unlocked (stdin);
396 # endif /* Optimizing. */
397 #endif /* Use POSIX or MISC. */
400 /* Write a character to STREAM. */
401 extern int fputc __P ((int __c, FILE *__stream));
402 extern int putc __P ((int __c, FILE *__stream));
404 /* Write a character to stdout. */
405 extern int putchar __P ((int __c));
407 /* The C standard explicitly says this can be a macro,
408 so we always do the optimization for it. */
409 #define putc(_ch, _fp) _IO_putc (_ch, _fp)
411 #if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__
412 __STDIO_INLINE int
413 putchar (int __c)
415 return _IO_putc (__c, stdout);
417 #endif
419 #ifdef __USE_MISC
420 /* Faster version when locking is not necessary. */
421 extern int fputc_unlocked __P ((int __c, FILE *__stream));
423 # ifdef __OPTIMIZE__
424 __STDIO_INLINE int
425 fputc_unlocked (int __c, FILE *__stream)
427 return _IO_putc_unlocked (__c, __stream);
429 # endif /* Optimizing. */
430 #endif /* Use MISC. */
432 #if defined __USE_POSIX || defined __USE_MISC
433 /* These are defined in POSIX.1:1996. */
434 extern int putc_unlocked __P ((int __c, FILE *__stream));
435 extern int putchar_unlocked __P ((int __c));
437 # ifdef __OPTIMIZE__
438 __STDIO_INLINE int
439 putc_unlocked (int __c, FILE *__stream)
441 return _IO_putc_unlocked (__c, __stream);
444 __STDIO_INLINE int
445 putchar_unlocked (int __c)
447 return _IO_putc_unlocked (__c, stdout);
449 # endif /* Optimizing. */
450 #endif /* Use POSIX or MISC. */
453 #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
454 /* Get a word (int) from STREAM. */
455 extern int getw __P ((FILE *__stream));
457 /* Write a word (int) to STREAM. */
458 extern int putw __P ((int __w, FILE *__stream));
459 #endif
462 /* Get a newline-terminated string of finite length from STREAM. */
463 extern char *fgets __P ((char *__restrict __s, int __n,
464 FILE *__restrict __stream));
466 #ifdef __USE_GNU
467 /* This function does the same as `fgets' but does not lock the stream. */
468 extern char *fgets_unlocked __P ((char *__restrict __s, int __n,
469 FILE *__restrict __stream));
470 #endif
472 /* Get a newline-terminated string from stdin, removing the newline.
473 DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. */
474 extern char *gets __P ((char *__s));
477 #ifdef __USE_GNU
478 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
479 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
480 NULL), pointing to *N characters of space. It is realloc'd as
481 necessary. Returns the number of characters read (not including the
482 null terminator), or -1 on error or EOF. */
483 extern _IO_ssize_t __getdelim __P ((char **__lineptr, size_t *__n,
484 int __delimiter, FILE *__stream));
485 extern _IO_ssize_t getdelim __P ((char **__lineptr, size_t *__n,
486 int __delimiter, FILE *__stream));
488 /* Like `getdelim', but reads up to a newline. */
489 extern _IO_ssize_t getline __P ((char **__lineptr, size_t *__n,
490 FILE *__stream));
492 # if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__
493 __STDIO_INLINE _IO_ssize_t
494 getline (char **__lineptr, size_t *__n, FILE *__stream)
496 return __getdelim (__lineptr, __n, '\n', __stream);
498 # endif /* Optimizing. */
499 #endif
502 /* Write a string to STREAM. */
503 extern int fputs __P ((__const char *__restrict __s,
504 FILE *__restrict __stream));
506 #ifdef __USE_GNU
507 /* This function does the same as `fputs' but does not lock the stream. */
508 extern int fputs_unlocked __P ((__const char *__restrict __s,
509 FILE *__restrict __stream));
510 #endif
512 /* Write a string, followed by a newline, to stdout. */
513 extern int puts __P ((__const char *__s));
516 /* Push a character back onto the input buffer of STREAM. */
517 extern int ungetc __P ((int __c, FILE *__stream));
520 /* Read chunks of generic data from STREAM. */
521 extern size_t fread __P ((void *__restrict __ptr, size_t __size,
522 size_t __n, FILE *__restrict __stream));
523 /* Write chunks of generic data to STREAM. */
524 extern size_t fwrite __P ((__const void *__restrict __ptr, size_t __size,
525 size_t __n, FILE *__restrict __s));
527 #ifdef __USE_MISC
528 /* Faster versions when locking is not necessary. */
529 extern size_t fread_unlocked __P ((void *__restrict __ptr, size_t __size,
530 size_t __n, FILE *__restrict __stream));
531 extern size_t fwrite_unlocked __P ((__const void *__restrict __ptr,
532 size_t __size, size_t __n,
533 FILE *__restrict __stream));
534 #endif
537 /* Seek to a certain position on STREAM. */
538 extern int fseek __P ((FILE *__stream, long int __off, int __whence));
539 /* Return the current position of STREAM. */
540 extern long int ftell __P ((FILE *__stream));
541 /* Rewind to the beginning of STREAM. */
542 extern void rewind __P ((FILE *__stream));
544 #if (defined __USE_LARGEFILE || defined __USE_LARGEFILE64 \
545 || defined __USE_FILE_OFFSET64)
546 /* The Single Unix Specification, Version 2, specifies an alternative,
547 more adequate interface for the two functions above which deal with
548 file offset. `long int' is not the right type. These definitions
549 are originally defined in the Large File Support API. */
551 /* Types needed in these functions. */
552 # ifndef off_t
553 # ifndef __USE_FILE_OFFSET64
554 typedef __off_t off_t;
555 # else
556 typedef __off64_t off_t;
557 # endif
558 # define off_t off_t
559 # endif
561 # if defined __USE_LARGEFILE64 && !defined off64_t
562 typedef __off64_t off64_t;
563 # define off64_t off64_t
564 # endif
567 # ifndef __USE_FILE_OFFSET64
568 /* Seek to a certain position on STREAM. */
569 extern int fseeko __P ((FILE *__stream, __off_t __off, int __whence));
570 /* Return the current position of STREAM. */
571 extern __off_t ftello __P ((FILE *__stream));
572 /* Get STREAM's position. */
573 extern int fgetpos __P ((FILE *__restrict __stream,
574 fpos_t *__restrict __pos));
575 /* Set STREAM's position. */
576 extern int fsetpos __P ((FILE *__stream, __const fpos_t *__pos));
577 # else
578 # ifdef __REDIRECT
579 extern int __REDIRECT (fseeko,
580 __P ((FILE *__stream, __off64_t __off, int __whence)),
581 fseeko64);
582 extern __off64_t __REDIRECT (ftello, __P ((FILE *__stream)), ftello64);
583 extern int __REDIRECT (fgetpos, __P ((FILE *__restrict __stream,
584 fpos_t *__restrict __pos)), fgetpos64);
585 extern int __REDIRECT (fsetpos, __P ((FILE *__stream, __const fpos_t *__pos)),
586 fsetpos64);
587 # else
588 # define fseeko fseeko64
589 # define ftello ftello64
590 # define fgetpos fgetpos64
591 # define fsetpos fsetpos64
592 # endif
593 # endif
595 # ifdef __USE_LARGEFILE64
596 extern int fseeko64 __P ((FILE *__stream, __off64_t __off, int __whence));
597 extern __off64_t ftello64 __P ((FILE *__stream));
598 extern int fgetpos64 __P ((FILE *__restrict __stream,
599 fpos64_t *__restrict __pos));
600 extern int fsetpos64 __P ((FILE *__stream, __const fpos64_t *__pos));
601 # endif
602 #endif
604 /* Clear the error and EOF indicators for STREAM. */
605 extern void clearerr __P ((FILE *__stream));
606 /* Return the EOF indicator for STREAM. */
607 extern int feof __P ((FILE *__stream));
608 /* Return the error indicator for STREAM. */
609 extern int ferror __P ((FILE *__stream));
611 #ifdef __USE_MISC
612 /* Faster versions when locking is not required. */
613 extern void clearerr_unlocked __P ((FILE *__stream));
614 extern int feof_unlocked __P ((FILE *__stream));
615 extern int ferror_unlocked __P ((FILE *__stream));
617 # ifdef __OPTIMIZE__
618 __STDIO_INLINE int
619 feof_unlocked (FILE *__stream)
621 return _IO_feof_unlocked (__stream);
624 __STDIO_INLINE int
625 ferror_unlocked (FILE *__stream)
627 return _IO_ferror_unlocked (__stream);
629 # endif /* Optimizing. */
630 #endif
633 /* Print a message describing the meaning of the value of errno. */
634 extern void perror __P ((__const char *__s));
636 /* These variables normally should not be used directly. The `strerror'
637 function provides all the needed functionality. */
638 #ifdef __USE_BSD
639 extern int sys_nerr;
640 extern __const char *__const sys_errlist[];
641 #endif
642 #ifdef __USE_GNU
643 extern int _sys_nerr;
644 extern __const char *__const _sys_errlist[];
645 #endif
648 #ifdef __USE_POSIX
649 /* Return the system file descriptor for STREAM. */
650 extern int fileno __P ((FILE *__stream));
651 #endif /* Use POSIX. */
653 #ifdef __USE_MISC
654 /* Faster version when locking is not required. */
655 extern int fileno_unlocked __P ((FILE *__stream));
656 #endif
659 #if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \
660 defined __USE_MISC)
661 /* Create a new stream connected to a pipe running the given command. */
662 extern FILE *popen __P ((__const char *__command, __const char *__modes));
664 /* Close a stream opened by popen and return the status of its child. */
665 extern int pclose __P ((FILE *__stream));
666 #endif
669 #ifdef __USE_POSIX
670 /* Return the name of the controlling terminal. */
671 extern char *ctermid __P ((char *__s));
672 #endif /* Use POSIX. */
675 #ifdef __USE_XOPEN
676 /* Return the name of the current user. */
677 extern char *cuserid __P ((char *__s));
678 #endif /* Use X/Open. */
681 #ifdef __USE_GNU
682 struct obstack; /* See <obstack.h>. */
684 /* Write formatted output to an obstack. */
685 extern int obstack_printf __P ((struct obstack *__obstack,
686 __const char *__format, ...));
687 extern int obstack_vprintf __P ((struct obstack *__obstack,
688 __const char *__format,
689 _G_va_list __args));
690 #endif /* Use GNU. */
693 #if defined __USE_POSIX || defined __USE_MISC
694 /* These are defined in POSIX.1:1996. */
696 /* Acquire ownership of STREAM. */
697 extern void flockfile __P ((FILE *__stream));
699 /* Try to acquire ownership of STREAM but do not block if it is not
700 possible. */
701 extern int ftrylockfile __P ((FILE *__stream));
703 /* Relinquish the ownership granted for STREAM. */
704 extern void funlockfile __P ((FILE *__stream));
705 #endif /* POSIX || misc */
707 #if defined __USE_XOPEN && !defined __USE_GNU
708 /* The X/Open standard requires some functions and variables to be
709 declared here which do not belong into this header. But we have to
710 follow. In GNU mode we don't do this nonsense. */
712 /* For more information on these symbols look in <getopt.h>. */
713 extern char *optarg;
714 extern int optind;
715 extern int opterr;
716 extern int optopt;
718 extern int getopt __P ((int __argc, char *__const *__argv,
719 __const char *__shortopts));
720 #endif
722 __END_DECLS
724 /* Define helper macro. */
725 #undef __STDIO_INLINE
727 #endif /* <stdio.h> included. */
729 #endif /* !_STDIO_H */