1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A GNU-like <stdlib.h>.
5 Copyright (C) 1995, 2001-2004, 2006-2013 Free Software Foundation, Inc.
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.
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.
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/>. */
21 @PRAGMA_SYSTEM_HEADER@
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. */
29 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
32 /* Normal invocation convention. */
34 #ifndef _@GUARD_PREFIX@_STDLIB_H
36 /* The include_next requires a split double-inclusion guard. */
37 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
39 #ifndef _@GUARD_PREFIX@_STDLIB_H
40 #define _@GUARD_PREFIX@_STDLIB_H
42 /* NetBSD 5.0 mis-defines NULL. */
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>
50 /* Solaris declares getloadavg() in <sys/loadavg.h>. */
51 #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
52 # include <sys/loadavg.h>
55 /* Native Windows platforms declare mktemp() in <io.h>. */
56 #if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
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'. */
69 # if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
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
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. */
87 # define GNULIB_defined_struct_random_data 1
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. */
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__))
105 # define _GL_ATTRIBUTE_PURE /* empty */
108 /* The definition of _Noreturn is copied here. */
110 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
112 /* The definition of _GL_ARG_NONNULL is copied here. */
114 /* The definition of _GL_WARN_ON_USE is copied here. */
117 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
119 # define EXIT_SUCCESS 0
121 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
122 with proper operation of xargs. */
124 # define EXIT_FAILURE 1
125 #elif EXIT_FAILURE != 1
127 # define EXIT_FAILURE 1
132 /* Terminate the current process with the given return code, without running
133 the 'atexit' handlers. */
135 _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
137 _GL_CXXALIAS_SYS (_Exit, void, (int status));
138 _GL_CXXALIASWARN (_Exit);
139 #elif defined GNULIB_POSIXCHECK
141 # if HAVE_RAW_DECL__EXIT
142 _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
143 "use gnulib module _Exit for portability");
149 /* Parse a signed decimal integer.
150 Returns the value of the integer. Errors are not detected. */
152 _GL_FUNCDECL_SYS (atoll, long long, (const char *string)
154 _GL_ARG_NONNULL ((1)));
156 _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
157 _GL_CXXALIASWARN (atoll);
158 #elif defined GNULIB_POSIXCHECK
160 # if HAVE_RAW_DECL_ATOLL
161 _GL_WARN_ON_USE (atoll, "atoll is unportable - "
162 "use gnulib module atoll for portability");
166 #if @GNULIB_CALLOC_POSIX@
167 # if @REPLACE_CALLOC@
168 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
170 # define calloc rpl_calloc
172 _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
173 _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
175 _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
177 _GL_CXXALIASWARN (calloc);
178 #elif defined GNULIB_POSIXCHECK
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");
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
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));
194 # if !@HAVE_CANONICALIZE_FILE_NAME@
195 _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
196 _GL_ARG_NONNULL ((1)));
198 _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
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");
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)));
219 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
220 _GL_CXXALIASWARN (getloadavg);
221 #elif defined GNULIB_POSIXCHECK
223 # if HAVE_RAW_DECL_GETLOADAVG
224 _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
225 "use gnulib module getloadavg for portability");
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)));
246 _GL_CXXALIAS_SYS (getsubopt, int,
247 (char **optionp, char *const *tokens, char **valuep));
248 _GL_CXXALIASWARN (getsubopt);
249 #elif defined GNULIB_POSIXCHECK
251 # if HAVE_RAW_DECL_GETSUBOPT
252 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
253 "use gnulib module getsubopt for portability");
258 /* Change the ownership and access permission of the slave side of the
259 pseudo-terminal whose master side is specified by FD. */
261 _GL_FUNCDECL_SYS (grantpt, int, (int fd));
263 _GL_CXXALIAS_SYS (grantpt, int, (int fd));
264 _GL_CXXALIASWARN (grantpt);
265 #elif defined GNULIB_POSIXCHECK
267 # if HAVE_RAW_DECL_GRANTPT
268 _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
269 "use gnulib module grantpt for portability");
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)
282 # define malloc rpl_malloc
284 _GL_FUNCDECL_RPL (malloc, void *, (size_t size));
285 _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
287 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
289 _GL_CXXALIASWARN (malloc);
290 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
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");
297 /* Convert a multibyte character to a wide character. */
299 # if @REPLACE_MBTOWC@
300 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
302 # define mbtowc rpl_mbtowc
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));
307 _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
309 _GL_CXXALIASWARN (mbtowc);
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. */
319 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
321 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
322 _GL_CXXALIASWARN (mkdtemp);
323 #elif defined GNULIB_POSIXCHECK
325 # if HAVE_RAW_DECL_MKDTEMP
326 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
327 "use gnulib module mkdtemp for portability");
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
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
342 Returns the open file descriptor if successful, otherwise -1 and errno
344 # if !@HAVE_MKOSTEMP@
345 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
346 _GL_ARG_NONNULL ((1)));
348 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
349 _GL_CXXALIASWARN (mkostemp);
350 #elif defined GNULIB_POSIXCHECK
352 # if HAVE_RAW_DECL_MKOSTEMP
353 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
354 "use gnulib module mkostemp for portability");
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
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
370 Returns the open file descriptor if successful, otherwise -1 and errno
372 # if !@HAVE_MKOSTEMPS@
373 _GL_FUNCDECL_SYS (mkostemps, int,
374 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
375 _GL_ARG_NONNULL ((1)));
377 _GL_CXXALIAS_SYS (mkostemps, int,
378 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
379 _GL_CXXALIASWARN (mkostemps);
380 #elif defined GNULIB_POSIXCHECK
382 # if HAVE_RAW_DECL_MKOSTEMPS
383 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
384 "use gnulib module mkostemps for portability");
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
396 Returns the open file descriptor if successful, otherwise -1 and errno
398 # if @REPLACE_MKSTEMP@
399 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
400 # define mkstemp rpl_mkstemp
402 _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
403 _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
405 # if ! @HAVE_MKSTEMP@
406 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
408 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
410 _GL_CXXALIASWARN (mkstemp);
411 #elif defined GNULIB_POSIXCHECK
413 # if HAVE_RAW_DECL_MKSTEMP
414 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
415 "use gnulib module mkstemp for portability");
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
428 Returns the open file descriptor if successful, otherwise -1 and errno
430 # if !@HAVE_MKSTEMPS@
431 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
432 _GL_ARG_NONNULL ((1)));
434 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
435 _GL_CXXALIASWARN (mkstemps);
436 #elif defined GNULIB_POSIXCHECK
438 # if HAVE_RAW_DECL_MKSTEMPS
439 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
440 "use gnulib module mkstemps for portability");
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));
450 _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
451 _GL_CXXALIASWARN (posix_openpt);
452 #elif defined GNULIB_POSIXCHECK
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");
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)
466 # define ptsname rpl_ptsname
468 _GL_FUNCDECL_RPL (ptsname, char *, (int fd));
469 _GL_CXXALIAS_RPL (ptsname, char *, (int fd));
472 _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
474 _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
476 _GL_CXXALIASWARN (ptsname);
477 #elif defined GNULIB_POSIXCHECK
479 # if HAVE_RAW_DECL_PTSNAME
480 _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
481 "use gnulib module ptsname for portability");
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)
492 # define ptsname_r rpl_ptsname_r
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));
497 # if !@HAVE_PTSNAME_R@
498 _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
500 _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
502 _GL_CXXALIASWARN (ptsname_r);
503 #elif defined GNULIB_POSIXCHECK
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");
512 # if @REPLACE_PUTENV@
513 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
515 # define putenv rpl_putenv
517 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
518 _GL_CXXALIAS_RPL (putenv, int, (char *string));
520 _GL_CXXALIAS_SYS (putenv, int, (char *string));
522 _GL_CXXALIASWARN (putenv);
526 #if @GNULIB_RANDOM_R@
527 # if !@HAVE_RANDOM_R@
529 # define RAND_MAX 2147483647
537 _GL_FUNCDECL_SYS (random, long, (void));
539 _GL_CXXALIAS_SYS (random, long, (void));
540 _GL_CXXALIASWARN (random);
541 #elif defined GNULIB_POSIXCHECK
543 # if HAVE_RAW_DECL_RANDOM
544 _GL_WARN_ON_USE (random, "random is unportable - "
545 "use gnulib module random for portability");
551 _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
553 _GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
554 _GL_CXXALIASWARN (srandom);
555 #elif defined GNULIB_POSIXCHECK
557 # if HAVE_RAW_DECL_SRANDOM
558 _GL_WARN_ON_USE (srandom, "srandom is unportable - "
559 "use gnulib module random for portability");
565 _GL_FUNCDECL_SYS (initstate, char *,
566 (unsigned int seed, char *buf, size_t buf_size)
567 _GL_ARG_NONNULL ((2)));
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
574 # if HAVE_RAW_DECL_INITSTATE_R
575 _GL_WARN_ON_USE (initstate, "initstate is unportable - "
576 "use gnulib module random for portability");
582 _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
584 _GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
585 _GL_CXXALIASWARN (setstate);
586 #elif defined GNULIB_POSIXCHECK
588 # if HAVE_RAW_DECL_SETSTATE_R
589 _GL_WARN_ON_USE (setstate, "setstate is unportable - "
590 "use gnulib module random for portability");
595 #if @GNULIB_RANDOM_R@
596 # if @REPLACE_RANDOM_R@
597 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
599 # define random_r rpl_random_r
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));
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)));
609 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
611 _GL_CXXALIASWARN (random_r);
612 #elif defined GNULIB_POSIXCHECK
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");
620 #if @GNULIB_RANDOM_R@
621 # if @REPLACE_RANDOM_R@
622 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
624 # define srandom_r rpl_srandom_r
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));
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)));
637 _GL_CXXALIAS_SYS (srandom_r, int,
638 (unsigned int seed, struct random_data *rand_state));
640 _GL_CXXALIASWARN (srandom_r);
641 #elif defined GNULIB_POSIXCHECK
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");
649 #if @GNULIB_RANDOM_R@
650 # if @REPLACE_RANDOM_R@
651 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
653 # define initstate_r rpl_initstate_r
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));
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)));
669 _GL_CXXALIAS_SYS (initstate_r, int,
670 (unsigned int seed, char *buf, size_t buf_size,
671 struct random_data *rand_state));
673 _GL_CXXALIASWARN (initstate_r);
674 #elif defined GNULIB_POSIXCHECK
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");
682 #if @GNULIB_RANDOM_R@
683 # if @REPLACE_RANDOM_R@
684 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
686 # define setstate_r rpl_setstate_r
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));
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)));
699 _GL_CXXALIAS_SYS (setstate_r, int,
700 (char *arg_state, struct random_data *rand_state));
702 _GL_CXXALIASWARN (setstate_r);
703 #elif defined GNULIB_POSIXCHECK
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");
712 #if @GNULIB_REALLOC_POSIX@
713 # if @REPLACE_REALLOC@
714 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
715 || _GL_USE_STDLIB_ALLOC)
717 # define realloc rpl_realloc
719 _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
720 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
722 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
724 _GL_CXXALIASWARN (realloc);
725 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
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");
732 #if @GNULIB_REALPATH@
733 # if @REPLACE_REALPATH@
734 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
735 # define realpath rpl_realpath
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));
741 # if !@HAVE_REALPATH@
742 _GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
743 _GL_ARG_NONNULL ((1)));
745 _GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
747 _GL_CXXALIASWARN (realpath);
748 #elif defined GNULIB_POSIXCHECK
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");
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. */
760 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
762 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
763 _GL_CXXALIASWARN (rpmatch);
764 #elif defined GNULIB_POSIXCHECK
766 # if HAVE_RAW_DECL_RPMATCH
767 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
768 "use gnulib module rpmatch for portability");
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)));
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");
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)
794 # define setenv rpl_setenv
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));
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)));
807 _GL_CXXALIAS_SYS (setenv, int,
808 (const char *name, const char *value, int replace));
810 # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
811 _GL_CXXALIASWARN (setenv);
813 #elif defined GNULIB_POSIXCHECK
815 # if HAVE_RAW_DECL_SETENV
816 _GL_WARN_ON_USE (setenv, "setenv is unportable - "
817 "use gnulib module setenv for portability");
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
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));
832 _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
833 _GL_ARG_NONNULL ((1)));
835 _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
837 _GL_CXXALIASWARN (strtod);
838 #elif defined GNULIB_POSIXCHECK
840 # if HAVE_RAW_DECL_STRTOD
841 _GL_WARN_ON_USE (strtod, "strtod is unportable - "
842 "use gnulib module strtod for portability");
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
851 If ENDPTR is not NULL, the address of the first byte after the integer is
853 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
856 _GL_FUNCDECL_SYS (strtoll, long long,
857 (const char *string, char **endptr, int base)
858 _GL_ARG_NONNULL ((1)));
860 _GL_CXXALIAS_SYS (strtoll, long long,
861 (const char *string, char **endptr, int base));
862 _GL_CXXALIASWARN (strtoll);
863 #elif defined GNULIB_POSIXCHECK
865 # if HAVE_RAW_DECL_STRTOLL
866 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
867 "use gnulib module strtoll for portability");
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
876 If ENDPTR is not NULL, the address of the first byte after the integer is
878 Upon overflow, the return value is ULLONG_MAX, and errno is set to
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)));
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
890 # if HAVE_RAW_DECL_STRTOULL
891 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
892 "use gnulib module strtoull for portability");
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));
902 _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
903 _GL_CXXALIASWARN (unlockpt);
904 #elif defined GNULIB_POSIXCHECK
906 # if HAVE_RAW_DECL_UNLOCKPT
907 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
908 "use gnulib module unlockpt for portability");
912 #if @GNULIB_UNSETENV@
913 /* Remove the variable NAME from the environment. */
914 # if @REPLACE_UNSETENV@
915 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
917 # define unsetenv rpl_unsetenv
919 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
920 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
922 # if !@HAVE_DECL_UNSETENV@
923 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
925 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
927 # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
928 _GL_CXXALIASWARN (unsetenv);
930 #elif defined GNULIB_POSIXCHECK
932 # if HAVE_RAW_DECL_UNSETENV
933 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
934 "use gnulib module unsetenv for portability");
938 /* Convert a wide character to a multibyte character. */
940 # if @REPLACE_WCTOMB@
941 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
943 # define wctomb rpl_wctomb
945 _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
946 _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
948 _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
950 _GL_CXXALIASWARN (wctomb);
954 #endif /* _@GUARD_PREFIX@_STDLIB_H */
955 #endif /* _@GUARD_PREFIX@_STDLIB_H */