]> git.cworth.org Git - tar/blob - lib/stdio.in.h
Imported Upstream version 1.20
[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 defined __need_FILE || defined __need___FILE
22 /* Special invocation convention inside glibc header files.  */
23
24 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
25
26 #else
27 /* Normal invocation convention.  */
28
29 #ifndef _GL_STDIO_H
30
31 /* The include_next requires a split double-inclusion guard.  */
32 #@INCLUDE_NEXT@ @NEXT_STDIO_H@
33
34 #ifndef _GL_STDIO_H
35 #define _GL_STDIO_H
36
37 #include <stdarg.h>
38 #include <stddef.h>
39
40 #if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
41   || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
42   || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \
43   || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@))
44 /* Get off_t and ssize_t.  */
45 # include <sys/types.h>
46 #endif
47
48 #ifndef __attribute__
49 /* This feature is available in gcc versions 2.5 and later.  */
50 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
51 #  define __attribute__(Spec) /* empty */
52 # endif
53 /* The __-protected variants of `format' and `printf' attributes
54    are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
55 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
56 #  define __format__ format
57 #  define __printf__ printf
58 # endif
59 #endif
60
61
62 /* The definition of GL_LINK_WARNING is copied here.  */
63
64
65 #ifdef __cplusplus
66 extern "C" {
67 #endif
68
69
70 #if @GNULIB_FPRINTF_POSIX@
71 # if @REPLACE_FPRINTF@
72 #  define fprintf rpl_fprintf
73 extern int fprintf (FILE *fp, const char *format, ...)
74        __attribute__ ((__format__ (__printf__, 2, 3)));
75 # endif
76 #elif defined GNULIB_POSIXCHECK
77 # undef fprintf
78 # define fprintf \
79     (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
80                       "use gnulib module fprintf-posix for portable " \
81                       "POSIX compliance"), \
82      fprintf)
83 #endif
84
85 #if @GNULIB_VFPRINTF_POSIX@
86 # if @REPLACE_VFPRINTF@
87 #  define vfprintf rpl_vfprintf
88 extern int vfprintf (FILE *fp, const char *format, va_list args)
89        __attribute__ ((__format__ (__printf__, 2, 0)));
90 # endif
91 #elif defined GNULIB_POSIXCHECK
92 # undef vfprintf
93 # define vfprintf(s,f,a) \
94     (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
95                       "use gnulib module vfprintf-posix for portable " \
96                       "POSIX compliance"), \
97      vfprintf (s, f, a))
98 #endif
99
100 #if @GNULIB_PRINTF_POSIX@
101 # if @REPLACE_PRINTF@
102 /* Don't break __attribute__((format(printf,M,N))).  */
103 #  define printf __printf__
104 extern int printf (const char *format, ...)
105        __attribute__ ((__format__ (__printf__, 1, 2)));
106 # endif
107 #elif defined GNULIB_POSIXCHECK
108 # undef printf
109 # define printf \
110     (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
111                       "use gnulib module printf-posix for portable " \
112                       "POSIX compliance"), \
113      printf)
114 /* Don't break __attribute__((format(printf,M,N))).  */
115 # define format(kind,m,n) format (__##kind##__, m, n)
116 # define __format__(kind,m,n) __format__ (__##kind##__, m, n)
117 # define ____printf____ __printf__
118 # define ____scanf____ __scanf__
119 # define ____strftime____ __strftime__
120 # define ____strfmon____ __strfmon__
121 #endif
122
123 #if @GNULIB_VPRINTF_POSIX@
124 # if @REPLACE_VPRINTF@
125 #  define vprintf rpl_vprintf
126 extern int vprintf (const char *format, va_list args)
127        __attribute__ ((__format__ (__printf__, 1, 0)));
128 # endif
129 #elif defined GNULIB_POSIXCHECK
130 # undef vprintf
131 # define vprintf(f,a) \
132     (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
133                       "use gnulib module vprintf-posix for portable " \
134                       "POSIX compliance"), \
135      vprintf (f, a))
136 #endif
137
138 #if @GNULIB_SNPRINTF@
139 # if @REPLACE_SNPRINTF@
140 #  define snprintf rpl_snprintf
141 # endif
142 # if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
143 extern int snprintf (char *str, size_t size, const char *format, ...)
144        __attribute__ ((__format__ (__printf__, 3, 4)));
145 # endif
146 #elif defined GNULIB_POSIXCHECK
147 # undef snprintf
148 # define snprintf \
149     (GL_LINK_WARNING ("snprintf is unportable - " \
150                       "use gnulib module snprintf for portability"), \
151      snprintf)
152 #endif
153
154 #if @GNULIB_VSNPRINTF@
155 # if @REPLACE_VSNPRINTF@
156 #  define vsnprintf rpl_vsnprintf
157 # endif
158 # if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
159 extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
160        __attribute__ ((__format__ (__printf__, 3, 0)));
161 # endif
162 #elif defined GNULIB_POSIXCHECK
163 # undef vsnprintf
164 # define vsnprintf(b,s,f,a) \
165     (GL_LINK_WARNING ("vsnprintf is unportable - " \
166                       "use gnulib module vsnprintf for portability"), \
167      vsnprintf (b, s, f, a))
168 #endif
169
170 #if @GNULIB_SPRINTF_POSIX@
171 # if @REPLACE_SPRINTF@
172 #  define sprintf rpl_sprintf
173 extern int sprintf (char *str, const char *format, ...)
174        __attribute__ ((__format__ (__printf__, 2, 3)));
175 # endif
176 #elif defined GNULIB_POSIXCHECK
177 # undef sprintf
178 # define sprintf \
179     (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
180                       "use gnulib module sprintf-posix for portable " \
181                       "POSIX compliance"), \
182      sprintf)
183 #endif
184
185 #if @GNULIB_VSPRINTF_POSIX@
186 # if @REPLACE_VSPRINTF@
187 #  define vsprintf rpl_vsprintf
188 extern int vsprintf (char *str, const char *format, va_list args)
189        __attribute__ ((__format__ (__printf__, 2, 0)));
190 # endif
191 #elif defined GNULIB_POSIXCHECK
192 # undef vsprintf
193 # define vsprintf(b,f,a) \
194     (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
195                       "use gnulib module vsprintf-posix for portable " \
196                       "POSIX compliance"), \
197      vsprintf (b, f, a))
198 #endif
199
200 #if @GNULIB_VASPRINTF@
201 # if @REPLACE_VASPRINTF@
202 #  define asprintf rpl_asprintf
203 #  define vasprintf rpl_vasprintf
204 # endif
205 # if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
206   /* Write formatted output to a string dynamically allocated with malloc().
207      If the memory allocation succeeds, store the address of the string in
208      *RESULT and return the number of resulting bytes, excluding the trailing
209      NUL.  Upon memory allocation error, or some other error, return -1.  */
210   extern int asprintf (char **result, const char *format, ...)
211     __attribute__ ((__format__ (__printf__, 2, 3)));
212   extern int vasprintf (char **result, const char *format, va_list args)
213     __attribute__ ((__format__ (__printf__, 2, 0)));
214 # endif
215 #endif
216
217 #if @GNULIB_FOPEN@
218 # if @REPLACE_FOPEN@
219 #  define fopen rpl_fopen
220 extern FILE * fopen (const char *filename, const char *mode);
221 # endif
222 #elif defined GNULIB_POSIXCHECK
223 # undef fopen
224 # define fopen(f,m) \
225    (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
226                      "use gnulib module fopen for portability"), \
227     fopen (f, m))
228 #endif
229
230 #if @GNULIB_FREOPEN@
231 # if @REPLACE_FREOPEN@
232 #  define freopen rpl_freopen
233 extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
234 # endif
235 #elif defined GNULIB_POSIXCHECK
236 # undef freopen
237 # define freopen(f,m,s) \
238    (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
239                      "use gnulib module freopen for portability"), \
240     freopen (f, m, s))
241 #endif
242
243 #if @GNULIB_FSEEKO@
244 # if @REPLACE_FSEEKO@
245 /* Provide fseek, fseeko functions that are aware of a preceding
246    fflush(), and which detect pipes.  */
247 #  define fseeko rpl_fseeko
248 extern int fseeko (FILE *fp, off_t offset, int whence);
249 #  define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
250 # endif
251 #elif defined GNULIB_POSIXCHECK
252 # undef fseeko
253 # define fseeko(f,o,w) \
254    (GL_LINK_WARNING ("fseeko is unportable - " \
255                      "use gnulib module fseeko for portability"), \
256     fseeko (f, o, w))
257 #endif
258
259 #if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
260 extern int rpl_fseek (FILE *fp, long offset, int whence);
261 # undef fseek
262 # if defined GNULIB_POSIXCHECK
263 #  define fseek(f,o,w) \
264      (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
265                        "on 32-bit platforms - " \
266                        "use fseeko function for handling of large files"), \
267       rpl_fseek (f, o, w))
268 # else
269 #  define fseek rpl_fseek
270 # endif
271 #elif defined GNULIB_POSIXCHECK
272 # ifndef fseek
273 #  define fseek(f,o,w) \
274      (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
275                        "on 32-bit platforms - " \
276                        "use fseeko function for handling of large files"), \
277       fseek (f, o, w))
278 # endif
279 #endif
280
281 #if @GNULIB_FTELLO@
282 # if @REPLACE_FTELLO@
283 #  define ftello rpl_ftello
284 extern off_t ftello (FILE *fp);
285 #  define ftell(fp) ftello (fp)
286 # endif
287 #elif defined GNULIB_POSIXCHECK
288 # undef ftello
289 # define ftello(f) \
290    (GL_LINK_WARNING ("ftello is unportable - " \
291                      "use gnulib module ftello for portability"), \
292     ftello (f))
293 #endif
294
295 #if @GNULIB_FTELL@ && @REPLACE_FTELL@
296 extern long rpl_ftell (FILE *fp);
297 # undef ftell
298 # if GNULIB_POSIXCHECK
299 #  define ftell(f) \
300      (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
301                        "on 32-bit platforms - " \
302                        "use ftello function for handling of large files"), \
303       rpl_ftell (f))
304 # else
305 #  define ftell rpl_ftell
306 # endif
307 #elif defined GNULIB_POSIXCHECK
308 # ifndef ftell
309 #  define ftell(f) \
310      (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
311                        "on 32-bit platforms - " \
312                        "use ftello function for handling of large files"), \
313       ftell (f))
314 # endif
315 #endif
316
317 #if @GNULIB_FFLUSH@
318 # if @REPLACE_FFLUSH@
319 #  define fflush rpl_fflush
320   /* Flush all pending data on STREAM according to POSIX rules.  Both
321      output and seekable input streams are supported.
322      Note! LOSS OF DATA can occur if fflush is applied on an input stream
323      that is _not_seekable_ or on an update stream that is _not_seekable_
324      and in which the most recent operation was input.  Seekability can
325      be tested with lseek(fileno(fp),0,SEEK_CUR).  */
326   extern int fflush (FILE *gl_stream);
327 # endif
328 #elif defined GNULIB_POSIXCHECK
329 # undef fflush
330 # define fflush(f) \
331    (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
332                      "use gnulib module fflush for portable " \
333                      "POSIX compliance"), \
334     fflush (f))
335 #endif
336
337 #if @GNULIB_GETDELIM@
338 # if !@HAVE_DECL_GETDELIM@
339 /* Read input, up to (and including) the next occurrence of DELIMITER, from
340    STREAM, store it in *LINEPTR (and NUL-terminate it).
341    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
342    bytes of space.  It is realloc'd as necessary.
343    Return the number of bytes read and stored at *LINEPTR (not including the
344    NUL terminator), or -1 on error or EOF.  */
345 extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
346                          FILE *stream);
347 # endif
348 #elif defined GNULIB_POSIXCHECK
349 # undef getdelim
350 # define getdelim(l, s, d, f)                                       \
351   (GL_LINK_WARNING ("getdelim is unportable - "                     \
352                     "use gnulib module getdelim for portability"),  \
353    getdelim (l, s, d, f))
354 #endif
355
356 #if @GNULIB_GETLINE@
357 # if @REPLACE_GETLINE@
358 #  undef getline
359 #  define getline rpl_getline
360 # endif
361 # if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
362 /* Read a line, up to (and including) the next newline, from STREAM, store it
363    in *LINEPTR (and NUL-terminate it).
364    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
365    bytes of space.  It is realloc'd as necessary.
366    Return the number of bytes read and stored at *LINEPTR (not including the
367    NUL terminator), or -1 on error or EOF.  */
368 extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
369 # endif
370 #elif defined GNULIB_POSIXCHECK
371 # undef getline
372 # define getline(l, s, f)                                               \
373   (GL_LINK_WARNING ("getline is unportable - "                          \
374                     "use gnulib module getline for portability"),       \
375    getline (l, s, f))
376 #endif
377
378 #ifdef __cplusplus
379 }
380 #endif
381
382 #endif /* _GL_STDIO_H */
383 #endif /* _GL_STDIO_H */
384 #endif