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