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