]> git.cworth.org Git - tar/blob - lib/stdio.in.h
Imported Upstream version 1.21
[tar] / 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-2008 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 #include <stdarg.h>
42 #include <stddef.h>
43
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>
50 #endif
51
52 #ifndef __attribute__
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 */
56 # endif
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
62 # endif
63 #endif
64
65
66 /* The definition of GL_LINK_WARNING is copied here.  */
67
68
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72
73
74 #if @GNULIB_FPRINTF_POSIX@
75 # if @REPLACE_FPRINTF@
76 #  define fprintf rpl_fprintf
77 extern int fprintf (FILE *fp, const char *format, ...)
78        __attribute__ ((__format__ (__printf__, 2, 3)));
79 # endif
80 #elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
81 # define fprintf rpl_fprintf
82 extern int fprintf (FILE *fp, const char *format, ...)
83        __attribute__ ((__format__ (__printf__, 2, 3)));
84 #elif defined GNULIB_POSIXCHECK
85 # undef fprintf
86 # define fprintf \
87     (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
88                       "use gnulib module fprintf-posix for portable " \
89                       "POSIX compliance"), \
90      fprintf)
91 #endif
92
93 #if @GNULIB_VFPRINTF_POSIX@
94 # if @REPLACE_VFPRINTF@
95 #  define vfprintf rpl_vfprintf
96 extern int vfprintf (FILE *fp, const char *format, va_list args)
97        __attribute__ ((__format__ (__printf__, 2, 0)));
98 # endif
99 #elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
100 # define vfprintf rpl_vfprintf
101 extern int vfprintf (FILE *fp, const char *format, va_list args)
102        __attribute__ ((__format__ (__printf__, 2, 0)));
103 #elif defined GNULIB_POSIXCHECK
104 # undef vfprintf
105 # define vfprintf(s,f,a) \
106     (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
107                       "use gnulib module vfprintf-posix for portable " \
108                       "POSIX compliance"), \
109      vfprintf (s, f, a))
110 #endif
111
112 #if @GNULIB_PRINTF_POSIX@
113 # if @REPLACE_PRINTF@
114 /* Don't break __attribute__((format(printf,M,N))).  */
115 #  define printf __printf__
116 extern int printf (const char *format, ...)
117        __attribute__ ((__format__ (__printf__, 1, 2)));
118 # endif
119 #elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
120 /* Don't break __attribute__((format(printf,M,N))).  */
121 # define printf __printf__
122 extern int printf (const char *format, ...)
123        __attribute__ ((__format__ (__printf__, 1, 2)));
124 #elif defined GNULIB_POSIXCHECK
125 # undef printf
126 # define printf \
127     (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
128                       "use gnulib module printf-posix for portable " \
129                       "POSIX compliance"), \
130      printf)
131 /* Don't break __attribute__((format(printf,M,N))).  */
132 # define format(kind,m,n) format (__##kind##__, m, n)
133 # define __format__(kind,m,n) __format__ (__##kind##__, m, n)
134 # define ____printf____ __printf__
135 # define ____scanf____ __scanf__
136 # define ____strftime____ __strftime__
137 # define ____strfmon____ __strfmon__
138 #endif
139
140 #if @GNULIB_VPRINTF_POSIX@
141 # if @REPLACE_VPRINTF@
142 #  define vprintf rpl_vprintf
143 extern int vprintf (const char *format, va_list args)
144        __attribute__ ((__format__ (__printf__, 1, 0)));
145 # endif
146 #elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
147 # define vprintf rpl_vprintf
148 extern int vprintf (const char *format, va_list args)
149        __attribute__ ((__format__ (__printf__, 1, 0)));
150 #elif defined GNULIB_POSIXCHECK
151 # undef vprintf
152 # define vprintf(f,a) \
153     (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
154                       "use gnulib module vprintf-posix for portable " \
155                       "POSIX compliance"), \
156      vprintf (f, a))
157 #endif
158
159 #if @GNULIB_SNPRINTF@
160 # if @REPLACE_SNPRINTF@
161 #  define snprintf rpl_snprintf
162 # endif
163 # if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
164 extern int snprintf (char *str, size_t size, const char *format, ...)
165        __attribute__ ((__format__ (__printf__, 3, 4)));
166 # endif
167 #elif defined GNULIB_POSIXCHECK
168 # undef snprintf
169 # define snprintf \
170     (GL_LINK_WARNING ("snprintf is unportable - " \
171                       "use gnulib module snprintf for portability"), \
172      snprintf)
173 #endif
174
175 #if @GNULIB_VSNPRINTF@
176 # if @REPLACE_VSNPRINTF@
177 #  define vsnprintf rpl_vsnprintf
178 # endif
179 # if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
180 extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
181        __attribute__ ((__format__ (__printf__, 3, 0)));
182 # endif
183 #elif defined GNULIB_POSIXCHECK
184 # undef vsnprintf
185 # define vsnprintf(b,s,f,a) \
186     (GL_LINK_WARNING ("vsnprintf is unportable - " \
187                       "use gnulib module vsnprintf for portability"), \
188      vsnprintf (b, s, f, a))
189 #endif
190
191 #if @GNULIB_SPRINTF_POSIX@
192 # if @REPLACE_SPRINTF@
193 #  define sprintf rpl_sprintf
194 extern int sprintf (char *str, const char *format, ...)
195        __attribute__ ((__format__ (__printf__, 2, 3)));
196 # endif
197 #elif defined GNULIB_POSIXCHECK
198 # undef sprintf
199 # define sprintf \
200     (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
201                       "use gnulib module sprintf-posix for portable " \
202                       "POSIX compliance"), \
203      sprintf)
204 #endif
205
206 #if @GNULIB_VSPRINTF_POSIX@
207 # if @REPLACE_VSPRINTF@
208 #  define vsprintf rpl_vsprintf
209 extern int vsprintf (char *str, const char *format, va_list args)
210        __attribute__ ((__format__ (__printf__, 2, 0)));
211 # endif
212 #elif defined GNULIB_POSIXCHECK
213 # undef vsprintf
214 # define vsprintf(b,f,a) \
215     (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
216                       "use gnulib module vsprintf-posix for portable " \
217                       "POSIX compliance"), \
218      vsprintf (b, f, a))
219 #endif
220
221 #if @GNULIB_VASPRINTF@
222 # if @REPLACE_VASPRINTF@
223 #  define asprintf rpl_asprintf
224 #  define vasprintf rpl_vasprintf
225 # endif
226 # if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
227   /* Write formatted output to a string dynamically allocated with malloc().
228      If the memory allocation succeeds, store the address of the string in
229      *RESULT and return the number of resulting bytes, excluding the trailing
230      NUL.  Upon memory allocation error, or some other error, return -1.  */
231   extern int asprintf (char **result, const char *format, ...)
232     __attribute__ ((__format__ (__printf__, 2, 3)));
233   extern int vasprintf (char **result, const char *format, va_list args)
234     __attribute__ ((__format__ (__printf__, 2, 0)));
235 # endif
236 #endif
237
238 #if @GNULIB_OBSTACK_PRINTF@
239 # if @REPLACE_OBSTACK_PRINTF@
240 #  define obstack_printf rpl_osbtack_printf
241 #  define obstack_vprintf rpl_obstack_vprintf
242 # endif
243 # if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@
244   struct obstack;
245   /* Grow an obstack with formatted output.  Return the number of
246      bytes added to OBS.  No trailing nul byte is added, and the
247      object should be closed with obstack_finish before use.  Upon
248      memory allocation error, call obstack_alloc_failed_handler.  Upon
249      other error, return -1.  */
250   extern int obstack_printf (struct obstack *obs, const char *format, ...)
251     __attribute__ ((__format__ (__printf__, 2, 3)));
252   extern int obstack_vprintf (struct obstack *obs, const char *format,
253                               va_list args)
254     __attribute__ ((__format__ (__printf__, 2, 0)));
255 # endif
256 #endif
257
258 #if @GNULIB_FOPEN@
259 # if @REPLACE_FOPEN@
260 #  undef fopen
261 #  define fopen rpl_fopen
262 extern FILE * fopen (const char *filename, const char *mode);
263 # endif
264 #elif defined GNULIB_POSIXCHECK
265 # undef fopen
266 # define fopen(f,m) \
267    (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
268                      "use gnulib module fopen for portability"), \
269     fopen (f, m))
270 #endif
271
272 #if @GNULIB_FREOPEN@
273 # if @REPLACE_FREOPEN@
274 #  undef freopen
275 #  define freopen rpl_freopen
276 extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
277 # endif
278 #elif defined GNULIB_POSIXCHECK
279 # undef freopen
280 # define freopen(f,m,s) \
281    (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
282                      "use gnulib module freopen for portability"), \
283     freopen (f, m, s))
284 #endif
285
286 #if @GNULIB_FSEEKO@
287 # if @REPLACE_FSEEKO@
288 /* Provide fseek, fseeko functions that are aware of a preceding
289    fflush(), and which detect pipes.  */
290 #  define fseeko rpl_fseeko
291 extern int fseeko (FILE *fp, off_t offset, int whence);
292 #  define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
293 # endif
294 #elif defined GNULIB_POSIXCHECK
295 # undef fseeko
296 # define fseeko(f,o,w) \
297    (GL_LINK_WARNING ("fseeko is unportable - " \
298                      "use gnulib module fseeko for portability"), \
299     fseeko (f, o, w))
300 #endif
301
302 #if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
303 extern int rpl_fseek (FILE *fp, long offset, int whence);
304 # undef fseek
305 # if defined GNULIB_POSIXCHECK
306 #  define fseek(f,o,w) \
307      (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
308                        "on 32-bit platforms - " \
309                        "use fseeko function for handling of large files"), \
310       rpl_fseek (f, o, w))
311 # else
312 #  define fseek rpl_fseek
313 # endif
314 #elif defined GNULIB_POSIXCHECK
315 # ifndef fseek
316 #  define fseek(f,o,w) \
317      (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
318                        "on 32-bit platforms - " \
319                        "use fseeko function for handling of large files"), \
320       fseek (f, o, w))
321 # endif
322 #endif
323
324 #if @GNULIB_FTELLO@
325 # if @REPLACE_FTELLO@
326 #  define ftello rpl_ftello
327 extern off_t ftello (FILE *fp);
328 #  define ftell(fp) ftello (fp)
329 # endif
330 #elif defined GNULIB_POSIXCHECK
331 # undef ftello
332 # define ftello(f) \
333    (GL_LINK_WARNING ("ftello is unportable - " \
334                      "use gnulib module ftello for portability"), \
335     ftello (f))
336 #endif
337
338 #if @GNULIB_FTELL@ && @REPLACE_FTELL@
339 extern long rpl_ftell (FILE *fp);
340 # undef ftell
341 # if GNULIB_POSIXCHECK
342 #  define ftell(f) \
343      (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
344                        "on 32-bit platforms - " \
345                        "use ftello function for handling of large files"), \
346       rpl_ftell (f))
347 # else
348 #  define ftell rpl_ftell
349 # endif
350 #elif defined GNULIB_POSIXCHECK
351 # ifndef ftell
352 #  define ftell(f) \
353      (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
354                        "on 32-bit platforms - " \
355                        "use ftello function for handling of large files"), \
356       ftell (f))
357 # endif
358 #endif
359
360 #if @GNULIB_FFLUSH@
361 # if @REPLACE_FFLUSH@
362 #  define fflush rpl_fflush
363   /* Flush all pending data on STREAM according to POSIX rules.  Both
364      output and seekable input streams are supported.
365      Note! LOSS OF DATA can occur if fflush is applied on an input stream
366      that is _not_seekable_ or on an update stream that is _not_seekable_
367      and in which the most recent operation was input.  Seekability can
368      be tested with lseek(fileno(fp),0,SEEK_CUR).  */
369   extern int fflush (FILE *gl_stream);
370 # endif
371 #elif defined GNULIB_POSIXCHECK
372 # undef fflush
373 # define fflush(f) \
374    (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
375                      "use gnulib module fflush for portable " \
376                      "POSIX compliance"), \
377     fflush (f))
378 #endif
379
380 #if @GNULIB_FCLOSE@
381 # if @REPLACE_FCLOSE@
382 #  define fclose rpl_fclose
383   /* Close STREAM and its underlying file descriptor.  */
384 extern int fclose (FILE *stream);
385 # endif
386 #elif defined GNULIB_POSIXCHECK
387 # undef fclose
388 # define fclose(f) \
389    (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
390                      "use gnulib module fclose for portable " \
391                      "POSIX compliance"), \
392     fclose (f))
393 #endif
394
395 #if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
396 # undef fputc
397 # define fputc rpl_fputc
398 extern int fputc (int c, FILE *stream);
399 #endif
400
401 #if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
402 # undef putc
403 # define putc rpl_fputc
404 extern int putc (int c, FILE *stream);
405 #endif
406
407 #if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
408 # undef putchar
409 # define putchar rpl_putchar
410 extern int putchar (int c);
411 #endif
412
413 #if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
414 # undef fputs
415 # define fputs rpl_fputs
416 extern int fputs (const char *string, FILE *stream);
417 #endif
418
419 #if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
420 # undef puts
421 # define puts rpl_puts
422 extern int puts (const char *string);
423 #endif
424
425 #if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
426 # undef fwrite
427 # define fwrite rpl_fwrite
428 extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
429 #endif
430
431 #if @GNULIB_GETDELIM@
432 # if !@HAVE_DECL_GETDELIM@
433 /* Read input, up to (and including) the next occurrence of DELIMITER, from
434    STREAM, store it in *LINEPTR (and NUL-terminate it).
435    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
436    bytes of space.  It is realloc'd as necessary.
437    Return the number of bytes read and stored at *LINEPTR (not including the
438    NUL terminator), or -1 on error or EOF.  */
439 extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
440                          FILE *stream);
441 # endif
442 #elif defined GNULIB_POSIXCHECK
443 # undef getdelim
444 # define getdelim(l, s, d, f)                                       \
445   (GL_LINK_WARNING ("getdelim is unportable - "                     \
446                     "use gnulib module getdelim for portability"),  \
447    getdelim (l, s, d, f))
448 #endif
449
450 #if @GNULIB_GETLINE@
451 # if @REPLACE_GETLINE@
452 #  undef getline
453 #  define getline rpl_getline
454 # endif
455 # if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
456 /* Read a line, up to (and including) the next newline, from STREAM, store it
457    in *LINEPTR (and NUL-terminate it).
458    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
459    bytes of space.  It is realloc'd as necessary.
460    Return the number of bytes read and stored at *LINEPTR (not including the
461    NUL terminator), or -1 on error or EOF.  */
462 extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
463 # endif
464 #elif defined GNULIB_POSIXCHECK
465 # undef getline
466 # define getline(l, s, f)                                               \
467   (GL_LINK_WARNING ("getline is unportable - "                          \
468                     "use gnulib module getline for portability"),       \
469    getline (l, s, f))
470 #endif
471
472 #if @GNULIB_PERROR@
473 # if @REPLACE_PERROR@
474 #  define perror rpl_perror
475 /* Print a message to standard error, describing the value of ERRNO,
476    (if STRING is not NULL and not empty) prefixed with STRING and ": ",
477    and terminated with a newline.  */
478 extern void perror (const char *string);
479 # endif
480 #elif defined GNULIB_POSIXCHECK
481 # undef perror
482 # define perror(s) \
483     (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
484                       "use gnulib module perror for portability"), \
485      perror (s))
486 #endif
487
488 #ifdef __cplusplus
489 }
490 #endif
491
492 #endif /* _GL_STDIO_H */
493 #endif /* _GL_STDIO_H */
494 #endif