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. */
21 #if defined __need_FILE || defined __need___FILE
22 /* Special invocation convention inside glibc header files. */
24 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
27 /* Normal invocation convention. */
31 /* The include_next requires a split double-inclusion guard. */
32 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
40 #if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
41 || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
42 || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \
43 || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@))
44 /* Get off_t and ssize_t. */
45 # include <sys/types.h>
49 /* This feature is available in gcc versions 2.5 and later. */
50 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
51 # define __attribute__(Spec) /* empty */
53 /* The __-protected variants of `format' and `printf' attributes
54 are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
55 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
56 # define __format__ format
57 # define __printf__ printf
62 /* The definition of GL_LINK_WARNING is copied here. */
70 #if @GNULIB_FPRINTF_POSIX@
71 # if @REPLACE_FPRINTF@
72 # define fprintf rpl_fprintf
73 extern int fprintf (FILE *fp, const char *format, ...)
74 __attribute__ ((__format__ (__printf__, 2, 3)));
76 #elif defined GNULIB_POSIXCHECK
79 (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
80 "use gnulib module fprintf-posix for portable " \
81 "POSIX compliance"), \
85 #if @GNULIB_VFPRINTF_POSIX@
86 # if @REPLACE_VFPRINTF@
87 # define vfprintf rpl_vfprintf
88 extern int vfprintf (FILE *fp, const char *format, va_list args)
89 __attribute__ ((__format__ (__printf__, 2, 0)));
91 #elif defined GNULIB_POSIXCHECK
93 # define vfprintf(s,f,a) \
94 (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
95 "use gnulib module vfprintf-posix for portable " \
96 "POSIX compliance"), \
100 #if @GNULIB_PRINTF_POSIX@
101 # if @REPLACE_PRINTF@
102 /* Don't break __attribute__((format(printf,M,N))). */
103 # define printf __printf__
104 extern int printf (const char *format, ...)
105 __attribute__ ((__format__ (__printf__, 1, 2)));
107 #elif defined GNULIB_POSIXCHECK
110 (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
111 "use gnulib module printf-posix for portable " \
112 "POSIX compliance"), \
114 /* Don't break __attribute__((format(printf,M,N))). */
115 # define format(kind,m,n) format (__##kind##__, m, n)
116 # define __format__(kind,m,n) __format__ (__##kind##__, m, n)
117 # define ____printf____ __printf__
118 # define ____scanf____ __scanf__
119 # define ____strftime____ __strftime__
120 # define ____strfmon____ __strfmon__
123 #if @GNULIB_VPRINTF_POSIX@
124 # if @REPLACE_VPRINTF@
125 # define vprintf rpl_vprintf
126 extern int vprintf (const char *format, va_list args)
127 __attribute__ ((__format__ (__printf__, 1, 0)));
129 #elif defined GNULIB_POSIXCHECK
131 # define vprintf(f,a) \
132 (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
133 "use gnulib module vprintf-posix for portable " \
134 "POSIX compliance"), \
138 #if @GNULIB_SNPRINTF@
139 # if @REPLACE_SNPRINTF@
140 # define snprintf rpl_snprintf
142 # if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
143 extern int snprintf (char *str, size_t size, const char *format, ...)
144 __attribute__ ((__format__ (__printf__, 3, 4)));
146 #elif defined GNULIB_POSIXCHECK
149 (GL_LINK_WARNING ("snprintf is unportable - " \
150 "use gnulib module snprintf for portability"), \
154 #if @GNULIB_VSNPRINTF@
155 # if @REPLACE_VSNPRINTF@
156 # define vsnprintf rpl_vsnprintf
158 # if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
159 extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
160 __attribute__ ((__format__ (__printf__, 3, 0)));
162 #elif defined GNULIB_POSIXCHECK
164 # define vsnprintf(b,s,f,a) \
165 (GL_LINK_WARNING ("vsnprintf is unportable - " \
166 "use gnulib module vsnprintf for portability"), \
167 vsnprintf (b, s, f, a))
170 #if @GNULIB_SPRINTF_POSIX@
171 # if @REPLACE_SPRINTF@
172 # define sprintf rpl_sprintf
173 extern int sprintf (char *str, const char *format, ...)
174 __attribute__ ((__format__ (__printf__, 2, 3)));
176 #elif defined GNULIB_POSIXCHECK
179 (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
180 "use gnulib module sprintf-posix for portable " \
181 "POSIX compliance"), \
185 #if @GNULIB_VSPRINTF_POSIX@
186 # if @REPLACE_VSPRINTF@
187 # define vsprintf rpl_vsprintf
188 extern int vsprintf (char *str, const char *format, va_list args)
189 __attribute__ ((__format__ (__printf__, 2, 0)));
191 #elif defined GNULIB_POSIXCHECK
193 # define vsprintf(b,f,a) \
194 (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
195 "use gnulib module vsprintf-posix for portable " \
196 "POSIX compliance"), \
200 #if @GNULIB_VASPRINTF@
201 # if @REPLACE_VASPRINTF@
202 # define asprintf rpl_asprintf
203 # define vasprintf rpl_vasprintf
205 # if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
206 /* Write formatted output to a string dynamically allocated with malloc().
207 If the memory allocation succeeds, store the address of the string in
208 *RESULT and return the number of resulting bytes, excluding the trailing
209 NUL. Upon memory allocation error, or some other error, return -1. */
210 extern int asprintf (char **result, const char *format, ...)
211 __attribute__ ((__format__ (__printf__, 2, 3)));
212 extern int vasprintf (char **result, const char *format, va_list args)
213 __attribute__ ((__format__ (__printf__, 2, 0)));
219 # define fopen rpl_fopen
220 extern FILE * fopen (const char *filename, const char *mode);
222 #elif defined GNULIB_POSIXCHECK
224 # define fopen(f,m) \
225 (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
226 "use gnulib module fopen for portability"), \
231 # if @REPLACE_FREOPEN@
232 # define freopen rpl_freopen
233 extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
235 #elif defined GNULIB_POSIXCHECK
237 # define freopen(f,m,s) \
238 (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
239 "use gnulib module freopen for portability"), \
244 # if @REPLACE_FSEEKO@
245 /* Provide fseek, fseeko functions that are aware of a preceding
246 fflush(), and which detect pipes. */
247 # define fseeko rpl_fseeko
248 extern int fseeko (FILE *fp, off_t offset, int whence);
249 # define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
251 #elif defined GNULIB_POSIXCHECK
253 # define fseeko(f,o,w) \
254 (GL_LINK_WARNING ("fseeko is unportable - " \
255 "use gnulib module fseeko for portability"), \
259 #if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
260 extern int rpl_fseek (FILE *fp, long offset, int whence);
262 # if defined GNULIB_POSIXCHECK
263 # define fseek(f,o,w) \
264 (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
265 "on 32-bit platforms - " \
266 "use fseeko function for handling of large files"), \
269 # define fseek rpl_fseek
271 #elif defined GNULIB_POSIXCHECK
273 # define fseek(f,o,w) \
274 (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
275 "on 32-bit platforms - " \
276 "use fseeko function for handling of large files"), \
282 # if @REPLACE_FTELLO@
283 # define ftello rpl_ftello
284 extern off_t ftello (FILE *fp);
285 # define ftell(fp) ftello (fp)
287 #elif defined GNULIB_POSIXCHECK
290 (GL_LINK_WARNING ("ftello is unportable - " \
291 "use gnulib module ftello for portability"), \
295 #if @GNULIB_FTELL@ && @REPLACE_FTELL@
296 extern long rpl_ftell (FILE *fp);
298 # if GNULIB_POSIXCHECK
300 (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
301 "on 32-bit platforms - " \
302 "use ftello function for handling of large files"), \
305 # define ftell rpl_ftell
307 #elif defined GNULIB_POSIXCHECK
310 (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
311 "on 32-bit platforms - " \
312 "use ftello function for handling of large files"), \
318 # if @REPLACE_FFLUSH@
319 # define fflush rpl_fflush
320 /* Flush all pending data on STREAM according to POSIX rules. Both
321 output and seekable input streams are supported.
322 Note! LOSS OF DATA can occur if fflush is applied on an input stream
323 that is _not_seekable_ or on an update stream that is _not_seekable_
324 and in which the most recent operation was input. Seekability can
325 be tested with lseek(fileno(fp),0,SEEK_CUR). */
326 extern int fflush (FILE *gl_stream);
328 #elif defined GNULIB_POSIXCHECK
331 (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
332 "use gnulib module fflush for portable " \
333 "POSIX compliance"), \
337 #if @GNULIB_GETDELIM@
338 # if !@HAVE_DECL_GETDELIM@
339 /* Read input, up to (and including) the next occurrence of DELIMITER, from
340 STREAM, store it in *LINEPTR (and NUL-terminate it).
341 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
342 bytes of space. It is realloc'd as necessary.
343 Return the number of bytes read and stored at *LINEPTR (not including the
344 NUL terminator), or -1 on error or EOF. */
345 extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
348 #elif defined GNULIB_POSIXCHECK
350 # define getdelim(l, s, d, f) \
351 (GL_LINK_WARNING ("getdelim is unportable - " \
352 "use gnulib module getdelim for portability"), \
353 getdelim (l, s, d, f))
357 # if @REPLACE_GETLINE@
359 # define getline rpl_getline
361 # if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
362 /* Read a line, up to (and including) the next newline, from STREAM, store it
363 in *LINEPTR (and NUL-terminate it).
364 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
365 bytes of space. It is realloc'd as necessary.
366 Return the number of bytes read and stored at *LINEPTR (not including the
367 NUL terminator), or -1 on error or EOF. */
368 extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
370 #elif defined GNULIB_POSIXCHECK
372 # define getline(l, s, f) \
373 (GL_LINK_WARNING ("getline is unportable - " \
374 "use gnulib module getline for portability"), \
382 #endif /* _GL_STDIO_H */
383 #endif /* _GL_STDIO_H */