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"), \
222 # if @REPLACE_DPRINTF@
223 # define dprintf rpl_dprintf
225 # if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@
226 extern int dprintf (int fd, const char *format, ...)
227 __attribute__ ((__format__ (__printf__, 2, 3)));
229 #elif defined GNULIB_POSIXCHECK
231 # define dprintf(d,f,a) \
232 (GL_LINK_WARNING ("dprintf is unportable - " \
233 "use gnulib module dprintf for portability"), \
237 #if @GNULIB_VDPRINTF@
238 # if @REPLACE_VDPRINTF@
239 # define vdprintf rpl_vdprintf
241 # if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@
242 extern int vdprintf (int fd, const char *format, va_list args)
243 __attribute__ ((__format__ (__printf__, 2, 0)));
245 #elif defined GNULIB_POSIXCHECK
247 # define vdprintf(d,f,a) \
248 (GL_LINK_WARNING ("vdprintf is unportable - " \
249 "use gnulib module vdprintf for portability"), \
253 #if @GNULIB_VASPRINTF@
254 # if @REPLACE_VASPRINTF@
255 # define asprintf rpl_asprintf
256 # define vasprintf rpl_vasprintf
258 # if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
259 /* Write formatted output to a string dynamically allocated with malloc().
260 If the memory allocation succeeds, store the address of the string in
261 *RESULT and return the number of resulting bytes, excluding the trailing
262 NUL. Upon memory allocation error, or some other error, return -1. */
263 extern int asprintf (char **result, const char *format, ...)
264 __attribute__ ((__format__ (__printf__, 2, 3)));
265 extern int vasprintf (char **result, const char *format, va_list args)
266 __attribute__ ((__format__ (__printf__, 2, 0)));
270 #if @GNULIB_OBSTACK_PRINTF@
271 # if @REPLACE_OBSTACK_PRINTF@
272 # define obstack_printf rpl_osbtack_printf
273 # define obstack_vprintf rpl_obstack_vprintf
275 # if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@
277 /* Grow an obstack with formatted output. Return the number of
278 bytes added to OBS. No trailing nul byte is added, and the
279 object should be closed with obstack_finish before use. Upon
280 memory allocation error, call obstack_alloc_failed_handler. Upon
281 other error, return -1. */
282 extern int obstack_printf (struct obstack *obs, const char *format, ...)
283 __attribute__ ((__format__ (__printf__, 2, 3)));
284 extern int obstack_vprintf (struct obstack *obs, const char *format,
286 __attribute__ ((__format__ (__printf__, 2, 0)));
293 # define fopen rpl_fopen
294 extern FILE * fopen (const char *filename, const char *mode);
296 #elif defined GNULIB_POSIXCHECK
298 # define fopen(f,m) \
299 (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
300 "use gnulib module fopen for portability"), \
305 # if @REPLACE_FREOPEN@
307 # define freopen rpl_freopen
308 extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
310 #elif defined GNULIB_POSIXCHECK
312 # define freopen(f,m,s) \
313 (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
314 "use gnulib module freopen for portability"), \
319 # if @REPLACE_FSEEKO@
320 /* Provide fseek, fseeko functions that are aware of a preceding
321 fflush(), and which detect pipes. */
322 # define fseeko rpl_fseeko
323 extern int fseeko (FILE *fp, off_t offset, int whence);
324 # define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
326 #elif defined GNULIB_POSIXCHECK
328 # define fseeko(f,o,w) \
329 (GL_LINK_WARNING ("fseeko is unportable - " \
330 "use gnulib module fseeko for portability"), \
334 #if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
335 extern int rpl_fseek (FILE *fp, long offset, int whence);
337 # if defined GNULIB_POSIXCHECK
338 # define fseek(f,o,w) \
339 (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
340 "on 32-bit platforms - " \
341 "use fseeko function for handling of large files"), \
344 # define fseek rpl_fseek
346 #elif defined GNULIB_POSIXCHECK
348 # define fseek(f,o,w) \
349 (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
350 "on 32-bit platforms - " \
351 "use fseeko function for handling of large files"), \
357 # if @REPLACE_FTELLO@
358 # define ftello rpl_ftello
359 extern off_t ftello (FILE *fp);
360 # define ftell(fp) ftello (fp)
362 #elif defined GNULIB_POSIXCHECK
365 (GL_LINK_WARNING ("ftello is unportable - " \
366 "use gnulib module ftello for portability"), \
370 #if @GNULIB_FTELL@ && @REPLACE_FTELL@
371 extern long rpl_ftell (FILE *fp);
373 # if GNULIB_POSIXCHECK
375 (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
376 "on 32-bit platforms - " \
377 "use ftello function for handling of large files"), \
380 # define ftell rpl_ftell
382 #elif defined GNULIB_POSIXCHECK
385 (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
386 "on 32-bit platforms - " \
387 "use ftello function for handling of large files"), \
393 # if @REPLACE_FFLUSH@
394 # define fflush rpl_fflush
395 /* Flush all pending data on STREAM according to POSIX rules. Both
396 output and seekable input streams are supported.
397 Note! LOSS OF DATA can occur if fflush is applied on an input stream
398 that is _not_seekable_ or on an update stream that is _not_seekable_
399 and in which the most recent operation was input. Seekability can
400 be tested with lseek(fileno(fp),0,SEEK_CUR). */
401 extern int fflush (FILE *gl_stream);
403 #elif defined GNULIB_POSIXCHECK
406 (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
407 "use gnulib module fflush for portable " \
408 "POSIX compliance"), \
413 # if @REPLACE_FCLOSE@
414 # define fclose rpl_fclose
415 /* Close STREAM and its underlying file descriptor. */
416 extern int fclose (FILE *stream);
418 #elif defined GNULIB_POSIXCHECK
421 (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
422 "use gnulib module fclose for portable " \
423 "POSIX compliance"), \
427 #if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
429 # define fputc rpl_fputc
430 extern int fputc (int c, FILE *stream);
433 #if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
435 # define putc rpl_fputc
436 extern int putc (int c, FILE *stream);
439 #if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
441 # define putchar rpl_putchar
442 extern int putchar (int c);
445 #if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
447 # define fputs rpl_fputs
448 extern int fputs (const char *string, FILE *stream);
451 #if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
453 # define puts rpl_puts
454 extern int puts (const char *string);
457 #if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
459 # define fwrite rpl_fwrite
460 extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
463 #if @GNULIB_GETDELIM@
464 # if !@HAVE_DECL_GETDELIM@
465 /* Read input, up to (and including) the next occurrence of DELIMITER, from
466 STREAM, store it in *LINEPTR (and NUL-terminate it).
467 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
468 bytes of space. It is realloc'd as necessary.
469 Return the number of bytes read and stored at *LINEPTR (not including the
470 NUL terminator), or -1 on error or EOF. */
471 extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
474 #elif defined GNULIB_POSIXCHECK
476 # define getdelim(l, s, d, f) \
477 (GL_LINK_WARNING ("getdelim is unportable - " \
478 "use gnulib module getdelim for portability"), \
479 getdelim (l, s, d, f))
483 # if @REPLACE_GETLINE@
485 # define getline rpl_getline
487 # if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
488 /* Read a line, up to (and including) the next newline, from STREAM, store it
489 in *LINEPTR (and NUL-terminate it).
490 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
491 bytes of space. It is realloc'd as necessary.
492 Return the number of bytes read and stored at *LINEPTR (not including the
493 NUL terminator), or -1 on error or EOF. */
494 extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
496 #elif defined GNULIB_POSIXCHECK
498 # define getline(l, s, f) \
499 (GL_LINK_WARNING ("getline is unportable - " \
500 "use gnulib module getline for portability"), \
505 # if @REPLACE_PERROR@
506 # define perror rpl_perror
507 /* Print a message to standard error, describing the value of ERRNO,
508 (if STRING is not NULL and not empty) prefixed with STRING and ": ",
509 and terminated with a newline. */
510 extern void perror (const char *string);
512 #elif defined GNULIB_POSIXCHECK
515 (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
516 "use gnulib module perror for portability"), \
524 #endif /* _GL_STDIO_H */
525 #endif /* _GL_STDIO_H */