]> git.cworth.org Git - tar/blob - lib/stdio.in.h
Imported Upstream version 1.22
[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_DPRINTF@
222 # if @REPLACE_DPRINTF@
223 #  define dprintf rpl_dprintf
224 # endif
225 # if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@
226 extern int dprintf (int fd, const char *format, ...)
227        __attribute__ ((__format__ (__printf__, 2, 3)));
228 # endif
229 #elif defined GNULIB_POSIXCHECK
230 # undef dprintf
231 # define dprintf(d,f,a) \
232     (GL_LINK_WARNING ("dprintf is unportable - " \
233                       "use gnulib module dprintf for portability"), \
234      dprintf (d, f, a))
235 #endif
236
237 #if @GNULIB_VDPRINTF@
238 # if @REPLACE_VDPRINTF@
239 #  define vdprintf rpl_vdprintf
240 # endif
241 # if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@
242 extern int vdprintf (int fd, const char *format, va_list args)
243        __attribute__ ((__format__ (__printf__, 2, 0)));
244 # endif
245 #elif defined GNULIB_POSIXCHECK
246 # undef vdprintf
247 # define vdprintf(d,f,a) \
248     (GL_LINK_WARNING ("vdprintf is unportable - " \
249                       "use gnulib module vdprintf for portability"), \
250      vdprintf (d, f, a))
251 #endif
252
253 #if @GNULIB_VASPRINTF@
254 # if @REPLACE_VASPRINTF@
255 #  define asprintf rpl_asprintf
256 #  define vasprintf rpl_vasprintf
257 # endif
258 # if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
259   /* Write formatted output to a string dynamically allocated with malloc().
260      If the memory allocation succeeds, store the address of the string in
261      *RESULT and return the number of resulting bytes, excluding the trailing
262      NUL.  Upon memory allocation error, or some other error, return -1.  */
263   extern int asprintf (char **result, const char *format, ...)
264     __attribute__ ((__format__ (__printf__, 2, 3)));
265   extern int vasprintf (char **result, const char *format, va_list args)
266     __attribute__ ((__format__ (__printf__, 2, 0)));
267 # endif
268 #endif
269
270 #if @GNULIB_OBSTACK_PRINTF@
271 # if @REPLACE_OBSTACK_PRINTF@
272 #  define obstack_printf rpl_osbtack_printf
273 #  define obstack_vprintf rpl_obstack_vprintf
274 # endif
275 # if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@
276   struct obstack;
277   /* Grow an obstack with formatted output.  Return the number of
278      bytes added to OBS.  No trailing nul byte is added, and the
279      object should be closed with obstack_finish before use.  Upon
280      memory allocation error, call obstack_alloc_failed_handler.  Upon
281      other error, return -1.  */
282   extern int obstack_printf (struct obstack *obs, const char *format, ...)
283     __attribute__ ((__format__ (__printf__, 2, 3)));
284   extern int obstack_vprintf (struct obstack *obs, const char *format,
285                               va_list args)
286     __attribute__ ((__format__ (__printf__, 2, 0)));
287 # endif
288 #endif
289
290 #if @GNULIB_FOPEN@
291 # if @REPLACE_FOPEN@
292 #  undef fopen
293 #  define fopen rpl_fopen
294 extern FILE * fopen (const char *filename, const char *mode);
295 # endif
296 #elif defined GNULIB_POSIXCHECK
297 # undef fopen
298 # define fopen(f,m) \
299    (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
300                      "use gnulib module fopen for portability"), \
301     fopen (f, m))
302 #endif
303
304 #if @GNULIB_FREOPEN@
305 # if @REPLACE_FREOPEN@
306 #  undef freopen
307 #  define freopen rpl_freopen
308 extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
309 # endif
310 #elif defined GNULIB_POSIXCHECK
311 # undef freopen
312 # define freopen(f,m,s) \
313    (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
314                      "use gnulib module freopen for portability"), \
315     freopen (f, m, s))
316 #endif
317
318 #if @GNULIB_FSEEKO@
319 # if @REPLACE_FSEEKO@
320 /* Provide fseek, fseeko functions that are aware of a preceding
321    fflush(), and which detect pipes.  */
322 #  define fseeko rpl_fseeko
323 extern int fseeko (FILE *fp, off_t offset, int whence);
324 #  define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
325 # endif
326 #elif defined GNULIB_POSIXCHECK
327 # undef fseeko
328 # define fseeko(f,o,w) \
329    (GL_LINK_WARNING ("fseeko is unportable - " \
330                      "use gnulib module fseeko for portability"), \
331     fseeko (f, o, w))
332 #endif
333
334 #if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
335 extern int rpl_fseek (FILE *fp, long offset, int whence);
336 # undef fseek
337 # if defined GNULIB_POSIXCHECK
338 #  define fseek(f,o,w) \
339      (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
340                        "on 32-bit platforms - " \
341                        "use fseeko function for handling of large files"), \
342       rpl_fseek (f, o, w))
343 # else
344 #  define fseek rpl_fseek
345 # endif
346 #elif defined GNULIB_POSIXCHECK
347 # ifndef fseek
348 #  define fseek(f,o,w) \
349      (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
350                        "on 32-bit platforms - " \
351                        "use fseeko function for handling of large files"), \
352       fseek (f, o, w))
353 # endif
354 #endif
355
356 #if @GNULIB_FTELLO@
357 # if @REPLACE_FTELLO@
358 #  define ftello rpl_ftello
359 extern off_t ftello (FILE *fp);
360 #  define ftell(fp) ftello (fp)
361 # endif
362 #elif defined GNULIB_POSIXCHECK
363 # undef ftello
364 # define ftello(f) \
365    (GL_LINK_WARNING ("ftello is unportable - " \
366                      "use gnulib module ftello for portability"), \
367     ftello (f))
368 #endif
369
370 #if @GNULIB_FTELL@ && @REPLACE_FTELL@
371 extern long rpl_ftell (FILE *fp);
372 # undef ftell
373 # if GNULIB_POSIXCHECK
374 #  define ftell(f) \
375      (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
376                        "on 32-bit platforms - " \
377                        "use ftello function for handling of large files"), \
378       rpl_ftell (f))
379 # else
380 #  define ftell rpl_ftell
381 # endif
382 #elif defined GNULIB_POSIXCHECK
383 # ifndef ftell
384 #  define ftell(f) \
385      (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
386                        "on 32-bit platforms - " \
387                        "use ftello function for handling of large files"), \
388       ftell (f))
389 # endif
390 #endif
391
392 #if @GNULIB_FFLUSH@
393 # if @REPLACE_FFLUSH@
394 #  define fflush rpl_fflush
395   /* Flush all pending data on STREAM according to POSIX rules.  Both
396      output and seekable input streams are supported.
397      Note! LOSS OF DATA can occur if fflush is applied on an input stream
398      that is _not_seekable_ or on an update stream that is _not_seekable_
399      and in which the most recent operation was input.  Seekability can
400      be tested with lseek(fileno(fp),0,SEEK_CUR).  */
401   extern int fflush (FILE *gl_stream);
402 # endif
403 #elif defined GNULIB_POSIXCHECK
404 # undef fflush
405 # define fflush(f) \
406    (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
407                      "use gnulib module fflush for portable " \
408                      "POSIX compliance"), \
409     fflush (f))
410 #endif
411
412 #if @GNULIB_FCLOSE@
413 # if @REPLACE_FCLOSE@
414 #  define fclose rpl_fclose
415   /* Close STREAM and its underlying file descriptor.  */
416 extern int fclose (FILE *stream);
417 # endif
418 #elif defined GNULIB_POSIXCHECK
419 # undef fclose
420 # define fclose(f) \
421    (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
422                      "use gnulib module fclose for portable " \
423                      "POSIX compliance"), \
424     fclose (f))
425 #endif
426
427 #if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
428 # undef fputc
429 # define fputc rpl_fputc
430 extern int fputc (int c, FILE *stream);
431 #endif
432
433 #if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
434 # undef putc
435 # define putc rpl_fputc
436 extern int putc (int c, FILE *stream);
437 #endif
438
439 #if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
440 # undef putchar
441 # define putchar rpl_putchar
442 extern int putchar (int c);
443 #endif
444
445 #if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
446 # undef fputs
447 # define fputs rpl_fputs
448 extern int fputs (const char *string, FILE *stream);
449 #endif
450
451 #if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
452 # undef puts
453 # define puts rpl_puts
454 extern int puts (const char *string);
455 #endif
456
457 #if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
458 # undef fwrite
459 # define fwrite rpl_fwrite
460 extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
461 #endif
462
463 #if @GNULIB_GETDELIM@
464 # if !@HAVE_DECL_GETDELIM@
465 /* Read input, up to (and including) the next occurrence of DELIMITER, from
466    STREAM, store it in *LINEPTR (and NUL-terminate it).
467    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
468    bytes of space.  It is realloc'd as necessary.
469    Return the number of bytes read and stored at *LINEPTR (not including the
470    NUL terminator), or -1 on error or EOF.  */
471 extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
472                          FILE *stream);
473 # endif
474 #elif defined GNULIB_POSIXCHECK
475 # undef getdelim
476 # define getdelim(l, s, d, f)                                       \
477   (GL_LINK_WARNING ("getdelim is unportable - "                     \
478                     "use gnulib module getdelim for portability"),  \
479    getdelim (l, s, d, f))
480 #endif
481
482 #if @GNULIB_GETLINE@
483 # if @REPLACE_GETLINE@
484 #  undef getline
485 #  define getline rpl_getline
486 # endif
487 # if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
488 /* Read a line, up to (and including) the next newline, from STREAM, store it
489    in *LINEPTR (and NUL-terminate it).
490    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
491    bytes of space.  It is realloc'd as necessary.
492    Return the number of bytes read and stored at *LINEPTR (not including the
493    NUL terminator), or -1 on error or EOF.  */
494 extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
495 # endif
496 #elif defined GNULIB_POSIXCHECK
497 # undef getline
498 # define getline(l, s, f)                                               \
499   (GL_LINK_WARNING ("getline is unportable - "                          \
500                     "use gnulib module getline for portability"),       \
501    getline (l, s, f))
502 #endif
503
504 #if @GNULIB_PERROR@
505 # if @REPLACE_PERROR@
506 #  define perror rpl_perror
507 /* Print a message to standard error, describing the value of ERRNO,
508    (if STRING is not NULL and not empty) prefixed with STRING and ": ",
509    and terminated with a newline.  */
510 extern void perror (const char *string);
511 # endif
512 #elif defined GNULIB_POSIXCHECK
513 # undef perror
514 # define perror(s) \
515     (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
516                       "use gnulib module perror for portability"), \
517      perror (s))
518 #endif
519
520 #ifdef __cplusplus
521 }
522 #endif
523
524 #endif /* _GL_STDIO_H */
525 #endif /* _GL_STDIO_H */
526 #endif