1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A GNU-like <stdio.h>.
5 Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
22 @PRAGMA_SYSTEM_HEADER@
25 #if defined __need_FILE || defined __need___FILE
26 /* Special invocation convention inside glibc header files. */
28 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
31 /* Normal invocation convention. */
35 /* The include_next requires a split double-inclusion guard. */
36 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
44 #if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
45 || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
46 || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \
47 || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@))
48 /* Get off_t and ssize_t. */
49 # include <sys/types.h>
53 /* This feature is available in gcc versions 2.5 and later. */
54 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
55 # define __attribute__(Spec) /* empty */
57 /* The __-protected variants of `format' and `printf' attributes
58 are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
59 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
60 # define __format__ format
61 # define __printf__ printf
66 /* The definition of GL_LINK_WARNING is copied here. */
74 #if @GNULIB_FPRINTF_POSIX@
75 # if @REPLACE_FPRINTF@
76 # define fprintf rpl_fprintf
77 extern int fprintf (FILE *fp, const char *format, ...)
78 __attribute__ ((__format__ (__printf__, 2, 3)));
80 #elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
81 # define fprintf rpl_fprintf
82 extern int fprintf (FILE *fp, const char *format, ...)
83 __attribute__ ((__format__ (__printf__, 2, 3)));
84 #elif defined GNULIB_POSIXCHECK
87 (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
88 "use gnulib module fprintf-posix for portable " \
89 "POSIX compliance"), \
93 #if @GNULIB_VFPRINTF_POSIX@
94 # if @REPLACE_VFPRINTF@
95 # define vfprintf rpl_vfprintf
96 extern int vfprintf (FILE *fp, const char *format, va_list args)
97 __attribute__ ((__format__ (__printf__, 2, 0)));
99 #elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
100 # define vfprintf rpl_vfprintf
101 extern int vfprintf (FILE *fp, const char *format, va_list args)
102 __attribute__ ((__format__ (__printf__, 2, 0)));
103 #elif defined GNULIB_POSIXCHECK
105 # define vfprintf(s,f,a) \
106 (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
107 "use gnulib module vfprintf-posix for portable " \
108 "POSIX compliance"), \
112 #if @GNULIB_PRINTF_POSIX@
113 # if @REPLACE_PRINTF@
114 /* Don't break __attribute__((format(printf,M,N))). */
115 # define printf __printf__
116 extern int printf (const char *format, ...)
117 __attribute__ ((__format__ (__printf__, 1, 2)));
119 #elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
120 /* Don't break __attribute__((format(printf,M,N))). */
121 # define printf __printf__
122 extern int printf (const char *format, ...)
123 __attribute__ ((__format__ (__printf__, 1, 2)));
124 #elif defined GNULIB_POSIXCHECK
127 (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
128 "use gnulib module printf-posix for portable " \
129 "POSIX compliance"), \
131 /* Don't break __attribute__((format(printf,M,N))). */
132 # define format(kind,m,n) format (__##kind##__, m, n)
133 # define __format__(kind,m,n) __format__ (__##kind##__, m, n)
134 # define ____printf____ __printf__
135 # define ____scanf____ __scanf__
136 # define ____strftime____ __strftime__
137 # define ____strfmon____ __strfmon__
140 #if @GNULIB_VPRINTF_POSIX@
141 # if @REPLACE_VPRINTF@
142 # define vprintf rpl_vprintf
143 extern int vprintf (const char *format, va_list args)
144 __attribute__ ((__format__ (__printf__, 1, 0)));
146 #elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
147 # define vprintf rpl_vprintf
148 extern int vprintf (const char *format, va_list args)
149 __attribute__ ((__format__ (__printf__, 1, 0)));
150 #elif defined GNULIB_POSIXCHECK
152 # define vprintf(f,a) \
153 (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
154 "use gnulib module vprintf-posix for portable " \
155 "POSIX compliance"), \
159 #if @GNULIB_SNPRINTF@
160 # if @REPLACE_SNPRINTF@
161 # define snprintf rpl_snprintf
163 # if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
164 extern int snprintf (char *str, size_t size, const char *format, ...)
165 __attribute__ ((__format__ (__printf__, 3, 4)));
167 #elif defined GNULIB_POSIXCHECK
170 (GL_LINK_WARNING ("snprintf is unportable - " \
171 "use gnulib module snprintf for portability"), \
175 #if @GNULIB_VSNPRINTF@
176 # if @REPLACE_VSNPRINTF@
177 # define vsnprintf rpl_vsnprintf
179 # if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
180 extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
181 __attribute__ ((__format__ (__printf__, 3, 0)));
183 #elif defined GNULIB_POSIXCHECK
185 # define vsnprintf(b,s,f,a) \
186 (GL_LINK_WARNING ("vsnprintf is unportable - " \
187 "use gnulib module vsnprintf for portability"), \
188 vsnprintf (b, s, f, a))
191 #if @GNULIB_SPRINTF_POSIX@
192 # if @REPLACE_SPRINTF@
193 # define sprintf rpl_sprintf
194 extern int sprintf (char *str, const char *format, ...)
195 __attribute__ ((__format__ (__printf__, 2, 3)));
197 #elif defined GNULIB_POSIXCHECK
200 (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
201 "use gnulib module sprintf-posix for portable " \
202 "POSIX compliance"), \
206 #if @GNULIB_VSPRINTF_POSIX@
207 # if @REPLACE_VSPRINTF@
208 # define vsprintf rpl_vsprintf
209 extern int vsprintf (char *str, const char *format, va_list args)
210 __attribute__ ((__format__ (__printf__, 2, 0)));
212 #elif defined GNULIB_POSIXCHECK
214 # define vsprintf(b,f,a) \
215 (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
216 "use gnulib module vsprintf-posix for portable " \
217 "POSIX compliance"), \
221 #if @GNULIB_VASPRINTF@
222 # if @REPLACE_VASPRINTF@
223 # define asprintf rpl_asprintf
224 # define vasprintf rpl_vasprintf
226 # if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
227 /* Write formatted output to a string dynamically allocated with malloc().
228 If the memory allocation succeeds, store the address of the string in
229 *RESULT and return the number of resulting bytes, excluding the trailing
230 NUL. Upon memory allocation error, or some other error, return -1. */
231 extern int asprintf (char **result, const char *format, ...)
232 __attribute__ ((__format__ (__printf__, 2, 3)));
233 extern int vasprintf (char **result, const char *format, va_list args)
234 __attribute__ ((__format__ (__printf__, 2, 0)));
238 #if @GNULIB_OBSTACK_PRINTF@
239 # if @REPLACE_OBSTACK_PRINTF@
240 # define obstack_printf rpl_osbtack_printf
241 # define obstack_vprintf rpl_obstack_vprintf
243 # if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@
245 /* Grow an obstack with formatted output. Return the number of
246 bytes added to OBS. No trailing nul byte is added, and the
247 object should be closed with obstack_finish before use. Upon
248 memory allocation error, call obstack_alloc_failed_handler. Upon
249 other error, return -1. */
250 extern int obstack_printf (struct obstack *obs, const char *format, ...)
251 __attribute__ ((__format__ (__printf__, 2, 3)));
252 extern int obstack_vprintf (struct obstack *obs, const char *format,
254 __attribute__ ((__format__ (__printf__, 2, 0)));
261 # define fopen rpl_fopen
262 extern FILE * fopen (const char *filename, const char *mode);
264 #elif defined GNULIB_POSIXCHECK
266 # define fopen(f,m) \
267 (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
268 "use gnulib module fopen for portability"), \
273 # if @REPLACE_FREOPEN@
275 # define freopen rpl_freopen
276 extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
278 #elif defined GNULIB_POSIXCHECK
280 # define freopen(f,m,s) \
281 (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
282 "use gnulib module freopen for portability"), \
287 # if @REPLACE_FSEEKO@
288 /* Provide fseek, fseeko functions that are aware of a preceding
289 fflush(), and which detect pipes. */
290 # define fseeko rpl_fseeko
291 extern int fseeko (FILE *fp, off_t offset, int whence);
292 # define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
294 #elif defined GNULIB_POSIXCHECK
296 # define fseeko(f,o,w) \
297 (GL_LINK_WARNING ("fseeko is unportable - " \
298 "use gnulib module fseeko for portability"), \
302 #if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
303 extern int rpl_fseek (FILE *fp, long offset, int whence);
305 # if defined GNULIB_POSIXCHECK
306 # define fseek(f,o,w) \
307 (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
308 "on 32-bit platforms - " \
309 "use fseeko function for handling of large files"), \
312 # define fseek rpl_fseek
314 #elif defined GNULIB_POSIXCHECK
316 # define fseek(f,o,w) \
317 (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
318 "on 32-bit platforms - " \
319 "use fseeko function for handling of large files"), \
325 # if @REPLACE_FTELLO@
326 # define ftello rpl_ftello
327 extern off_t ftello (FILE *fp);
328 # define ftell(fp) ftello (fp)
330 #elif defined GNULIB_POSIXCHECK
333 (GL_LINK_WARNING ("ftello is unportable - " \
334 "use gnulib module ftello for portability"), \
338 #if @GNULIB_FTELL@ && @REPLACE_FTELL@
339 extern long rpl_ftell (FILE *fp);
341 # if GNULIB_POSIXCHECK
343 (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
344 "on 32-bit platforms - " \
345 "use ftello function for handling of large files"), \
348 # define ftell rpl_ftell
350 #elif defined GNULIB_POSIXCHECK
353 (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
354 "on 32-bit platforms - " \
355 "use ftello function for handling of large files"), \
361 # if @REPLACE_FFLUSH@
362 # define fflush rpl_fflush
363 /* Flush all pending data on STREAM according to POSIX rules. Both
364 output and seekable input streams are supported.
365 Note! LOSS OF DATA can occur if fflush is applied on an input stream
366 that is _not_seekable_ or on an update stream that is _not_seekable_
367 and in which the most recent operation was input. Seekability can
368 be tested with lseek(fileno(fp),0,SEEK_CUR). */
369 extern int fflush (FILE *gl_stream);
371 #elif defined GNULIB_POSIXCHECK
374 (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
375 "use gnulib module fflush for portable " \
376 "POSIX compliance"), \
381 # if @REPLACE_FCLOSE@
382 # define fclose rpl_fclose
383 /* Close STREAM and its underlying file descriptor. */
384 extern int fclose (FILE *stream);
386 #elif defined GNULIB_POSIXCHECK
389 (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
390 "use gnulib module fclose for portable " \
391 "POSIX compliance"), \
395 #if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
397 # define fputc rpl_fputc
398 extern int fputc (int c, FILE *stream);
401 #if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
403 # define putc rpl_fputc
404 extern int putc (int c, FILE *stream);
407 #if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
409 # define putchar rpl_putchar
410 extern int putchar (int c);
413 #if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
415 # define fputs rpl_fputs
416 extern int fputs (const char *string, FILE *stream);
419 #if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
421 # define puts rpl_puts
422 extern int puts (const char *string);
425 #if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
427 # define fwrite rpl_fwrite
428 extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
431 #if @GNULIB_GETDELIM@
432 # if !@HAVE_DECL_GETDELIM@
433 /* Read input, up to (and including) the next occurrence of DELIMITER, from
434 STREAM, store it in *LINEPTR (and NUL-terminate it).
435 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
436 bytes of space. It is realloc'd as necessary.
437 Return the number of bytes read and stored at *LINEPTR (not including the
438 NUL terminator), or -1 on error or EOF. */
439 extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
442 #elif defined GNULIB_POSIXCHECK
444 # define getdelim(l, s, d, f) \
445 (GL_LINK_WARNING ("getdelim is unportable - " \
446 "use gnulib module getdelim for portability"), \
447 getdelim (l, s, d, f))
451 # if @REPLACE_GETLINE@
453 # define getline rpl_getline
455 # if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
456 /* Read a line, up to (and including) the next newline, from STREAM, store it
457 in *LINEPTR (and NUL-terminate it).
458 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
459 bytes of space. It is realloc'd as necessary.
460 Return the number of bytes read and stored at *LINEPTR (not including the
461 NUL terminator), or -1 on error or EOF. */
462 extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
464 #elif defined GNULIB_POSIXCHECK
466 # define getline(l, s, f) \
467 (GL_LINK_WARNING ("getline is unportable - " \
468 "use gnulib module getline for portability"), \
473 # if @REPLACE_PERROR@
474 # define perror rpl_perror
475 /* Print a message to standard error, describing the value of ERRNO,
476 (if STRING is not NULL and not empty) prefixed with STRING and ": ",
477 and terminated with a newline. */
478 extern void perror (const char *string);
480 #elif defined GNULIB_POSIXCHECK
483 (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
484 "use gnulib module perror for portability"), \
492 #endif /* _GL_STDIO_H */
493 #endif /* _GL_STDIO_H */