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