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-2009 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 @REPLACE_DPRINTF@
75 # define dprintf rpl_dprintf
77 # if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@
78 extern int dprintf (int fd, const char *format, ...)
79 __attribute__ ((__format__ (__printf__, 2, 3)));
81 #elif defined GNULIB_POSIXCHECK
83 # define dprintf(d,f,a) \
84 (GL_LINK_WARNING ("dprintf is unportable - " \
85 "use gnulib module dprintf for portability"), \
91 # define fclose rpl_fclose
92 /* Close STREAM and its underlying file descriptor. */
93 extern int fclose (FILE *stream);
95 #elif defined GNULIB_POSIXCHECK
98 (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
99 "use gnulib module fclose for portable " \
100 "POSIX compliance"), \
105 # if @REPLACE_FFLUSH@
106 # define fflush rpl_fflush
107 /* Flush all pending data on STREAM according to POSIX rules. Both
108 output and seekable input streams are supported.
109 Note! LOSS OF DATA can occur if fflush is applied on an input stream
110 that is _not_seekable_ or on an update stream that is _not_seekable_
111 and in which the most recent operation was input. Seekability can
112 be tested with lseek(fileno(fp),0,SEEK_CUR). */
113 extern int fflush (FILE *gl_stream);
115 #elif defined GNULIB_POSIXCHECK
118 (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
119 "use gnulib module fflush for portable " \
120 "POSIX compliance"), \
127 # define fopen rpl_fopen
128 extern FILE * fopen (const char *filename, const char *mode);
130 #elif defined GNULIB_POSIXCHECK
132 # define fopen(f,m) \
133 (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
134 "use gnulib module fopen for portability"), \
138 #if @GNULIB_FPRINTF_POSIX@
139 # if @REPLACE_FPRINTF@
140 # define fprintf rpl_fprintf
141 extern int fprintf (FILE *fp, const char *format, ...)
142 __attribute__ ((__format__ (__printf__, 2, 3)));
144 #elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
145 # define fprintf rpl_fprintf
146 extern int fprintf (FILE *fp, const char *format, ...)
147 __attribute__ ((__format__ (__printf__, 2, 3)));
148 #elif defined GNULIB_POSIXCHECK
151 (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
152 "use gnulib module fprintf-posix for portable " \
153 "POSIX compliance"), \
158 # if @REPLACE_FPURGE@
159 # define fpurge rpl_fpurge
161 # if @REPLACE_FPURGE@ || !@HAVE_DECL_FPURGE@
162 /* Discard all pending buffered I/O data on STREAM.
163 STREAM must not be wide-character oriented.
164 When discarding pending output, the file position is set back to where it
165 was before the write calls. When discarding pending input, the file
166 position is advanced to match the end of the previously read input.
167 Return 0 if successful. Upon error, return -1 and set errno. */
168 extern int fpurge (FILE *gl_stream);
170 #elif defined GNULIB_POSIXCHECK
173 (GL_LINK_WARNING ("fpurge is not always present - " \
174 "use gnulib module fpurge for portability"), \
178 #if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
180 # define fputc rpl_fputc
181 extern int fputc (int c, FILE *stream);
184 #if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
186 # define fputs rpl_fputs
187 extern int fputs (const char *string, FILE *stream);
191 # if @REPLACE_FREOPEN@
193 # define freopen rpl_freopen
194 extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
196 #elif defined GNULIB_POSIXCHECK
198 # define freopen(f,m,s) \
199 (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
200 "use gnulib module freopen for portability"), \
204 #if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
205 extern int rpl_fseek (FILE *fp, long offset, int whence);
207 # if defined GNULIB_POSIXCHECK
208 # define fseek(f,o,w) \
209 (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
210 "on 32-bit platforms - " \
211 "use fseeko function for handling of large files"), \
214 # define fseek rpl_fseek
216 #elif defined GNULIB_POSIXCHECK
218 # define fseek(f,o,w) \
219 (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
220 "on 32-bit platforms - " \
221 "use fseeko function for handling of large files"), \
227 # if @REPLACE_FSEEKO@
228 /* Provide fseek, fseeko functions that are aware of a preceding
229 fflush(), and which detect pipes. */
230 # define fseeko rpl_fseeko
231 extern int fseeko (FILE *fp, off_t offset, int whence);
234 # define fseek(f,o,w) \
235 (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
236 "on 32-bit platforms - " \
237 "use fseeko function for handling of large files"), \
241 #elif defined GNULIB_POSIXCHECK
243 # define fseeko(f,o,w) \
244 (GL_LINK_WARNING ("fseeko is unportable - " \
245 "use gnulib module fseeko for portability"), \
249 #if @GNULIB_FTELL@ && @REPLACE_FTELL@
250 extern long rpl_ftell (FILE *fp);
252 # if GNULIB_POSIXCHECK
254 (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
255 "on 32-bit platforms - " \
256 "use ftello function for handling of large files"), \
259 # define ftell rpl_ftell
261 #elif defined GNULIB_POSIXCHECK
264 (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
265 "on 32-bit platforms - " \
266 "use ftello function for handling of large files"), \
272 # if @REPLACE_FTELLO@
273 # define ftello rpl_ftello
274 extern off_t ftello (FILE *fp);
278 (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
279 "on 32-bit platforms - " \
280 "use ftello function for handling of large files"), \
284 #elif defined GNULIB_POSIXCHECK
287 (GL_LINK_WARNING ("ftello is unportable - " \
288 "use gnulib module ftello for portability"), \
292 #if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
294 # define fwrite rpl_fwrite
295 extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
298 #if @GNULIB_GETDELIM@
299 # if !@HAVE_DECL_GETDELIM@
300 /* Read input, up to (and including) the next occurrence of DELIMITER, from
301 STREAM, store it in *LINEPTR (and NUL-terminate it).
302 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
303 bytes of space. It is realloc'd as necessary.
304 Return the number of bytes read and stored at *LINEPTR (not including the
305 NUL terminator), or -1 on error or EOF. */
306 extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
309 #elif defined GNULIB_POSIXCHECK
311 # define getdelim(l, s, d, f) \
312 (GL_LINK_WARNING ("getdelim is unportable - " \
313 "use gnulib module getdelim for portability"), \
314 getdelim (l, s, d, f))
318 # if @REPLACE_GETLINE@
320 # define getline rpl_getline
322 # if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
323 /* Read a line, up to (and including) the next newline, from STREAM, store it
324 in *LINEPTR (and NUL-terminate it).
325 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
326 bytes of space. It is realloc'd as necessary.
327 Return the number of bytes read and stored at *LINEPTR (not including the
328 NUL terminator), or -1 on error or EOF. */
329 extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
331 #elif defined GNULIB_POSIXCHECK
333 # define getline(l, s, f) \
334 (GL_LINK_WARNING ("getline is unportable - " \
335 "use gnulib module getline for portability"), \
339 #if @GNULIB_OBSTACK_PRINTF@
340 # if @REPLACE_OBSTACK_PRINTF@
341 # define obstack_printf rpl_osbtack_printf
342 # define obstack_vprintf rpl_obstack_vprintf
344 # if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@
346 /* Grow an obstack with formatted output. Return the number of
347 bytes added to OBS. No trailing nul byte is added, and the
348 object should be closed with obstack_finish before use. Upon
349 memory allocation error, call obstack_alloc_failed_handler. Upon
350 other error, return -1. */
351 extern int obstack_printf (struct obstack *obs, const char *format, ...)
352 __attribute__ ((__format__ (__printf__, 2, 3)));
353 extern int obstack_vprintf (struct obstack *obs, const char *format,
355 __attribute__ ((__format__ (__printf__, 2, 0)));
360 # if @REPLACE_PERROR@
361 # define perror rpl_perror
362 /* Print a message to standard error, describing the value of ERRNO,
363 (if STRING is not NULL and not empty) prefixed with STRING and ": ",
364 and terminated with a newline. */
365 extern void perror (const char *string);
367 #elif defined GNULIB_POSIXCHECK
370 (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
371 "use gnulib module perror for portability"), \
378 # define popen rpl_popen
379 extern FILE *popen (const char *cmd, const char *mode);
381 #elif defined GNULIB_POSIXCHECK
383 # define popen(c,m) \
384 (GL_LINK_WARNING ("popen is buggy on some platforms - " \
385 "use gnulib module popen or pipe for more portability"), \
389 #if @GNULIB_PRINTF_POSIX@
390 # if @REPLACE_PRINTF@
391 /* Don't break __attribute__((format(printf,M,N))). */
392 # define printf __printf__
393 extern int printf (const char *format, ...)
394 __attribute__ ((__format__ (__printf__, 1, 2)));
396 #elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
397 /* Don't break __attribute__((format(printf,M,N))). */
398 # define printf __printf__
399 extern int printf (const char *format, ...)
400 __attribute__ ((__format__ (__printf__, 1, 2)));
401 #elif defined GNULIB_POSIXCHECK
404 (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
405 "use gnulib module printf-posix for portable " \
406 "POSIX compliance"), \
408 /* Don't break __attribute__((format(printf,M,N))). */
409 # define format(kind,m,n) format (__##kind##__, m, n)
410 # define __format__(kind,m,n) __format__ (__##kind##__, m, n)
411 # define ____printf____ __printf__
412 # define ____scanf____ __scanf__
413 # define ____strftime____ __strftime__
414 # define ____strfmon____ __strfmon__
417 #if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
419 # define putc rpl_fputc
420 extern int putc (int c, FILE *stream);
423 #if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
425 # define putchar rpl_putchar
426 extern int putchar (int c);
429 #if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
431 # define puts rpl_puts
432 extern int puts (const char *string);
436 # if @REPLACE_REMOVE@
438 # define remove rpl_remove
439 extern int remove (const char *name);
441 #elif defined GNULIB_POSIXCHECK
444 (GL_LINK_WARNING ("remove cannot handle directories on some platforms - " \
445 "use gnulib module remove for more portability"), \
450 # if @REPLACE_RENAME@
452 # define rename rpl_rename
453 extern int rename (const char *old, const char *new);
455 #elif defined GNULIB_POSIXCHECK
457 # define rename(o,n) \
458 (GL_LINK_WARNING ("rename is buggy on some platforms - " \
459 "use gnulib module rename for more portability"), \
463 #if @GNULIB_RENAMEAT@
464 # if @REPLACE_RENAMEAT@
466 # define renameat rpl_renameat
468 # if !@HAVE_RENAMEAT@ || @REPLACE_RENAMEAT@
469 extern int renameat (int fd1, char const *file1, int fd2, char const *file2);
471 #elif defined GNULIB_POSIXCHECK
473 # define renameat(d1,f1,d2,f2) \
474 (GL_LINK_WARNING ("renameat is not portable - " \
475 "use gnulib module renameat for portability"), \
476 renameat (d1, f1, d2, f2))
479 #if @GNULIB_SNPRINTF@
480 # if @REPLACE_SNPRINTF@
481 # define snprintf rpl_snprintf
483 # if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
484 extern int snprintf (char *str, size_t size, const char *format, ...)
485 __attribute__ ((__format__ (__printf__, 3, 4)));
487 #elif defined GNULIB_POSIXCHECK
490 (GL_LINK_WARNING ("snprintf is unportable - " \
491 "use gnulib module snprintf for portability"), \
495 #if @GNULIB_SPRINTF_POSIX@
496 # if @REPLACE_SPRINTF@
497 # define sprintf rpl_sprintf
498 extern int sprintf (char *str, const char *format, ...)
499 __attribute__ ((__format__ (__printf__, 2, 3)));
501 #elif defined GNULIB_POSIXCHECK
504 (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
505 "use gnulib module sprintf-posix for portable " \
506 "POSIX compliance"), \
510 #if @GNULIB_VASPRINTF@
511 # if @REPLACE_VASPRINTF@
512 # define asprintf rpl_asprintf
513 # define vasprintf rpl_vasprintf
515 # if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
516 /* Write formatted output to a string dynamically allocated with malloc().
517 If the memory allocation succeeds, store the address of the string in
518 *RESULT and return the number of resulting bytes, excluding the trailing
519 NUL. Upon memory allocation error, or some other error, return -1. */
520 extern int asprintf (char **result, const char *format, ...)
521 __attribute__ ((__format__ (__printf__, 2, 3)));
522 extern int vasprintf (char **result, const char *format, va_list args)
523 __attribute__ ((__format__ (__printf__, 2, 0)));
527 #if @GNULIB_VDPRINTF@
528 # if @REPLACE_VDPRINTF@
529 # define vdprintf rpl_vdprintf
531 # if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@
532 extern int vdprintf (int fd, const char *format, va_list args)
533 __attribute__ ((__format__ (__printf__, 2, 0)));
535 #elif defined GNULIB_POSIXCHECK
537 # define vdprintf(d,f,a) \
538 (GL_LINK_WARNING ("vdprintf is unportable - " \
539 "use gnulib module vdprintf for portability"), \
543 #if @GNULIB_VFPRINTF_POSIX@
544 # if @REPLACE_VFPRINTF@
545 # define vfprintf rpl_vfprintf
546 extern int vfprintf (FILE *fp, const char *format, va_list args)
547 __attribute__ ((__format__ (__printf__, 2, 0)));
549 #elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
550 # define vfprintf rpl_vfprintf
551 extern int vfprintf (FILE *fp, const char *format, va_list args)
552 __attribute__ ((__format__ (__printf__, 2, 0)));
553 #elif defined GNULIB_POSIXCHECK
555 # define vfprintf(s,f,a) \
556 (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
557 "use gnulib module vfprintf-posix for portable " \
558 "POSIX compliance"), \
562 #if @GNULIB_VPRINTF_POSIX@
563 # if @REPLACE_VPRINTF@
564 # define vprintf rpl_vprintf
565 extern int vprintf (const char *format, va_list args)
566 __attribute__ ((__format__ (__printf__, 1, 0)));
568 #elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
569 # define vprintf rpl_vprintf
570 extern int vprintf (const char *format, va_list args)
571 __attribute__ ((__format__ (__printf__, 1, 0)));
572 #elif defined GNULIB_POSIXCHECK
574 # define vprintf(f,a) \
575 (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
576 "use gnulib module vprintf-posix for portable " \
577 "POSIX compliance"), \
581 #if @GNULIB_VSNPRINTF@
582 # if @REPLACE_VSNPRINTF@
583 # define vsnprintf rpl_vsnprintf
585 # if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
586 extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
587 __attribute__ ((__format__ (__printf__, 3, 0)));
589 #elif defined GNULIB_POSIXCHECK
591 # define vsnprintf(b,s,f,a) \
592 (GL_LINK_WARNING ("vsnprintf is unportable - " \
593 "use gnulib module vsnprintf for portability"), \
594 vsnprintf (b, s, f, a))
597 #if @GNULIB_VSPRINTF_POSIX@
598 # if @REPLACE_VSPRINTF@
599 # define vsprintf rpl_vsprintf
600 extern int vsprintf (char *str, const char *format, va_list args)
601 __attribute__ ((__format__ (__printf__, 2, 0)));
603 #elif defined GNULIB_POSIXCHECK
605 # define vsprintf(b,f,a) \
606 (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
607 "use gnulib module vsprintf-posix for portable " \
608 "POSIX compliance"), \
616 #endif /* _GL_STDIO_H */
617 #endif /* _GL_STDIO_H */