1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* A GNU-like <stdio.h>.
4 Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 This program 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
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
20 #if defined __need_FILE || defined __need___FILE
21 /* Special invocation convention inside glibc header files. */
23 #include_next <stdio.h>
26 /* Normal invocation convention. */
30 /* The include_next requires a split double-inclusion guard. */
31 #include_next <stdio.h>
43 /* Get off_t and ssize_t. */
44 # include <sys/types.h>
48 /* This feature is available in gcc versions 2.5 and later. */
49 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
50 # define __attribute__(Spec) /* empty */
52 /* The __-protected variants of `format' and `printf' attributes
53 are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
54 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
55 # define __format__ format
56 # define __printf__ printf
61 /* The definition of GL_LINK_WARNING is copied here. */
62 /* GL_LINK_WARNING("literal string") arranges to emit the literal string as
63 a linker warning on most glibc systems.
64 We use a linker warning rather than a preprocessor warning, because
65 #warning cannot be used inside macros. */
66 #ifndef GL_LINK_WARNING
67 /* This works on platforms with GNU ld and ELF object format.
68 Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
69 Testing __ELF__ guarantees the ELF object format.
70 Testing __GNUC__ is necessary for the compound expression syntax. */
71 # if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
72 # define GL_LINK_WARNING(message) \
73 GL_LINK_WARNING1 (__FILE__, __LINE__, message)
74 # define GL_LINK_WARNING1(file, line, message) \
75 GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */
76 # define GL_LINK_WARNING2(file, line, message) \
77 GL_LINK_WARNING3 (file ":" #line ": warning: " message)
78 # define GL_LINK_WARNING3(message) \
79 ({ static const char warning[sizeof (message)] \
80 __attribute__ ((__unused__, \
81 __section__ (".gnu.warning"), \
87 # define GL_LINK_WARNING(message) ((void) 0)
99 # define fprintf rpl_fprintf
100 extern int fprintf (FILE *fp, const char *format, ...)
101 __attribute__ ((__format__ (__printf__, 2, 3)));
103 #elif defined GNULIB_POSIXCHECK
106 (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
107 "use gnulib module fprintf-posix for portable " \
108 "POSIX compliance"), \
114 # define vfprintf rpl_vfprintf
115 extern int vfprintf (FILE *fp, const char *format, va_list args)
116 __attribute__ ((__format__ (__printf__, 2, 0)));
118 #elif defined GNULIB_POSIXCHECK
120 # define vfprintf(s,f,a) \
121 (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
122 "use gnulib module vfprintf-posix for portable " \
123 "POSIX compliance"), \
129 /* Don't break __attribute__((format(printf,M,N))). */
130 # define printf __printf__
131 extern int printf (const char *format, ...)
132 __attribute__ ((__format__ (__printf__, 1, 2)));
134 #elif defined GNULIB_POSIXCHECK
137 (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
138 "use gnulib module printf-posix for portable " \
139 "POSIX compliance"), \
141 /* Don't break __attribute__((format(printf,M,N))). */
142 # define format(kind,m,n) format (__##kind##__, m, n)
143 # define __format__(kind,m,n) __format__ (__##kind##__, m, n)
144 # define ____printf____ __printf__
145 # define ____scanf____ __scanf__
146 # define ____strftime____ __strftime__
147 # define ____strfmon____ __strfmon__
152 # define vprintf rpl_vprintf
153 extern int vprintf (const char *format, va_list args)
154 __attribute__ ((__format__ (__printf__, 1, 0)));
156 #elif defined GNULIB_POSIXCHECK
158 # define vprintf(f,a) \
159 (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
160 "use gnulib module vprintf-posix for portable " \
161 "POSIX compliance"), \
167 # define snprintf rpl_snprintf
170 extern int snprintf (char *str, size_t size, const char *format, ...)
171 __attribute__ ((__format__ (__printf__, 3, 4)));
173 #elif defined GNULIB_POSIXCHECK
176 (GL_LINK_WARNING ("snprintf is unportable - " \
177 "use gnulib module snprintf for portability"), \
183 # define vsnprintf rpl_vsnprintf
186 extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
187 __attribute__ ((__format__ (__printf__, 3, 0)));
189 #elif defined GNULIB_POSIXCHECK
191 # define vsnprintf(b,s,f,a) \
192 (GL_LINK_WARNING ("vsnprintf is unportable - " \
193 "use gnulib module vsnprintf for portability"), \
194 vsnprintf (b, s, f, a))
199 # define sprintf rpl_sprintf
200 extern int sprintf (char *str, const char *format, ...)
201 __attribute__ ((__format__ (__printf__, 2, 3)));
203 #elif defined GNULIB_POSIXCHECK
206 (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
207 "use gnulib module sprintf-posix for portable " \
208 "POSIX compliance"), \
214 # define vsprintf rpl_vsprintf
215 extern int vsprintf (char *str, const char *format, va_list args)
216 __attribute__ ((__format__ (__printf__, 2, 0)));
218 #elif defined GNULIB_POSIXCHECK
220 # define vsprintf(b,f,a) \
221 (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
222 "use gnulib module vsprintf-posix for portable " \
223 "POSIX compliance"), \
229 # define asprintf rpl_asprintf
230 # define vasprintf rpl_vasprintf
233 /* Write formatted output to a string dynamically allocated with malloc().
234 If the memory allocation succeeds, store the address of the string in
235 *RESULT and return the number of resulting bytes, excluding the trailing
236 NUL. Upon memory allocation error, or some other error, return -1. */
237 extern int asprintf (char **result, const char *format, ...)
238 __attribute__ ((__format__ (__printf__, 2, 3)));
239 extern int vasprintf (char **result, const char *format, va_list args)
240 __attribute__ ((__format__ (__printf__, 2, 0)));
246 # define fopen rpl_fopen
247 extern FILE * fopen (const char *filename, const char *mode);
249 #elif defined GNULIB_POSIXCHECK
251 # define fopen(f,m) \
252 (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
253 "use gnulib module fopen for portability"), \
259 # define freopen rpl_freopen
260 extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
262 #elif defined GNULIB_POSIXCHECK
264 # define freopen(f,m,s) \
265 (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
266 "use gnulib module freopen for portability"), \
272 /* Provide fseek, fseeko functions that are aware of a preceding
273 fflush(), and which detect pipes. */
274 # define fseeko rpl_fseeko
275 extern int fseeko (FILE *fp, off_t offset, int whence);
276 # define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
278 #elif defined GNULIB_POSIXCHECK
280 # define fseeko(f,o,w) \
281 (GL_LINK_WARNING ("fseeko is unportable - " \
282 "use gnulib module fseeko for portability"), \
287 extern int rpl_fseek (FILE *fp, long offset, int whence);
289 # if defined GNULIB_POSIXCHECK
290 # define fseek(f,o,w) \
291 (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
292 "on 32-bit platforms - " \
293 "use fseeko function for handling of large files"), \
296 # define fseek rpl_fseek
298 #elif defined GNULIB_POSIXCHECK
300 # define fseek(f,o,w) \
301 (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
302 "on 32-bit platforms - " \
303 "use fseeko function for handling of large files"), \
310 # define ftello rpl_ftello
311 extern off_t ftello (FILE *fp);
312 # define ftell(fp) ftello (fp)
314 #elif defined GNULIB_POSIXCHECK
317 (GL_LINK_WARNING ("ftello is unportable - " \
318 "use gnulib module ftello for portability"), \
323 extern long rpl_ftell (FILE *fp);
325 # if GNULIB_POSIXCHECK
327 (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
328 "on 32-bit platforms - " \
329 "use ftello function for handling of large files"), \
332 # define ftell rpl_ftell
334 #elif defined GNULIB_POSIXCHECK
337 (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
338 "on 32-bit platforms - " \
339 "use ftello function for handling of large files"), \
346 # define fflush rpl_fflush
347 /* Flush all pending data on STREAM according to POSIX rules. Both
348 output and seekable input streams are supported.
349 Note! LOSS OF DATA can occur if fflush is applied on an input stream
350 that is _not_seekable_ or on an update stream that is _not_seekable_
351 and in which the most recent operation was input. Seekability can
352 be tested with lseek(fileno(fp),0,SEEK_CUR). */
353 extern int fflush (FILE *gl_stream);
355 #elif defined GNULIB_POSIXCHECK
358 (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
359 "use gnulib module fflush for portable " \
360 "POSIX compliance"), \
366 /* Read input, up to (and including) the next occurrence of DELIMITER, from
367 STREAM, store it in *LINEPTR (and NUL-terminate it).
368 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
369 bytes of space. It is realloc'd as necessary.
370 Return the number of bytes read and stored at *LINEPTR (not including the
371 NUL terminator), or -1 on error or EOF. */
372 extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
375 #elif defined GNULIB_POSIXCHECK
377 # define getdelim(l, s, d, f) \
378 (GL_LINK_WARNING ("getdelim is unportable - " \
379 "use gnulib module getdelim for portability"), \
380 getdelim (l, s, d, f))
386 # define getline rpl_getline
389 /* Read a line, up to (and including) the next newline, from STREAM, store it
390 in *LINEPTR (and NUL-terminate it).
391 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
392 bytes of space. It is realloc'd as necessary.
393 Return the number of bytes read and stored at *LINEPTR (not including the
394 NUL terminator), or -1 on error or EOF. */
395 extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
397 #elif defined GNULIB_POSIXCHECK
399 # define getline(l, s, f) \
400 (GL_LINK_WARNING ("getline is unportable - " \
401 "use gnulib module getline for portability"), \
409 #endif /* _GL_STDIO_H */
410 #endif /* _GL_STDIO_H */