xref: /utopia/UTPA2-700.0.x/projects/tools/lint/mips-linux-gnu_include/stdio.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1*53ee8cc1Swenshuai.xi /* Define ISO C stdio on top of C++ iostreams.
2*53ee8cc1Swenshuai.xi    Copyright (C) 1991, 1994-2007, 2008 Free Software Foundation, Inc.
3*53ee8cc1Swenshuai.xi    This file is part of the GNU C Library.
4*53ee8cc1Swenshuai.xi 
5*53ee8cc1Swenshuai.xi    The GNU C Library is free software; you can redistribute it and/or
6*53ee8cc1Swenshuai.xi    modify it under the terms of the GNU Lesser General Public
7*53ee8cc1Swenshuai.xi    License as published by the Free Software Foundation; either
8*53ee8cc1Swenshuai.xi    version 2.1 of the License, or (at your option) any later version.
9*53ee8cc1Swenshuai.xi 
10*53ee8cc1Swenshuai.xi    The GNU C Library is distributed in the hope that it will be useful,
11*53ee8cc1Swenshuai.xi    but WITHOUT ANY WARRANTY; without even the implied warranty of
12*53ee8cc1Swenshuai.xi    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13*53ee8cc1Swenshuai.xi    Lesser General Public License for more details.
14*53ee8cc1Swenshuai.xi 
15*53ee8cc1Swenshuai.xi    You should have received a copy of the GNU Lesser General Public
16*53ee8cc1Swenshuai.xi    License along with the GNU C Library; if not, write to the Free
17*53ee8cc1Swenshuai.xi    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18*53ee8cc1Swenshuai.xi    02111-1307 USA.  */
19*53ee8cc1Swenshuai.xi 
20*53ee8cc1Swenshuai.xi /*
21*53ee8cc1Swenshuai.xi  *	ISO C99 Standard: 7.19 Input/output	<stdio.h>
22*53ee8cc1Swenshuai.xi  */
23*53ee8cc1Swenshuai.xi 
24*53ee8cc1Swenshuai.xi #ifndef _STDIO_H
25*53ee8cc1Swenshuai.xi 
26*53ee8cc1Swenshuai.xi #if !defined __need_FILE && !defined __need___FILE
27*53ee8cc1Swenshuai.xi # define _STDIO_H	1
28*53ee8cc1Swenshuai.xi # include <features.h>
29*53ee8cc1Swenshuai.xi 
30*53ee8cc1Swenshuai.xi __BEGIN_DECLS
31*53ee8cc1Swenshuai.xi 
32*53ee8cc1Swenshuai.xi # define __need_size_t
33*53ee8cc1Swenshuai.xi # define __need_NULL
34*53ee8cc1Swenshuai.xi # include <stddef.h>
35*53ee8cc1Swenshuai.xi 
36*53ee8cc1Swenshuai.xi # include <bits/types.h>
37*53ee8cc1Swenshuai.xi # define __need_FILE
38*53ee8cc1Swenshuai.xi # define __need___FILE
39*53ee8cc1Swenshuai.xi #endif /* Don't need FILE.  */
40*53ee8cc1Swenshuai.xi 
41*53ee8cc1Swenshuai.xi 
42*53ee8cc1Swenshuai.xi #if !defined __FILE_defined && defined __need_FILE
43*53ee8cc1Swenshuai.xi 
44*53ee8cc1Swenshuai.xi /* Define outside of namespace so the C++ is happy.  */
45*53ee8cc1Swenshuai.xi struct _IO_FILE;
46*53ee8cc1Swenshuai.xi 
47*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
48*53ee8cc1Swenshuai.xi /* The opaque type of streams.  This is the definition used elsewhere.  */
49*53ee8cc1Swenshuai.xi typedef struct _IO_FILE FILE;
50*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
51*53ee8cc1Swenshuai.xi #if defined __USE_LARGEFILE64 || defined __USE_SVID || defined __USE_POSIX \
52*53ee8cc1Swenshuai.xi     || defined __USE_BSD || defined __USE_ISOC99 || defined __USE_XOPEN \
53*53ee8cc1Swenshuai.xi     || defined __USE_POSIX2
54*53ee8cc1Swenshuai.xi __USING_NAMESPACE_STD(FILE)
55*53ee8cc1Swenshuai.xi #endif
56*53ee8cc1Swenshuai.xi 
57*53ee8cc1Swenshuai.xi # define __FILE_defined	1
58*53ee8cc1Swenshuai.xi #endif /* FILE not defined.  */
59*53ee8cc1Swenshuai.xi #undef	__need_FILE
60*53ee8cc1Swenshuai.xi 
61*53ee8cc1Swenshuai.xi 
62*53ee8cc1Swenshuai.xi #if !defined ____FILE_defined && defined __need___FILE
63*53ee8cc1Swenshuai.xi 
64*53ee8cc1Swenshuai.xi /* The opaque type of streams.  This is the definition used elsewhere.  */
65*53ee8cc1Swenshuai.xi typedef struct _IO_FILE __FILE;
66*53ee8cc1Swenshuai.xi 
67*53ee8cc1Swenshuai.xi # define ____FILE_defined	1
68*53ee8cc1Swenshuai.xi #endif /* __FILE not defined.  */
69*53ee8cc1Swenshuai.xi #undef	__need___FILE
70*53ee8cc1Swenshuai.xi 
71*53ee8cc1Swenshuai.xi 
72*53ee8cc1Swenshuai.xi #ifdef	_STDIO_H
73*53ee8cc1Swenshuai.xi #define _STDIO_USES_IOSTREAM
74*53ee8cc1Swenshuai.xi 
75*53ee8cc1Swenshuai.xi #include <libio.h>
76*53ee8cc1Swenshuai.xi 
77*53ee8cc1Swenshuai.xi #ifdef __USE_XOPEN
78*53ee8cc1Swenshuai.xi # ifdef __GNUC__
79*53ee8cc1Swenshuai.xi #  ifndef _VA_LIST_DEFINED
80*53ee8cc1Swenshuai.xi typedef _G_va_list va_list;
81*53ee8cc1Swenshuai.xi #   define _VA_LIST_DEFINED
82*53ee8cc1Swenshuai.xi #  endif
83*53ee8cc1Swenshuai.xi # else
84*53ee8cc1Swenshuai.xi #  include <stdarg.h>
85*53ee8cc1Swenshuai.xi # endif
86*53ee8cc1Swenshuai.xi #endif
87*53ee8cc1Swenshuai.xi 
88*53ee8cc1Swenshuai.xi /* The type of the second argument to `fgetpos' and `fsetpos'.  */
89*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
90*53ee8cc1Swenshuai.xi #ifndef __USE_FILE_OFFSET64
91*53ee8cc1Swenshuai.xi typedef _G_fpos_t fpos_t;
92*53ee8cc1Swenshuai.xi #else
93*53ee8cc1Swenshuai.xi typedef _G_fpos64_t fpos_t;
94*53ee8cc1Swenshuai.xi #endif
95*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
96*53ee8cc1Swenshuai.xi #ifdef __USE_LARGEFILE64
97*53ee8cc1Swenshuai.xi typedef _G_fpos64_t fpos64_t;
98*53ee8cc1Swenshuai.xi #endif
99*53ee8cc1Swenshuai.xi 
100*53ee8cc1Swenshuai.xi /* The possibilities for the third argument to `setvbuf'.  */
101*53ee8cc1Swenshuai.xi #define _IOFBF 0 		/* Fully buffered.  */
102*53ee8cc1Swenshuai.xi #define _IOLBF 1		/* Line buffered.  */
103*53ee8cc1Swenshuai.xi #define _IONBF 2		/* No buffering.  */
104*53ee8cc1Swenshuai.xi 
105*53ee8cc1Swenshuai.xi 
106*53ee8cc1Swenshuai.xi /* Default buffer size.  */
107*53ee8cc1Swenshuai.xi #ifndef BUFSIZ
108*53ee8cc1Swenshuai.xi # define BUFSIZ _IO_BUFSIZ
109*53ee8cc1Swenshuai.xi #endif
110*53ee8cc1Swenshuai.xi 
111*53ee8cc1Swenshuai.xi 
112*53ee8cc1Swenshuai.xi /* End of file character.
113*53ee8cc1Swenshuai.xi    Some things throughout the library rely on this being -1.  */
114*53ee8cc1Swenshuai.xi #ifndef EOF
115*53ee8cc1Swenshuai.xi # define EOF (-1)
116*53ee8cc1Swenshuai.xi #endif
117*53ee8cc1Swenshuai.xi 
118*53ee8cc1Swenshuai.xi 
119*53ee8cc1Swenshuai.xi /* The possibilities for the third argument to `fseek'.
120*53ee8cc1Swenshuai.xi    These values should not be changed.  */
121*53ee8cc1Swenshuai.xi #define SEEK_SET	0	/* Seek from beginning of file.  */
122*53ee8cc1Swenshuai.xi #define SEEK_CUR	1	/* Seek from current position.  */
123*53ee8cc1Swenshuai.xi #define SEEK_END	2	/* Seek from end of file.  */
124*53ee8cc1Swenshuai.xi 
125*53ee8cc1Swenshuai.xi 
126*53ee8cc1Swenshuai.xi #if defined __USE_SVID || defined __USE_XOPEN
127*53ee8cc1Swenshuai.xi /* Default path prefix for `tempnam' and `tmpnam'.  */
128*53ee8cc1Swenshuai.xi # define P_tmpdir	"/tmp"
129*53ee8cc1Swenshuai.xi #endif
130*53ee8cc1Swenshuai.xi 
131*53ee8cc1Swenshuai.xi 
132*53ee8cc1Swenshuai.xi /* Get the values:
133*53ee8cc1Swenshuai.xi    L_tmpnam	How long an array of chars must be to be passed to `tmpnam'.
134*53ee8cc1Swenshuai.xi    TMP_MAX	The minimum number of unique filenames generated by tmpnam
135*53ee8cc1Swenshuai.xi    		(and tempnam when it uses tmpnam's name space),
136*53ee8cc1Swenshuai.xi 		or tempnam (the two are separate).
137*53ee8cc1Swenshuai.xi    L_ctermid	How long an array to pass to `ctermid'.
138*53ee8cc1Swenshuai.xi    L_cuserid	How long an array to pass to `cuserid'.
139*53ee8cc1Swenshuai.xi    FOPEN_MAX	Minimum number of files that can be open at once.
140*53ee8cc1Swenshuai.xi    FILENAME_MAX	Maximum length of a filename.  */
141*53ee8cc1Swenshuai.xi #include <bits/stdio_lim.h>
142*53ee8cc1Swenshuai.xi 
143*53ee8cc1Swenshuai.xi 
144*53ee8cc1Swenshuai.xi /* Standard streams.  */
145*53ee8cc1Swenshuai.xi extern struct _IO_FILE *stdin;		/* Standard input stream.  */
146*53ee8cc1Swenshuai.xi extern struct _IO_FILE *stdout;		/* Standard output stream.  */
147*53ee8cc1Swenshuai.xi extern struct _IO_FILE *stderr;		/* Standard error output stream.  */
148*53ee8cc1Swenshuai.xi /* C89/C99 say they're macros.  Make them happy.  */
149*53ee8cc1Swenshuai.xi #define stdin stdin
150*53ee8cc1Swenshuai.xi #define stdout stdout
151*53ee8cc1Swenshuai.xi #define stderr stderr
152*53ee8cc1Swenshuai.xi 
153*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
154*53ee8cc1Swenshuai.xi /* Remove file FILENAME.  */
155*53ee8cc1Swenshuai.xi extern int remove (__const char *__filename) __THROW;
156*53ee8cc1Swenshuai.xi /* Rename file OLD to NEW.  */
157*53ee8cc1Swenshuai.xi extern int rename (__const char *__old, __const char *__new) __THROW;
158*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
159*53ee8cc1Swenshuai.xi 
160*53ee8cc1Swenshuai.xi #ifdef __USE_ATFILE
161*53ee8cc1Swenshuai.xi /* Rename file OLD relative to OLDFD to NEW relative to NEWFD.  */
162*53ee8cc1Swenshuai.xi extern int renameat (int __oldfd, __const char *__old, int __newfd,
163*53ee8cc1Swenshuai.xi 		     __const char *__new) __THROW;
164*53ee8cc1Swenshuai.xi #endif
165*53ee8cc1Swenshuai.xi 
166*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
167*53ee8cc1Swenshuai.xi /* Create a temporary file and open it read/write.
168*53ee8cc1Swenshuai.xi 
169*53ee8cc1Swenshuai.xi    This function is a possible cancellation points and therefore not
170*53ee8cc1Swenshuai.xi    marked with __THROW.  */
171*53ee8cc1Swenshuai.xi #ifndef __USE_FILE_OFFSET64
172*53ee8cc1Swenshuai.xi extern FILE *tmpfile (void) __wur;
173*53ee8cc1Swenshuai.xi #else
174*53ee8cc1Swenshuai.xi # ifdef __REDIRECT
175*53ee8cc1Swenshuai.xi extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) __wur;
176*53ee8cc1Swenshuai.xi # else
177*53ee8cc1Swenshuai.xi #  define tmpfile tmpfile64
178*53ee8cc1Swenshuai.xi # endif
179*53ee8cc1Swenshuai.xi #endif
180*53ee8cc1Swenshuai.xi 
181*53ee8cc1Swenshuai.xi #ifdef __USE_LARGEFILE64
182*53ee8cc1Swenshuai.xi extern FILE *tmpfile64 (void) __wur;
183*53ee8cc1Swenshuai.xi #endif
184*53ee8cc1Swenshuai.xi 
185*53ee8cc1Swenshuai.xi /* Generate a temporary filename.  */
186*53ee8cc1Swenshuai.xi extern char *tmpnam (char *__s) __THROW __wur;
187*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
188*53ee8cc1Swenshuai.xi 
189*53ee8cc1Swenshuai.xi #ifdef __USE_MISC
190*53ee8cc1Swenshuai.xi /* This is the reentrant variant of `tmpnam'.  The only difference is
191*53ee8cc1Swenshuai.xi    that it does not allow S to be NULL.  */
192*53ee8cc1Swenshuai.xi extern char *tmpnam_r (char *__s) __THROW __wur;
193*53ee8cc1Swenshuai.xi #endif
194*53ee8cc1Swenshuai.xi 
195*53ee8cc1Swenshuai.xi 
196*53ee8cc1Swenshuai.xi #if defined __USE_SVID || defined __USE_XOPEN
197*53ee8cc1Swenshuai.xi /* Generate a unique temporary filename using up to five characters of PFX
198*53ee8cc1Swenshuai.xi    if it is not NULL.  The directory to put this file in is searched for
199*53ee8cc1Swenshuai.xi    as follows: First the environment variable "TMPDIR" is checked.
200*53ee8cc1Swenshuai.xi    If it contains the name of a writable directory, that directory is used.
201*53ee8cc1Swenshuai.xi    If not and if DIR is not NULL, that value is checked.  If that fails,
202*53ee8cc1Swenshuai.xi    P_tmpdir is tried and finally "/tmp".  The storage for the filename
203*53ee8cc1Swenshuai.xi    is allocated by `malloc'.  */
204*53ee8cc1Swenshuai.xi extern char *tempnam (__const char *__dir, __const char *__pfx)
205*53ee8cc1Swenshuai.xi      __THROW __attribute_malloc__ __wur;
206*53ee8cc1Swenshuai.xi #endif
207*53ee8cc1Swenshuai.xi 
208*53ee8cc1Swenshuai.xi 
209*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
210*53ee8cc1Swenshuai.xi /* Close STREAM.
211*53ee8cc1Swenshuai.xi 
212*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
213*53ee8cc1Swenshuai.xi    marked with __THROW.  */
214*53ee8cc1Swenshuai.xi extern int fclose (FILE *__stream);
215*53ee8cc1Swenshuai.xi /* Flush STREAM, or all streams if STREAM is NULL.
216*53ee8cc1Swenshuai.xi 
217*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
218*53ee8cc1Swenshuai.xi    marked with __THROW.  */
219*53ee8cc1Swenshuai.xi extern int fflush (FILE *__stream);
220*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
221*53ee8cc1Swenshuai.xi 
222*53ee8cc1Swenshuai.xi #ifdef __USE_MISC
223*53ee8cc1Swenshuai.xi /* Faster versions when locking is not required.
224*53ee8cc1Swenshuai.xi 
225*53ee8cc1Swenshuai.xi    This function is not part of POSIX and therefore no official
226*53ee8cc1Swenshuai.xi    cancellation point.  But due to similarity with an POSIX interface
227*53ee8cc1Swenshuai.xi    or due to the implementation it is a cancellation point and
228*53ee8cc1Swenshuai.xi    therefore not marked with __THROW.  */
229*53ee8cc1Swenshuai.xi extern int fflush_unlocked (FILE *__stream);
230*53ee8cc1Swenshuai.xi #endif
231*53ee8cc1Swenshuai.xi 
232*53ee8cc1Swenshuai.xi #ifdef __USE_GNU
233*53ee8cc1Swenshuai.xi /* Close all streams.
234*53ee8cc1Swenshuai.xi 
235*53ee8cc1Swenshuai.xi    This function is not part of POSIX and therefore no official
236*53ee8cc1Swenshuai.xi    cancellation point.  But due to similarity with an POSIX interface
237*53ee8cc1Swenshuai.xi    or due to the implementation it is a cancellation point and
238*53ee8cc1Swenshuai.xi    therefore not marked with __THROW.  */
239*53ee8cc1Swenshuai.xi extern int fcloseall (void);
240*53ee8cc1Swenshuai.xi #endif
241*53ee8cc1Swenshuai.xi 
242*53ee8cc1Swenshuai.xi 
243*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
244*53ee8cc1Swenshuai.xi #ifndef __USE_FILE_OFFSET64
245*53ee8cc1Swenshuai.xi /* Open a file and create a new stream for it.
246*53ee8cc1Swenshuai.xi 
247*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
248*53ee8cc1Swenshuai.xi    marked with __THROW.  */
249*53ee8cc1Swenshuai.xi extern FILE *fopen (__const char *__restrict __filename,
250*53ee8cc1Swenshuai.xi 		    __const char *__restrict __modes) __wur;
251*53ee8cc1Swenshuai.xi /* Open a file, replacing an existing stream with it.
252*53ee8cc1Swenshuai.xi 
253*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
254*53ee8cc1Swenshuai.xi    marked with __THROW.  */
255*53ee8cc1Swenshuai.xi extern FILE *freopen (__const char *__restrict __filename,
256*53ee8cc1Swenshuai.xi 		      __const char *__restrict __modes,
257*53ee8cc1Swenshuai.xi 		      FILE *__restrict __stream) __wur;
258*53ee8cc1Swenshuai.xi #else
259*53ee8cc1Swenshuai.xi # ifdef __REDIRECT
260*53ee8cc1Swenshuai.xi extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename,
261*53ee8cc1Swenshuai.xi 				 __const char *__restrict __modes), fopen64)
262*53ee8cc1Swenshuai.xi   __wur;
263*53ee8cc1Swenshuai.xi extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
264*53ee8cc1Swenshuai.xi 				   __const char *__restrict __modes,
265*53ee8cc1Swenshuai.xi 				   FILE *__restrict __stream), freopen64)
266*53ee8cc1Swenshuai.xi   __wur;
267*53ee8cc1Swenshuai.xi # else
268*53ee8cc1Swenshuai.xi #  define fopen fopen64
269*53ee8cc1Swenshuai.xi #  define freopen freopen64
270*53ee8cc1Swenshuai.xi # endif
271*53ee8cc1Swenshuai.xi #endif
272*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
273*53ee8cc1Swenshuai.xi #ifdef __USE_LARGEFILE64
274*53ee8cc1Swenshuai.xi extern FILE *fopen64 (__const char *__restrict __filename,
275*53ee8cc1Swenshuai.xi 		      __const char *__restrict __modes) __wur;
276*53ee8cc1Swenshuai.xi extern FILE *freopen64 (__const char *__restrict __filename,
277*53ee8cc1Swenshuai.xi 			__const char *__restrict __modes,
278*53ee8cc1Swenshuai.xi 			FILE *__restrict __stream) __wur;
279*53ee8cc1Swenshuai.xi #endif
280*53ee8cc1Swenshuai.xi 
281*53ee8cc1Swenshuai.xi #ifdef	__USE_POSIX
282*53ee8cc1Swenshuai.xi /* Create a new stream that refers to an existing system file descriptor.  */
283*53ee8cc1Swenshuai.xi extern FILE *fdopen (int __fd, __const char *__modes) __THROW __wur;
284*53ee8cc1Swenshuai.xi #endif
285*53ee8cc1Swenshuai.xi 
286*53ee8cc1Swenshuai.xi #ifdef	__USE_GNU
287*53ee8cc1Swenshuai.xi /* Create a new stream that refers to the given magic cookie,
288*53ee8cc1Swenshuai.xi    and uses the given functions for input and output.  */
289*53ee8cc1Swenshuai.xi extern FILE *fopencookie (void *__restrict __magic_cookie,
290*53ee8cc1Swenshuai.xi 			  __const char *__restrict __modes,
291*53ee8cc1Swenshuai.xi 			  _IO_cookie_io_functions_t __io_funcs) __THROW __wur;
292*53ee8cc1Swenshuai.xi 
293*53ee8cc1Swenshuai.xi /* Create a new stream that refers to a memory buffer.  */
294*53ee8cc1Swenshuai.xi extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes)
295*53ee8cc1Swenshuai.xi   __THROW __wur;
296*53ee8cc1Swenshuai.xi 
297*53ee8cc1Swenshuai.xi /* Open a stream that writes into a malloc'd buffer that is expanded as
298*53ee8cc1Swenshuai.xi    necessary.  *BUFLOC and *SIZELOC are updated with the buffer's location
299*53ee8cc1Swenshuai.xi    and the number of characters written on fflush or fclose.  */
300*53ee8cc1Swenshuai.xi extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur;
301*53ee8cc1Swenshuai.xi #endif
302*53ee8cc1Swenshuai.xi 
303*53ee8cc1Swenshuai.xi 
304*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
305*53ee8cc1Swenshuai.xi /* If BUF is NULL, make STREAM unbuffered.
306*53ee8cc1Swenshuai.xi    Else make it use buffer BUF, of size BUFSIZ.  */
307*53ee8cc1Swenshuai.xi extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
308*53ee8cc1Swenshuai.xi /* Make STREAM use buffering mode MODE.
309*53ee8cc1Swenshuai.xi    If BUF is not NULL, use N bytes of it for buffering;
310*53ee8cc1Swenshuai.xi    else allocate an internal buffer N bytes long.  */
311*53ee8cc1Swenshuai.xi extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
312*53ee8cc1Swenshuai.xi 		    int __modes, size_t __n) __THROW;
313*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
314*53ee8cc1Swenshuai.xi 
315*53ee8cc1Swenshuai.xi #ifdef	__USE_BSD
316*53ee8cc1Swenshuai.xi /* If BUF is NULL, make STREAM unbuffered.
317*53ee8cc1Swenshuai.xi    Else make it use SIZE bytes of BUF for buffering.  */
318*53ee8cc1Swenshuai.xi extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
319*53ee8cc1Swenshuai.xi 		       size_t __size) __THROW;
320*53ee8cc1Swenshuai.xi 
321*53ee8cc1Swenshuai.xi /* Make STREAM line-buffered.  */
322*53ee8cc1Swenshuai.xi extern void setlinebuf (FILE *__stream) __THROW;
323*53ee8cc1Swenshuai.xi #endif
324*53ee8cc1Swenshuai.xi 
325*53ee8cc1Swenshuai.xi 
326*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
327*53ee8cc1Swenshuai.xi /* Write formatted output to STREAM.
328*53ee8cc1Swenshuai.xi 
329*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
330*53ee8cc1Swenshuai.xi    marked with __THROW.  */
331*53ee8cc1Swenshuai.xi extern int fprintf (FILE *__restrict __stream,
332*53ee8cc1Swenshuai.xi 		    __const char *__restrict __format, ...);
333*53ee8cc1Swenshuai.xi /* Write formatted output to stdout.
334*53ee8cc1Swenshuai.xi 
335*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
336*53ee8cc1Swenshuai.xi    marked with __THROW.  */
337*53ee8cc1Swenshuai.xi extern int printf (__const char *__restrict __format, ...);
338*53ee8cc1Swenshuai.xi /* Write formatted output to S.  */
339*53ee8cc1Swenshuai.xi extern int sprintf (char *__restrict __s,
340*53ee8cc1Swenshuai.xi 		    __const char *__restrict __format, ...) __THROW;
341*53ee8cc1Swenshuai.xi 
342*53ee8cc1Swenshuai.xi /* Write formatted output to S from argument list ARG.
343*53ee8cc1Swenshuai.xi 
344*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
345*53ee8cc1Swenshuai.xi    marked with __THROW.  */
346*53ee8cc1Swenshuai.xi extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
347*53ee8cc1Swenshuai.xi 		     _G_va_list __arg);
348*53ee8cc1Swenshuai.xi /* Write formatted output to stdout from argument list ARG.
349*53ee8cc1Swenshuai.xi 
350*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
351*53ee8cc1Swenshuai.xi    marked with __THROW.  */
352*53ee8cc1Swenshuai.xi extern int vprintf (__const char *__restrict __format, _G_va_list __arg);
353*53ee8cc1Swenshuai.xi /* Write formatted output to S from argument list ARG.  */
354*53ee8cc1Swenshuai.xi extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
355*53ee8cc1Swenshuai.xi 		     _G_va_list __arg) __THROW;
356*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
357*53ee8cc1Swenshuai.xi 
358*53ee8cc1Swenshuai.xi #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
359*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_C99
360*53ee8cc1Swenshuai.xi /* Maximum chars of output to write in MAXLEN.  */
361*53ee8cc1Swenshuai.xi extern int snprintf (char *__restrict __s, size_t __maxlen,
362*53ee8cc1Swenshuai.xi 		     __const char *__restrict __format, ...)
363*53ee8cc1Swenshuai.xi      __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
364*53ee8cc1Swenshuai.xi 
365*53ee8cc1Swenshuai.xi extern int vsnprintf (char *__restrict __s, size_t __maxlen,
366*53ee8cc1Swenshuai.xi 		      __const char *__restrict __format, _G_va_list __arg)
367*53ee8cc1Swenshuai.xi      __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
368*53ee8cc1Swenshuai.xi __END_NAMESPACE_C99
369*53ee8cc1Swenshuai.xi #endif
370*53ee8cc1Swenshuai.xi 
371*53ee8cc1Swenshuai.xi #ifdef __USE_GNU
372*53ee8cc1Swenshuai.xi /* Write formatted output to a string dynamically allocated with `malloc'.
373*53ee8cc1Swenshuai.xi    Store the address of the string in *PTR.  */
374*53ee8cc1Swenshuai.xi extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
375*53ee8cc1Swenshuai.xi 		      _G_va_list __arg)
376*53ee8cc1Swenshuai.xi      __THROW __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
377*53ee8cc1Swenshuai.xi extern int __asprintf (char **__restrict __ptr,
378*53ee8cc1Swenshuai.xi 		       __const char *__restrict __fmt, ...)
379*53ee8cc1Swenshuai.xi      __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
380*53ee8cc1Swenshuai.xi extern int asprintf (char **__restrict __ptr,
381*53ee8cc1Swenshuai.xi 		     __const char *__restrict __fmt, ...)
382*53ee8cc1Swenshuai.xi      __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
383*53ee8cc1Swenshuai.xi 
384*53ee8cc1Swenshuai.xi /* Write formatted output to a file descriptor.
385*53ee8cc1Swenshuai.xi 
386*53ee8cc1Swenshuai.xi    These functions are not part of POSIX and therefore no official
387*53ee8cc1Swenshuai.xi    cancellation point.  But due to similarity with an POSIX interface
388*53ee8cc1Swenshuai.xi    or due to the implementation they are cancellation points and
389*53ee8cc1Swenshuai.xi    therefore not marked with __THROW.  */
390*53ee8cc1Swenshuai.xi extern int vdprintf (int __fd, __const char *__restrict __fmt,
391*53ee8cc1Swenshuai.xi 		     _G_va_list __arg)
392*53ee8cc1Swenshuai.xi      __attribute__ ((__format__ (__printf__, 2, 0)));
393*53ee8cc1Swenshuai.xi extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
394*53ee8cc1Swenshuai.xi      __attribute__ ((__format__ (__printf__, 2, 3)));
395*53ee8cc1Swenshuai.xi #endif
396*53ee8cc1Swenshuai.xi 
397*53ee8cc1Swenshuai.xi 
398*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
399*53ee8cc1Swenshuai.xi /* Read formatted input from STREAM.
400*53ee8cc1Swenshuai.xi 
401*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
402*53ee8cc1Swenshuai.xi    marked with __THROW.  */
403*53ee8cc1Swenshuai.xi extern int fscanf (FILE *__restrict __stream,
404*53ee8cc1Swenshuai.xi 		   __const char *__restrict __format, ...) __wur;
405*53ee8cc1Swenshuai.xi /* Read formatted input from stdin.
406*53ee8cc1Swenshuai.xi 
407*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
408*53ee8cc1Swenshuai.xi    marked with __THROW.  */
409*53ee8cc1Swenshuai.xi extern int scanf (__const char *__restrict __format, ...) __wur;
410*53ee8cc1Swenshuai.xi /* Read formatted input from S.  */
411*53ee8cc1Swenshuai.xi extern int sscanf (__const char *__restrict __s,
412*53ee8cc1Swenshuai.xi 		   __const char *__restrict __format, ...) __THROW;
413*53ee8cc1Swenshuai.xi 
414*53ee8cc1Swenshuai.xi #if defined __USE_ISOC99 && !defined __USE_GNU \
415*53ee8cc1Swenshuai.xi     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
416*53ee8cc1Swenshuai.xi     && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
417*53ee8cc1Swenshuai.xi # ifdef __REDIRECT
418*53ee8cc1Swenshuai.xi /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
419*53ee8cc1Swenshuai.xi    GNU extension which conflicts with valid %a followed by letter
420*53ee8cc1Swenshuai.xi    s, S or [.  */
421*53ee8cc1Swenshuai.xi extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
422*53ee8cc1Swenshuai.xi 				__const char *__restrict __format, ...),
423*53ee8cc1Swenshuai.xi 		       __isoc99_fscanf) __wur;
424*53ee8cc1Swenshuai.xi extern int __REDIRECT (scanf, (__const char *__restrict __format, ...),
425*53ee8cc1Swenshuai.xi 		       __isoc99_scanf) __wur;
426*53ee8cc1Swenshuai.xi extern int __REDIRECT (sscanf, (__const char *__restrict __s,
427*53ee8cc1Swenshuai.xi 				__const char *__restrict __format, ...),
428*53ee8cc1Swenshuai.xi 		       __isoc99_sscanf) __THROW;
429*53ee8cc1Swenshuai.xi # else
430*53ee8cc1Swenshuai.xi extern int __isoc99_fscanf (FILE *__restrict __stream,
431*53ee8cc1Swenshuai.xi 			    __const char *__restrict __format, ...) __wur;
432*53ee8cc1Swenshuai.xi extern int __isoc99_scanf (__const char *__restrict __format, ...) __wur;
433*53ee8cc1Swenshuai.xi extern int __isoc99_sscanf (__const char *__restrict __s,
434*53ee8cc1Swenshuai.xi 			    __const char *__restrict __format, ...) __THROW;
435*53ee8cc1Swenshuai.xi #  define fscanf __isoc99_fscanf
436*53ee8cc1Swenshuai.xi #  define scanf __isoc99_scanf
437*53ee8cc1Swenshuai.xi #  define sscanf __isoc99_sscanf
438*53ee8cc1Swenshuai.xi # endif
439*53ee8cc1Swenshuai.xi #endif
440*53ee8cc1Swenshuai.xi 
441*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
442*53ee8cc1Swenshuai.xi 
443*53ee8cc1Swenshuai.xi #ifdef	__USE_ISOC99
444*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_C99
445*53ee8cc1Swenshuai.xi /* Read formatted input from S into argument list ARG.
446*53ee8cc1Swenshuai.xi 
447*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
448*53ee8cc1Swenshuai.xi    marked with __THROW.  */
449*53ee8cc1Swenshuai.xi extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
450*53ee8cc1Swenshuai.xi 		    _G_va_list __arg)
451*53ee8cc1Swenshuai.xi      __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
452*53ee8cc1Swenshuai.xi 
453*53ee8cc1Swenshuai.xi /* Read formatted input from stdin into argument list ARG.
454*53ee8cc1Swenshuai.xi 
455*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
456*53ee8cc1Swenshuai.xi    marked with __THROW.  */
457*53ee8cc1Swenshuai.xi extern int vscanf (__const char *__restrict __format, _G_va_list __arg)
458*53ee8cc1Swenshuai.xi      __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
459*53ee8cc1Swenshuai.xi 
460*53ee8cc1Swenshuai.xi /* Read formatted input from S into argument list ARG.  */
461*53ee8cc1Swenshuai.xi extern int vsscanf (__const char *__restrict __s,
462*53ee8cc1Swenshuai.xi 		    __const char *__restrict __format, _G_va_list __arg)
463*53ee8cc1Swenshuai.xi      __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
464*53ee8cc1Swenshuai.xi 
465*53ee8cc1Swenshuai.xi # if !defined __USE_GNU \
466*53ee8cc1Swenshuai.xi      && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
467*53ee8cc1Swenshuai.xi      && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
468*53ee8cc1Swenshuai.xi #  ifdef __REDIRECT
469*53ee8cc1Swenshuai.xi /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[
470*53ee8cc1Swenshuai.xi    GNU extension which conflicts with valid %a followed by letter
471*53ee8cc1Swenshuai.xi    s, S or [.  */
472*53ee8cc1Swenshuai.xi extern int __REDIRECT (vfscanf,
473*53ee8cc1Swenshuai.xi 		       (FILE *__restrict __s,
474*53ee8cc1Swenshuai.xi 			__const char *__restrict __format, _G_va_list __arg),
475*53ee8cc1Swenshuai.xi 		       __isoc99_vfscanf)
476*53ee8cc1Swenshuai.xi      __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
477*53ee8cc1Swenshuai.xi extern int __REDIRECT (vscanf, (__const char *__restrict __format,
478*53ee8cc1Swenshuai.xi 				_G_va_list __arg), __isoc99_vfscanf)
479*53ee8cc1Swenshuai.xi      __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
480*53ee8cc1Swenshuai.xi extern int __REDIRECT (vsscanf,
481*53ee8cc1Swenshuai.xi 		       (__const char *__restrict __s,
482*53ee8cc1Swenshuai.xi 			__const char *__restrict __format, _G_va_list __arg),
483*53ee8cc1Swenshuai.xi 		       __isoc99_vsscanf)
484*53ee8cc1Swenshuai.xi      __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
485*53ee8cc1Swenshuai.xi #  else
486*53ee8cc1Swenshuai.xi extern int __isoc99_vfscanf (FILE *__restrict __s,
487*53ee8cc1Swenshuai.xi 			     __const char *__restrict __format,
488*53ee8cc1Swenshuai.xi 			     _G_va_list __arg) __wur;
489*53ee8cc1Swenshuai.xi extern int __isoc99_vscanf (__const char *__restrict __format,
490*53ee8cc1Swenshuai.xi 			    _G_va_list __arg) __wur;
491*53ee8cc1Swenshuai.xi extern int __isoc99_vsscanf (__const char *__restrict __s,
492*53ee8cc1Swenshuai.xi 			     __const char *__restrict __format,
493*53ee8cc1Swenshuai.xi 			     _G_va_list __arg) __THROW;
494*53ee8cc1Swenshuai.xi #   define vfscanf __isoc99_vfscanf
495*53ee8cc1Swenshuai.xi #   define vscanf __isoc99_vscanf
496*53ee8cc1Swenshuai.xi #   define vsscanf __isoc99_vsscanf
497*53ee8cc1Swenshuai.xi #  endif
498*53ee8cc1Swenshuai.xi # endif
499*53ee8cc1Swenshuai.xi 
500*53ee8cc1Swenshuai.xi __END_NAMESPACE_C99
501*53ee8cc1Swenshuai.xi #endif /* Use ISO C9x.  */
502*53ee8cc1Swenshuai.xi 
503*53ee8cc1Swenshuai.xi 
504*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
505*53ee8cc1Swenshuai.xi /* Read a character from STREAM.
506*53ee8cc1Swenshuai.xi 
507*53ee8cc1Swenshuai.xi    These functions are possible cancellation points and therefore not
508*53ee8cc1Swenshuai.xi    marked with __THROW.  */
509*53ee8cc1Swenshuai.xi extern int fgetc (FILE *__stream);
510*53ee8cc1Swenshuai.xi extern int getc (FILE *__stream);
511*53ee8cc1Swenshuai.xi 
512*53ee8cc1Swenshuai.xi /* Read a character from stdin.
513*53ee8cc1Swenshuai.xi 
514*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
515*53ee8cc1Swenshuai.xi    marked with __THROW.  */
516*53ee8cc1Swenshuai.xi extern int getchar (void);
517*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
518*53ee8cc1Swenshuai.xi 
519*53ee8cc1Swenshuai.xi /* The C standard explicitly says this is a macro, so we always do the
520*53ee8cc1Swenshuai.xi    optimization for it.  */
521*53ee8cc1Swenshuai.xi #define getc(_fp) _IO_getc (_fp)
522*53ee8cc1Swenshuai.xi 
523*53ee8cc1Swenshuai.xi #if defined __USE_POSIX || defined __USE_MISC
524*53ee8cc1Swenshuai.xi /* These are defined in POSIX.1:1996.
525*53ee8cc1Swenshuai.xi 
526*53ee8cc1Swenshuai.xi    These functions are possible cancellation points and therefore not
527*53ee8cc1Swenshuai.xi    marked with __THROW.  */
528*53ee8cc1Swenshuai.xi extern int getc_unlocked (FILE *__stream);
529*53ee8cc1Swenshuai.xi extern int getchar_unlocked (void);
530*53ee8cc1Swenshuai.xi #endif /* Use POSIX or MISC.  */
531*53ee8cc1Swenshuai.xi 
532*53ee8cc1Swenshuai.xi #ifdef __USE_MISC
533*53ee8cc1Swenshuai.xi /* Faster version when locking is not necessary.
534*53ee8cc1Swenshuai.xi 
535*53ee8cc1Swenshuai.xi    This function is not part of POSIX and therefore no official
536*53ee8cc1Swenshuai.xi    cancellation point.  But due to similarity with an POSIX interface
537*53ee8cc1Swenshuai.xi    or due to the implementation it is a cancellation point and
538*53ee8cc1Swenshuai.xi    therefore not marked with __THROW.  */
539*53ee8cc1Swenshuai.xi extern int fgetc_unlocked (FILE *__stream);
540*53ee8cc1Swenshuai.xi #endif /* Use MISC.  */
541*53ee8cc1Swenshuai.xi 
542*53ee8cc1Swenshuai.xi 
543*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
544*53ee8cc1Swenshuai.xi /* Write a character to STREAM.
545*53ee8cc1Swenshuai.xi 
546*53ee8cc1Swenshuai.xi    These functions are possible cancellation points and therefore not
547*53ee8cc1Swenshuai.xi    marked with __THROW.
548*53ee8cc1Swenshuai.xi 
549*53ee8cc1Swenshuai.xi    These functions is a possible cancellation point and therefore not
550*53ee8cc1Swenshuai.xi    marked with __THROW.  */
551*53ee8cc1Swenshuai.xi extern int fputc (int __c, FILE *__stream);
552*53ee8cc1Swenshuai.xi extern int putc (int __c, FILE *__stream);
553*53ee8cc1Swenshuai.xi 
554*53ee8cc1Swenshuai.xi /* Write a character to stdout.
555*53ee8cc1Swenshuai.xi 
556*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
557*53ee8cc1Swenshuai.xi    marked with __THROW.  */
558*53ee8cc1Swenshuai.xi extern int putchar (int __c);
559*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
560*53ee8cc1Swenshuai.xi 
561*53ee8cc1Swenshuai.xi /* The C standard explicitly says this can be a macro,
562*53ee8cc1Swenshuai.xi    so we always do the optimization for it.  */
563*53ee8cc1Swenshuai.xi #define putc(_ch, _fp) _IO_putc (_ch, _fp)
564*53ee8cc1Swenshuai.xi 
565*53ee8cc1Swenshuai.xi #ifdef __USE_MISC
566*53ee8cc1Swenshuai.xi /* Faster version when locking is not necessary.
567*53ee8cc1Swenshuai.xi 
568*53ee8cc1Swenshuai.xi    This function is not part of POSIX and therefore no official
569*53ee8cc1Swenshuai.xi    cancellation point.  But due to similarity with an POSIX interface
570*53ee8cc1Swenshuai.xi    or due to the implementation it is a cancellation point and
571*53ee8cc1Swenshuai.xi    therefore not marked with __THROW.  */
572*53ee8cc1Swenshuai.xi extern int fputc_unlocked (int __c, FILE *__stream);
573*53ee8cc1Swenshuai.xi #endif /* Use MISC.  */
574*53ee8cc1Swenshuai.xi 
575*53ee8cc1Swenshuai.xi #if defined __USE_POSIX || defined __USE_MISC
576*53ee8cc1Swenshuai.xi /* These are defined in POSIX.1:1996.
577*53ee8cc1Swenshuai.xi 
578*53ee8cc1Swenshuai.xi    These functions are possible cancellation points and therefore not
579*53ee8cc1Swenshuai.xi    marked with __THROW.  */
580*53ee8cc1Swenshuai.xi extern int putc_unlocked (int __c, FILE *__stream);
581*53ee8cc1Swenshuai.xi extern int putchar_unlocked (int __c);
582*53ee8cc1Swenshuai.xi #endif /* Use POSIX or MISC.  */
583*53ee8cc1Swenshuai.xi 
584*53ee8cc1Swenshuai.xi 
585*53ee8cc1Swenshuai.xi #if defined __USE_SVID || defined __USE_MISC \
586*53ee8cc1Swenshuai.xi     || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
587*53ee8cc1Swenshuai.xi /* Get a word (int) from STREAM.  */
588*53ee8cc1Swenshuai.xi extern int getw (FILE *__stream);
589*53ee8cc1Swenshuai.xi 
590*53ee8cc1Swenshuai.xi /* Write a word (int) to STREAM.  */
591*53ee8cc1Swenshuai.xi extern int putw (int __w, FILE *__stream);
592*53ee8cc1Swenshuai.xi #endif
593*53ee8cc1Swenshuai.xi 
594*53ee8cc1Swenshuai.xi 
595*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
596*53ee8cc1Swenshuai.xi /* Get a newline-terminated string of finite length from STREAM.
597*53ee8cc1Swenshuai.xi 
598*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
599*53ee8cc1Swenshuai.xi    marked with __THROW.  */
600*53ee8cc1Swenshuai.xi extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
601*53ee8cc1Swenshuai.xi      __wur;
602*53ee8cc1Swenshuai.xi 
603*53ee8cc1Swenshuai.xi /* Get a newline-terminated string from stdin, removing the newline.
604*53ee8cc1Swenshuai.xi    DO NOT USE THIS FUNCTION!!  There is no limit on how much it will read.
605*53ee8cc1Swenshuai.xi 
606*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
607*53ee8cc1Swenshuai.xi    marked with __THROW.  */
608*53ee8cc1Swenshuai.xi extern char *gets (char *__s) __wur;
609*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
610*53ee8cc1Swenshuai.xi 
611*53ee8cc1Swenshuai.xi #ifdef __USE_GNU
612*53ee8cc1Swenshuai.xi /* This function does the same as `fgets' but does not lock the stream.
613*53ee8cc1Swenshuai.xi 
614*53ee8cc1Swenshuai.xi    This function is not part of POSIX and therefore no official
615*53ee8cc1Swenshuai.xi    cancellation point.  But due to similarity with an POSIX interface
616*53ee8cc1Swenshuai.xi    or due to the implementation it is a cancellation point and
617*53ee8cc1Swenshuai.xi    therefore not marked with __THROW.  */
618*53ee8cc1Swenshuai.xi extern char *fgets_unlocked (char *__restrict __s, int __n,
619*53ee8cc1Swenshuai.xi 			     FILE *__restrict __stream) __wur;
620*53ee8cc1Swenshuai.xi #endif
621*53ee8cc1Swenshuai.xi 
622*53ee8cc1Swenshuai.xi 
623*53ee8cc1Swenshuai.xi #ifdef	__USE_GNU
624*53ee8cc1Swenshuai.xi /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
625*53ee8cc1Swenshuai.xi    (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
626*53ee8cc1Swenshuai.xi    NULL), pointing to *N characters of space.  It is realloc'd as
627*53ee8cc1Swenshuai.xi    necessary.  Returns the number of characters read (not including the
628*53ee8cc1Swenshuai.xi    null terminator), or -1 on error or EOF.
629*53ee8cc1Swenshuai.xi 
630*53ee8cc1Swenshuai.xi    These functions are not part of POSIX and therefore no official
631*53ee8cc1Swenshuai.xi    cancellation point.  But due to similarity with an POSIX interface
632*53ee8cc1Swenshuai.xi    or due to the implementation they are cancellation points and
633*53ee8cc1Swenshuai.xi    therefore not marked with __THROW.  */
634*53ee8cc1Swenshuai.xi extern _IO_ssize_t __getdelim (char **__restrict __lineptr,
635*53ee8cc1Swenshuai.xi 			       size_t *__restrict __n, int __delimiter,
636*53ee8cc1Swenshuai.xi 			       FILE *__restrict __stream) __wur;
637*53ee8cc1Swenshuai.xi extern _IO_ssize_t getdelim (char **__restrict __lineptr,
638*53ee8cc1Swenshuai.xi 			     size_t *__restrict __n, int __delimiter,
639*53ee8cc1Swenshuai.xi 			     FILE *__restrict __stream) __wur;
640*53ee8cc1Swenshuai.xi 
641*53ee8cc1Swenshuai.xi /* Like `getdelim', but reads up to a newline.
642*53ee8cc1Swenshuai.xi 
643*53ee8cc1Swenshuai.xi    This function is not part of POSIX and therefore no official
644*53ee8cc1Swenshuai.xi    cancellation point.  But due to similarity with an POSIX interface
645*53ee8cc1Swenshuai.xi    or due to the implementation it is a cancellation point and
646*53ee8cc1Swenshuai.xi    therefore not marked with __THROW.  */
647*53ee8cc1Swenshuai.xi extern _IO_ssize_t getline (char **__restrict __lineptr,
648*53ee8cc1Swenshuai.xi 			    size_t *__restrict __n,
649*53ee8cc1Swenshuai.xi 			    FILE *__restrict __stream) __wur;
650*53ee8cc1Swenshuai.xi #endif
651*53ee8cc1Swenshuai.xi 
652*53ee8cc1Swenshuai.xi 
653*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
654*53ee8cc1Swenshuai.xi /* Write a string to STREAM.
655*53ee8cc1Swenshuai.xi 
656*53ee8cc1Swenshuai.xi    This function is a possible cancellation points and therefore not
657*53ee8cc1Swenshuai.xi    marked with __THROW.  */
658*53ee8cc1Swenshuai.xi extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
659*53ee8cc1Swenshuai.xi 
660*53ee8cc1Swenshuai.xi /* Write a string, followed by a newline, to stdout.
661*53ee8cc1Swenshuai.xi 
662*53ee8cc1Swenshuai.xi    This function is a possible cancellation points and therefore not
663*53ee8cc1Swenshuai.xi    marked with __THROW.  */
664*53ee8cc1Swenshuai.xi extern int puts (__const char *__s);
665*53ee8cc1Swenshuai.xi 
666*53ee8cc1Swenshuai.xi 
667*53ee8cc1Swenshuai.xi /* Push a character back onto the input buffer of STREAM.
668*53ee8cc1Swenshuai.xi 
669*53ee8cc1Swenshuai.xi    This function is a possible cancellation points and therefore not
670*53ee8cc1Swenshuai.xi    marked with __THROW.  */
671*53ee8cc1Swenshuai.xi extern int ungetc (int __c, FILE *__stream);
672*53ee8cc1Swenshuai.xi 
673*53ee8cc1Swenshuai.xi 
674*53ee8cc1Swenshuai.xi /* Read chunks of generic data from STREAM.
675*53ee8cc1Swenshuai.xi 
676*53ee8cc1Swenshuai.xi    This function is a possible cancellation points and therefore not
677*53ee8cc1Swenshuai.xi    marked with __THROW.  */
678*53ee8cc1Swenshuai.xi extern size_t fread (void *__restrict __ptr, size_t __size,
679*53ee8cc1Swenshuai.xi 		     size_t __n, FILE *__restrict __stream) __wur;
680*53ee8cc1Swenshuai.xi /* Write chunks of generic data to STREAM.
681*53ee8cc1Swenshuai.xi 
682*53ee8cc1Swenshuai.xi    This function is a possible cancellation points and therefore not
683*53ee8cc1Swenshuai.xi    marked with __THROW.  */
684*53ee8cc1Swenshuai.xi extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
685*53ee8cc1Swenshuai.xi 		      size_t __n, FILE *__restrict __s) __wur;
686*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
687*53ee8cc1Swenshuai.xi 
688*53ee8cc1Swenshuai.xi #ifdef __USE_GNU
689*53ee8cc1Swenshuai.xi /* This function does the same as `fputs' but does not lock the stream.
690*53ee8cc1Swenshuai.xi 
691*53ee8cc1Swenshuai.xi    This function is not part of POSIX and therefore no official
692*53ee8cc1Swenshuai.xi    cancellation point.  But due to similarity with an POSIX interface
693*53ee8cc1Swenshuai.xi    or due to the implementation it is a cancellation point and
694*53ee8cc1Swenshuai.xi    therefore not marked with __THROW.  */
695*53ee8cc1Swenshuai.xi extern int fputs_unlocked (__const char *__restrict __s,
696*53ee8cc1Swenshuai.xi 			   FILE *__restrict __stream);
697*53ee8cc1Swenshuai.xi #endif
698*53ee8cc1Swenshuai.xi 
699*53ee8cc1Swenshuai.xi #ifdef __USE_MISC
700*53ee8cc1Swenshuai.xi /* Faster versions when locking is not necessary.
701*53ee8cc1Swenshuai.xi 
702*53ee8cc1Swenshuai.xi    These functions are not part of POSIX and therefore no official
703*53ee8cc1Swenshuai.xi    cancellation point.  But due to similarity with an POSIX interface
704*53ee8cc1Swenshuai.xi    or due to the implementation they are cancellation points and
705*53ee8cc1Swenshuai.xi    therefore not marked with __THROW.  */
706*53ee8cc1Swenshuai.xi extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
707*53ee8cc1Swenshuai.xi 			      size_t __n, FILE *__restrict __stream) __wur;
708*53ee8cc1Swenshuai.xi extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
709*53ee8cc1Swenshuai.xi 			       size_t __n, FILE *__restrict __stream) __wur;
710*53ee8cc1Swenshuai.xi #endif
711*53ee8cc1Swenshuai.xi 
712*53ee8cc1Swenshuai.xi 
713*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
714*53ee8cc1Swenshuai.xi /* Seek to a certain position on STREAM.
715*53ee8cc1Swenshuai.xi 
716*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
717*53ee8cc1Swenshuai.xi    marked with __THROW.  */
718*53ee8cc1Swenshuai.xi extern int fseek (FILE *__stream, long int __off, int __whence);
719*53ee8cc1Swenshuai.xi /* Return the current position of STREAM.
720*53ee8cc1Swenshuai.xi 
721*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
722*53ee8cc1Swenshuai.xi    marked with __THROW.  */
723*53ee8cc1Swenshuai.xi extern long int ftell (FILE *__stream) __wur;
724*53ee8cc1Swenshuai.xi /* Rewind to the beginning of STREAM.
725*53ee8cc1Swenshuai.xi 
726*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
727*53ee8cc1Swenshuai.xi    marked with __THROW.  */
728*53ee8cc1Swenshuai.xi extern void rewind (FILE *__stream);
729*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
730*53ee8cc1Swenshuai.xi 
731*53ee8cc1Swenshuai.xi /* The Single Unix Specification, Version 2, specifies an alternative,
732*53ee8cc1Swenshuai.xi    more adequate interface for the two functions above which deal with
733*53ee8cc1Swenshuai.xi    file offset.  `long int' is not the right type.  These definitions
734*53ee8cc1Swenshuai.xi    are originally defined in the Large File Support API.  */
735*53ee8cc1Swenshuai.xi 
736*53ee8cc1Swenshuai.xi #if defined __USE_LARGEFILE || defined __USE_XOPEN2K
737*53ee8cc1Swenshuai.xi # ifndef __USE_FILE_OFFSET64
738*53ee8cc1Swenshuai.xi /* Seek to a certain position on STREAM.
739*53ee8cc1Swenshuai.xi 
740*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
741*53ee8cc1Swenshuai.xi    marked with __THROW.  */
742*53ee8cc1Swenshuai.xi extern int fseeko (FILE *__stream, __off_t __off, int __whence);
743*53ee8cc1Swenshuai.xi /* Return the current position of STREAM.
744*53ee8cc1Swenshuai.xi 
745*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
746*53ee8cc1Swenshuai.xi    marked with __THROW.  */
747*53ee8cc1Swenshuai.xi extern __off_t ftello (FILE *__stream) __wur;
748*53ee8cc1Swenshuai.xi # else
749*53ee8cc1Swenshuai.xi #  ifdef __REDIRECT
750*53ee8cc1Swenshuai.xi extern int __REDIRECT (fseeko,
751*53ee8cc1Swenshuai.xi 		       (FILE *__stream, __off64_t __off, int __whence),
752*53ee8cc1Swenshuai.xi 		       fseeko64);
753*53ee8cc1Swenshuai.xi extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64);
754*53ee8cc1Swenshuai.xi #  else
755*53ee8cc1Swenshuai.xi #   define fseeko fseeko64
756*53ee8cc1Swenshuai.xi #   define ftello ftello64
757*53ee8cc1Swenshuai.xi #  endif
758*53ee8cc1Swenshuai.xi # endif
759*53ee8cc1Swenshuai.xi #endif
760*53ee8cc1Swenshuai.xi 
761*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
762*53ee8cc1Swenshuai.xi #ifndef __USE_FILE_OFFSET64
763*53ee8cc1Swenshuai.xi /* Get STREAM's position.
764*53ee8cc1Swenshuai.xi 
765*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
766*53ee8cc1Swenshuai.xi    marked with __THROW.  */
767*53ee8cc1Swenshuai.xi extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
768*53ee8cc1Swenshuai.xi /* Set STREAM's position.
769*53ee8cc1Swenshuai.xi 
770*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
771*53ee8cc1Swenshuai.xi    marked with __THROW.  */
772*53ee8cc1Swenshuai.xi extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
773*53ee8cc1Swenshuai.xi #else
774*53ee8cc1Swenshuai.xi # ifdef __REDIRECT
775*53ee8cc1Swenshuai.xi extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
776*53ee8cc1Swenshuai.xi 				 fpos_t *__restrict __pos), fgetpos64);
777*53ee8cc1Swenshuai.xi extern int __REDIRECT (fsetpos,
778*53ee8cc1Swenshuai.xi 		       (FILE *__stream, __const fpos_t *__pos), fsetpos64);
779*53ee8cc1Swenshuai.xi # else
780*53ee8cc1Swenshuai.xi #  define fgetpos fgetpos64
781*53ee8cc1Swenshuai.xi #  define fsetpos fsetpos64
782*53ee8cc1Swenshuai.xi # endif
783*53ee8cc1Swenshuai.xi #endif
784*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
785*53ee8cc1Swenshuai.xi 
786*53ee8cc1Swenshuai.xi #ifdef __USE_LARGEFILE64
787*53ee8cc1Swenshuai.xi extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
788*53ee8cc1Swenshuai.xi extern __off64_t ftello64 (FILE *__stream) __wur;
789*53ee8cc1Swenshuai.xi extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
790*53ee8cc1Swenshuai.xi extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos);
791*53ee8cc1Swenshuai.xi #endif
792*53ee8cc1Swenshuai.xi 
793*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
794*53ee8cc1Swenshuai.xi /* Clear the error and EOF indicators for STREAM.  */
795*53ee8cc1Swenshuai.xi extern void clearerr (FILE *__stream) __THROW;
796*53ee8cc1Swenshuai.xi /* Return the EOF indicator for STREAM.  */
797*53ee8cc1Swenshuai.xi extern int feof (FILE *__stream) __THROW __wur;
798*53ee8cc1Swenshuai.xi /* Return the error indicator for STREAM.  */
799*53ee8cc1Swenshuai.xi extern int ferror (FILE *__stream) __THROW __wur;
800*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
801*53ee8cc1Swenshuai.xi 
802*53ee8cc1Swenshuai.xi #ifdef __USE_MISC
803*53ee8cc1Swenshuai.xi /* Faster versions when locking is not required.  */
804*53ee8cc1Swenshuai.xi extern void clearerr_unlocked (FILE *__stream) __THROW;
805*53ee8cc1Swenshuai.xi extern int feof_unlocked (FILE *__stream) __THROW __wur;
806*53ee8cc1Swenshuai.xi extern int ferror_unlocked (FILE *__stream) __THROW __wur;
807*53ee8cc1Swenshuai.xi #endif
808*53ee8cc1Swenshuai.xi 
809*53ee8cc1Swenshuai.xi 
810*53ee8cc1Swenshuai.xi __BEGIN_NAMESPACE_STD
811*53ee8cc1Swenshuai.xi /* Print a message describing the meaning of the value of errno.
812*53ee8cc1Swenshuai.xi 
813*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
814*53ee8cc1Swenshuai.xi    marked with __THROW.  */
815*53ee8cc1Swenshuai.xi extern void perror (__const char *__s);
816*53ee8cc1Swenshuai.xi __END_NAMESPACE_STD
817*53ee8cc1Swenshuai.xi 
818*53ee8cc1Swenshuai.xi /* Provide the declarations for `sys_errlist' and `sys_nerr' if they
819*53ee8cc1Swenshuai.xi    are available on this system.  Even if available, these variables
820*53ee8cc1Swenshuai.xi    should not be used directly.  The `strerror' function provides
821*53ee8cc1Swenshuai.xi    all the necessary functionality.  */
822*53ee8cc1Swenshuai.xi #include <bits/sys_errlist.h>
823*53ee8cc1Swenshuai.xi 
824*53ee8cc1Swenshuai.xi 
825*53ee8cc1Swenshuai.xi #ifdef	__USE_POSIX
826*53ee8cc1Swenshuai.xi /* Return the system file descriptor for STREAM.  */
827*53ee8cc1Swenshuai.xi extern int fileno (FILE *__stream) __THROW __wur;
828*53ee8cc1Swenshuai.xi #endif /* Use POSIX.  */
829*53ee8cc1Swenshuai.xi 
830*53ee8cc1Swenshuai.xi #ifdef __USE_MISC
831*53ee8cc1Swenshuai.xi /* Faster version when locking is not required.  */
832*53ee8cc1Swenshuai.xi extern int fileno_unlocked (FILE *__stream) __THROW __wur;
833*53ee8cc1Swenshuai.xi #endif
834*53ee8cc1Swenshuai.xi 
835*53ee8cc1Swenshuai.xi 
836*53ee8cc1Swenshuai.xi #if (defined __USE_POSIX2 || defined __USE_SVID  || defined __USE_BSD || \
837*53ee8cc1Swenshuai.xi      defined __USE_MISC)
838*53ee8cc1Swenshuai.xi /* Create a new stream connected to a pipe running the given command.
839*53ee8cc1Swenshuai.xi 
840*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
841*53ee8cc1Swenshuai.xi    marked with __THROW.  */
842*53ee8cc1Swenshuai.xi extern FILE *popen (__const char *__command, __const char *__modes) __wur;
843*53ee8cc1Swenshuai.xi 
844*53ee8cc1Swenshuai.xi /* Close a stream opened by popen and return the status of its child.
845*53ee8cc1Swenshuai.xi 
846*53ee8cc1Swenshuai.xi    This function is a possible cancellation point and therefore not
847*53ee8cc1Swenshuai.xi    marked with __THROW.  */
848*53ee8cc1Swenshuai.xi extern int pclose (FILE *__stream);
849*53ee8cc1Swenshuai.xi #endif
850*53ee8cc1Swenshuai.xi 
851*53ee8cc1Swenshuai.xi 
852*53ee8cc1Swenshuai.xi #ifdef	__USE_POSIX
853*53ee8cc1Swenshuai.xi /* Return the name of the controlling terminal.  */
854*53ee8cc1Swenshuai.xi extern char *ctermid (char *__s) __THROW;
855*53ee8cc1Swenshuai.xi #endif /* Use POSIX.  */
856*53ee8cc1Swenshuai.xi 
857*53ee8cc1Swenshuai.xi 
858*53ee8cc1Swenshuai.xi #ifdef __USE_XOPEN
859*53ee8cc1Swenshuai.xi /* Return the name of the current user.  */
860*53ee8cc1Swenshuai.xi extern char *cuserid (char *__s);
861*53ee8cc1Swenshuai.xi #endif /* Use X/Open, but not issue 6.  */
862*53ee8cc1Swenshuai.xi 
863*53ee8cc1Swenshuai.xi 
864*53ee8cc1Swenshuai.xi #ifdef	__USE_GNU
865*53ee8cc1Swenshuai.xi struct obstack;			/* See <obstack.h>.  */
866*53ee8cc1Swenshuai.xi 
867*53ee8cc1Swenshuai.xi /* Write formatted output to an obstack.  */
868*53ee8cc1Swenshuai.xi extern int obstack_printf (struct obstack *__restrict __obstack,
869*53ee8cc1Swenshuai.xi 			   __const char *__restrict __format, ...)
870*53ee8cc1Swenshuai.xi      __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
871*53ee8cc1Swenshuai.xi extern int obstack_vprintf (struct obstack *__restrict __obstack,
872*53ee8cc1Swenshuai.xi 			    __const char *__restrict __format,
873*53ee8cc1Swenshuai.xi 			    _G_va_list __args)
874*53ee8cc1Swenshuai.xi      __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
875*53ee8cc1Swenshuai.xi #endif /* Use GNU.  */
876*53ee8cc1Swenshuai.xi 
877*53ee8cc1Swenshuai.xi 
878*53ee8cc1Swenshuai.xi #if defined __USE_POSIX || defined __USE_MISC
879*53ee8cc1Swenshuai.xi /* These are defined in POSIX.1:1996.  */
880*53ee8cc1Swenshuai.xi 
881*53ee8cc1Swenshuai.xi /* Acquire ownership of STREAM.  */
882*53ee8cc1Swenshuai.xi extern void flockfile (FILE *__stream) __THROW;
883*53ee8cc1Swenshuai.xi 
884*53ee8cc1Swenshuai.xi /* Try to acquire ownership of STREAM but do not block if it is not
885*53ee8cc1Swenshuai.xi    possible.  */
886*53ee8cc1Swenshuai.xi extern int ftrylockfile (FILE *__stream) __THROW __wur;
887*53ee8cc1Swenshuai.xi 
888*53ee8cc1Swenshuai.xi /* Relinquish the ownership granted for STREAM.  */
889*53ee8cc1Swenshuai.xi extern void funlockfile (FILE *__stream) __THROW;
890*53ee8cc1Swenshuai.xi #endif /* POSIX || misc */
891*53ee8cc1Swenshuai.xi 
892*53ee8cc1Swenshuai.xi #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
893*53ee8cc1Swenshuai.xi /* The X/Open standard requires some functions and variables to be
894*53ee8cc1Swenshuai.xi    declared here which do not belong into this header.  But we have to
895*53ee8cc1Swenshuai.xi    follow.  In GNU mode we don't do this nonsense.  */
896*53ee8cc1Swenshuai.xi # define __need_getopt
897*53ee8cc1Swenshuai.xi # include <getopt.h>
898*53ee8cc1Swenshuai.xi #endif	/* X/Open, but not issue 6 and not for GNU.  */
899*53ee8cc1Swenshuai.xi 
900*53ee8cc1Swenshuai.xi /* If we are compiling with optimizing read this file.  It contains
901*53ee8cc1Swenshuai.xi    several optimizing inline functions and macros.  */
902*53ee8cc1Swenshuai.xi #ifdef __USE_EXTERN_INLINES
903*53ee8cc1Swenshuai.xi # include <bits/stdio.h>
904*53ee8cc1Swenshuai.xi #endif
905*53ee8cc1Swenshuai.xi #if __USE_FORTIFY_LEVEL > 0 && defined __extern_always_inline
906*53ee8cc1Swenshuai.xi # include <bits/stdio2.h>
907*53ee8cc1Swenshuai.xi #endif
908*53ee8cc1Swenshuai.xi #ifdef __LDBL_COMPAT
909*53ee8cc1Swenshuai.xi # include <bits/stdio-ldbl.h>
910*53ee8cc1Swenshuai.xi #endif
911*53ee8cc1Swenshuai.xi 
912*53ee8cc1Swenshuai.xi __END_DECLS
913*53ee8cc1Swenshuai.xi 
914*53ee8cc1Swenshuai.xi #endif /* <stdio.h> included.  */
915*53ee8cc1Swenshuai.xi 
916*53ee8cc1Swenshuai.xi #endif /* !_STDIO_H */
917