a815b6f0965b21013bf6f01bf1904b8f812a0a74
[debian/gzip] / lib / stdio.in.h
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A GNU-like <stdio.h>.
4
5    Copyright (C) 2004, 2007-2010 Free Software Foundation, Inc.
6
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)
10    any later version.
11
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.
16
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.  */
20
21 #if __GNUC__ >= 3
22 @PRAGMA_SYSTEM_HEADER@
23 #endif
24
25 #if defined __need_FILE || defined __need___FILE
26 /* Special invocation convention inside glibc header files.  */
27
28 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
29
30 #else
31 /* Normal invocation convention.  */
32
33 #ifndef _GL_STDIO_H
34
35 /* The include_next requires a split double-inclusion guard.  */
36 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
37
38 #ifndef _GL_STDIO_H
39 #define _GL_STDIO_H
40
41 /* Get va_list.  Needed on many systems, including glibc 2.8.  */
42 #include <stdarg.h>
43
44 #include <stddef.h>
45
46 /* Get off_t and ssize_t.  Needed on many systems, including glibc 2.8.  */
47 #include <sys/types.h>
48
49 #ifndef __attribute__
50 /* The __attribute__ feature is available in gcc versions 2.5 and later.
51    The __-protected variants of the attributes 'format' and 'printf' are
52    accepted by gcc versions 2.6.4 (effectively 2.7) and later.
53    We enable __attribute__ only if these are supported too, because
54    gnulib and libintl do '#define printf __printf__' when they override
55    the 'printf' function.  */
56 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
57 #  define __attribute__(Spec)   /* empty */
58 # endif
59 #endif
60
61
62 /* The definition of GL_LINK_WARNING is copied here.  */
63
64 /* The definition of _GL_ARG_NONNULL is copied here.  */
65
66 /* The definition of _GL_WARN_ON_USE is copied here.  */
67
68
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72
73 #if @GNULIB_DPRINTF@
74 # if @REPLACE_DPRINTF@
75 #  define dprintf rpl_dprintf
76 # endif
77 # if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@
78 extern int dprintf (int fd, const char *format, ...)
79        __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((2));
80 # endif
81 #elif defined GNULIB_POSIXCHECK
82 # undef dprintf
83 # define dprintf \
84     (GL_LINK_WARNING ("dprintf is unportable - " \
85                       "use gnulib module dprintf for portability"), \
86      dprintf)
87 #endif
88
89 #if @GNULIB_FCLOSE@
90 # if @REPLACE_FCLOSE@
91 #  define fclose rpl_fclose
92   /* Close STREAM and its underlying file descriptor.  */
93 extern int fclose (FILE *stream) _GL_ARG_NONNULL ((1));
94 # endif
95 #elif defined GNULIB_POSIXCHECK
96 # undef fclose
97 # define fclose(f) \
98    (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
99                      "use gnulib module fclose for portable " \
100                      "POSIX compliance"), \
101     fclose (f))
102 #endif
103
104 #if @GNULIB_FFLUSH@
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);
114 # endif
115 #elif defined GNULIB_POSIXCHECK
116 # undef fflush
117 # define fflush(f) \
118    (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
119                      "use gnulib module fflush for portable " \
120                      "POSIX compliance"), \
121     fflush (f))
122 #endif
123
124 /* It is very rare that the developer ever has full control of stdin,
125    so any use of gets warrants an unconditional warning.  Assume it is
126    always declared, since it is required by C89.  */
127 #undef gets
128 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
129
130 #if @GNULIB_FOPEN@
131 # if @REPLACE_FOPEN@
132 #  undef fopen
133 #  define fopen rpl_fopen
134 extern FILE * fopen (const char *filename, const char *mode)
135      _GL_ARG_NONNULL ((1, 2));
136 # endif
137 #elif defined GNULIB_POSIXCHECK
138 # undef fopen
139 # define fopen(f,m) \
140    (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
141                      "use gnulib module fopen for portability"), \
142     fopen (f, m))
143 #endif
144
145 #if @GNULIB_FPRINTF_POSIX@
146 # if @REPLACE_FPRINTF@
147 #  define fprintf rpl_fprintf
148 extern int fprintf (FILE *fp, const char *format, ...)
149        __attribute__ ((__format__ (__printf__, 2, 3)))
150        _GL_ARG_NONNULL ((1, 2));
151 # endif
152 #elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
153 # define fprintf rpl_fprintf
154 extern int fprintf (FILE *fp, const char *format, ...)
155        __attribute__ ((__format__ (__printf__, 2, 3)))
156        _GL_ARG_NONNULL ((1, 2));
157 #elif defined GNULIB_POSIXCHECK
158 # undef fprintf
159 # define fprintf \
160     (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
161                       "use gnulib module fprintf-posix for portable " \
162                       "POSIX compliance"), \
163      fprintf)
164 #endif
165
166 #if @GNULIB_FPURGE@
167 # if @REPLACE_FPURGE@
168 #  define fpurge rpl_fpurge
169 # endif
170 # if @REPLACE_FPURGE@ || !@HAVE_DECL_FPURGE@
171   /* Discard all pending buffered I/O data on STREAM.
172      STREAM must not be wide-character oriented.
173      When discarding pending output, the file position is set back to where it
174      was before the write calls.  When discarding pending input, the file
175      position is advanced to match the end of the previously read input.
176      Return 0 if successful.  Upon error, return -1 and set errno.  */
177   extern int fpurge (FILE *gl_stream) _GL_ARG_NONNULL ((1));
178 # endif
179 #elif defined GNULIB_POSIXCHECK
180 # undef fpurge
181 # define fpurge(f) \
182    (GL_LINK_WARNING ("fpurge is not always present - " \
183                      "use gnulib module fpurge for portability"), \
184     fpurge (f))
185 #endif
186
187 #if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
188 # undef fputc
189 # define fputc rpl_fputc
190 extern int fputc (int c, FILE *stream) _GL_ARG_NONNULL ((2));
191 #endif
192
193 #if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
194 # undef fputs
195 # define fputs rpl_fputs
196 extern int fputs (const char *string, FILE *stream) _GL_ARG_NONNULL ((1, 2));
197 #endif
198
199 #if @GNULIB_FREOPEN@
200 # if @REPLACE_FREOPEN@
201 #  undef freopen
202 #  define freopen rpl_freopen
203 extern FILE * freopen (const char *filename, const char *mode, FILE *stream)
204      _GL_ARG_NONNULL ((2, 3));
205 # endif
206 #elif defined GNULIB_POSIXCHECK
207 # undef freopen
208 # define freopen(f,m,s) \
209    (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
210                      "use gnulib module freopen for portability"), \
211     freopen (f, m, s))
212 #endif
213
214 /* Set up the following warnings, based on which modules are in use.
215    GNU Coding Standards discourage the use of fseek, since it imposes
216    an arbitrary limitation on some 32-bit hosts.  Remember that the
217    fseek module depends on the fseeko module, so we only have three
218    cases to consider:
219
220    1. The developer is not using either module.  Issue a warning under
221    GNULIB_POSIXCHECK for both functions, to remind them that both
222    functions have bugs on some systems.  _GL_NO_LARGE_FILES has no
223    impact on this warning.
224
225    2. The developer is using both modules.  They may be unaware of the
226    arbitrary limitations of fseek, so issue a warning under
227    GNULIB_POSIXCHECK.  On the other hand, they may be using both
228    modules intentionally, so the developer can define
229    _GL_NO_LARGE_FILES in the compilation units where the use of fseek
230    is safe, to silence the warning.
231
232    3. The developer is using the fseeko module, but not fseek.  Gnulib
233    guarantees that fseek will still work around platform bugs in that
234    case, but we presume that the developer is aware of the pitfalls of
235    fseek and was trying to avoid it, so issue a warning even when
236    GNULIB_POSIXCHECK is undefined.  Again, _GL_NO_LARGE_FILES can be
237    defined to silence the warning in particular compilation units.
238
239    Most gnulib clients that perform stream operations should fall into
240    category three.  */
241
242 #if @GNULIB_FSEEK@
243 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
244 #  define _GL_FSEEK_WARN /* Category 2, above.  */
245 #  undef fseek
246 # endif
247 # if @REPLACE_FSEEK@
248 #  undef fseek
249 #  define fseek rpl_fseek
250 extern int fseek (FILE *fp, long offset, int whence) _GL_ARG_NONNULL ((1));
251 # endif
252 #endif
253
254 #if @GNULIB_FSEEKO@
255 # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
256 #  define _GL_FSEEK_WARN /* Category 3, above.  */
257 #  undef fseek
258 # endif
259 # if @REPLACE_FSEEKO@
260 /* Provide fseek, fseeko functions that are aware of a preceding
261    fflush(), and which detect pipes.  */
262 #  undef fseeko
263 #  define fseeko rpl_fseeko
264 extern int fseeko (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1));
265 #  if !@GNULIB_FSEEK@
266 #   undef fseek
267 #   define fseek rpl_fseek
268 static inline int _GL_ARG_NONNULL ((1))
269 rpl_fseek (FILE *fp, long offset, int whence)
270 {
271   return fseeko (fp, offset, whence);
272 }
273 #  endif
274 # endif
275 #elif defined GNULIB_POSIXCHECK
276 # define _GL_FSEEK_WARN /* Category 1, above.  */
277 # undef fseek
278 # undef fseeko
279 # if HAVE_RAW_DECL_FSEEKO
280 _GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
281                  "use gnulib module fseeko for portability");
282 # endif
283 #endif
284
285 #ifdef _GL_FSEEK_WARN
286 # undef _GL_FSEEK_WARN
287 /* Here, either fseek is undefined (but C89 guarantees that it is
288    declared), or it is defined as rpl_fseek (declared above).  */
289 _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
290                  "on 32-bit platforms - "
291                  "use fseeko function for handling of large files");
292 #endif
293
294 /* See the comments on fseek/fseeko.  */
295
296 #if @GNULIB_FTELL@
297 # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
298 #  define _GL_FTELL_WARN /* Category 2, above.  */
299 #  undef ftell
300 # endif
301 # if @REPLACE_FTELL@
302 #  undef ftell
303 #  define ftell rpl_ftell
304 extern long ftell (FILE *fp) _GL_ARG_NONNULL ((1));
305 # endif
306 #endif
307
308 #if @GNULIB_FTELLO@
309 # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
310 #  define _GL_FTELL_WARN /* Category 3, above.  */
311 #  undef ftell
312 # endif
313 # if @REPLACE_FTELLO@
314 #  undef ftello
315 #  define ftello rpl_ftello
316 extern off_t ftello (FILE *fp) _GL_ARG_NONNULL ((1));
317 #  if !@GNULIB_FTELL@
318 #   undef ftell
319 #   define ftell rpl_ftell
320 static inline long _GL_ARG_NONNULL ((1))
321 rpl_ftell (FILE *f)
322 {
323   return ftello (f);
324 }
325 #  endif
326 # endif
327 #elif defined GNULIB_POSIXCHECK
328 # define _GL_FTELL_WARN /* Category 1, above.  */
329 # undef ftell
330 # undef ftello
331 # if HAVE_RAW_DECL_FTELLO
332 _GL_WARN_ON_USE (ftello, "ftello is unportable - "
333                  "use gnulib module ftello for portability");
334 # endif
335 #endif
336
337 #ifdef _GL_FTELL_WARN
338 # undef _GL_FTELL_WARN
339 /* Here, either ftell is undefined (but C89 guarantees that it is
340    declared), or it is defined as rpl_ftell (declared above).  */
341 _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
342                  "on 32-bit platforms - "
343                  "use ftello function for handling of large files");
344 #endif
345
346 #if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
347 # undef fwrite
348 # define fwrite rpl_fwrite
349 extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
350      _GL_ARG_NONNULL ((1, 4));
351 #endif
352
353 #if @GNULIB_GETDELIM@
354 # if !@HAVE_DECL_GETDELIM@
355 /* Read input, up to (and including) the next occurrence of DELIMITER, from
356    STREAM, store it in *LINEPTR (and NUL-terminate it).
357    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
358    bytes of space.  It is realloc'd as necessary.
359    Return the number of bytes read and stored at *LINEPTR (not including the
360    NUL terminator), or -1 on error or EOF.  */
361 extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
362                          FILE *stream)
363      _GL_ARG_NONNULL ((1, 2, 4));
364 # endif
365 #elif defined GNULIB_POSIXCHECK
366 # undef getdelim
367 # define getdelim(l, s, d, f)                                       \
368   (GL_LINK_WARNING ("getdelim is unportable - "                     \
369                     "use gnulib module getdelim for portability"),  \
370    getdelim (l, s, d, f))
371 #endif
372
373 #if @GNULIB_GETLINE@
374 # if @REPLACE_GETLINE@
375 #  undef getline
376 #  define getline rpl_getline
377 # endif
378 # if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
379 /* Read a line, up to (and including) the next newline, from STREAM, store it
380    in *LINEPTR (and NUL-terminate it).
381    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
382    bytes of space.  It is realloc'd as necessary.
383    Return the number of bytes read and stored at *LINEPTR (not including the
384    NUL terminator), or -1 on error or EOF.  */
385 extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream)
386      _GL_ARG_NONNULL ((1, 2, 3));
387 # endif
388 #elif defined GNULIB_POSIXCHECK
389 # undef getline
390 # define getline(l, s, f)                                               \
391   (GL_LINK_WARNING ("getline is unportable - "                          \
392                     "use gnulib module getline for portability"),       \
393    getline (l, s, f))
394 #endif
395
396 #if @GNULIB_OBSTACK_PRINTF@
397 # if @REPLACE_OBSTACK_PRINTF@
398 #  define obstack_printf rpl_osbtack_printf
399 #  define obstack_vprintf rpl_obstack_vprintf
400 # endif
401 # if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@
402   struct obstack;
403   /* Grow an obstack with formatted output.  Return the number of
404      bytes added to OBS.  No trailing nul byte is added, and the
405      object should be closed with obstack_finish before use.  Upon
406      memory allocation error, call obstack_alloc_failed_handler.  Upon
407      other error, return -1.  */
408   extern int obstack_printf (struct obstack *obs, const char *format, ...)
409     __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((1, 2));
410   extern int obstack_vprintf (struct obstack *obs, const char *format,
411                               va_list args)
412     __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((1, 2));
413 # endif
414 #endif
415
416 #if @GNULIB_PERROR@
417 # if @REPLACE_PERROR@
418 #  define perror rpl_perror
419 /* Print a message to standard error, describing the value of ERRNO,
420    (if STRING is not NULL and not empty) prefixed with STRING and ": ",
421    and terminated with a newline.  */
422 extern void perror (const char *string);
423 # endif
424 #elif defined GNULIB_POSIXCHECK
425 # undef perror
426 # define perror(s) \
427     (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
428                       "use gnulib module perror for portability"), \
429      perror (s))
430 #endif
431
432 #if @GNULIB_POPEN@
433 # if @REPLACE_POPEN@
434 #  undef popen
435 #  define popen rpl_popen
436 extern FILE *popen (const char *cmd, const char *mode)
437      _GL_ARG_NONNULL ((1, 2));
438 # endif
439 #elif defined GNULIB_POSIXCHECK
440 # undef popen
441 # define popen(c,m) \
442    (GL_LINK_WARNING ("popen is buggy on some platforms - " \
443                      "use gnulib module popen or pipe for more portability"), \
444     popen (c, m))
445 #endif
446
447 #if @GNULIB_PRINTF_POSIX@
448 # if @REPLACE_PRINTF@
449 /* Don't break __attribute__((format(printf,M,N))).  */
450 #  define printf __printf__
451 extern int printf (const char *format, ...)
452        __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
453 # endif
454 #elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
455 /* Don't break __attribute__((format(printf,M,N))).  */
456 # define printf __printf__
457 extern int printf (const char *format, ...)
458        __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
459 #elif defined GNULIB_POSIXCHECK
460 # undef printf
461 # define printf \
462     (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
463                       "use gnulib module printf-posix for portable " \
464                       "POSIX compliance"), \
465      printf)
466 /* Don't break __attribute__((format(printf,M,N))).  */
467 # define format(kind,m,n) format (__##kind##__, m, n)
468 # define __format__(kind,m,n) __format__ (__##kind##__, m, n)
469 # define ____printf____ __printf__
470 # define ____scanf____ __scanf__
471 # define ____strftime____ __strftime__
472 # define ____strfmon____ __strfmon__
473 #endif
474
475 #if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
476 # undef putc
477 # define putc rpl_fputc
478 extern int putc (int c, FILE *stream) _GL_ARG_NONNULL ((2));
479 #endif
480
481 #if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
482 # undef putchar
483 # define putchar rpl_putchar
484 extern int putchar (int c);
485 #endif
486
487 #if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
488 # undef puts
489 # define puts rpl_puts
490 extern int puts (const char *string) _GL_ARG_NONNULL ((1));
491 #endif
492
493 #if @GNULIB_REMOVE@
494 # if @REPLACE_REMOVE@
495 #  undef remove
496 #  define remove rpl_remove
497 extern int remove (const char *name) _GL_ARG_NONNULL ((1));
498 # endif
499 #elif defined GNULIB_POSIXCHECK
500 # undef remove
501 # define remove(n)                                         \
502    (GL_LINK_WARNING ("remove cannot handle directories on some platforms - " \
503                      "use gnulib module remove for more portability"), \
504     remove (n))
505 #endif
506
507 #if @GNULIB_RENAME@
508 # if @REPLACE_RENAME@
509 #  undef rename
510 #  define rename rpl_rename
511 extern int rename (const char *old_filename, const char *new_filename)
512      _GL_ARG_NONNULL ((1, 2));
513 # endif
514 #elif defined GNULIB_POSIXCHECK
515 # undef rename
516 # define rename(o,n)                                       \
517    (GL_LINK_WARNING ("rename is buggy on some platforms - " \
518                      "use gnulib module rename for more portability"), \
519     rename (o, n))
520 #endif
521
522 #if @GNULIB_RENAMEAT@
523 # if @REPLACE_RENAMEAT@
524 #  undef renameat
525 #  define renameat rpl_renameat
526 # endif
527 # if !@HAVE_RENAMEAT@ || @REPLACE_RENAMEAT@
528 extern int renameat (int fd1, char const *file1, int fd2, char const *file2)
529      _GL_ARG_NONNULL ((2, 4));
530 # endif
531 #elif defined GNULIB_POSIXCHECK
532 # undef renameat
533 # define renameat(d1,f1,d2,f2)             \
534     (GL_LINK_WARNING ("renameat is not portable - " \
535                       "use gnulib module renameat for portability"), \
536      renameat (d1, f1, d2, f2))
537 #endif
538
539 #if @GNULIB_SNPRINTF@
540 # if @REPLACE_SNPRINTF@
541 #  define snprintf rpl_snprintf
542 # endif
543 # if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
544 extern int snprintf (char *str, size_t size, const char *format, ...)
545        __attribute__ ((__format__ (__printf__, 3, 4)))
546        _GL_ARG_NONNULL ((3));
547 # endif
548 #elif defined GNULIB_POSIXCHECK
549 # undef snprintf
550 # define snprintf \
551     (GL_LINK_WARNING ("snprintf is unportable - " \
552                       "use gnulib module snprintf for portability"), \
553      snprintf)
554 #endif
555
556 /* Some people would argue that sprintf should be handled like gets
557    (for example, OpenBSD issues a link warning for both functions),
558    since both can cause security holes due to buffer overruns.
559    However, we believe that sprintf can be used safely, and is more
560    efficient than snprintf in those safe cases; and as proof of our
561    belief, we use sprintf in several gnulib modules.  So this header
562    intentionally avoids adding a warning to sprintf except when
563    GNULIB_POSIXCHECK is defined.  */
564
565 #if @GNULIB_SPRINTF_POSIX@
566 # if @REPLACE_SPRINTF@
567 #  define sprintf rpl_sprintf
568 extern int sprintf (char *str, const char *format, ...)
569        __attribute__ ((__format__ (__printf__, 2, 3)))
570        _GL_ARG_NONNULL ((1, 2));
571 # endif
572 #elif defined GNULIB_POSIXCHECK
573 # undef sprintf
574 # define sprintf \
575     (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
576                       "use gnulib module sprintf-posix for portable " \
577                       "POSIX compliance"), \
578      sprintf)
579 #endif
580
581 #if @GNULIB_VASPRINTF@
582 # if @REPLACE_VASPRINTF@
583 #  define asprintf rpl_asprintf
584 #  define vasprintf rpl_vasprintf
585 # endif
586 # if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
587   /* Write formatted output to a string dynamically allocated with malloc().
588      If the memory allocation succeeds, store the address of the string in
589      *RESULT and return the number of resulting bytes, excluding the trailing
590      NUL.  Upon memory allocation error, or some other error, return -1.  */
591   extern int asprintf (char **result, const char *format, ...)
592     __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((1, 2));
593   extern int vasprintf (char **result, const char *format, va_list args)
594     __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((1, 2));
595 # endif
596 #endif
597
598 #if @GNULIB_VDPRINTF@
599 # if @REPLACE_VDPRINTF@
600 #  define vdprintf rpl_vdprintf
601 # endif
602 # if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@
603 extern int vdprintf (int fd, const char *format, va_list args)
604        __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((2));
605 # endif
606 #elif defined GNULIB_POSIXCHECK
607 # undef vdprintf
608 # define vdprintf(d,f,a) \
609     (GL_LINK_WARNING ("vdprintf is unportable - " \
610                       "use gnulib module vdprintf for portability"), \
611      vdprintf (d, f, a))
612 #endif
613
614 #if @GNULIB_VFPRINTF_POSIX@
615 # if @REPLACE_VFPRINTF@
616 #  define vfprintf rpl_vfprintf
617 extern int vfprintf (FILE *fp, const char *format, va_list args)
618        __attribute__ ((__format__ (__printf__, 2, 0)))
619        _GL_ARG_NONNULL ((1, 2));
620 # endif
621 #elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
622 # define vfprintf rpl_vfprintf
623 extern int vfprintf (FILE *fp, const char *format, va_list args)
624        __attribute__ ((__format__ (__printf__, 2, 0)))
625        _GL_ARG_NONNULL ((1, 2));
626 #elif defined GNULIB_POSIXCHECK
627 # undef vfprintf
628 # define vfprintf(s,f,a) \
629     (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
630                       "use gnulib module vfprintf-posix for portable " \
631                       "POSIX compliance"), \
632      vfprintf (s, f, a))
633 #endif
634
635 #if @GNULIB_VPRINTF_POSIX@
636 # if @REPLACE_VPRINTF@
637 #  define vprintf rpl_vprintf
638 extern int vprintf (const char *format, va_list args)
639        __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
640 # endif
641 #elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
642 # define vprintf rpl_vprintf
643 extern int vprintf (const char *format, va_list args)
644        __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
645 #elif defined GNULIB_POSIXCHECK
646 # undef vprintf
647 # define vprintf(f,a) \
648     (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
649                       "use gnulib module vprintf-posix for portable " \
650                       "POSIX compliance"), \
651      vprintf (f, a))
652 #endif
653
654 #if @GNULIB_VSNPRINTF@
655 # if @REPLACE_VSNPRINTF@
656 #  define vsnprintf rpl_vsnprintf
657 # endif
658 # if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
659 extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
660        __attribute__ ((__format__ (__printf__, 3, 0)))
661        _GL_ARG_NONNULL ((3));
662 # endif
663 #elif defined GNULIB_POSIXCHECK
664 # undef vsnprintf
665 # define vsnprintf(b,s,f,a) \
666     (GL_LINK_WARNING ("vsnprintf is unportable - " \
667                       "use gnulib module vsnprintf for portability"), \
668      vsnprintf (b, s, f, a))
669 #endif
670
671 #if @GNULIB_VSPRINTF_POSIX@
672 # if @REPLACE_VSPRINTF@
673 #  define vsprintf rpl_vsprintf
674 extern int vsprintf (char *str, const char *format, va_list args)
675        __attribute__ ((__format__ (__printf__, 2, 0)))
676        _GL_ARG_NONNULL ((1, 2));
677 # endif
678 #elif defined GNULIB_POSIXCHECK
679 # undef vsprintf
680 # define vsprintf(b,f,a) \
681     (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
682                       "use gnulib module vsprintf-posix for portable " \
683                       "POSIX compliance"), \
684      vsprintf (b, f, a))
685 #endif
686
687 #ifdef __cplusplus
688 }
689 #endif
690
691 #endif /* _GL_STDIO_H */
692 #endif /* _GL_STDIO_H */
693 #endif