Use spaces for indentation, not tabs.
[gnulib.git] / lib / stdio.in.h
1 /* A GNU-like <stdio.h>.
2
3    Copyright (C) 2004, 2007-2009 Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2, or (at your option)
8    any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software Foundation,
17    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
18
19 #if __GNUC__ >= 3
20 @PRAGMA_SYSTEM_HEADER@
21 #endif
22
23 #if defined __need_FILE || defined __need___FILE
24 /* Special invocation convention inside glibc header files.  */
25
26 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
27
28 #else
29 /* Normal invocation convention.  */
30
31 #ifndef _GL_STDIO_H
32
33 /* The include_next requires a split double-inclusion guard.  */
34 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
35
36 #ifndef _GL_STDIO_H
37 #define _GL_STDIO_H
38
39 #include <stdarg.h>
40 #include <stddef.h>
41
42 #if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
43   || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
44   || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \
45   || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@))
46 /* Get off_t and ssize_t.  */
47 # include <sys/types.h>
48 #endif
49
50 #ifndef __attribute__
51 /* This feature is available in gcc versions 2.5 and later.  */
52 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
53 #  define __attribute__(Spec) /* empty */
54 # endif
55 /* The __-protected variants of `format' and `printf' attributes
56    are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
57 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
58 #  define __format__ format
59 #  define __printf__ printf
60 # endif
61 #endif
62
63
64 /* The definition of GL_LINK_WARNING is copied here.  */
65
66
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70
71 #if @GNULIB_DPRINTF@
72 # if @REPLACE_DPRINTF@
73 #  define dprintf rpl_dprintf
74 # endif
75 # if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@
76 extern int dprintf (int fd, const char *format, ...)
77        __attribute__ ((__format__ (__printf__, 2, 3)));
78 # endif
79 #elif defined GNULIB_POSIXCHECK
80 # undef dprintf
81 # define dprintf(d,f,a) \
82     (GL_LINK_WARNING ("dprintf is unportable - " \
83                       "use gnulib module dprintf for portability"), \
84      dprintf (d, f, a))
85 #endif
86
87 #if @GNULIB_FCLOSE@
88 # if @REPLACE_FCLOSE@
89 #  define fclose rpl_fclose
90   /* Close STREAM and its underlying file descriptor.  */
91 extern int fclose (FILE *stream);
92 # endif
93 #elif defined GNULIB_POSIXCHECK
94 # undef fclose
95 # define fclose(f) \
96    (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
97                      "use gnulib module fclose for portable " \
98                      "POSIX compliance"), \
99     fclose (f))
100 #endif
101
102 #if @GNULIB_FFLUSH@
103 # if @REPLACE_FFLUSH@
104 #  define fflush rpl_fflush
105   /* Flush all pending data on STREAM according to POSIX rules.  Both
106      output and seekable input streams are supported.
107      Note! LOSS OF DATA can occur if fflush is applied on an input stream
108      that is _not_seekable_ or on an update stream that is _not_seekable_
109      and in which the most recent operation was input.  Seekability can
110      be tested with lseek(fileno(fp),0,SEEK_CUR).  */
111   extern int fflush (FILE *gl_stream);
112 # endif
113 #elif defined GNULIB_POSIXCHECK
114 # undef fflush
115 # define fflush(f) \
116    (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
117                      "use gnulib module fflush for portable " \
118                      "POSIX compliance"), \
119     fflush (f))
120 #endif
121
122 #if @GNULIB_FOPEN@
123 # if @REPLACE_FOPEN@
124 #  undef fopen
125 #  define fopen rpl_fopen
126 extern FILE * fopen (const char *filename, const char *mode);
127 # endif
128 #elif defined GNULIB_POSIXCHECK
129 # undef fopen
130 # define fopen(f,m) \
131    (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
132                      "use gnulib module fopen for portability"), \
133     fopen (f, m))
134 #endif
135
136 #if @GNULIB_FPRINTF_POSIX@
137 # if @REPLACE_FPRINTF@
138 #  define fprintf rpl_fprintf
139 extern int fprintf (FILE *fp, const char *format, ...)
140        __attribute__ ((__format__ (__printf__, 2, 3)));
141 # endif
142 #elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
143 # define fprintf rpl_fprintf
144 extern int fprintf (FILE *fp, const char *format, ...)
145        __attribute__ ((__format__ (__printf__, 2, 3)));
146 #elif defined GNULIB_POSIXCHECK
147 # undef fprintf
148 # define fprintf \
149     (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
150                       "use gnulib module fprintf-posix for portable " \
151                       "POSIX compliance"), \
152      fprintf)
153 #endif
154
155 #if @GNULIB_FPURGE@
156 # if @REPLACE_FPURGE@
157 #  define fpurge rpl_fpurge
158 # endif
159 # if @REPLACE_FPURGE@ || !@HAVE_DECL_FPURGE@
160   /* Discard all pending buffered I/O data on STREAM.
161      STREAM must not be wide-character oriented.
162      When discarding pending output, the file position is set back to where it
163      was before the write calls.  When discarding pending input, the file
164      position is advanced to match the end of the previously read input.
165      Return 0 if successful.  Upon error, return -1 and set errno.  */
166   extern int fpurge (FILE *gl_stream);
167 # endif
168 #elif defined GNULIB_POSIXCHECK
169 # undef fpurge
170 # define fpurge(f) \
171    (GL_LINK_WARNING ("fpurge is not always present - " \
172                      "use gnulib module fpurge for portability"), \
173     fpurge (f))
174 #endif
175
176 #if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
177 # undef fputc
178 # define fputc rpl_fputc
179 extern int fputc (int c, FILE *stream);
180 #endif
181
182 #if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
183 # undef fputs
184 # define fputs rpl_fputs
185 extern int fputs (const char *string, FILE *stream);
186 #endif
187
188 #if @GNULIB_FREOPEN@
189 # if @REPLACE_FREOPEN@
190 #  undef freopen
191 #  define freopen rpl_freopen
192 extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
193 # endif
194 #elif defined GNULIB_POSIXCHECK
195 # undef freopen
196 # define freopen(f,m,s) \
197    (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
198                      "use gnulib module freopen for portability"), \
199     freopen (f, m, s))
200 #endif
201
202 #if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
203 extern int rpl_fseek (FILE *fp, long offset, int whence);
204 # undef fseek
205 # if defined GNULIB_POSIXCHECK
206 #  define fseek(f,o,w) \
207      (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
208                        "on 32-bit platforms - " \
209                        "use fseeko function for handling of large files"), \
210       rpl_fseek (f, o, w))
211 # else
212 #  define fseek rpl_fseek
213 # endif
214 #elif defined GNULIB_POSIXCHECK
215 # ifndef fseek
216 #  define fseek(f,o,w) \
217      (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
218                        "on 32-bit platforms - " \
219                        "use fseeko function for handling of large files"), \
220       fseek (f, o, w))
221 # endif
222 #endif
223
224 #if @GNULIB_FSEEKO@
225 # if @REPLACE_FSEEKO@
226 /* Provide fseek, fseeko functions that are aware of a preceding
227    fflush(), and which detect pipes.  */
228 #  define fseeko rpl_fseeko
229 extern int fseeko (FILE *fp, off_t offset, int whence);
230 #  if !@GNULIB_FSEEK@
231 #   undef fseek
232 #   define fseek(f,o,w) \
233      (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
234                        "on 32-bit platforms - " \
235                        "use fseeko function for handling of large files"), \
236       fseeko (f, o, w))
237 #  endif
238 # endif
239 #elif defined GNULIB_POSIXCHECK
240 # undef fseeko
241 # define fseeko(f,o,w) \
242    (GL_LINK_WARNING ("fseeko is unportable - " \
243                      "use gnulib module fseeko for portability"), \
244     fseeko (f, o, w))
245 #endif
246
247 #if @GNULIB_FTELL@ && @REPLACE_FTELL@
248 extern long rpl_ftell (FILE *fp);
249 # undef ftell
250 # if GNULIB_POSIXCHECK
251 #  define ftell(f) \
252      (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
253                        "on 32-bit platforms - " \
254                        "use ftello function for handling of large files"), \
255       rpl_ftell (f))
256 # else
257 #  define ftell rpl_ftell
258 # endif
259 #elif defined GNULIB_POSIXCHECK
260 # ifndef ftell
261 #  define ftell(f) \
262      (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
263                        "on 32-bit platforms - " \
264                        "use ftello function for handling of large files"), \
265       ftell (f))
266 # endif
267 #endif
268
269 #if @GNULIB_FTELLO@
270 # if @REPLACE_FTELLO@
271 #  define ftello rpl_ftello
272 extern off_t ftello (FILE *fp);
273 #  if !@GNULIB_FTELL@
274 #   undef ftell
275 #   define ftell(f) \
276      (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
277                        "on 32-bit platforms - " \
278                        "use ftello function for handling of large files"), \
279       ftello (f))
280 #  endif
281 # endif
282 #elif defined GNULIB_POSIXCHECK
283 # undef ftello
284 # define ftello(f) \
285    (GL_LINK_WARNING ("ftello is unportable - " \
286                      "use gnulib module ftello for portability"), \
287     ftello (f))
288 #endif
289
290 #if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
291 # undef fwrite
292 # define fwrite rpl_fwrite
293 extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
294 #endif
295
296 #if @GNULIB_GETDELIM@
297 # if !@HAVE_DECL_GETDELIM@
298 /* Read input, up to (and including) the next occurrence of DELIMITER, from
299    STREAM, store it in *LINEPTR (and NUL-terminate it).
300    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
301    bytes of space.  It is realloc'd as necessary.
302    Return the number of bytes read and stored at *LINEPTR (not including the
303    NUL terminator), or -1 on error or EOF.  */
304 extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
305                          FILE *stream);
306 # endif
307 #elif defined GNULIB_POSIXCHECK
308 # undef getdelim
309 # define getdelim(l, s, d, f)                                       \
310   (GL_LINK_WARNING ("getdelim is unportable - "                     \
311                     "use gnulib module getdelim for portability"),  \
312    getdelim (l, s, d, f))
313 #endif
314
315 #if @GNULIB_GETLINE@
316 # if @REPLACE_GETLINE@
317 #  undef getline
318 #  define getline rpl_getline
319 # endif
320 # if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
321 /* Read a line, up to (and including) the next newline, from STREAM, store it
322    in *LINEPTR (and NUL-terminate it).
323    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
324    bytes of space.  It is realloc'd as necessary.
325    Return the number of bytes read and stored at *LINEPTR (not including the
326    NUL terminator), or -1 on error or EOF.  */
327 extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
328 # endif
329 #elif defined GNULIB_POSIXCHECK
330 # undef getline
331 # define getline(l, s, f)                                               \
332   (GL_LINK_WARNING ("getline is unportable - "                          \
333                     "use gnulib module getline for portability"),       \
334    getline (l, s, f))
335 #endif
336
337 #if @GNULIB_OBSTACK_PRINTF@
338 # if @REPLACE_OBSTACK_PRINTF@
339 #  define obstack_printf rpl_osbtack_printf
340 #  define obstack_vprintf rpl_obstack_vprintf
341 # endif
342 # if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@
343   struct obstack;
344   /* Grow an obstack with formatted output.  Return the number of
345      bytes added to OBS.  No trailing nul byte is added, and the
346      object should be closed with obstack_finish before use.  Upon
347      memory allocation error, call obstack_alloc_failed_handler.  Upon
348      other error, return -1.  */
349   extern int obstack_printf (struct obstack *obs, const char *format, ...)
350     __attribute__ ((__format__ (__printf__, 2, 3)));
351   extern int obstack_vprintf (struct obstack *obs, const char *format,
352                               va_list args)
353     __attribute__ ((__format__ (__printf__, 2, 0)));
354 # endif
355 #endif
356
357 #if @GNULIB_PERROR@
358 # if @REPLACE_PERROR@
359 #  define perror rpl_perror
360 /* Print a message to standard error, describing the value of ERRNO,
361    (if STRING is not NULL and not empty) prefixed with STRING and ": ",
362    and terminated with a newline.  */
363 extern void perror (const char *string);
364 # endif
365 #elif defined GNULIB_POSIXCHECK
366 # undef perror
367 # define perror(s) \
368     (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
369                       "use gnulib module perror for portability"), \
370      perror (s))
371 #endif
372
373 #if @GNULIB_POPEN@
374 # if @REPLACE_POPEN@
375 #  undef popen
376 #  define popen rpl_popen
377 extern FILE *popen (const char *cmd, const char *mode);
378 # endif
379 #elif defined GNULIB_POSIXCHECK
380 # undef popen
381 # define popen(c,m) \
382    (GL_LINK_WARNING ("popen is buggy on some platforms - " \
383                      "use gnulib module popen or pipe for more portability"), \
384     popen (c, m))
385 #endif
386
387 #if @GNULIB_PRINTF_POSIX@
388 # if @REPLACE_PRINTF@
389 /* Don't break __attribute__((format(printf,M,N))).  */
390 #  define printf __printf__
391 extern int printf (const char *format, ...)
392        __attribute__ ((__format__ (__printf__, 1, 2)));
393 # endif
394 #elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
395 /* Don't break __attribute__((format(printf,M,N))).  */
396 # define printf __printf__
397 extern int printf (const char *format, ...)
398        __attribute__ ((__format__ (__printf__, 1, 2)));
399 #elif defined GNULIB_POSIXCHECK
400 # undef printf
401 # define printf \
402     (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
403                       "use gnulib module printf-posix for portable " \
404                       "POSIX compliance"), \
405      printf)
406 /* Don't break __attribute__((format(printf,M,N))).  */
407 # define format(kind,m,n) format (__##kind##__, m, n)
408 # define __format__(kind,m,n) __format__ (__##kind##__, m, n)
409 # define ____printf____ __printf__
410 # define ____scanf____ __scanf__
411 # define ____strftime____ __strftime__
412 # define ____strfmon____ __strfmon__
413 #endif
414
415 #if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
416 # undef putc
417 # define putc rpl_fputc
418 extern int putc (int c, FILE *stream);
419 #endif
420
421 #if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
422 # undef putchar
423 # define putchar rpl_putchar
424 extern int putchar (int c);
425 #endif
426
427 #if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
428 # undef puts
429 # define puts rpl_puts
430 extern int puts (const char *string);
431 #endif
432
433 #if @GNULIB_REMOVE@
434 # if @REPLACE_REMOVE@
435 #  undef remove
436 #  define remove rpl_remove
437 extern int remove (const char *name);
438 # endif
439 #elif defined GNULIB_POSIXCHECK
440 # undef remove
441 # define remove(n)                                         \
442    (GL_LINK_WARNING ("remove cannot handle directories on some platforms - " \
443                      "use gnulib module remove for more portability"), \
444     remove (n))
445 #endif
446
447 #if @GNULIB_RENAME@
448 # if @REPLACE_RENAME@
449 #  undef rename
450 #  define rename rpl_rename
451 extern int rename (const char *old_filename, const char *new_filename);
452 # endif
453 #elif defined GNULIB_POSIXCHECK
454 # undef rename
455 # define rename(o,n)                                       \
456    (GL_LINK_WARNING ("rename is buggy on some platforms - " \
457                      "use gnulib module rename for more portability"), \
458     rename (o, n))
459 #endif
460
461 #if @GNULIB_RENAMEAT@
462 # if @REPLACE_RENAMEAT@
463 #  undef renameat
464 #  define renameat rpl_renameat
465 # endif
466 # if !@HAVE_RENAMEAT@ || @REPLACE_RENAMEAT@
467 extern int renameat (int fd1, char const *file1, int fd2, char const *file2);
468 # endif
469 #elif defined GNULIB_POSIXCHECK
470 # undef renameat
471 # define renameat(d1,f1,d2,f2)             \
472     (GL_LINK_WARNING ("renameat is not portable - " \
473                       "use gnulib module renameat for portability"), \
474      renameat (d1, f1, d2, f2))
475 #endif
476
477 #if @GNULIB_SNPRINTF@
478 # if @REPLACE_SNPRINTF@
479 #  define snprintf rpl_snprintf
480 # endif
481 # if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
482 extern int snprintf (char *str, size_t size, const char *format, ...)
483        __attribute__ ((__format__ (__printf__, 3, 4)));
484 # endif
485 #elif defined GNULIB_POSIXCHECK
486 # undef snprintf
487 # define snprintf \
488     (GL_LINK_WARNING ("snprintf is unportable - " \
489                       "use gnulib module snprintf for portability"), \
490      snprintf)
491 #endif
492
493 #if @GNULIB_SPRINTF_POSIX@
494 # if @REPLACE_SPRINTF@
495 #  define sprintf rpl_sprintf
496 extern int sprintf (char *str, const char *format, ...)
497        __attribute__ ((__format__ (__printf__, 2, 3)));
498 # endif
499 #elif defined GNULIB_POSIXCHECK
500 # undef sprintf
501 # define sprintf \
502     (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
503                       "use gnulib module sprintf-posix for portable " \
504                       "POSIX compliance"), \
505      sprintf)
506 #endif
507
508 #if @GNULIB_VASPRINTF@
509 # if @REPLACE_VASPRINTF@
510 #  define asprintf rpl_asprintf
511 #  define vasprintf rpl_vasprintf
512 # endif
513 # if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
514   /* Write formatted output to a string dynamically allocated with malloc().
515      If the memory allocation succeeds, store the address of the string in
516      *RESULT and return the number of resulting bytes, excluding the trailing
517      NUL.  Upon memory allocation error, or some other error, return -1.  */
518   extern int asprintf (char **result, const char *format, ...)
519     __attribute__ ((__format__ (__printf__, 2, 3)));
520   extern int vasprintf (char **result, const char *format, va_list args)
521     __attribute__ ((__format__ (__printf__, 2, 0)));
522 # endif
523 #endif
524
525 #if @GNULIB_VDPRINTF@
526 # if @REPLACE_VDPRINTF@
527 #  define vdprintf rpl_vdprintf
528 # endif
529 # if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@
530 extern int vdprintf (int fd, const char *format, va_list args)
531        __attribute__ ((__format__ (__printf__, 2, 0)));
532 # endif
533 #elif defined GNULIB_POSIXCHECK
534 # undef vdprintf
535 # define vdprintf(d,f,a) \
536     (GL_LINK_WARNING ("vdprintf is unportable - " \
537                       "use gnulib module vdprintf for portability"), \
538      vdprintf (d, f, a))
539 #endif
540
541 #if @GNULIB_VFPRINTF_POSIX@
542 # if @REPLACE_VFPRINTF@
543 #  define vfprintf rpl_vfprintf
544 extern int vfprintf (FILE *fp, const char *format, va_list args)
545        __attribute__ ((__format__ (__printf__, 2, 0)));
546 # endif
547 #elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
548 # define vfprintf rpl_vfprintf
549 extern int vfprintf (FILE *fp, const char *format, va_list args)
550        __attribute__ ((__format__ (__printf__, 2, 0)));
551 #elif defined GNULIB_POSIXCHECK
552 # undef vfprintf
553 # define vfprintf(s,f,a) \
554     (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
555                       "use gnulib module vfprintf-posix for portable " \
556                       "POSIX compliance"), \
557      vfprintf (s, f, a))
558 #endif
559
560 #if @GNULIB_VPRINTF_POSIX@
561 # if @REPLACE_VPRINTF@
562 #  define vprintf rpl_vprintf
563 extern int vprintf (const char *format, va_list args)
564        __attribute__ ((__format__ (__printf__, 1, 0)));
565 # endif
566 #elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
567 # define vprintf rpl_vprintf
568 extern int vprintf (const char *format, va_list args)
569        __attribute__ ((__format__ (__printf__, 1, 0)));
570 #elif defined GNULIB_POSIXCHECK
571 # undef vprintf
572 # define vprintf(f,a) \
573     (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
574                       "use gnulib module vprintf-posix for portable " \
575                       "POSIX compliance"), \
576      vprintf (f, a))
577 #endif
578
579 #if @GNULIB_VSNPRINTF@
580 # if @REPLACE_VSNPRINTF@
581 #  define vsnprintf rpl_vsnprintf
582 # endif
583 # if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
584 extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
585        __attribute__ ((__format__ (__printf__, 3, 0)));
586 # endif
587 #elif defined GNULIB_POSIXCHECK
588 # undef vsnprintf
589 # define vsnprintf(b,s,f,a) \
590     (GL_LINK_WARNING ("vsnprintf is unportable - " \
591                       "use gnulib module vsnprintf for portability"), \
592      vsnprintf (b, s, f, a))
593 #endif
594
595 #if @GNULIB_VSPRINTF_POSIX@
596 # if @REPLACE_VSPRINTF@
597 #  define vsprintf rpl_vsprintf
598 extern int vsprintf (char *str, const char *format, va_list args)
599        __attribute__ ((__format__ (__printf__, 2, 0)));
600 # endif
601 #elif defined GNULIB_POSIXCHECK
602 # undef vsprintf
603 # define vsprintf(b,f,a) \
604     (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
605                       "use gnulib module vsprintf-posix for portable " \
606                       "POSIX compliance"), \
607      vsprintf (b, f, a))
608 #endif
609
610 #ifdef __cplusplus
611 }
612 #endif
613
614 #endif /* _GL_STDIO_H */
615 #endif /* _GL_STDIO_H */
616 #endif