Update.
[glibc.git] / libio / stdio.h
blob13287f98800971150e03d01da89aa815bdbac48d
1 /* Define ISO C stdio on top of C++ iostreams.
2 Copyright (C) 1991, 1994, 1995, 1996, 1997 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 # define __need___va_list
36 # include <stdarg.h>
38 # include <bits/types.h>
39 #endif /* Don't need FILE. */
40 #undef __need_FILE
43 #ifndef __FILE_defined
45 /* The opaque type of streams. */
46 typedef struct _IO_FILE FILE;
48 # define __FILE_defined 1
49 #endif /* FILE not defined. */
52 #ifdef _STDIO_H
53 #define _STDIO_USES_IOSTREAM
55 #include <libio.h>
57 #ifdef __cplusplus
58 # define __STDIO_INLINE inline
59 #else
60 # define __STDIO_INLINE extern __inline
61 #endif
63 /* The type of the second argument to `fgetpos' and `fsetpos'. */
64 #ifndef __USE_FILE_OFFSET64
65 typedef _G_fpos_t fpos_t;
66 #else
67 typedef _G_fpos64_t fpos_t;
68 #endif
69 #ifdef __USE_LARGEFILE64
70 typedef _G_fpos64_t fpos64_t;
71 #endif
73 /* Generate a unique file name (and possibly open it with mode "w+b"). */
74 extern char *__stdio_gen_tempname __P ((char *__buf, size_t __bufsize,
75 __const char *__dir,
76 __const char *__pfx,
77 int __dir_search,
78 size_t *__lenptr,
79 FILE **__streamptr,
80 int __large_file));
83 /* Print out MESSAGE on the error output and abort. */
84 extern void __libc_fatal __P ((__const char *__message))
85 __attribute__ ((__noreturn__));
88 /* The possibilities for the third argument to `setvbuf'. */
89 #define _IOFBF 0 /* Fully buffered. */
90 #define _IOLBF 1 /* Line buffered. */
91 #define _IONBF 2 /* No buffering. */
94 /* Default buffer size. */
95 #ifndef BUFSIZ
96 # define BUFSIZ _IO_BUFSIZ
97 #endif
100 /* End of file character.
101 Some things throughout the library rely on this being -1. */
102 #ifndef EOF
103 # define EOF (-1)
104 #endif
107 /* The possibilities for the third argument to `fseek'.
108 These values should not be changed. */
109 #define SEEK_SET 0 /* Seek from beginning of file. */
110 #define SEEK_CUR 1 /* Seek from current position. */
111 #define SEEK_END 2 /* Seek from end of file. */
114 #ifdef __USE_SVID
115 /* Default path prefix for `tempnam' and `tmpnam'. */
116 # define P_tmpdir "/tmp"
117 #endif
120 /* Get the values:
121 L_tmpnam How long an array of chars must be to be passed to `tmpnam'.
122 TMP_MAX The minimum number of unique filenames generated by tmpnam
123 (and tempnam when it uses tmpnam's name space),
124 or tempnam (the two are separate).
125 L_ctermid How long an array to pass to `ctermid'.
126 L_cuserid How long an array to pass to `cuserid'.
127 FOPEN_MAX Minimum number of files that can be open at once.
128 FILENAME_MAX Maximum length of a filename. */
129 #include <bits/stdio_lim.h>
132 /* Standard streams. */
133 extern FILE *stdin; /* Standard input stream. */
134 extern FILE *stdout; /* Standard output stream. */
135 extern FILE *stderr; /* Standard error output stream. */
138 /* Remove file FILENAME. */
139 extern int remove __P ((__const char *__filename));
140 /* Rename file OLD to NEW. */
141 extern int rename __P ((__const char *__old, __const char *__new));
144 /* Create a temporary file and open it read/write. */
145 #ifndef __USE_FILE_OFFSET64
146 extern FILE *tmpfile __P ((void));
147 #else
148 extern FILE *tmpfile __P ((void)) __asm__ ("tmpfile64");
149 #endif
150 #ifdef __USE_LARGEFILE64
151 extern FILE *tmpfile64 __P ((void));
152 #endif
153 /* Generate a temporary filename. */
154 extern char *tmpnam __P ((char *__s));
156 #ifdef __USE_MISC
157 /* This is the reentrant variant of `tmpnam'. The only difference is
158 that it does not allow S to be NULL. */
159 extern char *tmpnam_r __P ((char *__s));
160 #endif
163 #if defined __USE_SVID || defined __USE_XOPEN
164 /* Generate a unique temporary filename using up to five characters of PFX
165 if it is not NULL. The directory to put this file in is searched for
166 as follows: First the environment variable "TMPDIR" is checked.
167 If it contains the name of a writable directory, that directory is used.
168 If not and if DIR is not NULL, that value is checked. If that fails,
169 P_tmpdir is tried and finally "/tmp". The storage for the filename
170 is allocated by `malloc'. */
171 extern char *tempnam __P ((__const char *__dir, __const char *__pfx));
172 #endif
175 /* Close STREAM. */
176 extern int fclose __P ((FILE *__stream));
177 /* Flush STREAM, or all streams if STREAM is NULL. */
178 extern int fflush __P ((FILE *__stream));
180 #ifdef __USE_MISC
181 /* Faster versions when locking is not required. */
182 extern int fclose_unlocked __P ((FILE *__stream));
183 extern int fflush_unlocked __P ((FILE *__stream));
184 #endif
186 #ifdef __USE_GNU
187 /* Close all streams. */
188 extern int __fcloseall __P ((void));
189 extern int fcloseall __P ((void));
190 #endif
193 /* Open a file and create a new stream for it. */
194 #ifndef __USE_FILE_OFFSET64
195 extern FILE *fopen __P ((__const char *__restrict __filename,
196 __const char *__restrict __modes));
197 #else
198 extern FILE *fopen __P ((__const char *__restrict __filename,
199 __const char *__restrict __modes))
200 __asm__ ("fopen64");
201 #endif
202 #ifdef __USE_LARGEFILE64
203 extern FILE *fopen64 __P ((__const char *__restrict __filename,
204 __const char *__restrict __modes));
205 #endif
206 /* Open a file, replacing an existing stream with it. */
207 #ifndef __USE_FILE_OFFSET64
208 extern FILE *freopen __P ((__const char *__restrict __filename,
209 __const char *__restrict __modes,
210 FILE *__restrict __stream));
211 #else
212 extern FILE *freopen __P ((__const char *__restrict __filename,
213 __const char *__restrict __modes,
214 FILE *__restrict __stream)) __asm__ ("freopen64");
215 #endif
216 #ifdef __USE_LARGEFILE64
217 extern FILE *freopen64 __P ((__const char *__restrict __filename,
218 __const char *__restrict __modes,
219 FILE *__restrict __stream));
220 #endif
222 #ifdef __USE_POSIX
223 /* Create a new stream that refers to an existing system file descriptor. */
224 extern FILE *fdopen __P ((int __fd, __const char *__modes));
225 #endif
227 #ifdef __USE_GNU
228 /* Create a new stream that refers to the given magic cookie,
229 and uses the given functions for input and output. */
230 extern FILE *fopencookie __P ((void *__magic_cookie, __const char *__modes,
231 _IO_cookie_io_functions_t __io_funcs));
233 /* Open a stream that writes into a malloc'd buffer that is expanded as
234 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
235 and the number of characters written on fflush or fclose. */
236 extern FILE *open_memstream __P ((char **__bufloc, size_t *__sizeloc));
237 #endif
240 /* If BUF is NULL, make STREAM unbuffered.
241 Else make it use buffer BUF, of size BUFSIZ. */
242 extern void setbuf __P ((FILE *__restrict __stream, char *__restrict __buf));
243 /* Make STREAM use buffering mode MODE.
244 If BUF is not NULL, use N bytes of it for buffering;
245 else allocate an internal buffer N bytes long. */
246 extern int setvbuf __P ((FILE *__restrict __stream, char *__restrict __buf,
247 int __modes, size_t __n));
249 #ifdef __USE_BSD
250 /* If BUF is NULL, make STREAM unbuffered.
251 Else make it use SIZE bytes of BUF for buffering. */
252 extern void setbuffer __P ((FILE *__stream, char *__buf, size_t __size));
254 /* Make STREAM line-buffered. */
255 extern void setlinebuf __P ((FILE *__stream));
256 #endif
259 /* Write formatted output to STREAM. */
260 extern int fprintf __P ((FILE *__restrict __stream,
261 __const char *__restrict __format, ...));
262 /* Write formatted output to stdout. */
263 extern int printf __P ((__const char *__restrict __format, ...));
264 /* Write formatted output to S. */
265 extern int sprintf __P ((char *__restrict __s,
266 __const char *__restrict __format, ...));
268 /* Write formatted output to S from argument list ARG. */
269 extern int vfprintf __P ((FILE *__restrict __s,
270 __const char *__restrict __format,
271 _G_va_list __arg));
272 /* Write formatted output to stdout from argument list ARG. */
273 extern int vprintf __P ((__const char *__restrict __format,
274 _G_va_list __arg));
275 /* Write formatted output to S from argument list ARG. */
276 extern int vsprintf __P ((char *__restrict __s,
277 __const char *__restrict __format,
278 _G_va_list __arg));
280 #ifdef __OPTIMIZE__
281 __STDIO_INLINE int
282 vprintf (__const char *__restrict __fmt, _G_va_list __arg)
284 return vfprintf (stdout, __fmt, __arg);
286 #endif /* Optimizing. */
288 #if defined __USE_BSD || defined __USE_ISOC9X || defined __USE_UNIX98
289 /* Maximum chars of output to write in MAXLEN. */
290 extern int __snprintf __P ((char *__restrict __s, size_t __maxlen,
291 __const char *__restrict __format, ...))
292 __attribute__ ((__format__ (__printf__, 3, 4)));
293 extern int snprintf __P ((char *__restrict __s, size_t __maxlen,
294 __const char *__restrict __format, ...))
295 __attribute__ ((__format__ (__printf__, 3, 4)));
297 extern int __vsnprintf __P ((char *__restrict __s, size_t __maxlen,
298 __const char *__restrict __format,
299 _G_va_list __arg))
300 __attribute__ ((__format__ (__printf__, 3, 0)));
301 extern int vsnprintf __P ((char *__restrict __s, size_t __maxlen,
302 __const char *__restrict __format,
303 _G_va_list __arg))
304 __attribute__ ((__format__ (__printf__, 3, 0)));
305 #endif
307 #ifdef __USE_GNU
308 /* Write formatted output to a string dynamically allocated with `malloc'.
309 Store the address of the string in *PTR. */
310 extern int vasprintf __P ((char **__restrict __ptr,
311 __const char *__restrict __f, _G_va_list __arg))
312 __attribute__ ((__format__ (__printf__, 2, 0)));
313 extern int asprintf __P ((char **__restrict __ptr,
314 __const char *__restrict __fmt, ...))
315 __attribute__ ((__format__ (__printf__, 2, 3)));
317 /* Write formatted output to a file descriptor. */
318 extern int vdprintf __P ((int __fd, __const char *__restrict __fmt,
319 _G_va_list __arg))
320 __attribute__ ((__format__ (__printf__, 2, 0)));
321 extern int dprintf __P ((int __fd, __const char *__restrict __fmt, ...))
322 __attribute__ ((__format__ (__printf__, 2, 3)));
323 #endif
326 /* Read formatted input from STREAM. */
327 extern int fscanf __P ((FILE *__restrict __stream,
328 __const char *__restrict __format, ...));
329 /* Read formatted input from stdin. */
330 extern int scanf __P ((__const char *__restrict __format, ...));
331 /* Read formatted input from S. */
332 extern int sscanf __P ((__const char *__restrict __s,
333 __const char *__restrict __format, ...));
335 #ifdef __USE_GNU
336 /* Read formatted input from S into argument list ARG. */
337 extern int __vfscanf __P ((FILE *__restrict __s,
338 __const char *__restrict __format,
339 _G_va_list __arg))
340 __attribute__ ((__format__ (__scanf__, 2, 0)));
341 extern int vfscanf __P ((FILE *__restrict __s,
342 __const char *__restrict __format,
343 _G_va_list __arg))
344 __attribute__ ((__format__ (__scanf__, 2, 0)));
346 /* Read formatted input from stdin into argument list ARG. */
347 extern int __vscanf __P ((__const char *__restrict __format,
348 _G_va_list __arg))
349 __attribute__ ((__format__ (__scanf__, 1, 0)));
350 extern int vscanf __P ((__const char *__restrict __format, _G_va_list __arg))
351 __attribute__ ((__format__ (__scanf__, 1, 0)));
353 /* Read formatted input from S into argument list ARG. */
354 extern int __vsscanf __P ((__const char *__restrict __s,
355 __const char *__restrict __format,
356 _G_va_list __arg))
357 __attribute__ ((__format__ (__scanf__, 2, 0)));
358 extern int vsscanf __P ((__const char *__restrict __s,
359 __const char *__restrict __format,
360 _G_va_list __arg))
361 __attribute__ ((__format__ (__scanf__, 2, 0)));
362 #endif /* Use GNU. */
365 /* Read a character from STREAM. */
366 extern int fgetc __P ((FILE *__stream));
367 extern int getc __P ((FILE *__stream));
369 /* Read a character from stdin. */
370 extern int getchar __P ((void));
372 /* The C standard explicitly says this is a macro, so we always do the
373 optimization for it. */
374 #define getc(_fp) _IO_getc (_fp)
376 #ifdef __OPTIMIZE__
377 __STDIO_INLINE int
378 getchar (void)
380 return _IO_getc (stdin);
382 #endif /* Optimizing. */
384 #if defined __USE_POSIX || defined __USE_MISC
385 /* These are defined in POSIX.1:1996. */
386 extern int getc_unlocked __P ((FILE *__stream));
387 extern int getchar_unlocked __P ((void));
389 # ifdef __OPTIMIZE__
390 __STDIO_INLINE int
391 getc_unlocked (FILE *__fp)
393 return _IO_getc_unlocked (__fp);
396 __STDIO_INLINE int
397 getchar_unlocked (void)
399 return _IO_getc_unlocked (stdin);
401 # endif /* Optimizing. */
402 #endif /* Use POSIX or MISC. */
405 /* Write a character to STREAM. */
406 extern int fputc __P ((int __c, FILE *__stream));
407 extern int putc __P ((int __c, FILE *__stream));
409 /* Write a character to stdout. */
410 extern int putchar __P ((int __c));
412 /* The C standard explicitly says this can be a macro,
413 so we always do the optimization for it. */
414 #define putc(_ch, _fp) _IO_putc (_ch, _fp)
416 #ifdef __OPTIMIZE__
417 __STDIO_INLINE int
418 putchar (int __c)
420 return _IO_putc (__c, stdout);
422 #endif
424 #ifdef __USE_MISC
425 /* Faster version when locking is not necessary. */
426 extern int fputc_unlocked __P ((int __c, FILE *__stream));
428 # ifdef __OPTIMIZE__
429 __STDIO_INLINE int
430 fputc_unlocked (int __c, FILE *__stream)
432 return _IO_putc_unlocked (__c, __stream);
434 # endif /* Optimizing. */
435 #endif /* Use MISC. */
437 #if defined __USE_POSIX || defined __USE_MISC
438 /* These are defined in POSIX.1:1996. */
439 extern int putc_unlocked __P ((int __c, FILE *__stream));
440 extern int putchar_unlocked __P ((int __c));
442 # ifdef __OPTIMIZE__
443 __STDIO_INLINE int
444 putc_unlocked (int __c, FILE *__stream)
446 return _IO_putc_unlocked (__c, __stream);
449 __STDIO_INLINE int
450 putchar_unlocked (int __c)
452 return _IO_putc_unlocked (__c, stdout);
454 # endif /* Optimizing. */
455 #endif /* Use POSIX or MISc. */
458 #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
459 /* Get a word (int) from STREAM. */
460 extern int getw __P ((FILE *__stream));
462 /* Write a word (int) to STREAM. */
463 extern int putw __P ((int __w, FILE *__stream));
464 #endif
467 /* Get a newline-terminated string of finite length from STREAM. */
468 extern char *fgets __P ((char *__restrict __s, int __n,
469 FILE *__restrict __stream));
471 /* Get a newline-terminated string from stdin, removing the newline.
472 DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. */
473 extern char *gets __P ((char *__s));
476 #ifdef __USE_GNU
477 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
478 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
479 NULL), pointing to *N characters of space. It is realloc'd as
480 necessary. Returns the number of characters read (not including the
481 null terminator), or -1 on error or EOF. */
482 _IO_ssize_t __getdelim __P ((char **__lineptr, size_t *__n,
483 int __delimiter, FILE *__stream));
484 _IO_ssize_t getdelim __P ((char **__lineptr, size_t *__n,
485 int __delimiter, FILE *__stream));
487 /* Like `getdelim', but reads up to a newline. */
488 _IO_ssize_t __getline __P ((char **__lineptr, size_t *__n, FILE *__stream));
489 _IO_ssize_t getline __P ((char **__lineptr, size_t *__n, FILE *__stream));
491 # ifdef __OPTIMIZE__
492 __STDIO_INLINE _IO_ssize_t
493 getline (char **__lineptr, size_t *__n, FILE *__stream)
495 return __getdelim (__lineptr, __n, '\n', __stream);
497 # endif /* Optimizing. */
498 #endif
501 /* Write a string to STREAM. */
502 extern int fputs __P ((__const char *__restrict __s,
503 FILE *__restrict __stream));
504 /* Write a string, followed by a newline, to stdout. */
505 extern int puts __P ((__const char *__s));
508 /* Push a character back onto the input buffer of STREAM. */
509 extern int ungetc __P ((int __c, FILE *__stream));
512 /* Read chunks of generic data from STREAM. */
513 extern size_t fread __P ((void *__restrict __ptr, size_t __size,
514 size_t __n, FILE *__restrict __stream));
515 /* Write chunks of generic data to STREAM. */
516 extern size_t fwrite __P ((__const void *__restrict __ptr, size_t __size,
517 size_t __n, FILE *__restrict __s));
519 #ifdef __USE_MISC
520 /* Faster versions when locking is not necessary. */
521 extern size_t fread_unlocked __P ((void *__restrict __ptr, size_t __size,
522 size_t __n, FILE *__restrict __stream));
523 extern size_t fwrite_unlocked __P ((__const void *__restrict __ptr,
524 size_t __size, size_t __n,
525 FILE *__restrict __stream));
526 #endif
529 /* Seek to a certain position on STREAM. */
530 extern int fseek __P ((FILE *__stream, long int __off, int __whence));
531 /* Return the current position of STREAM. */
532 extern long int ftell __P ((FILE *__stream));
533 /* Rewind to the beginning of STREAM. */
534 extern void rewind __P ((FILE *__stream));
536 #if (defined __USE_LARGEFILE || defined __USE_LARGEFILE64 \
537 || defined __USE_FILE_OFFSET64)
538 /* The Single Unix Specification, Version 2, specifies an alternative,
539 more adequate interface for the two functions above which deal with
540 file offset. `long int' is not the right type. These definitions
541 are originally defined in the Large File Support API. */
543 /* Types needed in these functions. */
544 # ifndef off_t
545 # ifndef __USE_FILE_OFFSET64
546 typedef __off_t off_t;
547 # else
548 typedef __off64_t off_t;
549 # endif
550 # define off_t off_t
551 # endif
553 # if defined __USE_LARGEFILE64 && !defined off64_t
554 typedef __off64_t off64_t;
555 # define off64_t off64_t
556 # endif
558 /* Seek to a certain position on STREAM. */
559 # ifndef __USE_FILE_OFFSET64
560 extern int fseeko __P ((FILE *__stream, __off_t __off, int __whence));
561 # else
562 extern int fseeko __P ((FILE *__stream, __off_t __off, int __whence))
563 __asm__ ("fseeko64");
564 # endif
565 # ifdef __USE_LARGEFILE64
566 extern int fseeko64 __P ((FILE *__stream, __off64_t __off, int __whence));
567 # endif
569 /* Return the current position of STREAM. */
570 # ifndef __USE_FILE_OFFSET64
571 extern __off_t ftello __P ((FILE *__stream));
572 # else
573 extern __off_t ftello __P ((FILE *__stream)) __asm__ ("ftello");
574 # endif
575 # ifdef __USE_LARGEFILE64
576 extern __off64_t ftello64 __P ((FILE *__stream));
577 # endif
578 #endif
580 /* Get STREAM's position. */
581 #ifndef __USE_FILE_OFFSET64
582 extern int fgetpos __P ((FILE *__restrict __stream,
583 fpos_t *__restrict __pos));
584 #else
585 extern int fgetpos __P ((FILE *__restrict __stream,
586 fpos_t *__restrict __pos)) __asm__ ("fgetpos64");
587 #endif
588 #ifdef __USE_LARGEFILE64
589 extern int fgetpos64 __P ((FILE *__restrict __stream,
590 fpos64_t *__restrict __pos));
591 #endif
592 /* Set STREAM's position. */
593 #ifndef __USE_FILE_OFFSET64
594 extern int fsetpos __P ((FILE *__stream, __const fpos_t *__pos));
595 #else
596 extern int fsetpos __P ((FILE *__stream, __const fpos_t *__pos))
597 __asm__ ("fsetpos64");
598 #endif
599 #ifdef __USE_LARGEFILE64
600 extern int fsetpos64 __P ((FILE *__stream, __const fpos64_t *__pos));
601 #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 */