~ubuntu-branches/ubuntu/quantal/gnutls26/quantal-security

« back to all changes in this revision

Viewing changes to gl/stdio.in.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-05-20 13:07:18 UTC
  • mfrom: (12.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20110520130718-db41dybbanzfvlji
Tags: 2.10.5-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Fix build failure with --no-add-needed.
  - Build for multiarch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* A GNU-like <stdio.h>.
2
2
 
3
 
   Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc.
 
3
   Copyright (C) 2004, 2007-2010 Free Software Foundation, Inc.
4
4
 
5
5
   This program is free software; you can redistribute it and/or modify
6
6
   it under the terms of the GNU General Public License as published by
36
36
#ifndef _GL_STDIO_H
37
37
#define _GL_STDIO_H
38
38
 
 
39
/* Get va_list.  Needed on many systems, including glibc 2.8.  */
39
40
#include <stdarg.h>
 
41
 
40
42
#include <stddef.h>
41
43
 
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
 
44
/* Get off_t and ssize_t.  Needed on many systems, including glibc 2.8.  */
 
45
#include <sys/types.h>
49
46
 
50
47
#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.  */
 
48
/* The __attribute__ feature is available in gcc versions 2.5 and later.
 
49
   The __-protected variants of the attributes 'format' and 'printf' are
 
50
   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
 
51
   We enable __attribute__ only if these are supported too, because
 
52
   gnulib and libintl do '#define printf __printf__' when they override
 
53
   the 'printf' function.  */
57
54
# 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
 
 
72
 
#if @GNULIB_FPRINTF_POSIX@
73
 
# if @REPLACE_FPRINTF@
74
 
#  define fprintf rpl_fprintf
75
 
extern int fprintf (FILE *fp, const char *format, ...)
76
 
       __attribute__ ((__format__ (__printf__, 2, 3)));
77
 
# endif
78
 
#elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
79
 
# define fprintf rpl_fprintf
80
 
extern int fprintf (FILE *fp, const char *format, ...)
81
 
       __attribute__ ((__format__ (__printf__, 2, 3)));
82
 
#elif defined GNULIB_POSIXCHECK
83
 
# undef fprintf
84
 
# define fprintf \
85
 
    (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
86
 
                      "use gnulib module fprintf-posix for portable " \
87
 
                      "POSIX compliance"), \
88
 
     fprintf)
89
 
#endif
90
 
 
91
 
#if @GNULIB_VFPRINTF_POSIX@
92
 
# if @REPLACE_VFPRINTF@
93
 
#  define vfprintf rpl_vfprintf
94
 
extern int vfprintf (FILE *fp, const char *format, va_list args)
95
 
       __attribute__ ((__format__ (__printf__, 2, 0)));
96
 
# endif
97
 
#elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
98
 
# define vfprintf rpl_vfprintf
99
 
extern int vfprintf (FILE *fp, const char *format, va_list args)
100
 
       __attribute__ ((__format__ (__printf__, 2, 0)));
101
 
#elif defined GNULIB_POSIXCHECK
102
 
# undef vfprintf
103
 
# define vfprintf(s,f,a) \
104
 
    (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
105
 
                      "use gnulib module vfprintf-posix for portable " \
106
 
                      "POSIX compliance"), \
107
 
     vfprintf (s, f, a))
108
 
#endif
109
 
 
110
 
#if @GNULIB_PRINTF_POSIX@
111
 
# if @REPLACE_PRINTF@
112
 
/* Don't break __attribute__((format(printf,M,N))).  */
113
 
#  define printf __printf__
114
 
extern int printf (const char *format, ...)
115
 
       __attribute__ ((__format__ (__printf__, 1, 2)));
116
 
# endif
117
 
#elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
118
 
/* Don't break __attribute__((format(printf,M,N))).  */
119
 
# define printf __printf__
120
 
extern int printf (const char *format, ...)
121
 
       __attribute__ ((__format__ (__printf__, 1, 2)));
122
 
#elif defined GNULIB_POSIXCHECK
123
 
# undef printf
124
 
# define printf \
125
 
    (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
126
 
                      "use gnulib module printf-posix for portable " \
127
 
                      "POSIX compliance"), \
128
 
     printf)
129
 
/* Don't break __attribute__((format(printf,M,N))).  */
130
 
# define format(kind,m,n) format (__##kind##__, m, n)
131
 
# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
132
 
# define ____printf____ __printf__
133
 
# define ____scanf____ __scanf__
134
 
# define ____strftime____ __strftime__
135
 
# define ____strfmon____ __strfmon__
136
 
#endif
137
 
 
138
 
#if @GNULIB_VPRINTF_POSIX@
139
 
# if @REPLACE_VPRINTF@
140
 
#  define vprintf rpl_vprintf
141
 
extern int vprintf (const char *format, va_list args)
142
 
       __attribute__ ((__format__ (__printf__, 1, 0)));
143
 
# endif
144
 
#elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
145
 
# define vprintf rpl_vprintf
146
 
extern int vprintf (const char *format, va_list args)
147
 
       __attribute__ ((__format__ (__printf__, 1, 0)));
148
 
#elif defined GNULIB_POSIXCHECK
149
 
# undef vprintf
150
 
# define vprintf(f,a) \
151
 
    (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
152
 
                      "use gnulib module vprintf-posix for portable " \
153
 
                      "POSIX compliance"), \
154
 
     vprintf (f, a))
155
 
#endif
156
 
 
157
 
#if @GNULIB_SNPRINTF@
158
 
# if @REPLACE_SNPRINTF@
159
 
#  define snprintf rpl_snprintf
160
 
# endif
161
 
# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
162
 
extern int snprintf (char *str, size_t size, const char *format, ...)
163
 
       __attribute__ ((__format__ (__printf__, 3, 4)));
164
 
# endif
165
 
#elif defined GNULIB_POSIXCHECK
166
 
# undef snprintf
167
 
# define snprintf \
168
 
    (GL_LINK_WARNING ("snprintf is unportable - " \
169
 
                      "use gnulib module snprintf for portability"), \
170
 
     snprintf)
171
 
#endif
172
 
 
173
 
#if @GNULIB_VSNPRINTF@
174
 
# if @REPLACE_VSNPRINTF@
175
 
#  define vsnprintf rpl_vsnprintf
176
 
# endif
177
 
# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
178
 
extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
179
 
       __attribute__ ((__format__ (__printf__, 3, 0)));
180
 
# endif
181
 
#elif defined GNULIB_POSIXCHECK
182
 
# undef vsnprintf
183
 
# define vsnprintf(b,s,f,a) \
184
 
    (GL_LINK_WARNING ("vsnprintf is unportable - " \
185
 
                      "use gnulib module vsnprintf for portability"), \
186
 
     vsnprintf (b, s, f, a))
187
 
#endif
188
 
 
189
 
#if @GNULIB_SPRINTF_POSIX@
190
 
# if @REPLACE_SPRINTF@
191
 
#  define sprintf rpl_sprintf
192
 
extern int sprintf (char *str, const char *format, ...)
193
 
       __attribute__ ((__format__ (__printf__, 2, 3)));
194
 
# endif
195
 
#elif defined GNULIB_POSIXCHECK
196
 
# undef sprintf
197
 
# define sprintf \
198
 
    (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
199
 
                      "use gnulib module sprintf-posix for portable " \
200
 
                      "POSIX compliance"), \
201
 
     sprintf)
202
 
#endif
203
 
 
204
 
#if @GNULIB_VSPRINTF_POSIX@
205
 
# if @REPLACE_VSPRINTF@
206
 
#  define vsprintf rpl_vsprintf
207
 
extern int vsprintf (char *str, const char *format, va_list args)
208
 
       __attribute__ ((__format__ (__printf__, 2, 0)));
209
 
# endif
210
 
#elif defined GNULIB_POSIXCHECK
211
 
# undef vsprintf
212
 
# define vsprintf(b,f,a) \
213
 
    (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
214
 
                      "use gnulib module vsprintf-posix for portable " \
215
 
                      "POSIX compliance"), \
216
 
     vsprintf (b, f, a))
217
 
#endif
 
55
#  define __attribute__(Spec)   /* empty */
 
56
# endif
 
57
#endif
 
58
 
 
59
 
 
60
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
61
 
 
62
/* The definition of _GL_ARG_NONNULL is copied here.  */
 
63
 
 
64
/* The definition of _GL_WARN_ON_USE is copied here.  */
 
65
 
 
66
/* Macros for stringification.  */
 
67
#define _GL_STDIO_STRINGIZE(token) #token
 
68
#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
 
69
 
218
70
 
219
71
#if @GNULIB_DPRINTF@
220
72
# if @REPLACE_DPRINTF@
221
 
#  define dprintf rpl_dprintf
222
 
# endif
223
 
# if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@
224
 
extern int dprintf (int fd, const char *format, ...)
225
 
       __attribute__ ((__format__ (__printf__, 2, 3)));
226
 
# endif
 
73
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
74
#   define dprintf rpl_dprintf
 
75
#  endif
 
76
_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...)
 
77
                                __attribute__ ((__format__ (__printf__, 2, 3)))
 
78
                                _GL_ARG_NONNULL ((2)));
 
79
_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...));
 
80
# else
 
81
#  if !@HAVE_DPRINTF@
 
82
_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...)
 
83
                                __attribute__ ((__format__ (__printf__, 2, 3)))
 
84
                                _GL_ARG_NONNULL ((2)));
 
85
#  endif
 
86
_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...));
 
87
# endif
 
88
_GL_CXXALIASWARN (dprintf);
227
89
#elif defined GNULIB_POSIXCHECK
228
90
# undef dprintf
229
 
# define dprintf(d,f,a) \
230
 
    (GL_LINK_WARNING ("dprintf is unportable - " \
231
 
                      "use gnulib module dprintf for portability"), \
232
 
     dprintf (d, f, a))
233
 
#endif
234
 
 
235
 
#if @GNULIB_VDPRINTF@
236
 
# if @REPLACE_VDPRINTF@
237
 
#  define vdprintf rpl_vdprintf
238
 
# endif
239
 
# if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@
240
 
extern int vdprintf (int fd, const char *format, va_list args)
241
 
       __attribute__ ((__format__ (__printf__, 2, 0)));
242
 
# endif
243
 
#elif defined GNULIB_POSIXCHECK
244
 
# undef vdprintf
245
 
# define vdprintf(d,f,a) \
246
 
    (GL_LINK_WARNING ("vdprintf is unportable - " \
247
 
                      "use gnulib module vdprintf for portability"), \
248
 
     vdprintf (d, f, a))
249
 
#endif
250
 
 
251
 
#if @GNULIB_VASPRINTF@
252
 
# if @REPLACE_VASPRINTF@
253
 
#  define asprintf rpl_asprintf
254
 
#  define vasprintf rpl_vasprintf
255
 
# endif
256
 
# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
257
 
  /* Write formatted output to a string dynamically allocated with malloc().
258
 
     If the memory allocation succeeds, store the address of the string in
259
 
     *RESULT and return the number of resulting bytes, excluding the trailing
260
 
     NUL.  Upon memory allocation error, or some other error, return -1.  */
261
 
  extern int asprintf (char **result, const char *format, ...)
262
 
    __attribute__ ((__format__ (__printf__, 2, 3)));
263
 
  extern int vasprintf (char **result, const char *format, va_list args)
264
 
    __attribute__ ((__format__ (__printf__, 2, 0)));
265
 
# endif
266
 
#endif
267
 
 
268
 
#if @GNULIB_OBSTACK_PRINTF@
269
 
# if @REPLACE_OBSTACK_PRINTF@
270
 
#  define obstack_printf rpl_osbtack_printf
271
 
#  define obstack_vprintf rpl_obstack_vprintf
272
 
# endif
273
 
# if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@
274
 
  struct obstack;
275
 
  /* Grow an obstack with formatted output.  Return the number of
276
 
     bytes added to OBS.  No trailing nul byte is added, and the
277
 
     object should be closed with obstack_finish before use.  Upon
278
 
     memory allocation error, call obstack_alloc_failed_handler.  Upon
279
 
     other error, return -1.  */
280
 
  extern int obstack_printf (struct obstack *obs, const char *format, ...)
281
 
    __attribute__ ((__format__ (__printf__, 2, 3)));
282
 
  extern int obstack_vprintf (struct obstack *obs, const char *format,
283
 
                              va_list args)
284
 
    __attribute__ ((__format__ (__printf__, 2, 0)));
285
 
# endif
286
 
#endif
 
91
# if HAVE_RAW_DECL_DPRINTF
 
92
_GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
 
93
                 "use gnulib module dprintf for portability");
 
94
# endif
 
95
#endif
 
96
 
 
97
#if @GNULIB_FCLOSE@
 
98
/* Close STREAM and its underlying file descriptor.  */
 
99
# if @REPLACE_FCLOSE@
 
100
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
101
#   define fclose rpl_fclose
 
102
#  endif
 
103
_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
 
104
_GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
 
105
# else
 
106
_GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
 
107
# endif
 
108
_GL_CXXALIASWARN (fclose);
 
109
#elif defined GNULIB_POSIXCHECK
 
110
# undef fclose
 
111
/* Assume fclose is always declared.  */
 
112
_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
 
113
                 "use gnulib module fclose for portable POSIX compliance");
 
114
#endif
 
115
 
 
116
#if @GNULIB_FFLUSH@
 
117
/* Flush all pending data on STREAM according to POSIX rules.  Both
 
118
   output and seekable input streams are supported.
 
119
   Note! LOSS OF DATA can occur if fflush is applied on an input stream
 
120
   that is _not_seekable_ or on an update stream that is _not_seekable_
 
121
   and in which the most recent operation was input.  Seekability can
 
122
   be tested with lseek(fileno(fp),0,SEEK_CUR).  */
 
123
# if @REPLACE_FFLUSH@
 
124
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
125
#   define fflush rpl_fflush
 
126
#  endif
 
127
_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
 
128
_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
 
129
# else
 
130
_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
 
131
# endif
 
132
_GL_CXXALIASWARN (fflush);
 
133
#elif defined GNULIB_POSIXCHECK
 
134
# undef fflush
 
135
/* Assume fflush is always declared.  */
 
136
_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
 
137
                 "use gnulib module fflush for portable POSIX compliance");
 
138
#endif
 
139
 
 
140
/* It is very rare that the developer ever has full control of stdin,
 
141
   so any use of gets warrants an unconditional warning.  Assume it is
 
142
   always declared, since it is required by C89.  */
 
143
#undef gets
 
144
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
287
145
 
288
146
#if @GNULIB_FOPEN@
289
147
# if @REPLACE_FOPEN@
290
 
#  undef fopen
291
 
#  define fopen rpl_fopen
292
 
extern FILE * fopen (const char *filename, const char *mode);
 
148
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
149
#   undef fopen
 
150
#   define fopen rpl_fopen
 
151
#  endif
 
152
_GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode)
 
153
                                 _GL_ARG_NONNULL ((1, 2)));
 
154
_GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
 
155
# else
 
156
_GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
293
157
# endif
 
158
_GL_CXXALIASWARN (fopen);
294
159
#elif defined GNULIB_POSIXCHECK
295
160
# undef fopen
296
 
# define fopen(f,m) \
297
 
   (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
298
 
                     "use gnulib module fopen for portability"), \
299
 
    fopen (f, m))
 
161
/* Assume fopen is always declared.  */
 
162
_GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
 
163
                 "use gnulib module fopen for portability");
 
164
#endif
 
165
 
 
166
#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
 
167
# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
 
168
     || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
 
169
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
170
#   define fprintf rpl_fprintf
 
171
#  endif
 
172
#  define GNULIB_overrides_fprintf 1
 
173
_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
 
174
                                __attribute__ ((__format__ (__printf__, 2, 3)))
 
175
                                _GL_ARG_NONNULL ((1, 2)));
 
176
_GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
 
177
# else
 
178
_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
 
179
# endif
 
180
_GL_CXXALIASWARN (fprintf);
 
181
#endif
 
182
#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
 
183
# if !GNULIB_overrides_fprintf
 
184
#  undef fprintf
 
185
# endif
 
186
/* Assume fprintf is always declared.  */
 
187
_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
 
188
                 "use gnulib module fprintf-posix for portable "
 
189
                 "POSIX compliance");
 
190
#endif
 
191
 
 
192
#if @GNULIB_FPURGE@
 
193
/* Discard all pending buffered I/O data on STREAM.
 
194
   STREAM must not be wide-character oriented.
 
195
   When discarding pending output, the file position is set back to where it
 
196
   was before the write calls.  When discarding pending input, the file
 
197
   position is advanced to match the end of the previously read input.
 
198
   Return 0 if successful.  Upon error, return -1 and set errno.  */
 
199
# if @REPLACE_FPURGE@
 
200
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
201
#   define fpurge rpl_fpurge
 
202
#  endif
 
203
_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
 
204
_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
 
205
# else
 
206
#  if !@HAVE_DECL_FPURGE@
 
207
_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
 
208
#  endif
 
209
_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
 
210
# endif
 
211
_GL_CXXALIASWARN (fpurge);
 
212
#elif defined GNULIB_POSIXCHECK
 
213
# undef fpurge
 
214
# if HAVE_RAW_DECL_FPURGE
 
215
_GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
 
216
                 "use gnulib module fpurge for portability");
 
217
# endif
 
218
#endif
 
219
 
 
220
#if @GNULIB_FPUTC@
 
221
# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 
222
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
223
#   undef fputc
 
224
#   define fputc rpl_fputc
 
225
#  endif
 
226
_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
 
227
_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
 
228
# else
 
229
_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
 
230
# endif
 
231
_GL_CXXALIASWARN (fputc);
 
232
#endif
 
233
 
 
234
#if @GNULIB_FPUTS@
 
235
# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 
236
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
237
#   undef fputs
 
238
#   define fputs rpl_fputs
 
239
#  endif
 
240
_GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream)
 
241
                              _GL_ARG_NONNULL ((1, 2)));
 
242
_GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
 
243
# else
 
244
_GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
 
245
# endif
 
246
_GL_CXXALIASWARN (fputs);
300
247
#endif
301
248
 
302
249
#if @GNULIB_FREOPEN@
303
250
# if @REPLACE_FREOPEN@
304
 
#  undef freopen
305
 
#  define freopen rpl_freopen
306
 
extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
 
251
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
252
#   undef freopen
 
253
#   define freopen rpl_freopen
 
254
#  endif
 
255
_GL_FUNCDECL_RPL (freopen, FILE *,
 
256
                  (const char *filename, const char *mode, FILE *stream)
 
257
                  _GL_ARG_NONNULL ((2, 3)));
 
258
_GL_CXXALIAS_RPL (freopen, FILE *,
 
259
                  (const char *filename, const char *mode, FILE *stream));
 
260
# else
 
261
_GL_CXXALIAS_SYS (freopen, FILE *,
 
262
                  (const char *filename, const char *mode, FILE *stream));
307
263
# endif
 
264
_GL_CXXALIASWARN (freopen);
308
265
#elif defined GNULIB_POSIXCHECK
309
266
# undef freopen
310
 
# define freopen(f,m,s) \
311
 
   (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
312
 
                     "use gnulib module freopen for portability"), \
313
 
    freopen (f, m, s))
 
267
/* Assume freopen is always declared.  */
 
268
_GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - "
 
269
                 "use gnulib module freopen for portability");
 
270
#endif
 
271
 
 
272
 
 
273
/* Set up the following warnings, based on which modules are in use.
 
274
   GNU Coding Standards discourage the use of fseek, since it imposes
 
275
   an arbitrary limitation on some 32-bit hosts.  Remember that the
 
276
   fseek module depends on the fseeko module, so we only have three
 
277
   cases to consider:
 
278
 
 
279
   1. The developer is not using either module.  Issue a warning under
 
280
   GNULIB_POSIXCHECK for both functions, to remind them that both
 
281
   functions have bugs on some systems.  _GL_NO_LARGE_FILES has no
 
282
   impact on this warning.
 
283
 
 
284
   2. The developer is using both modules.  They may be unaware of the
 
285
   arbitrary limitations of fseek, so issue a warning under
 
286
   GNULIB_POSIXCHECK.  On the other hand, they may be using both
 
287
   modules intentionally, so the developer can define
 
288
   _GL_NO_LARGE_FILES in the compilation units where the use of fseek
 
289
   is safe, to silence the warning.
 
290
 
 
291
   3. The developer is using the fseeko module, but not fseek.  Gnulib
 
292
   guarantees that fseek will still work around platform bugs in that
 
293
   case, but we presume that the developer is aware of the pitfalls of
 
294
   fseek and was trying to avoid it, so issue a warning even when
 
295
   GNULIB_POSIXCHECK is undefined.  Again, _GL_NO_LARGE_FILES can be
 
296
   defined to silence the warning in particular compilation units.
 
297
   In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
 
298
   fseek gets defined as a macro, it is recommended that the developer
 
299
   uses the fseek module, even if he is not calling the fseek function.
 
300
 
 
301
   Most gnulib clients that perform stream operations should fall into
 
302
   category 3.  */
 
303
 
 
304
#if @GNULIB_FSEEK@
 
305
# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
 
306
#  define _GL_FSEEK_WARN /* Category 2, above.  */
 
307
#  undef fseek
 
308
# endif
 
309
# if @REPLACE_FSEEK@
 
310
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
311
#   undef fseek
 
312
#   define fseek rpl_fseek
 
313
#  endif
 
314
_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
 
315
                              _GL_ARG_NONNULL ((1)));
 
316
_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
 
317
# else
 
318
_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
 
319
# endif
 
320
_GL_CXXALIASWARN (fseek);
314
321
#endif
315
322
 
316
323
#if @GNULIB_FSEEKO@
 
324
# if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
 
325
#  define _GL_FSEEK_WARN /* Category 3, above.  */
 
326
#  undef fseek
 
327
# endif
317
328
# if @REPLACE_FSEEKO@
318
 
/* Provide fseek, fseeko functions that are aware of a preceding
319
 
   fflush(), and which detect pipes.  */
320
 
#  define fseeko rpl_fseeko
321
 
extern int fseeko (FILE *fp, off_t offset, int whence);
322
 
#  define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
 
329
/* Provide an fseeko function that is aware of a preceding fflush(), and which
 
330
   detects pipes.  */
 
331
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
332
#   undef fseeko
 
333
#   define fseeko rpl_fseeko
 
334
#  endif
 
335
_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
 
336
                               _GL_ARG_NONNULL ((1)));
 
337
_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
 
338
# else
 
339
#  if ! @HAVE_FSEEKO@
 
340
_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
 
341
                               _GL_ARG_NONNULL ((1)));
 
342
#  endif
 
343
_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
 
344
# endif
 
345
_GL_CXXALIASWARN (fseeko);
 
346
# if (@REPLACE_FSEEKO@ || !@HAVE_FSEEKO@) && !@GNULIB_FSEEK@
 
347
   /* Provide an fseek function that is consistent with fseeko.  */
 
348
   /* In order to avoid that fseek gets defined as a macro here, the
 
349
      developer can request the 'fseek' module.  */
 
350
#  undef fseek
 
351
#  define fseek rpl_fseek
 
352
static inline int _GL_ARG_NONNULL ((1))
 
353
rpl_fseek (FILE *fp, long offset, int whence)
 
354
{
 
355
#  if @REPLACE_FSEEKO@
 
356
  return rpl_fseeko (fp, offset, whence);
 
357
#  else
 
358
  return fseeko (fp, offset, whence);
 
359
#  endif
 
360
}
323
361
# endif
324
362
#elif defined GNULIB_POSIXCHECK
 
363
# define _GL_FSEEK_WARN /* Category 1, above.  */
 
364
# undef fseek
325
365
# undef fseeko
326
 
# define fseeko(f,o,w) \
327
 
   (GL_LINK_WARNING ("fseeko is unportable - " \
328
 
                     "use gnulib module fseeko for portability"), \
329
 
    fseeko (f, o, w))
330
 
#endif
331
 
 
332
 
#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
333
 
extern int rpl_fseek (FILE *fp, long offset, int whence);
334
 
# undef fseek
335
 
# if defined GNULIB_POSIXCHECK
336
 
#  define fseek(f,o,w) \
337
 
     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
338
 
                       "on 32-bit platforms - " \
339
 
                       "use fseeko function for handling of large files"), \
340
 
      rpl_fseek (f, o, w))
 
366
# if HAVE_RAW_DECL_FSEEKO
 
367
_GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
 
368
                 "use gnulib module fseeko for portability");
 
369
# endif
 
370
#endif
 
371
 
 
372
#ifdef _GL_FSEEK_WARN
 
373
# undef _GL_FSEEK_WARN
 
374
/* Here, either fseek is undefined (but C89 guarantees that it is
 
375
   declared), or it is defined as rpl_fseek (declared above).  */
 
376
_GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
 
377
                 "on 32-bit platforms - "
 
378
                 "use fseeko function for handling of large files");
 
379
#endif
 
380
 
 
381
 
 
382
/* ftell, ftello.  See the comments on fseek/fseeko.  */
 
383
 
 
384
#if @GNULIB_FTELL@
 
385
# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
 
386
#  define _GL_FTELL_WARN /* Category 2, above.  */
 
387
#  undef ftell
 
388
# endif
 
389
# if @REPLACE_FTELL@
 
390
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
391
#   undef ftell
 
392
#   define ftell rpl_ftell
 
393
#  endif
 
394
_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
 
395
_GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
341
396
# else
342
 
#  define fseek rpl_fseek
343
 
# endif
344
 
#elif defined GNULIB_POSIXCHECK
345
 
# ifndef fseek
346
 
#  define fseek(f,o,w) \
347
 
     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
348
 
                       "on 32-bit platforms - " \
349
 
                       "use fseeko function for handling of large files"), \
350
 
      fseek (f, o, w))
351
 
# endif
 
397
_GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
 
398
# endif
 
399
_GL_CXXALIASWARN (ftell);
352
400
#endif
353
401
 
354
402
#if @GNULIB_FTELLO@
 
403
# if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
 
404
#  define _GL_FTELL_WARN /* Category 3, above.  */
 
405
#  undef ftell
 
406
# endif
355
407
# if @REPLACE_FTELLO@
356
 
#  define ftello rpl_ftello
357
 
extern off_t ftello (FILE *fp);
358
 
#  define ftell(fp) ftello (fp)
 
408
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
409
#   undef ftello
 
410
#   define ftello rpl_ftello
 
411
#  endif
 
412
_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
 
413
_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
 
414
# else
 
415
#  if ! @HAVE_FTELLO@
 
416
_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
 
417
#  endif
 
418
_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
 
419
# endif
 
420
_GL_CXXALIASWARN (ftello);
 
421
# if (@REPLACE_FTELLO@ || !@HAVE_FTELLO@) && !@GNULIB_FTELL@
 
422
   /* Provide an ftell function that is consistent with ftello.  */
 
423
   /* In order to avoid that ftell gets defined as a macro here, the
 
424
      developer can request the 'ftell' module.  */
 
425
#  undef ftell
 
426
#  define ftell rpl_ftell
 
427
static inline long _GL_ARG_NONNULL ((1))
 
428
rpl_ftell (FILE *f)
 
429
{
 
430
#  if @REPLACE_FTELLO@
 
431
  return rpl_ftello (f);
 
432
#  else
 
433
  return ftello (f);
 
434
#  endif
 
435
}
359
436
# endif
360
437
#elif defined GNULIB_POSIXCHECK
 
438
# define _GL_FTELL_WARN /* Category 1, above.  */
 
439
# undef ftell
361
440
# undef ftello
362
 
# define ftello(f) \
363
 
   (GL_LINK_WARNING ("ftello is unportable - " \
364
 
                     "use gnulib module ftello for portability"), \
365
 
    ftello (f))
366
 
#endif
367
 
 
368
 
#if @GNULIB_FTELL@ && @REPLACE_FTELL@
369
 
extern long rpl_ftell (FILE *fp);
370
 
# undef ftell
371
 
# if GNULIB_POSIXCHECK
372
 
#  define ftell(f) \
373
 
     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
374
 
                       "on 32-bit platforms - " \
375
 
                       "use ftello function for handling of large files"), \
376
 
      rpl_ftell (f))
 
441
# if HAVE_RAW_DECL_FTELLO
 
442
_GL_WARN_ON_USE (ftello, "ftello is unportable - "
 
443
                 "use gnulib module ftello for portability");
 
444
# endif
 
445
#endif
 
446
 
 
447
#ifdef _GL_FTELL_WARN
 
448
# undef _GL_FTELL_WARN
 
449
/* Here, either ftell is undefined (but C89 guarantees that it is
 
450
   declared), or it is defined as rpl_ftell (declared above).  */
 
451
_GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
 
452
                 "on 32-bit platforms - "
 
453
                 "use ftello function for handling of large files");
 
454
#endif
 
455
 
 
456
 
 
457
#if @GNULIB_FWRITE@
 
458
# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 
459
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
460
#   undef fwrite
 
461
#   define fwrite rpl_fwrite
 
462
#  endif
 
463
_GL_FUNCDECL_RPL (fwrite, size_t,
 
464
                  (const void *ptr, size_t s, size_t n, FILE *stream)
 
465
                  _GL_ARG_NONNULL ((1, 4)));
 
466
_GL_CXXALIAS_RPL (fwrite, size_t,
 
467
                  (const void *ptr, size_t s, size_t n, FILE *stream));
377
468
# else
378
 
#  define ftell rpl_ftell
379
 
# endif
380
 
#elif defined GNULIB_POSIXCHECK
381
 
# ifndef ftell
382
 
#  define ftell(f) \
383
 
     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
384
 
                       "on 32-bit platforms - " \
385
 
                       "use ftello function for handling of large files"), \
386
 
      ftell (f))
387
 
# endif
388
 
#endif
389
 
 
390
 
#if @GNULIB_FFLUSH@
391
 
# if @REPLACE_FFLUSH@
392
 
#  define fflush rpl_fflush
393
 
  /* Flush all pending data on STREAM according to POSIX rules.  Both
394
 
     output and seekable input streams are supported.
395
 
     Note! LOSS OF DATA can occur if fflush is applied on an input stream
396
 
     that is _not_seekable_ or on an update stream that is _not_seekable_
397
 
     and in which the most recent operation was input.  Seekability can
398
 
     be tested with lseek(fileno(fp),0,SEEK_CUR).  */
399
 
  extern int fflush (FILE *gl_stream);
400
 
# endif
401
 
#elif defined GNULIB_POSIXCHECK
402
 
# undef fflush
403
 
# define fflush(f) \
404
 
   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
405
 
                     "use gnulib module fflush for portable " \
406
 
                     "POSIX compliance"), \
407
 
    fflush (f))
408
 
#endif
409
 
 
410
 
#if @GNULIB_FCLOSE@
411
 
# if @REPLACE_FCLOSE@
412
 
#  define fclose rpl_fclose
413
 
  /* Close STREAM and its underlying file descriptor.  */
414
 
extern int fclose (FILE *stream);
415
 
# endif
416
 
#elif defined GNULIB_POSIXCHECK
417
 
# undef fclose
418
 
# define fclose(f) \
419
 
   (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
420
 
                     "use gnulib module fclose for portable " \
421
 
                     "POSIX compliance"), \
422
 
    fclose (f))
423
 
#endif
424
 
 
425
 
#if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
426
 
# undef fputc
427
 
# define fputc rpl_fputc
428
 
extern int fputc (int c, FILE *stream);
429
 
#endif
430
 
 
431
 
#if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
432
 
# undef putc
433
 
# define putc rpl_fputc
434
 
extern int putc (int c, FILE *stream);
435
 
#endif
436
 
 
437
 
#if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
438
 
# undef putchar
439
 
# define putchar rpl_putchar
440
 
extern int putchar (int c);
441
 
#endif
442
 
 
443
 
#if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
444
 
# undef fputs
445
 
# define fputs rpl_fputs
446
 
extern int fputs (const char *string, FILE *stream);
447
 
#endif
448
 
 
449
 
#if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
450
 
# undef puts
451
 
# define puts rpl_puts
452
 
extern int puts (const char *string);
453
 
#endif
454
 
 
455
 
#if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
456
 
# undef fwrite
457
 
# define fwrite rpl_fwrite
458
 
extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream);
 
469
_GL_CXXALIAS_SYS (fwrite, size_t,
 
470
                  (const void *ptr, size_t s, size_t n, FILE *stream));
 
471
# endif
 
472
_GL_CXXALIASWARN (fwrite);
459
473
#endif
460
474
 
461
475
#if @GNULIB_GETDELIM@
462
 
# if !@HAVE_DECL_GETDELIM@
463
476
/* Read input, up to (and including) the next occurrence of DELIMITER, from
464
477
   STREAM, store it in *LINEPTR (and NUL-terminate it).
465
478
   *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
466
479
   bytes of space.  It is realloc'd as necessary.
467
480
   Return the number of bytes read and stored at *LINEPTR (not including the
468
481
   NUL terminator), or -1 on error or EOF.  */
469
 
extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
470
 
                         FILE *stream);
 
482
# if @REPLACE_GETDELIM@
 
483
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
484
#   undef getdelim
 
485
#   define getdelim rpl_getdelim
 
486
#  endif
 
487
_GL_FUNCDECL_RPL (getdelim, ssize_t,
 
488
                  (char **lineptr, size_t *linesize, int delimiter,
 
489
                   FILE *stream)
 
490
                  _GL_ARG_NONNULL ((1, 2, 4)));
 
491
_GL_CXXALIAS_RPL (getdelim, ssize_t,
 
492
                  (char **lineptr, size_t *linesize, int delimiter,
 
493
                   FILE *stream));
 
494
# else
 
495
#  if !@HAVE_DECL_GETDELIM@
 
496
_GL_FUNCDECL_SYS (getdelim, ssize_t,
 
497
                  (char **lineptr, size_t *linesize, int delimiter,
 
498
                   FILE *stream)
 
499
                  _GL_ARG_NONNULL ((1, 2, 4)));
 
500
#  endif
 
501
_GL_CXXALIAS_SYS (getdelim, ssize_t,
 
502
                  (char **lineptr, size_t *linesize, int delimiter,
 
503
                   FILE *stream));
471
504
# endif
 
505
_GL_CXXALIASWARN (getdelim);
472
506
#elif defined GNULIB_POSIXCHECK
473
507
# undef getdelim
474
 
# define getdelim(l, s, d, f)                                       \
475
 
  (GL_LINK_WARNING ("getdelim is unportable - "                     \
476
 
                    "use gnulib module getdelim for portability"),  \
477
 
   getdelim (l, s, d, f))
 
508
# if HAVE_RAW_DECL_GETDELIM
 
509
_GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
 
510
                 "use gnulib module getdelim for portability");
 
511
# endif
478
512
#endif
479
513
 
480
514
#if @GNULIB_GETLINE@
481
 
# if @REPLACE_GETLINE@
482
 
#  undef getline
483
 
#  define getline rpl_getline
484
 
# endif
485
 
# if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
486
515
/* Read a line, up to (and including) the next newline, from STREAM, store it
487
516
   in *LINEPTR (and NUL-terminate it).
488
517
   *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
489
518
   bytes of space.  It is realloc'd as necessary.
490
519
   Return the number of bytes read and stored at *LINEPTR (not including the
491
520
   NUL terminator), or -1 on error or EOF.  */
492
 
extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
 
521
# if @REPLACE_GETLINE@
 
522
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
523
#   undef getline
 
524
#   define getline rpl_getline
 
525
#  endif
 
526
_GL_FUNCDECL_RPL (getline, ssize_t,
 
527
                  (char **lineptr, size_t *linesize, FILE *stream)
 
528
                  _GL_ARG_NONNULL ((1, 2, 3)));
 
529
_GL_CXXALIAS_RPL (getline, ssize_t,
 
530
                  (char **lineptr, size_t *linesize, FILE *stream));
 
531
# else
 
532
#  if !@HAVE_DECL_GETLINE@
 
533
_GL_FUNCDECL_SYS (getline, ssize_t,
 
534
                  (char **lineptr, size_t *linesize, FILE *stream)
 
535
                  _GL_ARG_NONNULL ((1, 2, 3)));
 
536
#  endif
 
537
_GL_CXXALIAS_SYS (getline, ssize_t,
 
538
                  (char **lineptr, size_t *linesize, FILE *stream));
 
539
# endif
 
540
# if @HAVE_DECL_GETLINE@
 
541
_GL_CXXALIASWARN (getline);
493
542
# endif
494
543
#elif defined GNULIB_POSIXCHECK
495
544
# undef getline
496
 
# define getline(l, s, f)                                               \
497
 
  (GL_LINK_WARNING ("getline is unportable - "                          \
498
 
                    "use gnulib module getline for portability"),       \
499
 
   getline (l, s, f))
 
545
# if HAVE_RAW_DECL_GETLINE
 
546
_GL_WARN_ON_USE (getline, "getline is unportable - "
 
547
                 "use gnulib module getline for portability");
 
548
# endif
 
549
#endif
 
550
 
 
551
#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
 
552
struct obstack;
 
553
/* Grow an obstack with formatted output.  Return the number of
 
554
   bytes added to OBS.  No trailing nul byte is added, and the
 
555
   object should be closed with obstack_finish before use.  Upon
 
556
   memory allocation error, call obstack_alloc_failed_handler.  Upon
 
557
   other error, return -1.  */
 
558
# if @REPLACE_OBSTACK_PRINTF@
 
559
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
560
#   define obstack_printf rpl_obstack_printf
 
561
#  endif
 
562
_GL_FUNCDECL_RPL (obstack_printf, int,
 
563
                  (struct obstack *obs, const char *format, ...)
 
564
                  __attribute__ ((__format__ (__printf__, 2, 3)))
 
565
                  _GL_ARG_NONNULL ((1, 2)));
 
566
_GL_CXXALIAS_RPL (obstack_printf, int,
 
567
                  (struct obstack *obs, const char *format, ...));
 
568
# else
 
569
#  if !@HAVE_DECL_OBSTACK_PRINTF@
 
570
_GL_FUNCDECL_SYS (obstack_printf, int,
 
571
                  (struct obstack *obs, const char *format, ...)
 
572
                  __attribute__ ((__format__ (__printf__, 2, 3)))
 
573
                  _GL_ARG_NONNULL ((1, 2)));
 
574
#  endif
 
575
_GL_CXXALIAS_SYS (obstack_printf, int,
 
576
                  (struct obstack *obs, const char *format, ...));
 
577
# endif
 
578
_GL_CXXALIASWARN (obstack_printf);
 
579
# if @REPLACE_OBSTACK_PRINTF@
 
580
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
581
#   define obstack_vprintf rpl_obstack_vprintf
 
582
#  endif
 
583
_GL_FUNCDECL_RPL (obstack_vprintf, int,
 
584
                  (struct obstack *obs, const char *format, va_list args)
 
585
                  __attribute__ ((__format__ (__printf__, 2, 0)))
 
586
                  _GL_ARG_NONNULL ((1, 2)));
 
587
_GL_CXXALIAS_RPL (obstack_vprintf, int,
 
588
                  (struct obstack *obs, const char *format, va_list args));
 
589
# else
 
590
#  if !@HAVE_DECL_OBSTACK_PRINTF@
 
591
_GL_FUNCDECL_SYS (obstack_vprintf, int,
 
592
                  (struct obstack *obs, const char *format, va_list args)
 
593
                  __attribute__ ((__format__ (__printf__, 2, 0)))
 
594
                  _GL_ARG_NONNULL ((1, 2)));
 
595
#  endif
 
596
_GL_CXXALIAS_SYS (obstack_vprintf, int,
 
597
                  (struct obstack *obs, const char *format, va_list args));
 
598
# endif
 
599
_GL_CXXALIASWARN (obstack_vprintf);
500
600
#endif
501
601
 
502
602
#if @GNULIB_PERROR@
503
 
# if @REPLACE_PERROR@
504
 
#  define perror rpl_perror
505
603
/* Print a message to standard error, describing the value of ERRNO,
506
604
   (if STRING is not NULL and not empty) prefixed with STRING and ": ",
507
605
   and terminated with a newline.  */
508
 
extern void perror (const char *string);
 
606
# if @REPLACE_PERROR@
 
607
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
608
#   define perror rpl_perror
 
609
#  endif
 
610
_GL_FUNCDECL_RPL (perror, void, (const char *string));
 
611
_GL_CXXALIAS_RPL (perror, void, (const char *string));
 
612
# else
 
613
_GL_CXXALIAS_SYS (perror, void, (const char *string));
509
614
# endif
 
615
_GL_CXXALIASWARN (perror);
510
616
#elif defined GNULIB_POSIXCHECK
511
617
# undef perror
512
 
# define perror(s) \
513
 
    (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
514
 
                      "use gnulib module perror for portability"), \
515
 
     perror (s))
516
 
#endif
517
 
 
518
 
#ifdef __cplusplus
519
 
}
520
 
#endif
 
618
/* Assume perror is always declared.  */
 
619
_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
 
620
                 "use gnulib module perror for portability");
 
621
#endif
 
622
 
 
623
#if @GNULIB_POPEN@
 
624
# if @REPLACE_POPEN@
 
625
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
626
#   undef popen
 
627
#   define popen rpl_popen
 
628
#  endif
 
629
_GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
 
630
                                 _GL_ARG_NONNULL ((1, 2)));
 
631
_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
 
632
# else
 
633
_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
 
634
# endif
 
635
_GL_CXXALIASWARN (popen);
 
636
#elif defined GNULIB_POSIXCHECK
 
637
# undef popen
 
638
# if HAVE_RAW_DECL_POPEN
 
639
_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
 
640
                 "use gnulib module popen or pipe for more portability");
 
641
# endif
 
642
#endif
 
643
 
 
644
#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
 
645
# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
 
646
     || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
 
647
#  if defined __GNUC__
 
648
#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
649
/* Don't break __attribute__((format(printf,M,N))).  */
 
650
#    define printf __printf__
 
651
#   endif
 
652
_GL_FUNCDECL_RPL_1 (__printf__, int,
 
653
                    (const char *format, ...)
 
654
                    __asm__ (@ASM_SYMBOL_PREFIX@
 
655
                             _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
 
656
                    __attribute__ ((__format__ (__printf__, 1, 2)))
 
657
                    _GL_ARG_NONNULL ((1)));
 
658
_GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
 
659
#  else
 
660
_GL_FUNCDECL_RPL (printf, int,
 
661
                  (const char *format, ...)
 
662
                  __attribute__ ((__format__ (__printf__, 1, 2)))
 
663
                  _GL_ARG_NONNULL ((1)));
 
664
_GL_CXXALIAS_RPL (printf, printf, int, (const char *format, ...));
 
665
#  endif
 
666
#  define GNULIB_overrides_printf 1
 
667
# else
 
668
_GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
 
669
# endif
 
670
_GL_CXXALIASWARN (printf);
 
671
#endif
 
672
#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
 
673
# if !GNULIB_overrides_printf
 
674
#  undef printf
 
675
# endif
 
676
/* Assume printf is always declared.  */
 
677
_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
 
678
                 "use gnulib module printf-posix for portable "
 
679
                 "POSIX compliance");
 
680
#endif
 
681
 
 
682
#if @GNULIB_PUTC@
 
683
# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 
684
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
685
#   undef putc
 
686
#   define putc rpl_fputc
 
687
#  endif
 
688
_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
 
689
_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
 
690
# else
 
691
_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
 
692
# endif
 
693
_GL_CXXALIASWARN (putc);
 
694
#endif
 
695
 
 
696
#if @GNULIB_PUTCHAR@
 
697
# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 
698
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
699
#   undef putchar
 
700
#   define putchar rpl_putchar
 
701
#  endif
 
702
_GL_FUNCDECL_RPL (putchar, int, (int c));
 
703
_GL_CXXALIAS_RPL (putchar, int, (int c));
 
704
# else
 
705
_GL_CXXALIAS_SYS (putchar, int, (int c));
 
706
# endif
 
707
_GL_CXXALIASWARN (putchar);
 
708
#endif
 
709
 
 
710
#if @GNULIB_PUTS@
 
711
# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
 
712
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
713
#   undef puts
 
714
#   define puts rpl_puts
 
715
#  endif
 
716
_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
 
717
_GL_CXXALIAS_RPL (puts, int, (const char *string));
 
718
# else
 
719
_GL_CXXALIAS_SYS (puts, int, (const char *string));
 
720
# endif
 
721
_GL_CXXALIASWARN (puts);
 
722
#endif
 
723
 
 
724
#if @GNULIB_REMOVE@
 
725
# if @REPLACE_REMOVE@
 
726
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
727
#   undef remove
 
728
#   define remove rpl_remove
 
729
#  endif
 
730
_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
 
731
_GL_CXXALIAS_RPL (remove, int, (const char *name));
 
732
# else
 
733
_GL_CXXALIAS_SYS (remove, int, (const char *name));
 
734
# endif
 
735
_GL_CXXALIASWARN (remove);
 
736
#elif defined GNULIB_POSIXCHECK
 
737
# undef remove
 
738
/* Assume remove is always declared.  */
 
739
_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
 
740
                 "use gnulib module remove for more portability");
 
741
#endif
 
742
 
 
743
#if @GNULIB_RENAME@
 
744
# if @REPLACE_RENAME@
 
745
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
746
#   undef rename
 
747
#   define rename rpl_rename
 
748
#  endif
 
749
_GL_FUNCDECL_RPL (rename, int,
 
750
                  (const char *old_filename, const char *new_filename)
 
751
                  _GL_ARG_NONNULL ((1, 2)));
 
752
_GL_CXXALIAS_RPL (rename, int,
 
753
                  (const char *old_filename, const char *new_filename));
 
754
# else
 
755
_GL_CXXALIAS_SYS (rename, int,
 
756
                  (const char *old_filename, const char *new_filename));
 
757
# endif
 
758
_GL_CXXALIASWARN (rename);
 
759
#elif defined GNULIB_POSIXCHECK
 
760
# undef rename
 
761
/* Assume rename is always declared.  */
 
762
_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
 
763
                 "use gnulib module rename for more portability");
 
764
#endif
 
765
 
 
766
#if @GNULIB_RENAMEAT@
 
767
# if @REPLACE_RENAMEAT@
 
768
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
769
#   undef renameat
 
770
#   define renameat rpl_renameat
 
771
#  endif
 
772
_GL_FUNCDECL_RPL (renameat, int,
 
773
                  (int fd1, char const *file1, int fd2, char const *file2)
 
774
                  _GL_ARG_NONNULL ((2, 4)));
 
775
_GL_CXXALIAS_RPL (renameat, int,
 
776
                  (int fd1, char const *file1, int fd2, char const *file2));
 
777
# else
 
778
#  if !@HAVE_RENAMEAT@
 
779
_GL_FUNCDECL_SYS (renameat, int,
 
780
                  (int fd1, char const *file1, int fd2, char const *file2)
 
781
                  _GL_ARG_NONNULL ((2, 4)));
 
782
#  endif
 
783
_GL_CXXALIAS_SYS (renameat, int,
 
784
                  (int fd1, char const *file1, int fd2, char const *file2));
 
785
# endif
 
786
_GL_CXXALIASWARN (renameat);
 
787
#elif defined GNULIB_POSIXCHECK
 
788
# undef renameat
 
789
# if HAVE_RAW_DECL_RENAMEAT
 
790
_GL_WARN_ON_USE (renameat, "renameat is not portable - "
 
791
                 "use gnulib module renameat for portability");
 
792
# endif
 
793
#endif
 
794
 
 
795
#if @GNULIB_SNPRINTF@
 
796
# if @REPLACE_SNPRINTF@
 
797
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
798
#   define snprintf rpl_snprintf
 
799
#  endif
 
800
_GL_FUNCDECL_RPL (snprintf, int,
 
801
                  (char *str, size_t size, const char *format, ...)
 
802
                  __attribute__ ((__format__ (__printf__, 3, 4)))
 
803
                  _GL_ARG_NONNULL ((3)));
 
804
_GL_CXXALIAS_RPL (snprintf, int,
 
805
                  (char *str, size_t size, const char *format, ...));
 
806
# else
 
807
#  if !@HAVE_DECL_SNPRINTF@
 
808
_GL_FUNCDECL_SYS (snprintf, int,
 
809
                  (char *str, size_t size, const char *format, ...)
 
810
                  __attribute__ ((__format__ (__printf__, 3, 4)))
 
811
                  _GL_ARG_NONNULL ((3)));
 
812
#  endif
 
813
_GL_CXXALIAS_SYS (snprintf, int,
 
814
                  (char *str, size_t size, const char *format, ...));
 
815
# endif
 
816
_GL_CXXALIASWARN (snprintf);
 
817
#elif defined GNULIB_POSIXCHECK
 
818
# undef snprintf
 
819
# if HAVE_RAW_DECL_SNPRINTF
 
820
_GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
 
821
                 "use gnulib module snprintf for portability");
 
822
# endif
 
823
#endif
 
824
 
 
825
/* Some people would argue that sprintf should be handled like gets
 
826
   (for example, OpenBSD issues a link warning for both functions),
 
827
   since both can cause security holes due to buffer overruns.
 
828
   However, we believe that sprintf can be used safely, and is more
 
829
   efficient than snprintf in those safe cases; and as proof of our
 
830
   belief, we use sprintf in several gnulib modules.  So this header
 
831
   intentionally avoids adding a warning to sprintf except when
 
832
   GNULIB_POSIXCHECK is defined.  */
 
833
 
 
834
#if @GNULIB_SPRINTF_POSIX@
 
835
# if @REPLACE_SPRINTF@
 
836
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
837
#   define sprintf rpl_sprintf
 
838
#  endif
 
839
_GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...)
 
840
                                __attribute__ ((__format__ (__printf__, 2, 3)))
 
841
                                _GL_ARG_NONNULL ((1, 2)));
 
842
_GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
 
843
# else
 
844
_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
 
845
# endif
 
846
_GL_CXXALIASWARN (sprintf);
 
847
#elif defined GNULIB_POSIXCHECK
 
848
# undef sprintf
 
849
/* Assume sprintf is always declared.  */
 
850
_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
 
851
                 "use gnulib module sprintf-posix for portable "
 
852
                 "POSIX compliance");
 
853
#endif
 
854
 
 
855
#if @GNULIB_TMPFILE@
 
856
# if @REPLACE_TMPFILE@
 
857
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
858
#   define tmpfile rpl_tmpfile
 
859
#  endif
 
860
_GL_FUNCDECL_RPL (tmpfile, FILE *, (void));
 
861
_GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
 
862
# else
 
863
_GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
 
864
# endif
 
865
_GL_CXXALIASWARN (tmpfile);
 
866
#elif defined GNULIB_POSIXCHECK
 
867
# undef tmpfile
 
868
# if HAVE_RAW_DECL_TMPFILE
 
869
_GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
 
870
                 "use gnulib module tmpfile for portability");
 
871
# endif
 
872
#endif
 
873
 
 
874
#if @GNULIB_VASPRINTF@
 
875
/* Write formatted output to a string dynamically allocated with malloc().
 
876
   If the memory allocation succeeds, store the address of the string in
 
877
   *RESULT and return the number of resulting bytes, excluding the trailing
 
878
   NUL.  Upon memory allocation error, or some other error, return -1.  */
 
879
# if @REPLACE_VASPRINTF@
 
880
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
881
#   define asprintf rpl_asprintf
 
882
#  endif
 
883
_GL_FUNCDECL_RPL (asprintf, int,
 
884
                  (char **result, const char *format, ...)
 
885
                  __attribute__ ((__format__ (__printf__, 2, 3)))
 
886
                  _GL_ARG_NONNULL ((1, 2)));
 
887
_GL_CXXALIAS_RPL (asprintf, int,
 
888
                  (char **result, const char *format, ...));
 
889
# else
 
890
#  if !@HAVE_VASPRINTF@
 
891
_GL_FUNCDECL_SYS (asprintf, int,
 
892
                  (char **result, const char *format, ...)
 
893
                  __attribute__ ((__format__ (__printf__, 2, 3)))
 
894
                  _GL_ARG_NONNULL ((1, 2)));
 
895
#  endif
 
896
_GL_CXXALIAS_SYS (asprintf, int,
 
897
                  (char **result, const char *format, ...));
 
898
# endif
 
899
_GL_CXXALIASWARN (asprintf);
 
900
# if @REPLACE_VASPRINTF@
 
901
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
902
#   define vasprintf rpl_vasprintf
 
903
#  endif
 
904
_GL_FUNCDECL_RPL (vasprintf, int,
 
905
                  (char **result, const char *format, va_list args)
 
906
                  __attribute__ ((__format__ (__printf__, 2, 0)))
 
907
                  _GL_ARG_NONNULL ((1, 2)));
 
908
_GL_CXXALIAS_RPL (vasprintf, int,
 
909
                  (char **result, const char *format, va_list args));
 
910
# else
 
911
#  if !@HAVE_VASPRINTF@
 
912
_GL_FUNCDECL_SYS (vasprintf, int,
 
913
                  (char **result, const char *format, va_list args)
 
914
                  __attribute__ ((__format__ (__printf__, 2, 0)))
 
915
                  _GL_ARG_NONNULL ((1, 2)));
 
916
#  endif
 
917
_GL_CXXALIAS_SYS (vasprintf, int,
 
918
                  (char **result, const char *format, va_list args));
 
919
# endif
 
920
_GL_CXXALIASWARN (vasprintf);
 
921
#endif
 
922
 
 
923
#if @GNULIB_VDPRINTF@
 
924
# if @REPLACE_VDPRINTF@
 
925
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
926
#   define vdprintf rpl_vdprintf
 
927
#  endif
 
928
_GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args)
 
929
                                 __attribute__ ((__format__ (__printf__, 2, 0)))
 
930
                                 _GL_ARG_NONNULL ((2)));
 
931
_GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args));
 
932
# else
 
933
#  if !@HAVE_VDPRINTF@
 
934
_GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args)
 
935
                                 __attribute__ ((__format__ (__printf__, 2, 0)))
 
936
                                 _GL_ARG_NONNULL ((2)));
 
937
#  endif
 
938
/* Need to cast, because on Solaris, the third parameter will likely be
 
939
                                                    __va_list args.  */
 
940
_GL_CXXALIAS_SYS_CAST (vdprintf, int,
 
941
                       (int fd, const char *format, va_list args));
 
942
# endif
 
943
_GL_CXXALIASWARN (vdprintf);
 
944
#elif defined GNULIB_POSIXCHECK
 
945
# undef vdprintf
 
946
# if HAVE_RAW_DECL_VDPRINTF
 
947
_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
 
948
                 "use gnulib module vdprintf for portability");
 
949
# endif
 
950
#endif
 
951
 
 
952
#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
 
953
# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
 
954
     || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
 
955
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
956
#   define vfprintf rpl_vfprintf
 
957
#  endif
 
958
#  define GNULIB_overrides_vfprintf 1
 
959
_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
 
960
                                 __attribute__ ((__format__ (__printf__, 2, 0)))
 
961
                                 _GL_ARG_NONNULL ((1, 2)));
 
962
_GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
 
963
# else
 
964
/* Need to cast, because on Solaris, the third parameter is
 
965
                                                      __va_list args
 
966
   and GCC's fixincludes did not change this to __gnuc_va_list.  */
 
967
_GL_CXXALIAS_SYS_CAST (vfprintf, int,
 
968
                       (FILE *fp, const char *format, va_list args));
 
969
# endif
 
970
_GL_CXXALIASWARN (vfprintf);
 
971
#endif
 
972
#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
 
973
# if !GNULIB_overrides_vfprintf
 
974
#  undef vfprintf
 
975
# endif
 
976
/* Assume vfprintf is always declared.  */
 
977
_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
 
978
                 "use gnulib module vfprintf-posix for portable "
 
979
                      "POSIX compliance");
 
980
#endif
 
981
 
 
982
#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
 
983
# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
 
984
     || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
 
985
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
986
#   define vprintf rpl_vprintf
 
987
#  endif
 
988
#  define GNULIB_overrides_vprintf 1
 
989
_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
 
990
                                __attribute__ ((__format__ (__printf__, 1, 0)))
 
991
                                _GL_ARG_NONNULL ((1)));
 
992
_GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
 
993
# else
 
994
/* Need to cast, because on Solaris, the second parameter is
 
995
                                                          __va_list args
 
996
   and GCC's fixincludes did not change this to __gnuc_va_list.  */
 
997
_GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
 
998
# endif
 
999
_GL_CXXALIASWARN (vprintf);
 
1000
#endif
 
1001
#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
 
1002
# if !GNULIB_overrides_vprintf
 
1003
#  undef vprintf
 
1004
# endif
 
1005
/* Assume vprintf is always declared.  */
 
1006
_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
 
1007
                 "use gnulib module vprintf-posix for portable "
 
1008
                 "POSIX compliance");
 
1009
#endif
 
1010
 
 
1011
#if @GNULIB_VSNPRINTF@
 
1012
# if @REPLACE_VSNPRINTF@
 
1013
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
1014
#   define vsnprintf rpl_vsnprintf
 
1015
#  endif
 
1016
_GL_FUNCDECL_RPL (vsnprintf, int,
 
1017
                  (char *str, size_t size, const char *format, va_list args)
 
1018
                  __attribute__ ((__format__ (__printf__, 3, 0)))
 
1019
                  _GL_ARG_NONNULL ((3)));
 
1020
_GL_CXXALIAS_RPL (vsnprintf, int,
 
1021
                  (char *str, size_t size, const char *format, va_list args));
 
1022
# else
 
1023
#  if !@HAVE_DECL_VSNPRINTF@
 
1024
_GL_FUNCDECL_SYS (vsnprintf, int,
 
1025
                  (char *str, size_t size, const char *format, va_list args)
 
1026
                  __attribute__ ((__format__ (__printf__, 3, 0)))
 
1027
                  _GL_ARG_NONNULL ((3)));
 
1028
#  endif
 
1029
_GL_CXXALIAS_SYS (vsnprintf, int,
 
1030
                  (char *str, size_t size, const char *format, va_list args));
 
1031
# endif
 
1032
_GL_CXXALIASWARN (vsnprintf);
 
1033
#elif defined GNULIB_POSIXCHECK
 
1034
# undef vsnprintf
 
1035
# if HAVE_RAW_DECL_VSNPRINTF
 
1036
_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
 
1037
                 "use gnulib module vsnprintf for portability");
 
1038
# endif
 
1039
#endif
 
1040
 
 
1041
#if @GNULIB_VSPRINTF_POSIX@
 
1042
# if @REPLACE_VSPRINTF@
 
1043
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
1044
#   define vsprintf rpl_vsprintf
 
1045
#  endif
 
1046
_GL_FUNCDECL_RPL (vsprintf, int,
 
1047
                  (char *str, const char *format, va_list args)
 
1048
                  __attribute__ ((__format__ (__printf__, 2, 0)))
 
1049
                  _GL_ARG_NONNULL ((1, 2)));
 
1050
_GL_CXXALIAS_RPL (vsprintf, int,
 
1051
                  (char *str, const char *format, va_list args));
 
1052
# else
 
1053
/* Need to cast, because on Solaris, the third parameter is
 
1054
                                                       __va_list args
 
1055
   and GCC's fixincludes did not change this to __gnuc_va_list.  */
 
1056
_GL_CXXALIAS_SYS_CAST (vsprintf, int,
 
1057
                       (char *str, const char *format, va_list args));
 
1058
# endif
 
1059
_GL_CXXALIASWARN (vsprintf);
 
1060
#elif defined GNULIB_POSIXCHECK
 
1061
# undef vsprintf
 
1062
/* Assume vsprintf is always declared.  */
 
1063
_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
 
1064
                 "use gnulib module vsprintf-posix for portable "
 
1065
                      "POSIX compliance");
 
1066
#endif
 
1067
 
521
1068
 
522
1069
#endif /* _GL_STDIO_H */
523
1070
#endif /* _GL_STDIO_H */