863457f6fcb39ac3b41602a9d70bcec4e1d88d24
[debian/tar] / gnu / stdlib.in.h
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A GNU-like <stdlib.h>.
4
5    Copyright (C) 1995, 2001-2004, 2006-2013 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 of the License, or
10    (at your option) 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, see <http://www.gnu.org/licenses/>.  */
19
20 #if __GNUC__ >= 3
21 @PRAGMA_SYSTEM_HEADER@
22 #endif
23 @PRAGMA_COLUMNS@
24
25 #if defined __need_system_stdlib_h || defined __need_malloc_and_calloc
26 /* Special invocation conventions inside some gnulib header files,
27    and inside some glibc header files, respectively.  */
28
29 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
30
31 #else
32 /* Normal invocation convention.  */
33
34 #ifndef _@GUARD_PREFIX@_STDLIB_H
35
36 /* The include_next requires a split double-inclusion guard.  */
37 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
38
39 #ifndef _@GUARD_PREFIX@_STDLIB_H
40 #define _@GUARD_PREFIX@_STDLIB_H
41
42 /* NetBSD 5.0 mis-defines NULL.  */
43 #include <stddef.h>
44
45 /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.  */
46 #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
47 # include <sys/wait.h>
48 #endif
49
50 /* Solaris declares getloadavg() in <sys/loadavg.h>.  */
51 #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
52 # include <sys/loadavg.h>
53 #endif
54
55 /* Native Windows platforms declare mktemp() in <io.h>.  */
56 #if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
57 # include <io.h>
58 #endif
59
60 #if @GNULIB_RANDOM_R@
61
62 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
63    from <stdlib.h> if _REENTRANT is defined.  Include it whenever we need
64    'struct random_data'.  */
65 # if @HAVE_RANDOM_H@
66 #  include <random.h>
67 # endif
68
69 # if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
70 #  include <stdint.h>
71 # endif
72
73 # if !@HAVE_STRUCT_RANDOM_DATA@
74 /* Define 'struct random_data'.
75    But allow multiple gnulib generated <stdlib.h> replacements to coexist.  */
76 #  if !GNULIB_defined_struct_random_data
77 struct random_data
78 {
79   int32_t *fptr;                /* Front pointer.  */
80   int32_t *rptr;                /* Rear pointer.  */
81   int32_t *state;               /* Array of state values.  */
82   int rand_type;                /* Type of random number generator.  */
83   int rand_deg;                 /* Degree of random number generator.  */
84   int rand_sep;                 /* Distance between front and rear.  */
85   int32_t *end_ptr;             /* Pointer behind state table.  */
86 };
87 #   define GNULIB_defined_struct_random_data 1
88 #  endif
89 # endif
90 #endif
91
92 #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
93 /* On Mac OS X 10.3, only <unistd.h> declares mkstemp.  */
94 /* On Mac OS X 10.5, only <unistd.h> declares mkstemps.  */
95 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
96 /* But avoid namespace pollution on glibc systems and native Windows.  */
97 # include <unistd.h>
98 #endif
99
100 /* The __attribute__ feature is available in gcc versions 2.5 and later.
101    The attribute __pure__ was added in gcc 2.96.  */
102 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
103 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
104 #else
105 # define _GL_ATTRIBUTE_PURE /* empty */
106 #endif
107
108 /* The definition of _Noreturn is copied here.  */
109
110 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
111
112 /* The definition of _GL_ARG_NONNULL is copied here.  */
113
114 /* The definition of _GL_WARN_ON_USE is copied here.  */
115
116
117 /* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
118 #ifndef EXIT_SUCCESS
119 # define EXIT_SUCCESS 0
120 #endif
121 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
122    with proper operation of xargs.  */
123 #ifndef EXIT_FAILURE
124 # define EXIT_FAILURE 1
125 #elif EXIT_FAILURE != 1
126 # undef EXIT_FAILURE
127 # define EXIT_FAILURE 1
128 #endif
129
130
131 #if @GNULIB__EXIT@
132 /* Terminate the current process with the given return code, without running
133    the 'atexit' handlers.  */
134 # if !@HAVE__EXIT@
135 _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
136 # endif
137 _GL_CXXALIAS_SYS (_Exit, void, (int status));
138 _GL_CXXALIASWARN (_Exit);
139 #elif defined GNULIB_POSIXCHECK
140 # undef _Exit
141 # if HAVE_RAW_DECL__EXIT
142 _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
143                  "use gnulib module _Exit for portability");
144 # endif
145 #endif
146
147
148 #if @GNULIB_ATOLL@
149 /* Parse a signed decimal integer.
150    Returns the value of the integer.  Errors are not detected.  */
151 # if !@HAVE_ATOLL@
152 _GL_FUNCDECL_SYS (atoll, long long, (const char *string)
153                                     _GL_ATTRIBUTE_PURE
154                                     _GL_ARG_NONNULL ((1)));
155 # endif
156 _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
157 _GL_CXXALIASWARN (atoll);
158 #elif defined GNULIB_POSIXCHECK
159 # undef atoll
160 # if HAVE_RAW_DECL_ATOLL
161 _GL_WARN_ON_USE (atoll, "atoll is unportable - "
162                  "use gnulib module atoll for portability");
163 # endif
164 #endif
165
166 #if @GNULIB_CALLOC_POSIX@
167 # if @REPLACE_CALLOC@
168 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
169 #   undef calloc
170 #   define calloc rpl_calloc
171 #  endif
172 _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
173 _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
174 # else
175 _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
176 # endif
177 _GL_CXXALIASWARN (calloc);
178 #elif defined GNULIB_POSIXCHECK
179 # undef calloc
180 /* Assume calloc is always declared.  */
181 _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
182                  "use gnulib module calloc-posix for portability");
183 #endif
184
185 #if @GNULIB_CANONICALIZE_FILE_NAME@
186 # if @REPLACE_CANONICALIZE_FILE_NAME@
187 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
188 #   define canonicalize_file_name rpl_canonicalize_file_name
189 #  endif
190 _GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
191                                                   _GL_ARG_NONNULL ((1)));
192 _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
193 # else
194 #  if !@HAVE_CANONICALIZE_FILE_NAME@
195 _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
196                                                   _GL_ARG_NONNULL ((1)));
197 #  endif
198 _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
199 # endif
200 _GL_CXXALIASWARN (canonicalize_file_name);
201 #elif defined GNULIB_POSIXCHECK
202 # undef canonicalize_file_name
203 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
204 _GL_WARN_ON_USE (canonicalize_file_name,
205                  "canonicalize_file_name is unportable - "
206                  "use gnulib module canonicalize-lgpl for portability");
207 # endif
208 #endif
209
210 #if @GNULIB_GETLOADAVG@
211 /* Store max(NELEM,3) load average numbers in LOADAVG[].
212    The three numbers are the load average of the last 1 minute, the last 5
213    minutes, and the last 15 minutes, respectively.
214    LOADAVG is an array of NELEM numbers.  */
215 # if !@HAVE_DECL_GETLOADAVG@
216 _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
217                                    _GL_ARG_NONNULL ((1)));
218 # endif
219 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
220 _GL_CXXALIASWARN (getloadavg);
221 #elif defined GNULIB_POSIXCHECK
222 # undef getloadavg
223 # if HAVE_RAW_DECL_GETLOADAVG
224 _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
225                  "use gnulib module getloadavg for portability");
226 # endif
227 #endif
228
229 #if @GNULIB_GETSUBOPT@
230 /* Assuming *OPTIONP is a comma separated list of elements of the form
231    "token" or "token=value", getsubopt parses the first of these elements.
232    If the first element refers to a "token" that is member of the given
233    NULL-terminated array of tokens:
234      - It replaces the comma with a NUL byte, updates *OPTIONP to point past
235        the first option and the comma, sets *VALUEP to the value of the
236        element (or NULL if it doesn't contain an "=" sign),
237      - It returns the index of the "token" in the given array of tokens.
238    Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
239    For more details see the POSIX:2001 specification.
240    http://www.opengroup.org/susv3xsh/getsubopt.html */
241 # if !@HAVE_GETSUBOPT@
242 _GL_FUNCDECL_SYS (getsubopt, int,
243                   (char **optionp, char *const *tokens, char **valuep)
244                   _GL_ARG_NONNULL ((1, 2, 3)));
245 # endif
246 _GL_CXXALIAS_SYS (getsubopt, int,
247                   (char **optionp, char *const *tokens, char **valuep));
248 _GL_CXXALIASWARN (getsubopt);
249 #elif defined GNULIB_POSIXCHECK
250 # undef getsubopt
251 # if HAVE_RAW_DECL_GETSUBOPT
252 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
253                  "use gnulib module getsubopt for portability");
254 # endif
255 #endif
256
257 #if @GNULIB_GRANTPT@
258 /* Change the ownership and access permission of the slave side of the
259    pseudo-terminal whose master side is specified by FD.  */
260 # if !@HAVE_GRANTPT@
261 _GL_FUNCDECL_SYS (grantpt, int, (int fd));
262 # endif
263 _GL_CXXALIAS_SYS (grantpt, int, (int fd));
264 _GL_CXXALIASWARN (grantpt);
265 #elif defined GNULIB_POSIXCHECK
266 # undef grantpt
267 # if HAVE_RAW_DECL_GRANTPT
268 _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
269                  "use gnulib module grantpt for portability");
270 # endif
271 #endif
272
273 /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
274    rely on GNU or POSIX semantics for malloc and realloc (for example,
275    by never specifying a zero size), so it does not need malloc or
276    realloc to be redefined.  */
277 #if @GNULIB_MALLOC_POSIX@
278 # if @REPLACE_MALLOC@
279 #  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
280         || _GL_USE_STDLIB_ALLOC)
281 #   undef malloc
282 #   define malloc rpl_malloc
283 #  endif
284 _GL_FUNCDECL_RPL (malloc, void *, (size_t size));
285 _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
286 # else
287 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
288 # endif
289 _GL_CXXALIASWARN (malloc);
290 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
291 # undef malloc
292 /* Assume malloc is always declared.  */
293 _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
294                  "use gnulib module malloc-posix for portability");
295 #endif
296
297 /* Convert a multibyte character to a wide character.  */
298 #if @GNULIB_MBTOWC@
299 # if @REPLACE_MBTOWC@
300 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
301 #   undef mbtowc
302 #   define mbtowc rpl_mbtowc
303 #  endif
304 _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
305 _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
306 # else
307 _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
308 # endif
309 _GL_CXXALIASWARN (mbtowc);
310 #endif
311
312 #if @GNULIB_MKDTEMP@
313 /* Create a unique temporary directory from TEMPLATE.
314    The last six characters of TEMPLATE must be "XXXXXX";
315    they are replaced with a string that makes the directory name unique.
316    Returns TEMPLATE, or a null pointer if it cannot get a unique name.
317    The directory is created mode 700.  */
318 # if !@HAVE_MKDTEMP@
319 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
320 # endif
321 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
322 _GL_CXXALIASWARN (mkdtemp);
323 #elif defined GNULIB_POSIXCHECK
324 # undef mkdtemp
325 # if HAVE_RAW_DECL_MKDTEMP
326 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
327                  "use gnulib module mkdtemp for portability");
328 # endif
329 #endif
330
331 #if @GNULIB_MKOSTEMP@
332 /* Create a unique temporary file from TEMPLATE.
333    The last six characters of TEMPLATE must be "XXXXXX";
334    they are replaced with a string that makes the file name unique.
335    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
336    and O_TEXT, O_BINARY (defined in "binary-io.h").
337    The file is then created, with the specified flags, ensuring it didn't exist
338    before.
339    The file is created read-write (mask at least 0600 & ~umask), but it may be
340    world-readable and world-writable (mask 0666 & ~umask), depending on the
341    implementation.
342    Returns the open file descriptor if successful, otherwise -1 and errno
343    set.  */
344 # if !@HAVE_MKOSTEMP@
345 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
346                                  _GL_ARG_NONNULL ((1)));
347 # endif
348 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
349 _GL_CXXALIASWARN (mkostemp);
350 #elif defined GNULIB_POSIXCHECK
351 # undef mkostemp
352 # if HAVE_RAW_DECL_MKOSTEMP
353 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
354                  "use gnulib module mkostemp for portability");
355 # endif
356 #endif
357
358 #if @GNULIB_MKOSTEMPS@
359 /* Create a unique temporary file from TEMPLATE.
360    The last six characters of TEMPLATE before a suffix of length
361    SUFFIXLEN must be "XXXXXX";
362    they are replaced with a string that makes the file name unique.
363    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
364    and O_TEXT, O_BINARY (defined in "binary-io.h").
365    The file is then created, with the specified flags, ensuring it didn't exist
366    before.
367    The file is created read-write (mask at least 0600 & ~umask), but it may be
368    world-readable and world-writable (mask 0666 & ~umask), depending on the
369    implementation.
370    Returns the open file descriptor if successful, otherwise -1 and errno
371    set.  */
372 # if !@HAVE_MKOSTEMPS@
373 _GL_FUNCDECL_SYS (mkostemps, int,
374                   (char * /*template*/, int /*suffixlen*/, int /*flags*/)
375                   _GL_ARG_NONNULL ((1)));
376 # endif
377 _GL_CXXALIAS_SYS (mkostemps, int,
378                   (char * /*template*/, int /*suffixlen*/, int /*flags*/));
379 _GL_CXXALIASWARN (mkostemps);
380 #elif defined GNULIB_POSIXCHECK
381 # undef mkostemps
382 # if HAVE_RAW_DECL_MKOSTEMPS
383 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
384                  "use gnulib module mkostemps for portability");
385 # endif
386 #endif
387
388 #if @GNULIB_MKSTEMP@
389 /* Create a unique temporary file from TEMPLATE.
390    The last six characters of TEMPLATE must be "XXXXXX";
391    they are replaced with a string that makes the file name unique.
392    The file is then created, ensuring it didn't exist before.
393    The file is created read-write (mask at least 0600 & ~umask), but it may be
394    world-readable and world-writable (mask 0666 & ~umask), depending on the
395    implementation.
396    Returns the open file descriptor if successful, otherwise -1 and errno
397    set.  */
398 # if @REPLACE_MKSTEMP@
399 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
400 #   define mkstemp rpl_mkstemp
401 #  endif
402 _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
403 _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
404 # else
405 #  if ! @HAVE_MKSTEMP@
406 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
407 #  endif
408 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
409 # endif
410 _GL_CXXALIASWARN (mkstemp);
411 #elif defined GNULIB_POSIXCHECK
412 # undef mkstemp
413 # if HAVE_RAW_DECL_MKSTEMP
414 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
415                  "use gnulib module mkstemp for portability");
416 # endif
417 #endif
418
419 #if @GNULIB_MKSTEMPS@
420 /* Create a unique temporary file from TEMPLATE.
421    The last six characters of TEMPLATE prior to a suffix of length
422    SUFFIXLEN must be "XXXXXX";
423    they are replaced with a string that makes the file name unique.
424    The file is then created, ensuring it didn't exist before.
425    The file is created read-write (mask at least 0600 & ~umask), but it may be
426    world-readable and world-writable (mask 0666 & ~umask), depending on the
427    implementation.
428    Returns the open file descriptor if successful, otherwise -1 and errno
429    set.  */
430 # if !@HAVE_MKSTEMPS@
431 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
432                                  _GL_ARG_NONNULL ((1)));
433 # endif
434 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
435 _GL_CXXALIASWARN (mkstemps);
436 #elif defined GNULIB_POSIXCHECK
437 # undef mkstemps
438 # if HAVE_RAW_DECL_MKSTEMPS
439 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
440                  "use gnulib module mkstemps for portability");
441 # endif
442 #endif
443
444 #if @GNULIB_POSIX_OPENPT@
445 /* Return an FD open to the master side of a pseudo-terminal.  Flags should
446    include O_RDWR, and may also include O_NOCTTY.  */
447 # if !@HAVE_POSIX_OPENPT@
448 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
449 # endif
450 _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
451 _GL_CXXALIASWARN (posix_openpt);
452 #elif defined GNULIB_POSIXCHECK
453 # undef posix_openpt
454 # if HAVE_RAW_DECL_POSIX_OPENPT
455 _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
456                  "use gnulib module posix_openpt for portability");
457 # endif
458 #endif
459
460 #if @GNULIB_PTSNAME@
461 /* Return the pathname of the pseudo-terminal slave associated with
462    the master FD is open on, or NULL on errors.  */
463 # if @REPLACE_PTSNAME@
464 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
465 #   undef ptsname
466 #   define ptsname rpl_ptsname
467 #  endif
468 _GL_FUNCDECL_RPL (ptsname, char *, (int fd));
469 _GL_CXXALIAS_RPL (ptsname, char *, (int fd));
470 # else
471 #  if !@HAVE_PTSNAME@
472 _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
473 #  endif
474 _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
475 # endif
476 _GL_CXXALIASWARN (ptsname);
477 #elif defined GNULIB_POSIXCHECK
478 # undef ptsname
479 # if HAVE_RAW_DECL_PTSNAME
480 _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
481                  "use gnulib module ptsname for portability");
482 # endif
483 #endif
484
485 #if @GNULIB_PTSNAME_R@
486 /* Set the pathname of the pseudo-terminal slave associated with
487    the master FD is open on and return 0, or set errno and return
488    non-zero on errors.  */
489 # if @REPLACE_PTSNAME_R@
490 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
491 #   undef ptsname_r
492 #   define ptsname_r rpl_ptsname_r
493 #  endif
494 _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
495 _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
496 # else
497 #  if !@HAVE_PTSNAME_R@
498 _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
499 #  endif
500 _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
501 # endif
502 _GL_CXXALIASWARN (ptsname_r);
503 #elif defined GNULIB_POSIXCHECK
504 # undef ptsname_r
505 # if HAVE_RAW_DECL_PTSNAME_R
506 _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
507                  "use gnulib module ptsname_r for portability");
508 # endif
509 #endif
510
511 #if @GNULIB_PUTENV@
512 # if @REPLACE_PUTENV@
513 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
514 #   undef putenv
515 #   define putenv rpl_putenv
516 #  endif
517 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
518 _GL_CXXALIAS_RPL (putenv, int, (char *string));
519 # else
520 _GL_CXXALIAS_SYS (putenv, int, (char *string));
521 # endif
522 _GL_CXXALIASWARN (putenv);
523 #endif
524
525
526 #if @GNULIB_RANDOM_R@
527 # if !@HAVE_RANDOM_R@
528 #  ifndef RAND_MAX
529 #   define RAND_MAX 2147483647
530 #  endif
531 # endif
532 #endif
533
534
535 #if @GNULIB_RANDOM@
536 # if !@HAVE_RANDOM@
537 _GL_FUNCDECL_SYS (random, long, (void));
538 # endif
539 _GL_CXXALIAS_SYS (random, long, (void));
540 _GL_CXXALIASWARN (random);
541 #elif defined GNULIB_POSIXCHECK
542 # undef random
543 # if HAVE_RAW_DECL_RANDOM
544 _GL_WARN_ON_USE (random, "random is unportable - "
545                  "use gnulib module random for portability");
546 # endif
547 #endif
548
549 #if @GNULIB_RANDOM@
550 # if !@HAVE_RANDOM@
551 _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
552 # endif
553 _GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
554 _GL_CXXALIASWARN (srandom);
555 #elif defined GNULIB_POSIXCHECK
556 # undef srandom
557 # if HAVE_RAW_DECL_SRANDOM
558 _GL_WARN_ON_USE (srandom, "srandom is unportable - "
559                  "use gnulib module random for portability");
560 # endif
561 #endif
562
563 #if @GNULIB_RANDOM@
564 # if !@HAVE_RANDOM@
565 _GL_FUNCDECL_SYS (initstate, char *,
566                   (unsigned int seed, char *buf, size_t buf_size)
567                   _GL_ARG_NONNULL ((2)));
568 # endif
569 _GL_CXXALIAS_SYS (initstate, char *,
570                   (unsigned int seed, char *buf, size_t buf_size));
571 _GL_CXXALIASWARN (initstate);
572 #elif defined GNULIB_POSIXCHECK
573 # undef initstate
574 # if HAVE_RAW_DECL_INITSTATE_R
575 _GL_WARN_ON_USE (initstate, "initstate is unportable - "
576                  "use gnulib module random for portability");
577 # endif
578 #endif
579
580 #if @GNULIB_RANDOM@
581 # if !@HAVE_RANDOM@
582 _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
583 # endif
584 _GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
585 _GL_CXXALIASWARN (setstate);
586 #elif defined GNULIB_POSIXCHECK
587 # undef setstate
588 # if HAVE_RAW_DECL_SETSTATE_R
589 _GL_WARN_ON_USE (setstate, "setstate is unportable - "
590                  "use gnulib module random for portability");
591 # endif
592 #endif
593
594
595 #if @GNULIB_RANDOM_R@
596 # if @REPLACE_RANDOM_R@
597 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
598 #   undef random_r
599 #   define random_r rpl_random_r
600 #  endif
601 _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
602                                  _GL_ARG_NONNULL ((1, 2)));
603 _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
604 # else
605 #  if !@HAVE_RANDOM_R@
606 _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
607                                  _GL_ARG_NONNULL ((1, 2)));
608 #  endif
609 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
610 # endif
611 _GL_CXXALIASWARN (random_r);
612 #elif defined GNULIB_POSIXCHECK
613 # undef random_r
614 # if HAVE_RAW_DECL_RANDOM_R
615 _GL_WARN_ON_USE (random_r, "random_r is unportable - "
616                  "use gnulib module random_r for portability");
617 # endif
618 #endif
619
620 #if @GNULIB_RANDOM_R@
621 # if @REPLACE_RANDOM_R@
622 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
623 #   undef srandom_r
624 #   define srandom_r rpl_srandom_r
625 #  endif
626 _GL_FUNCDECL_RPL (srandom_r, int,
627                   (unsigned int seed, struct random_data *rand_state)
628                   _GL_ARG_NONNULL ((2)));
629 _GL_CXXALIAS_RPL (srandom_r, int,
630                   (unsigned int seed, struct random_data *rand_state));
631 # else
632 #  if !@HAVE_RANDOM_R@
633 _GL_FUNCDECL_SYS (srandom_r, int,
634                   (unsigned int seed, struct random_data *rand_state)
635                   _GL_ARG_NONNULL ((2)));
636 #  endif
637 _GL_CXXALIAS_SYS (srandom_r, int,
638                   (unsigned int seed, struct random_data *rand_state));
639 # endif
640 _GL_CXXALIASWARN (srandom_r);
641 #elif defined GNULIB_POSIXCHECK
642 # undef srandom_r
643 # if HAVE_RAW_DECL_SRANDOM_R
644 _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
645                  "use gnulib module random_r for portability");
646 # endif
647 #endif
648
649 #if @GNULIB_RANDOM_R@
650 # if @REPLACE_RANDOM_R@
651 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
652 #   undef initstate_r
653 #   define initstate_r rpl_initstate_r
654 #  endif
655 _GL_FUNCDECL_RPL (initstate_r, int,
656                   (unsigned int seed, char *buf, size_t buf_size,
657                    struct random_data *rand_state)
658                   _GL_ARG_NONNULL ((2, 4)));
659 _GL_CXXALIAS_RPL (initstate_r, int,
660                   (unsigned int seed, char *buf, size_t buf_size,
661                    struct random_data *rand_state));
662 # else
663 #  if !@HAVE_RANDOM_R@
664 _GL_FUNCDECL_SYS (initstate_r, int,
665                   (unsigned int seed, char *buf, size_t buf_size,
666                    struct random_data *rand_state)
667                   _GL_ARG_NONNULL ((2, 4)));
668 #  endif
669 _GL_CXXALIAS_SYS (initstate_r, int,
670                   (unsigned int seed, char *buf, size_t buf_size,
671                    struct random_data *rand_state));
672 # endif
673 _GL_CXXALIASWARN (initstate_r);
674 #elif defined GNULIB_POSIXCHECK
675 # undef initstate_r
676 # if HAVE_RAW_DECL_INITSTATE_R
677 _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
678                  "use gnulib module random_r for portability");
679 # endif
680 #endif
681
682 #if @GNULIB_RANDOM_R@
683 # if @REPLACE_RANDOM_R@
684 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
685 #   undef setstate_r
686 #   define setstate_r rpl_setstate_r
687 #  endif
688 _GL_FUNCDECL_RPL (setstate_r, int,
689                   (char *arg_state, struct random_data *rand_state)
690                   _GL_ARG_NONNULL ((1, 2)));
691 _GL_CXXALIAS_RPL (setstate_r, int,
692                   (char *arg_state, struct random_data *rand_state));
693 # else
694 #  if !@HAVE_RANDOM_R@
695 _GL_FUNCDECL_SYS (setstate_r, int,
696                   (char *arg_state, struct random_data *rand_state)
697                   _GL_ARG_NONNULL ((1, 2)));
698 #  endif
699 _GL_CXXALIAS_SYS (setstate_r, int,
700                   (char *arg_state, struct random_data *rand_state));
701 # endif
702 _GL_CXXALIASWARN (setstate_r);
703 #elif defined GNULIB_POSIXCHECK
704 # undef setstate_r
705 # if HAVE_RAW_DECL_SETSTATE_R
706 _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
707                  "use gnulib module random_r for portability");
708 # endif
709 #endif
710
711
712 #if @GNULIB_REALLOC_POSIX@
713 # if @REPLACE_REALLOC@
714 #  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
715         || _GL_USE_STDLIB_ALLOC)
716 #   undef realloc
717 #   define realloc rpl_realloc
718 #  endif
719 _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
720 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
721 # else
722 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
723 # endif
724 _GL_CXXALIASWARN (realloc);
725 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
726 # undef realloc
727 /* Assume realloc is always declared.  */
728 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
729                  "use gnulib module realloc-posix for portability");
730 #endif
731
732 #if @GNULIB_REALPATH@
733 # if @REPLACE_REALPATH@
734 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
735 #   define realpath rpl_realpath
736 #  endif
737 _GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
738                                     _GL_ARG_NONNULL ((1)));
739 _GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
740 # else
741 #  if !@HAVE_REALPATH@
742 _GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
743                                     _GL_ARG_NONNULL ((1)));
744 #  endif
745 _GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
746 # endif
747 _GL_CXXALIASWARN (realpath);
748 #elif defined GNULIB_POSIXCHECK
749 # undef realpath
750 # if HAVE_RAW_DECL_REALPATH
751 _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
752                  "canonicalize or canonicalize-lgpl for portability");
753 # endif
754 #endif
755
756 #if @GNULIB_RPMATCH@
757 /* Test a user response to a question.
758    Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear.  */
759 # if !@HAVE_RPMATCH@
760 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
761 # endif
762 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
763 _GL_CXXALIASWARN (rpmatch);
764 #elif defined GNULIB_POSIXCHECK
765 # undef rpmatch
766 # if HAVE_RAW_DECL_RPMATCH
767 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
768                  "use gnulib module rpmatch for portability");
769 # endif
770 #endif
771
772 #if @GNULIB_SECURE_GETENV@
773 /* Look up NAME in the environment, returning 0 in insecure situations.  */
774 # if !@HAVE_SECURE_GETENV@
775 _GL_FUNCDECL_SYS (secure_getenv, char *,
776                   (char const *name) _GL_ARG_NONNULL ((1)));
777 # endif
778 _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
779 _GL_CXXALIASWARN (secure_getenv);
780 #elif defined GNULIB_POSIXCHECK
781 # undef secure_getenv
782 # if HAVE_RAW_DECL_SECURE_GETENV
783 _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
784                  "use gnulib module secure_getenv for portability");
785 # endif
786 #endif
787
788 #if @GNULIB_SETENV@
789 /* Set NAME to VALUE in the environment.
790    If REPLACE is nonzero, overwrite an existing value.  */
791 # if @REPLACE_SETENV@
792 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
793 #   undef setenv
794 #   define setenv rpl_setenv
795 #  endif
796 _GL_FUNCDECL_RPL (setenv, int,
797                   (const char *name, const char *value, int replace)
798                   _GL_ARG_NONNULL ((1)));
799 _GL_CXXALIAS_RPL (setenv, int,
800                   (const char *name, const char *value, int replace));
801 # else
802 #  if !@HAVE_DECL_SETENV@
803 _GL_FUNCDECL_SYS (setenv, int,
804                   (const char *name, const char *value, int replace)
805                   _GL_ARG_NONNULL ((1)));
806 #  endif
807 _GL_CXXALIAS_SYS (setenv, int,
808                   (const char *name, const char *value, int replace));
809 # endif
810 # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
811 _GL_CXXALIASWARN (setenv);
812 # endif
813 #elif defined GNULIB_POSIXCHECK
814 # undef setenv
815 # if HAVE_RAW_DECL_SETENV
816 _GL_WARN_ON_USE (setenv, "setenv is unportable - "
817                  "use gnulib module setenv for portability");
818 # endif
819 #endif
820
821 #if @GNULIB_STRTOD@
822  /* Parse a double from STRING, updating ENDP if appropriate.  */
823 # if @REPLACE_STRTOD@
824 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
825 #   define strtod rpl_strtod
826 #  endif
827 _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
828                                   _GL_ARG_NONNULL ((1)));
829 _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
830 # else
831 #  if !@HAVE_STRTOD@
832 _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
833                                   _GL_ARG_NONNULL ((1)));
834 #  endif
835 _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
836 # endif
837 _GL_CXXALIASWARN (strtod);
838 #elif defined GNULIB_POSIXCHECK
839 # undef strtod
840 # if HAVE_RAW_DECL_STRTOD
841 _GL_WARN_ON_USE (strtod, "strtod is unportable - "
842                  "use gnulib module strtod for portability");
843 # endif
844 #endif
845
846 #if @GNULIB_STRTOLL@
847 /* Parse a signed integer whose textual representation starts at STRING.
848    The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
849    it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
850    "0x").
851    If ENDPTR is not NULL, the address of the first byte after the integer is
852    stored in *ENDPTR.
853    Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
854    to ERANGE.  */
855 # if !@HAVE_STRTOLL@
856 _GL_FUNCDECL_SYS (strtoll, long long,
857                   (const char *string, char **endptr, int base)
858                   _GL_ARG_NONNULL ((1)));
859 # endif
860 _GL_CXXALIAS_SYS (strtoll, long long,
861                   (const char *string, char **endptr, int base));
862 _GL_CXXALIASWARN (strtoll);
863 #elif defined GNULIB_POSIXCHECK
864 # undef strtoll
865 # if HAVE_RAW_DECL_STRTOLL
866 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
867                  "use gnulib module strtoll for portability");
868 # endif
869 #endif
870
871 #if @GNULIB_STRTOULL@
872 /* Parse an unsigned integer whose textual representation starts at STRING.
873    The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
874    it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
875    "0x").
876    If ENDPTR is not NULL, the address of the first byte after the integer is
877    stored in *ENDPTR.
878    Upon overflow, the return value is ULLONG_MAX, and errno is set to
879    ERANGE.  */
880 # if !@HAVE_STRTOULL@
881 _GL_FUNCDECL_SYS (strtoull, unsigned long long,
882                   (const char *string, char **endptr, int base)
883                   _GL_ARG_NONNULL ((1)));
884 # endif
885 _GL_CXXALIAS_SYS (strtoull, unsigned long long,
886                   (const char *string, char **endptr, int base));
887 _GL_CXXALIASWARN (strtoull);
888 #elif defined GNULIB_POSIXCHECK
889 # undef strtoull
890 # if HAVE_RAW_DECL_STRTOULL
891 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
892                  "use gnulib module strtoull for portability");
893 # endif
894 #endif
895
896 #if @GNULIB_UNLOCKPT@
897 /* Unlock the slave side of the pseudo-terminal whose master side is specified
898    by FD, so that it can be opened.  */
899 # if !@HAVE_UNLOCKPT@
900 _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
901 # endif
902 _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
903 _GL_CXXALIASWARN (unlockpt);
904 #elif defined GNULIB_POSIXCHECK
905 # undef unlockpt
906 # if HAVE_RAW_DECL_UNLOCKPT
907 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
908                  "use gnulib module unlockpt for portability");
909 # endif
910 #endif
911
912 #if @GNULIB_UNSETENV@
913 /* Remove the variable NAME from the environment.  */
914 # if @REPLACE_UNSETENV@
915 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
916 #   undef unsetenv
917 #   define unsetenv rpl_unsetenv
918 #  endif
919 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
920 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
921 # else
922 #  if !@HAVE_DECL_UNSETENV@
923 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
924 #  endif
925 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
926 # endif
927 # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
928 _GL_CXXALIASWARN (unsetenv);
929 # endif
930 #elif defined GNULIB_POSIXCHECK
931 # undef unsetenv
932 # if HAVE_RAW_DECL_UNSETENV
933 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
934                  "use gnulib module unsetenv for portability");
935 # endif
936 #endif
937
938 /* Convert a wide character to a multibyte character.  */
939 #if @GNULIB_WCTOMB@
940 # if @REPLACE_WCTOMB@
941 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
942 #   undef wctomb
943 #   define wctomb rpl_wctomb
944 #  endif
945 _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
946 _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
947 # else
948 _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
949 # endif
950 _GL_CXXALIASWARN (wctomb);
951 #endif
952
953
954 #endif /* _@GUARD_PREFIX@_STDLIB_H */
955 #endif /* _@GUARD_PREFIX@_STDLIB_H */
956 #endif