* stdlib/strtod.c: Likewise.
[glibc.git] / libio / stdio.h
blob048a11d60cdb23f221efc09517a215728a1baf49
1 /* This is part of the iostream/stdio library, providing -*- C -*- I/O.
2 Define ANSI C stdio on top of C++ iostreams.
3 Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * ANSI Standard: 4.9 INPUT/OUTPUT <stdio.h>
25 #ifndef _STDIO_H
26 #define _STDIO_H
27 #define _STDIO_USES_IOSTREAM
29 #include <libio.h>
31 #ifndef NULL
32 #ifdef __cplusplus
33 #define NULL 0
34 #else
35 #define NULL (void*)0
36 #endif
37 #endif
39 #ifndef EOF
40 #define EOF (-1)
41 #endif
42 #ifndef BUFSIZ
43 #define BUFSIZ 1024
44 #endif
46 #define _IOFBF 0 /* Fully buffered. */
47 #define _IOLBF 1 /* Line buffered. */
48 #define _IONBF 2 /* No buffering. */
50 #define SEEK_SET 0
51 #define SEEK_CUR 1
52 #define SEEK_END 2
54 /* define size_t. Crud in case <sys/types.h> has defined it. */
55 #if !defined(_SIZE_T) && !defined(_T_SIZE_) && !defined(_T_SIZE)
56 #if !defined(__SIZE_T) && !defined(_SIZE_T_) && !defined(___int_size_t_h)
57 #if !defined(_GCC_SIZE_T) && !defined(_SIZET_)
58 #define _SIZE_T
59 #define _T_SIZE_
60 #define _T_SIZE
61 #define __SIZE_T
62 #define _SIZE_T_
63 #define ___int_size_t_h
64 #define _GCC_SIZE_T
65 #define _SIZET_
66 typedef _IO_size_t size_t;
67 #endif
68 #endif
69 #endif
71 typedef struct _IO_FILE FILE;
72 typedef _IO_fpos_t fpos_t;
74 #include <stdio_lim.h>
76 #define P_tmpdir "/tmp"
78 /* For use by debuggers. These are linked in if printf or fprintf are used. */
79 extern FILE *stdin, *stdout, *stderr; /* TODO */
81 #define stdin _IO_stdin
82 #define stdout _IO_stdout
83 #define stderr _IO_stderr
85 #ifdef __cplusplus
86 extern "C" {
87 #endif
89 #ifndef __P
90 #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
91 #define __P(args) args
92 #else
93 #define __P(args) ()
94 #endif
95 #endif /*!__P*/
97 extern void clearerr __P ((FILE*));
98 extern int fclose __P ((FILE*));
99 extern int feof __P ((FILE*));
100 extern int ferror __P ((FILE*));
101 extern int fflush __P ((FILE*));
102 extern int fgetc __P ((FILE *));
103 extern int fgetpos __P ((FILE* fp, fpos_t *pos));
104 extern char* fgets __P ((char*, int, FILE*));
105 extern FILE* fopen __P ((__const char*, __const char*));
106 extern FILE* fopencookie __P ((void *cookie, __const char *mode,
107 _IO_cookie_io_functions_t io_functions));
108 extern int fprintf __P ((FILE*, __const char* format, ...));
109 extern int fputc __P ((int, FILE*));
110 extern int fputs __P ((__const char *str, FILE *fp));
111 extern size_t fread __P ((void*, size_t, size_t, FILE*));
112 extern FILE* freopen __P ((__const char*, __const char*, FILE*));
113 extern int fscanf __P ((FILE *fp, __const char* format, ...));
114 extern int fseek __P ((FILE* fp, long int offset, int whence));
115 extern int fsetpos __P ((FILE* fp, __const fpos_t *pos));
116 extern long int ftell __P ((FILE* fp));
117 extern size_t fwrite __P ((__const void*, size_t, size_t, FILE*));
118 extern int getc __P ((FILE *));
119 extern int getchar __P ((void));
120 extern char* gets __P ((char*));
121 extern void perror __P ((__const char *));
122 extern int printf __P ((__const char* format, ...));
123 extern int putc __P ((int, FILE *));
124 extern int putchar __P ((int));
125 extern int puts __P ((__const char *str));
126 extern int remove __P ((__const char*));
127 extern int rename __P ((__const char* _old, __const char* _new));
128 extern void rewind __P ((FILE*));
129 extern int scanf __P ((__const char* format, ...));
130 extern void setbuf __P ((FILE*, char*));
131 extern void setlinebuf __P ((FILE*));
132 extern void setbuffer __P ((FILE*, char*, int));
133 extern int setvbuf __P ((FILE*, char*, int mode, size_t size));
134 extern int sprintf __P ((char*, __const char* format, ...));
135 extern int sscanf __P ((__const char* string, __const char* format, ...));
136 extern FILE* tmpfile __P ((void));
137 extern char* tmpnam __P ((char*));
138 #ifdef __USE_SVID
139 extern char *tempnam __P ((__const char *__dir, __const char *__pfx));
140 #endif
141 extern char *__stdio_gen_tempname __P ((__const char *dir, __const char *pfx,
142 int dir_search, size_t *lenptr,
143 FILE **streamptr));
144 extern int ungetc __P ((int c, FILE* fp));
145 extern int vfprintf __P ((FILE *fp, char __const *fmt0, _G_va_list));
146 extern int vprintf __P ((char __const *fmt, _G_va_list));
147 extern int vsprintf __P ((char* string, __const char* format, _G_va_list));
148 extern void __libc_fatal __P ((__const char *__message))
149 __attribute__ ((__noreturn__));
151 #ifndef __STRICT_ANSI__
152 extern int dprintf __P ((int, __const char *, ...));
153 extern int vdprintf __P ((int, __const char *, _G_va_list));
154 extern int vfscanf __P ((FILE*, __const char *, _G_va_list));
155 extern int __vfscanf __P ((FILE*, __const char *, _G_va_list));
156 extern int vscanf __P ((__const char *, _G_va_list));
157 extern int vsscanf __P ((__const char *, __const char *, _G_va_list));
158 extern int __vsscanf __P ((__const char *, __const char *, _G_va_list));
159 #endif
161 #if !defined(__STRICT_ANSI__) || defined(_POSIX_SOURCE)
162 extern FILE *fdopen __P ((int, __const char *));
163 extern int fileno __P ((FILE*));
164 extern FILE* popen __P ((__const char*, __const char*));
165 extern int pclose __P ((FILE*));
167 #define L_ctermid 9
168 #define L_cuserid 9
170 /* Return the name of the controlling terminal. */
171 extern char *ctermid __P ((char *__buf));
173 /* Get character login name of the user. */
174 extern char *cuserid __P ((char * __buf));
175 #endif
177 #ifdef __USE_GNU
178 extern _IO_ssize_t getdelim __P ((char **, size_t *, int, FILE*));
179 extern _IO_ssize_t getline __P ((char **, size_t *, FILE *));
180 extern _IO_ssize_t __getline __P ((char **, size_t *, FILE *));
182 extern int snprintf __P ((char *, size_t, __const char *, ...));
183 extern int __snprintf __P ((char *, size_t, __const char *, ...));
184 extern int vsnprintf __P ((char *, size_t, __const char *, _G_va_list));
185 extern int __vsnprintf __P ((char *, size_t, __const char *, _G_va_list));
187 extern int asprintf __P ((char **, const char *, ...));
188 extern int vasprintf __P ((char **, const char *, _G_va_list));
190 /* Open a stream that writes into a malloc'd buffer that is expanded as
191 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
192 and the number of characters written on fflush or fclose. */
193 extern FILE *open_memstream __P ((char **__bufloc, size_t *__sizeloc));
194 #endif
196 extern int __underflow __P ((struct _IO_FILE*));
197 extern int __overflow __P ((struct _IO_FILE*, int));
199 #ifdef __USE_BSD
200 extern int sys_nerr;
201 extern const char *const sys_errlist[];
202 #endif
203 #ifdef __USE_GNU
204 extern int _sys_nerr;
205 extern const char *const _sys_errlist[];
206 #endif
208 /* Handle locking of streams. */
209 #if defined(_REENTRANT) || defined(_THREAD_SAFE)
210 extern void clearerr_unlocked __P ((FILE *));
211 extern void fileno_unlocked __P ((FILE *));
212 extern void flockfile __P ((FILE *));
213 extern void funlockfile __P ((FILE *));
214 extern int fclose_unlocked __P ((FILE *));
215 extern int fflush_unlocked __P ((FILE *));
216 extern size_t fread_unlocked __P ((void *, size_t, size_t, FILE *));
217 extern size_t fwrite_unlocked __P ((const void *, size_t, size_t, FILE *));
219 # define getc_unlocked(fp) _IO_getc_unlocked (fp)
220 # define getc_locked(fp) _IO_fgetc (fp)
221 # define getchar_unlocked() getc_unlocked (stdin)
222 # define getchar_locked() getc_locked (stdin)
223 # define getc(fp) getc_locked (fp)
225 # define putc_unlocked(c, fp) _IO_putc_unlocked (c, fp)
226 # define putc_locked(c, fp) _IO_putc_locked (c, fp)
227 # define putchar_unlocked(c) putc_unlocked (c, stdout)
228 # define putchar_locked(c) putc_locked (c, stdout)
229 # define putc(c, fp) putc_locked (c, fp)
231 # define feof_unlocked(fp) _IO_feof_unlocked (fp)
232 # define ferror_unlocked(fp) _IO_ferror_unlocked (fp)
234 #else
235 # define getc(fp) _IO_getc_unlocked (fp)
236 # define putc(c, fp) _IO_putc_unlocked (c, fp)
238 #endif /* _REENTRANT || _THREAD_SAFE */
240 #define flockfile(FILE) _IO_flockfile (FILE)
241 #define funlockfile(FILE) _IO_funlockfile (FILE)
243 #define putchar(c) putc (c, stdout)
244 #define getchar() getc (stdin)
247 #ifdef __cplusplus
249 #endif
253 #endif /* !_STDIO_H */