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