*** empty log message ***
[glibc.git] / libio / stdio.h
blob3acaa8bd97d8cc9aab99e3843c1e77393091c8e8
1 /* Define ISO C stdio on top of C++ iostreams.
2 Copyright (C) 1991,1994-1999,2000,01,02 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
18 02111-1307 USA. */
21 * ISO C99 Standard: 7.19 Input/output <stdio.h>
24 #ifndef _STDIO_H
26 #if !defined __need_FILE && !defined __need___FILE
27 # define _STDIO_H 1
28 # include <features.h>
30 __BEGIN_DECLS
32 # define __need_size_t
33 # define __need_NULL
34 # include <stddef.h>
36 # include <bits/types.h>
37 # define __need_FILE
38 # define __need___FILE
39 #endif /* Don't need FILE. */
42 #if !defined __FILE_defined && defined __need_FILE
44 __BEGIN_NAMESPACE_STD
45 /* The opaque type of streams. This is the definition used elsewhere. */
46 typedef struct _IO_FILE FILE;
47 __END_NAMESPACE_STD
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)
52 #endif
54 # define __FILE_defined 1
55 #endif /* FILE not defined. */
56 #undef __need_FILE
59 #if !defined ____FILE_defined && defined __need___FILE
61 /* The opaque type of streams. This is the definition used elsewhere. */
62 typedef struct _IO_FILE __FILE;
64 # define ____FILE_defined 1
65 #endif /* __FILE not defined. */
66 #undef __need___FILE
69 #ifdef _STDIO_H
70 #define _STDIO_USES_IOSTREAM
72 #include <libio.h>
74 #ifdef __USE_XOPEN
75 # ifdef __GNUC__
76 # ifndef _VA_LIST_DEFINED
77 typedef _G_va_list va_list;
78 # define _VA_LIST_DEFINED
79 # endif
80 # else
81 # include <stdarg.h>
82 # endif
83 #endif
85 /* The type of the second argument to `fgetpos' and `fsetpos'. */
86 __BEGIN_NAMESPACE_STD
87 #ifndef __USE_FILE_OFFSET64
88 typedef _G_fpos_t fpos_t;
89 #else
90 typedef _G_fpos64_t fpos_t;
91 #endif
92 __END_NAMESPACE_STD
93 #ifdef __USE_LARGEFILE64
94 typedef _G_fpos64_t fpos64_t;
95 #endif
97 /* The possibilities for the third argument to `setvbuf'. */
98 #define _IOFBF 0 /* Fully buffered. */
99 #define _IOLBF 1 /* Line buffered. */
100 #define _IONBF 2 /* No buffering. */
103 /* Default buffer size. */
104 #ifndef BUFSIZ
105 # define BUFSIZ _IO_BUFSIZ
106 #endif
109 /* End of file character.
110 Some things throughout the library rely on this being -1. */
111 #ifndef EOF
112 # define EOF (-1)
113 #endif
116 /* The possibilities for the third argument to `fseek'.
117 These values should not be changed. */
118 #define SEEK_SET 0 /* Seek from beginning of file. */
119 #define SEEK_CUR 1 /* Seek from current position. */
120 #define SEEK_END 2 /* Seek from end of file. */
123 #if defined __USE_SVID || defined __USE_XOPEN
124 /* Default path prefix for `tempnam' and `tmpnam'. */
125 # define P_tmpdir "/tmp"
126 #endif
129 /* Get the values:
130 L_tmpnam How long an array of chars must be to be passed to `tmpnam'.
131 TMP_MAX The minimum number of unique filenames generated by tmpnam
132 (and tempnam when it uses tmpnam's name space),
133 or tempnam (the two are separate).
134 L_ctermid How long an array to pass to `ctermid'.
135 L_cuserid How long an array to pass to `cuserid'.
136 FOPEN_MAX Minimum number of files that can be open at once.
137 FILENAME_MAX Maximum length of a filename. */
138 #include <bits/stdio_lim.h>
141 /* Standard streams. */
142 extern struct _IO_FILE *stdin; /* Standard input stream. */
143 extern struct _IO_FILE *stdout; /* Standard output stream. */
144 extern struct _IO_FILE *stderr; /* Standard error output stream. */
145 /* C89/C99 say they're macros. Make them happy. */
146 #define stdin stdin
147 #define stdout stdout
148 #define stderr stderr
150 __BEGIN_NAMESPACE_STD
151 /* Remove file FILENAME. */
152 extern int remove (__const char *__filename) __THROW;
153 /* Rename file OLD to NEW. */
154 extern int rename (__const char *__old, __const char *__new) __THROW;
155 __END_NAMESPACE_STD
158 __BEGIN_NAMESPACE_STD
159 /* Create a temporary file and open it read/write. */
160 #ifndef __USE_FILE_OFFSET64
161 extern FILE *tmpfile (void) __THROW;
162 #else
163 # ifdef __REDIRECT
164 extern FILE *__REDIRECT (tmpfile, (void) __THROW, tmpfile64);
165 # else
166 # define tmpfile tmpfile64
167 # endif
168 #endif
170 /* Generate a temporary filename. */
171 extern char *tmpnam (char *__s) __THROW;
172 __END_NAMESPACE_STD
174 #ifdef __USE_LARGEFILE64
175 extern FILE *tmpfile64 (void) __THROW;
176 #endif
178 #ifdef __USE_MISC
179 /* This is the reentrant variant of `tmpnam'. The only difference is
180 that it does not allow S to be NULL. */
181 extern char *tmpnam_r (char *__s) __THROW;
182 #endif
185 #if defined __USE_SVID || defined __USE_XOPEN
186 /* Generate a unique temporary filename using up to five characters of PFX
187 if it is not NULL. The directory to put this file in is searched for
188 as follows: First the environment variable "TMPDIR" is checked.
189 If it contains the name of a writable directory, that directory is used.
190 If not and if DIR is not NULL, that value is checked. If that fails,
191 P_tmpdir is tried and finally "/tmp". The storage for the filename
192 is allocated by `malloc'. */
193 extern char *tempnam (__const char *__dir, __const char *__pfx)
194 __THROW __attribute_malloc__;
195 #endif
198 __BEGIN_NAMESPACE_STD
199 /* Close STREAM. */
200 extern int fclose (FILE *__stream) __THROW;
201 /* Flush STREAM, or all streams if STREAM is NULL. */
202 extern int fflush (FILE *__stream) __THROW;
203 __END_NAMESPACE_STD
205 #ifdef __USE_MISC
206 /* Faster versions when locking is not required. */
207 extern int fflush_unlocked (FILE *__stream) __THROW;
208 #endif
210 #ifdef __USE_GNU
211 /* Close all streams. */
212 extern int fcloseall (void) __THROW;
213 #endif
216 __BEGIN_NAMESPACE_STD
217 #ifndef __USE_FILE_OFFSET64
218 /* Open a file and create a new stream for it. */
219 extern FILE *fopen (__const char *__restrict __filename,
220 __const char *__restrict __modes) __THROW;
221 /* Open a file, replacing an existing stream with it. */
222 extern FILE *freopen (__const char *__restrict __filename,
223 __const char *__restrict __modes,
224 FILE *__restrict __stream) __THROW;
225 #else
226 # ifdef __REDIRECT
227 extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename,
228 __const char *__restrict __modes) __THROW,
229 fopen64);
230 extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
231 __const char *__restrict __modes,
232 FILE *__restrict __stream) __THROW,
233 freopen64);
234 # else
235 # define fopen fopen64
236 # define freopen freopen64
237 # endif
238 #endif
239 __END_NAMESPACE_STD
240 #ifdef __USE_LARGEFILE64
241 extern FILE *fopen64 (__const char *__restrict __filename,
242 __const char *__restrict __modes) __THROW;
243 extern FILE *freopen64 (__const char *__restrict __filename,
244 __const char *__restrict __modes,
245 FILE *__restrict __stream) __THROW;
246 #endif
248 #ifdef __USE_POSIX
249 /* Create a new stream that refers to an existing system file descriptor. */
250 extern FILE *fdopen (int __fd, __const char *__modes) __THROW;
251 #endif
253 #ifdef __USE_GNU
254 /* Create a new stream that refers to the given magic cookie,
255 and uses the given functions for input and output. */
256 extern FILE *fopencookie (void *__restrict __magic_cookie,
257 __const char *__restrict __modes,
258 _IO_cookie_io_functions_t __io_funcs) __THROW;
260 /* Create a new stream that refers to a memory buffer. */
261 extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW;
263 /* Open a stream that writes into a malloc'd buffer that is expanded as
264 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
265 and the number of characters written on fflush or fclose. */
266 extern FILE *open_memstream (char **__restrict __bufloc,
267 size_t *__restrict __sizeloc) __THROW;
268 #endif
271 __BEGIN_NAMESPACE_STD
272 /* If BUF is NULL, make STREAM unbuffered.
273 Else make it use buffer BUF, of size BUFSIZ. */
274 extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
275 /* Make STREAM use buffering mode MODE.
276 If BUF is not NULL, use N bytes of it for buffering;
277 else allocate an internal buffer N bytes long. */
278 extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
279 int __modes, size_t __n) __THROW;
280 __END_NAMESPACE_STD
282 #ifdef __USE_BSD
283 /* If BUF is NULL, make STREAM unbuffered.
284 Else make it use SIZE bytes of BUF for buffering. */
285 extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
286 size_t __size) __THROW;
288 /* Make STREAM line-buffered. */
289 extern void setlinebuf (FILE *__stream) __THROW;
290 #endif
293 __BEGIN_NAMESPACE_STD
294 /* Write formatted output to STREAM. */
295 extern int fprintf (FILE *__restrict __stream,
296 __const char *__restrict __format, ...) __THROW;
297 /* Write formatted output to stdout. */
298 extern int printf (__const char *__restrict __format, ...) __THROW;
299 /* Write formatted output to S. */
300 extern int sprintf (char *__restrict __s,
301 __const char *__restrict __format, ...) __THROW;
303 /* Write formatted output to S from argument list ARG. */
304 extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
305 _G_va_list __arg) __THROW;
306 /* Write formatted output to stdout from argument list ARG. */
307 extern int vprintf (__const char *__restrict __format, _G_va_list __arg)
308 __THROW;
309 /* Write formatted output to S from argument list ARG. */
310 extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
311 _G_va_list __arg) __THROW;
312 __END_NAMESPACE_STD
314 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
315 __BEGIN_NAMESPACE_C99
316 /* Maximum chars of output to write in MAXLEN. */
317 extern int snprintf (char *__restrict __s, size_t __maxlen,
318 __const char *__restrict __format, ...)
319 __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
321 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
322 __const char *__restrict __format, _G_va_list __arg)
323 __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
324 __END_NAMESPACE_C99
325 #endif
327 #ifdef __USE_GNU
328 /* Write formatted output to a string dynamically allocated with `malloc'.
329 Store the address of the string in *PTR. */
330 extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
331 _G_va_list __arg)
332 __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
333 extern int __asprintf (char **__restrict __ptr,
334 __const char *__restrict __fmt, ...)
335 __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
336 extern int asprintf (char **__restrict __ptr,
337 __const char *__restrict __fmt, ...)
338 __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
340 /* Write formatted output to a file descriptor. */
341 extern int vdprintf (int __fd, __const char *__restrict __fmt,
342 _G_va_list __arg)
343 __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
344 extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
345 __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
346 #endif
349 __BEGIN_NAMESPACE_STD
350 /* Read formatted input from STREAM. */
351 extern int fscanf (FILE *__restrict __stream,
352 __const char *__restrict __format, ...) __THROW;
353 /* Read formatted input from stdin. */
354 extern int scanf (__const char *__restrict __format, ...) __THROW;
355 /* Read formatted input from S. */
356 extern int sscanf (__const char *__restrict __s,
357 __const char *__restrict __format, ...) __THROW;
358 __END_NAMESPACE_STD
360 #ifdef __USE_ISOC99
361 __BEGIN_NAMESPACE_C99
362 /* Read formatted input from S into argument list ARG. */
363 extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
364 _G_va_list __arg)
365 __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
367 /* Read formatted input from stdin into argument list ARG. */
368 extern int vscanf (__const char *__restrict __format, _G_va_list __arg)
369 __THROW __attribute__ ((__format__ (__scanf__, 1, 0)));
371 /* Read formatted input from S into argument list ARG. */
372 extern int vsscanf (__const char *__restrict __s,
373 __const char *__restrict __format, _G_va_list __arg)
374 __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
375 __END_NAMESPACE_C99
376 #endif /* Use ISO C9x. */
379 __BEGIN_NAMESPACE_STD
380 /* Read a character from STREAM. */
381 extern int fgetc (FILE *__stream) __THROW;
382 extern int getc (FILE *__stream) __THROW;
384 /* Read a character from stdin. */
385 extern int getchar (void) __THROW;
386 __END_NAMESPACE_STD
388 /* The C standard explicitly says this is a macro, so we always do the
389 optimization for it. */
390 #define getc(_fp) _IO_getc (_fp)
392 #if defined __USE_POSIX || defined __USE_MISC
393 /* These are defined in POSIX.1:1996. */
394 extern int getc_unlocked (FILE *__stream) __THROW;
395 extern int getchar_unlocked (void) __THROW;
396 #endif /* Use POSIX or MISC. */
398 #ifdef __USE_MISC
399 /* Faster version when locking is not necessary. */
400 extern int fgetc_unlocked (FILE *__stream) __THROW;
401 #endif /* Use MISC. */
404 __BEGIN_NAMESPACE_STD
405 /* Write a character to STREAM. */
406 extern int fputc (int __c, FILE *__stream) __THROW;
407 extern int putc (int __c, FILE *__stream) __THROW;
409 /* Write a character to stdout. */
410 extern int putchar (int __c) __THROW;
411 __END_NAMESPACE_STD
413 /* The C standard explicitly says this can be a macro,
414 so we always do the optimization for it. */
415 #define putc(_ch, _fp) _IO_putc (_ch, _fp)
417 #ifdef __USE_MISC
418 /* Faster version when locking is not necessary. */
419 extern int fputc_unlocked (int __c, FILE *__stream) __THROW;
420 #endif /* Use MISC. */
422 #if defined __USE_POSIX || defined __USE_MISC
423 /* These are defined in POSIX.1:1996. */
424 extern int putc_unlocked (int __c, FILE *__stream) __THROW;
425 extern int putchar_unlocked (int __c) __THROW;
426 #endif /* Use POSIX or MISC. */
429 #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
430 /* Get a word (int) from STREAM. */
431 extern int getw (FILE *__stream) __THROW;
433 /* Write a word (int) to STREAM. */
434 extern int putw (int __w, FILE *__stream) __THROW;
435 #endif
438 __BEGIN_NAMESPACE_STD
439 /* Get a newline-terminated string of finite length from STREAM. */
440 extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
441 __THROW;
443 /* Get a newline-terminated string from stdin, removing the newline.
444 DO NOT USE THIS FUNCTION!! There is no limit on how much it will read. */
445 extern char *gets (char *__s) __THROW;
446 __END_NAMESPACE_STD
448 #ifdef __USE_GNU
449 /* This function does the same as `fgets' but does not lock the stream. */
450 extern char *fgets_unlocked (char *__restrict __s, int __n,
451 FILE *__restrict __stream) __THROW;
452 #endif
455 #ifdef __USE_GNU
456 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
457 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
458 NULL), pointing to *N characters of space. It is realloc'd as
459 necessary. Returns the number of characters read (not including the
460 null terminator), or -1 on error or EOF. */
461 extern _IO_ssize_t __getdelim (char **__restrict __lineptr,
462 size_t *__restrict __n, int __delimiter,
463 FILE *__restrict __stream) __THROW;
464 extern _IO_ssize_t getdelim (char **__restrict __lineptr,
465 size_t *__restrict __n, int __delimiter,
466 FILE *__restrict __stream) __THROW;
468 /* Like `getdelim', but reads up to a newline. */
469 extern _IO_ssize_t getline (char **__restrict __lineptr,
470 size_t *__restrict __n,
471 FILE *__restrict __stream) __THROW;
472 #endif
475 __BEGIN_NAMESPACE_STD
476 /* Write a string to STREAM. */
477 extern int fputs (__const char *__restrict __s, FILE *__restrict __stream)
478 __THROW;
480 /* Write a string, followed by a newline, to stdout. */
481 extern int puts (__const char *__s) __THROW;
484 /* Push a character back onto the input buffer of STREAM. */
485 extern int ungetc (int __c, FILE *__stream) __THROW;
488 /* Read chunks of generic data from STREAM. */
489 extern size_t fread (void *__restrict __ptr, size_t __size,
490 size_t __n, FILE *__restrict __stream) __THROW;
491 /* Write chunks of generic data to STREAM. */
492 extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
493 size_t __n, FILE *__restrict __s) __THROW;
494 __END_NAMESPACE_STD
496 #ifdef __USE_GNU
497 /* This function does the same as `fputs' but does not lock the stream. */
498 extern int fputs_unlocked (__const char *__restrict __s,
499 FILE *__restrict __stream) __THROW;
500 #endif
502 #ifdef __USE_MISC
503 /* Faster versions when locking is not necessary. */
504 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
505 size_t __n, FILE *__restrict __stream) __THROW;
506 extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
507 size_t __n, FILE *__restrict __stream) __THROW;
508 #endif
511 __BEGIN_NAMESPACE_STD
512 /* Seek to a certain position on STREAM. */
513 extern int fseek (FILE *__stream, long int __off, int __whence) __THROW;
514 /* Return the current position of STREAM. */
515 extern long int ftell (FILE *__stream) __THROW;
516 /* Rewind to the beginning of STREAM. */
517 extern void rewind (FILE *__stream) __THROW;
518 __END_NAMESPACE_STD
520 /* The Single Unix Specification, Version 2, specifies an alternative,
521 more adequate interface for the two functions above which deal with
522 file offset. `long int' is not the right type. These definitions
523 are originally defined in the Large File Support API. */
525 #ifdef __USE_LARGEFILE
526 # ifndef __USE_FILE_OFFSET64
527 /* Seek to a certain position on STREAM. */
528 extern int fseeko (FILE *__stream, __off_t __off, int __whence) __THROW;
529 /* Return the current position of STREAM. */
530 extern __off_t ftello (FILE *__stream) __THROW;
531 # else
532 # ifdef __REDIRECT
533 extern int __REDIRECT (fseeko,
534 (FILE *__stream, __off64_t __off, int __whence) __THROW,
535 fseeko64);
536 extern __off64_t __REDIRECT (ftello, (FILE *__stream) __THROW, ftello64);
537 # else
538 # define fseeko fseeko64
539 # define ftello ftello64
540 # endif
541 # endif
542 #endif
544 __BEGIN_NAMESPACE_STD
545 #ifndef __USE_FILE_OFFSET64
546 /* Get STREAM's position. */
547 extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos)
548 __THROW;
549 /* Set STREAM's position. */
550 extern int fsetpos (FILE *__stream, __const fpos_t *__pos) __THROW;
551 #else
552 # ifdef __REDIRECT
553 extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
554 fpos_t *__restrict __pos) __THROW, fgetpos64);
555 extern int __REDIRECT (fsetpos,
556 (FILE *__stream, __const fpos_t *__pos) __THROW,
557 fsetpos64);
558 # else
559 # define fgetpos fgetpos64
560 # define fsetpos fsetpos64
561 # endif
562 #endif
563 __END_NAMESPACE_STD
565 #ifdef __USE_LARGEFILE64
566 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence) __THROW;
567 extern __off64_t ftello64 (FILE *__stream) __THROW;
568 extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos)
569 __THROW;
570 extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos) __THROW;
571 #endif
573 __BEGIN_NAMESPACE_STD
574 /* Clear the error and EOF indicators for STREAM. */
575 extern void clearerr (FILE *__stream) __THROW;
576 /* Return the EOF indicator for STREAM. */
577 extern int feof (FILE *__stream) __THROW;
578 /* Return the error indicator for STREAM. */
579 extern int ferror (FILE *__stream) __THROW;
580 __END_NAMESPACE_STD
582 #ifdef __USE_MISC
583 /* Faster versions when locking is not required. */
584 extern void clearerr_unlocked (FILE *__stream) __THROW;
585 extern int feof_unlocked (FILE *__stream) __THROW;
586 extern int ferror_unlocked (FILE *__stream) __THROW;
587 #endif
590 __BEGIN_NAMESPACE_STD
591 /* Print a message describing the meaning of the value of errno. */
592 extern void perror (__const char *__s) __THROW;
593 __END_NAMESPACE_STD
595 /* Provide the declarations for `sys_errlist' and `sys_nerr' if they
596 are available on this system. Even if available, these variables
597 should not be used directly. The `strerror' function provides
598 all the necessary functionality. */
599 #include <bits/sys_errlist.h>
602 #ifdef __USE_POSIX
603 /* Return the system file descriptor for STREAM. */
604 extern int fileno (FILE *__stream) __THROW;
605 #endif /* Use POSIX. */
607 #ifdef __USE_MISC
608 /* Faster version when locking is not required. */
609 extern int fileno_unlocked (FILE *__stream) __THROW;
610 #endif
613 #if (defined __USE_POSIX2 || defined __USE_SVID || defined __USE_BSD || \
614 defined __USE_MISC)
615 /* Create a new stream connected to a pipe running the given command. */
616 extern FILE *popen (__const char *__command, __const char *__modes) __THROW;
618 /* Close a stream opened by popen and return the status of its child. */
619 extern int pclose (FILE *__stream) __THROW;
620 #endif
623 #ifdef __USE_POSIX
624 /* Return the name of the controlling terminal. */
625 extern char *ctermid (char *__s) __THROW;
626 #endif /* Use POSIX. */
629 #ifdef __USE_XOPEN
630 /* Return the name of the current user. */
631 extern char *cuserid (char *__s) __THROW;
632 #endif /* Use X/Open, but not issue 6. */
635 #ifdef __USE_GNU
636 struct obstack; /* See <obstack.h>. */
638 /* Write formatted output to an obstack. */
639 extern int obstack_printf (struct obstack *__restrict __obstack,
640 __const char *__restrict __format, ...)
641 __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
642 extern int obstack_vprintf (struct obstack *__restrict __obstack,
643 __const char *__restrict __format,
644 _G_va_list __args)
645 __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
646 #endif /* Use GNU. */
649 #if defined __USE_POSIX || defined __USE_MISC
650 /* These are defined in POSIX.1:1996. */
652 /* Acquire ownership of STREAM. */
653 extern void flockfile (FILE *__stream) __THROW;
655 /* Try to acquire ownership of STREAM but do not block if it is not
656 possible. */
657 extern int ftrylockfile (FILE *__stream) __THROW;
659 /* Relinquish the ownership granted for STREAM. */
660 extern void funlockfile (FILE *__stream) __THROW;
661 #endif /* POSIX || misc */
663 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
664 /* The X/Open standard requires some functions and variables to be
665 declared here which do not belong into this header. But we have to
666 follow. In GNU mode we don't do this nonsense. */
667 # define __need_getopt
668 # include <getopt.h>
669 #endif /* X/Open, but not issue 6 and not for GNU. */
671 /* If we are compiling with optimizing read this file. It contains
672 several optimizing inline functions and macros. */
673 #ifdef __USE_EXTERN_INLINES
674 # include <bits/stdio.h>
675 #endif
677 __END_DECLS
679 #endif /* <stdio.h> included. */
681 #endif /* !_STDIO_H */