1 /* A GNU-like <stdlib.h>.
3 Copyright (C) 1995, 2001-2004, 2006-2020 Free Software Foundation, Inc.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19 @PRAGMA_SYSTEM_HEADER@
23 #if defined __need_system_stdlib_h || defined __need_malloc_and_calloc
24 /* Special invocation conventions inside some gnulib header files,
25 and inside some glibc header files, respectively. */
27 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
30 /* Normal invocation convention. */
32 #ifndef _@GUARD_PREFIX@_STDLIB_H
34 /* The include_next requires a split double-inclusion guard. */
35 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
37 #ifndef _@GUARD_PREFIX@_STDLIB_H
38 #define _@GUARD_PREFIX@_STDLIB_H
40 /* NetBSD 5.0 mis-defines NULL. */
43 /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
44 #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
45 # include <sys/wait.h>
48 /* Solaris declares getloadavg() in <sys/loadavg.h>. */
49 #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
50 /* OpenIndiana has a bug: <sys/time.h> must be included before
52 # include <sys/time.h>
53 # include <sys/loadavg.h>
56 /* Native Windows platforms declare _mktemp() in <io.h>. */
57 #if defined _WIN32 && !defined __CYGWIN__
63 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
64 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
65 'struct random_data'. */
70 # if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
74 # if !@HAVE_STRUCT_RANDOM_DATA@
75 /* Define 'struct random_data'.
76 But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
77 # if !GNULIB_defined_struct_random_data
80 int32_t *fptr
; /* Front pointer. */
81 int32_t *rptr
; /* Rear pointer. */
82 int32_t *state
; /* Array of state values. */
83 int rand_type
; /* Type of random number generator. */
84 int rand_deg
; /* Degree of random number generator. */
85 int rand_sep
; /* Distance between front and rear. */
86 int32_t *end_ptr
; /* Pointer behind state table. */
88 # define GNULIB_defined_struct_random_data 1
93 #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__)
94 /* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
95 /* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
96 /* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */
97 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
98 /* But avoid namespace pollution on glibc systems and native Windows. */
102 /* The __attribute__ feature is available in gcc versions 2.5 and later.
103 The attribute __pure__ was added in gcc 2.96. */
104 #ifndef _GL_ATTRIBUTE_PURE
105 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
106 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
108 # define _GL_ATTRIBUTE_PURE /* empty */
112 /* The definition of _Noreturn is copied here. */
114 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
116 /* The definition of _GL_ARG_NONNULL is copied here. */
118 /* The definition of _GL_WARN_ON_USE is copied here. */
121 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
123 # define EXIT_SUCCESS 0
125 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
126 with proper operation of xargs. */
128 # define EXIT_FAILURE 1
129 #elif EXIT_FAILURE != 1
131 # define EXIT_FAILURE 1
136 /* Terminate the current process with the given return code, without running
137 the 'atexit' handlers. */
139 _GL_FUNCDECL_SYS (_Exit
, _Noreturn
void, (int status
));
141 _GL_CXXALIAS_SYS (_Exit
, void, (int status
));
142 _GL_CXXALIASWARN (_Exit
);
143 #elif defined GNULIB_POSIXCHECK
145 # if HAVE_RAW_DECL__EXIT
146 _GL_WARN_ON_USE (_Exit
, "_Exit is unportable - "
147 "use gnulib module _Exit for portability");
152 /* Allocate memory with indefinite extent and specified alignment. */
153 #if @GNULIB_ALIGNED_ALLOC@
154 # if @REPLACE_ALIGNED_ALLOC@
155 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
156 # undef aligned_alloc
157 # define aligned_alloc rpl_aligned_alloc
159 _GL_FUNCDECL_RPL (aligned_alloc
, void *, (size_t alignment
, size_t size
));
160 _GL_CXXALIAS_RPL (aligned_alloc
, void *, (size_t alignment
, size_t size
));
162 # if @HAVE_ALIGNED_ALLOC@
163 _GL_CXXALIAS_SYS (aligned_alloc
, void *, (size_t alignment
, size_t size
));
166 # if @HAVE_ALIGNED_ALLOC@
167 _GL_CXXALIASWARN (aligned_alloc
);
169 #elif defined GNULIB_POSIXCHECK
170 # undef aligned_alloc
171 # if HAVE_RAW_DECL_ALIGNED_ALLOC
172 _GL_WARN_ON_USE (aligned_alloc
, "aligned_alloc is not portable - "
173 "use gnulib module aligned_alloc for portability");
178 /* Parse a signed decimal integer.
179 Returns the value of the integer. Errors are not detected. */
181 _GL_FUNCDECL_SYS (atoll
, long long, (const char *string
)
183 _GL_ARG_NONNULL ((1)));
185 _GL_CXXALIAS_SYS (atoll
, long long, (const char *string
));
186 _GL_CXXALIASWARN (atoll
);
187 #elif defined GNULIB_POSIXCHECK
189 # if HAVE_RAW_DECL_ATOLL
190 _GL_WARN_ON_USE (atoll
, "atoll is unportable - "
191 "use gnulib module atoll for portability");
195 #if @GNULIB_CALLOC_POSIX@
196 # if @REPLACE_CALLOC@
197 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
199 # define calloc rpl_calloc
201 _GL_FUNCDECL_RPL (calloc
, void *, (size_t nmemb
, size_t size
));
202 _GL_CXXALIAS_RPL (calloc
, void *, (size_t nmemb
, size_t size
));
204 _GL_CXXALIAS_SYS (calloc
, void *, (size_t nmemb
, size_t size
));
207 _GL_CXXALIASWARN (calloc
);
209 #elif defined GNULIB_POSIXCHECK
211 /* Assume calloc is always declared. */
212 _GL_WARN_ON_USE (calloc
, "calloc is not POSIX compliant everywhere - "
213 "use gnulib module calloc-posix for portability");
216 #if @GNULIB_CANONICALIZE_FILE_NAME@
217 # if @REPLACE_CANONICALIZE_FILE_NAME@
218 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
219 # define canonicalize_file_name rpl_canonicalize_file_name
221 _GL_FUNCDECL_RPL (canonicalize_file_name
, char *, (const char *name
)
222 _GL_ARG_NONNULL ((1)));
223 _GL_CXXALIAS_RPL (canonicalize_file_name
, char *, (const char *name
));
225 # if !@HAVE_CANONICALIZE_FILE_NAME@
226 _GL_FUNCDECL_SYS (canonicalize_file_name
, char *, (const char *name
)
227 _GL_ARG_NONNULL ((1)));
229 _GL_CXXALIAS_SYS (canonicalize_file_name
, char *, (const char *name
));
231 # ifndef GNULIB_defined_canonicalize_file_name
232 # define GNULIB_defined_canonicalize_file_name \
233 (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@)
235 _GL_CXXALIASWARN (canonicalize_file_name
);
236 #elif defined GNULIB_POSIXCHECK
237 # undef canonicalize_file_name
238 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
239 _GL_WARN_ON_USE (canonicalize_file_name
,
240 "canonicalize_file_name is unportable - "
241 "use gnulib module canonicalize-lgpl for portability");
245 /* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not
246 required. In C++ with GNULIB_NAMESPACE, avoid differences between
247 platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have
249 #if defined _WIN32 && !defined __CYGWIN__
250 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
254 _GL_CXXALIAS_MDA (ecvt
, char *,
255 (double number
, int ndigits
, int *decptp
, int *signp
));
257 # if @HAVE_DECL_ECVT@
258 _GL_CXXALIAS_SYS (ecvt
, char *,
259 (double number
, int ndigits
, int *decptp
, int *signp
));
262 #if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@
263 _GL_CXXALIASWARN (ecvt
);
266 /* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not
267 required. In C++ with GNULIB_NAMESPACE, avoid differences between
268 platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have
270 #if defined _WIN32 && !defined __CYGWIN__
271 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
275 _GL_CXXALIAS_MDA (fcvt
, char *,
276 (double number
, int ndigits
, int *decptp
, int *signp
));
278 # if @HAVE_DECL_FCVT@
279 _GL_CXXALIAS_SYS (fcvt
, char *,
280 (double number
, int ndigits
, int *decptp
, int *signp
));
283 #if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@
284 _GL_CXXALIASWARN (fcvt
);
287 /* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not
288 required. In C++ with GNULIB_NAMESPACE, avoid differences between
289 platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have
291 #if defined _WIN32 && !defined __CYGWIN__
292 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
296 _GL_CXXALIAS_MDA (gcvt
, char *, (double number
, int ndigits
, char *buf
));
298 # if @HAVE_DECL_GCVT@
299 _GL_CXXALIAS_SYS (gcvt
, char *, (double number
, int ndigits
, char *buf
));
302 #if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@
303 _GL_CXXALIASWARN (gcvt
);
306 #if @GNULIB_GETLOADAVG@
307 /* Store max(NELEM,3) load average numbers in LOADAVG[].
308 The three numbers are the load average of the last 1 minute, the last 5
309 minutes, and the last 15 minutes, respectively.
310 LOADAVG is an array of NELEM numbers. */
311 # if !@HAVE_DECL_GETLOADAVG@
312 _GL_FUNCDECL_SYS (getloadavg
, int, (double loadavg
[], int nelem
)
313 _GL_ARG_NONNULL ((1)));
315 _GL_CXXALIAS_SYS (getloadavg
, int, (double loadavg
[], int nelem
));
316 _GL_CXXALIASWARN (getloadavg
);
317 #elif defined GNULIB_POSIXCHECK
319 # if HAVE_RAW_DECL_GETLOADAVG
320 _GL_WARN_ON_USE (getloadavg
, "getloadavg is not portable - "
321 "use gnulib module getloadavg for portability");
325 #if @GNULIB_GETSUBOPT@
326 /* Assuming *OPTIONP is a comma separated list of elements of the form
327 "token" or "token=value", getsubopt parses the first of these elements.
328 If the first element refers to a "token" that is member of the given
329 NULL-terminated array of tokens:
330 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
331 the first option and the comma, sets *VALUEP to the value of the
332 element (or NULL if it doesn't contain an "=" sign),
333 - It returns the index of the "token" in the given array of tokens.
334 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
335 For more details see the POSIX specification.
336 https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */
337 # if !@HAVE_GETSUBOPT@
338 _GL_FUNCDECL_SYS (getsubopt
, int,
339 (char **optionp
, char *const *tokens
, char **valuep
)
340 _GL_ARG_NONNULL ((1, 2, 3)));
342 _GL_CXXALIAS_SYS (getsubopt
, int,
343 (char **optionp
, char *const *tokens
, char **valuep
));
344 _GL_CXXALIASWARN (getsubopt
);
345 #elif defined GNULIB_POSIXCHECK
347 # if HAVE_RAW_DECL_GETSUBOPT
348 _GL_WARN_ON_USE (getsubopt
, "getsubopt is unportable - "
349 "use gnulib module getsubopt for portability");
354 /* Change the ownership and access permission of the slave side of the
355 pseudo-terminal whose master side is specified by FD. */
357 _GL_FUNCDECL_SYS (grantpt
, int, (int fd
));
359 _GL_CXXALIAS_SYS (grantpt
, int, (int fd
));
360 _GL_CXXALIASWARN (grantpt
);
361 #elif defined GNULIB_POSIXCHECK
363 # if HAVE_RAW_DECL_GRANTPT
364 _GL_WARN_ON_USE (grantpt
, "grantpt is not portable - "
365 "use gnulib module grantpt for portability");
369 /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
370 rely on GNU or POSIX semantics for malloc and realloc (for example,
371 by never specifying a zero size), so it does not need malloc or
372 realloc to be redefined. */
373 #if @GNULIB_MALLOC_POSIX@
374 # if @REPLACE_MALLOC@
375 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
376 || _GL_USE_STDLIB_ALLOC)
378 # define malloc rpl_malloc
380 _GL_FUNCDECL_RPL (malloc
, void *, (size_t size
));
381 _GL_CXXALIAS_RPL (malloc
, void *, (size_t size
));
383 _GL_CXXALIAS_SYS (malloc
, void *, (size_t size
));
386 _GL_CXXALIASWARN (malloc
);
388 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
390 /* Assume malloc is always declared. */
391 _GL_WARN_ON_USE (malloc
, "malloc is not POSIX compliant everywhere - "
392 "use gnulib module malloc-posix for portability");
395 /* Convert a multibyte character to a wide character. */
397 # if @REPLACE_MBTOWC@
398 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
400 # define mbtowc rpl_mbtowc
402 _GL_FUNCDECL_RPL (mbtowc
, int,
403 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
));
404 _GL_CXXALIAS_RPL (mbtowc
, int,
405 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
));
408 _GL_FUNCDECL_SYS (mbtowc
, int,
409 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
));
411 _GL_CXXALIAS_SYS (mbtowc
, int,
412 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
));
415 _GL_CXXALIASWARN (mbtowc
);
417 #elif defined GNULIB_POSIXCHECK
419 # if HAVE_RAW_DECL_MBTOWC
420 _GL_WARN_ON_USE (mbtowc
, "mbtowc is not portable - "
421 "use gnulib module mbtowc for portability");
426 /* Create a unique temporary directory from TEMPLATE.
427 The last six characters of TEMPLATE must be "XXXXXX";
428 they are replaced with a string that makes the directory name unique.
429 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
430 The directory is created mode 700. */
432 _GL_FUNCDECL_SYS (mkdtemp
, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
434 _GL_CXXALIAS_SYS (mkdtemp
, char *, (char * /*template*/));
435 _GL_CXXALIASWARN (mkdtemp
);
436 #elif defined GNULIB_POSIXCHECK
438 # if HAVE_RAW_DECL_MKDTEMP
439 _GL_WARN_ON_USE (mkdtemp
, "mkdtemp is unportable - "
440 "use gnulib module mkdtemp for portability");
444 #if @GNULIB_MKOSTEMP@
445 /* Create a unique temporary file from TEMPLATE.
446 The last six characters of TEMPLATE must be "XXXXXX";
447 they are replaced with a string that makes the file name unique.
448 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
449 and O_TEXT, O_BINARY (defined in "binary-io.h").
450 The file is then created, with the specified flags, ensuring it didn't exist
452 The file is created read-write (mask at least 0600 & ~umask), but it may be
453 world-readable and world-writable (mask 0666 & ~umask), depending on the
455 Returns the open file descriptor if successful, otherwise -1 and errno
457 # if !@HAVE_MKOSTEMP@
458 _GL_FUNCDECL_SYS (mkostemp
, int, (char * /*template*/, int /*flags*/)
459 _GL_ARG_NONNULL ((1)));
461 _GL_CXXALIAS_SYS (mkostemp
, int, (char * /*template*/, int /*flags*/));
462 _GL_CXXALIASWARN (mkostemp
);
463 #elif defined GNULIB_POSIXCHECK
465 # if HAVE_RAW_DECL_MKOSTEMP
466 _GL_WARN_ON_USE (mkostemp
, "mkostemp is unportable - "
467 "use gnulib module mkostemp for portability");
471 #if @GNULIB_MKOSTEMPS@
472 /* Create a unique temporary file from TEMPLATE.
473 The last six characters of TEMPLATE before a suffix of length
474 SUFFIXLEN must be "XXXXXX";
475 they are replaced with a string that makes the file name unique.
476 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
477 and O_TEXT, O_BINARY (defined in "binary-io.h").
478 The file is then created, with the specified flags, ensuring it didn't exist
480 The file is created read-write (mask at least 0600 & ~umask), but it may be
481 world-readable and world-writable (mask 0666 & ~umask), depending on the
483 Returns the open file descriptor if successful, otherwise -1 and errno
485 # if !@HAVE_MKOSTEMPS@
486 _GL_FUNCDECL_SYS (mkostemps
, int,
487 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
488 _GL_ARG_NONNULL ((1)));
490 _GL_CXXALIAS_SYS (mkostemps
, int,
491 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
492 _GL_CXXALIASWARN (mkostemps
);
493 #elif defined GNULIB_POSIXCHECK
495 # if HAVE_RAW_DECL_MKOSTEMPS
496 _GL_WARN_ON_USE (mkostemps
, "mkostemps is unportable - "
497 "use gnulib module mkostemps for portability");
502 /* Create a unique temporary file from TEMPLATE.
503 The last six characters of TEMPLATE must be "XXXXXX";
504 they are replaced with a string that makes the file name unique.
505 The file is then created, ensuring it didn't exist before.
506 The file is created read-write (mask at least 0600 & ~umask), but it may be
507 world-readable and world-writable (mask 0666 & ~umask), depending on the
509 Returns the open file descriptor if successful, otherwise -1 and errno
511 # if @REPLACE_MKSTEMP@
512 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
513 # define mkstemp rpl_mkstemp
515 _GL_FUNCDECL_RPL (mkstemp
, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
516 _GL_CXXALIAS_RPL (mkstemp
, int, (char * /*template*/));
518 # if ! @HAVE_MKSTEMP@
519 _GL_FUNCDECL_SYS (mkstemp
, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
521 _GL_CXXALIAS_SYS (mkstemp
, int, (char * /*template*/));
523 _GL_CXXALIASWARN (mkstemp
);
524 #elif defined GNULIB_POSIXCHECK
526 # if HAVE_RAW_DECL_MKSTEMP
527 _GL_WARN_ON_USE (mkstemp
, "mkstemp is unportable - "
528 "use gnulib module mkstemp for portability");
532 #if @GNULIB_MKSTEMPS@
533 /* Create a unique temporary file from TEMPLATE.
534 The last six characters of TEMPLATE prior to a suffix of length
535 SUFFIXLEN must be "XXXXXX";
536 they are replaced with a string that makes the file name unique.
537 The file is then created, ensuring it didn't exist before.
538 The file is created read-write (mask at least 0600 & ~umask), but it may be
539 world-readable and world-writable (mask 0666 & ~umask), depending on the
541 Returns the open file descriptor if successful, otherwise -1 and errno
543 # if !@HAVE_MKSTEMPS@
544 _GL_FUNCDECL_SYS (mkstemps
, int, (char * /*template*/, int /*suffixlen*/)
545 _GL_ARG_NONNULL ((1)));
547 _GL_CXXALIAS_SYS (mkstemps
, int, (char * /*template*/, int /*suffixlen*/));
548 _GL_CXXALIASWARN (mkstemps
);
549 #elif defined GNULIB_POSIXCHECK
551 # if HAVE_RAW_DECL_MKSTEMPS
552 _GL_WARN_ON_USE (mkstemps
, "mkstemps is unportable - "
553 "use gnulib module mkstemps for portability");
557 /* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not
558 required. In C++ with GNULIB_NAMESPACE, avoid differences between
559 platforms by defining GNULIB_NAMESPACE::mktemp always. */
560 #if defined _WIN32 && !defined __CYGWIN__
561 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
563 # define mktemp _mktemp
565 _GL_CXXALIAS_MDA (mktemp
, char *, (char * /*template*/));
567 _GL_CXXALIAS_SYS (mktemp
, char *, (char * /*template*/));
569 _GL_CXXALIASWARN (mktemp
);
571 /* Allocate memory with indefinite extent and specified alignment. */
572 #if @GNULIB_POSIX_MEMALIGN@
573 # if @REPLACE_POSIX_MEMALIGN@
574 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
575 # undef posix_memalign
576 # define posix_memalign rpl_posix_memalign
578 _GL_FUNCDECL_RPL (posix_memalign
, int,
579 (void **memptr
, size_t alignment
, size_t size
)
580 _GL_ARG_NONNULL ((1)));
581 _GL_CXXALIAS_RPL (posix_memalign
, int,
582 (void **memptr
, size_t alignment
, size_t size
));
584 # if @HAVE_POSIX_MEMALIGN@
585 _GL_CXXALIAS_SYS (posix_memalign
, int,
586 (void **memptr
, size_t alignment
, size_t size
));
589 # if @HAVE_POSIX_MEMALIGN@
590 _GL_CXXALIASWARN (posix_memalign
);
592 #elif defined GNULIB_POSIXCHECK
593 # undef posix_memalign
594 # if HAVE_RAW_DECL_POSIX_MEMALIGN
595 _GL_WARN_ON_USE (posix_memalign
, "posix_memalign is not portable - "
596 "use gnulib module posix_memalign for portability");
600 #if @GNULIB_POSIX_OPENPT@
601 /* Return an FD open to the master side of a pseudo-terminal. Flags should
602 include O_RDWR, and may also include O_NOCTTY. */
603 # if !@HAVE_POSIX_OPENPT@
604 _GL_FUNCDECL_SYS (posix_openpt
, int, (int flags
));
606 _GL_CXXALIAS_SYS (posix_openpt
, int, (int flags
));
607 _GL_CXXALIASWARN (posix_openpt
);
608 #elif defined GNULIB_POSIXCHECK
610 # if HAVE_RAW_DECL_POSIX_OPENPT
611 _GL_WARN_ON_USE (posix_openpt
, "posix_openpt is not portable - "
612 "use gnulib module posix_openpt for portability");
617 /* Return the pathname of the pseudo-terminal slave associated with
618 the master FD is open on, or NULL on errors. */
619 # if @REPLACE_PTSNAME@
620 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
622 # define ptsname rpl_ptsname
624 _GL_FUNCDECL_RPL (ptsname
, char *, (int fd
));
625 _GL_CXXALIAS_RPL (ptsname
, char *, (int fd
));
628 _GL_FUNCDECL_SYS (ptsname
, char *, (int fd
));
630 _GL_CXXALIAS_SYS (ptsname
, char *, (int fd
));
632 _GL_CXXALIASWARN (ptsname
);
633 #elif defined GNULIB_POSIXCHECK
635 # if HAVE_RAW_DECL_PTSNAME
636 _GL_WARN_ON_USE (ptsname
, "ptsname is not portable - "
637 "use gnulib module ptsname for portability");
641 #if @GNULIB_PTSNAME_R@
642 /* Set the pathname of the pseudo-terminal slave associated with
643 the master FD is open on and return 0, or set errno and return
644 non-zero on errors. */
645 # if @REPLACE_PTSNAME_R@
646 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
648 # define ptsname_r rpl_ptsname_r
650 _GL_FUNCDECL_RPL (ptsname_r
, int, (int fd
, char *buf
, size_t len
));
651 _GL_CXXALIAS_RPL (ptsname_r
, int, (int fd
, char *buf
, size_t len
));
653 # if !@HAVE_PTSNAME_R@
654 _GL_FUNCDECL_SYS (ptsname_r
, int, (int fd
, char *buf
, size_t len
));
656 _GL_CXXALIAS_SYS (ptsname_r
, int, (int fd
, char *buf
, size_t len
));
658 # ifndef GNULIB_defined_ptsname_r
659 # define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@)
661 _GL_CXXALIASWARN (ptsname_r
);
662 #elif defined GNULIB_POSIXCHECK
664 # if HAVE_RAW_DECL_PTSNAME_R
665 _GL_WARN_ON_USE (ptsname_r
, "ptsname_r is not portable - "
666 "use gnulib module ptsname_r for portability");
671 # if @REPLACE_PUTENV@
672 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
674 # define putenv rpl_putenv
676 _GL_FUNCDECL_RPL (putenv
, int, (char *string
) _GL_ARG_NONNULL ((1)));
677 _GL_CXXALIAS_RPL (putenv
, int, (char *string
));
678 # elif defined _WIN32 && !defined __CYGWIN__
679 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
681 # define putenv _putenv
683 _GL_CXXALIAS_MDA (putenv
, int, (char *string
));
685 _GL_CXXALIAS_SYS (putenv
, int, (char *string
));
687 _GL_CXXALIASWARN (putenv
);
689 /* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not
690 required. In C++ with GNULIB_NAMESPACE, avoid differences between
691 platforms by defining GNULIB_NAMESPACE::putenv always. */
692 # if defined _WIN32 && !defined __CYGWIN__
693 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
695 # define putenv _putenv
697 _GL_CXXALIAS_MDA (putenv
, int, (char *string
));
699 _GL_CXXALIAS_SYS (putenv
, int, (char *string
));
701 _GL_CXXALIASWARN (putenv
);
705 /* Sort an array of NMEMB elements, starting at address BASE, each element
706 occupying SIZE bytes, in ascending order according to the comparison
708 # if @REPLACE_QSORT_R@
709 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
711 # define qsort_r rpl_qsort_r
713 _GL_FUNCDECL_RPL (qsort_r
, void, (void *base
, size_t nmemb
, size_t size
,
714 int (*compare
) (void const *, void const *,
716 void *arg
) _GL_ARG_NONNULL ((1, 4)));
717 _GL_CXXALIAS_RPL (qsort_r
, void, (void *base
, size_t nmemb
, size_t size
,
718 int (*compare
) (void const *, void const *,
723 _GL_FUNCDECL_SYS (qsort_r
, void, (void *base
, size_t nmemb
, size_t size
,
724 int (*compare
) (void const *, void const *,
726 void *arg
) _GL_ARG_NONNULL ((1, 4)));
728 _GL_CXXALIAS_SYS (qsort_r
, void, (void *base
, size_t nmemb
, size_t size
,
729 int (*compare
) (void const *, void const *,
733 _GL_CXXALIASWARN (qsort_r
);
734 #elif defined GNULIB_POSIXCHECK
736 # if HAVE_RAW_DECL_QSORT_R
737 _GL_WARN_ON_USE (qsort_r
, "qsort_r is not portable - "
738 "use gnulib module qsort_r for portability");
743 #if @GNULIB_RANDOM_R@
744 # if !@HAVE_RANDOM_R@
746 # define RAND_MAX 2147483647
753 # if @REPLACE_RANDOM@
754 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
756 # define random rpl_random
758 _GL_FUNCDECL_RPL (random
, long, (void));
759 _GL_CXXALIAS_RPL (random
, long, (void));
762 _GL_FUNCDECL_SYS (random
, long, (void));
764 /* Need to cast, because on Haiku, the return type is
766 _GL_CXXALIAS_SYS_CAST (random
, long, (void));
768 _GL_CXXALIASWARN (random
);
769 #elif defined GNULIB_POSIXCHECK
771 # if HAVE_RAW_DECL_RANDOM
772 _GL_WARN_ON_USE (random
, "random is unportable - "
773 "use gnulib module random for portability");
778 # if @REPLACE_RANDOM@
779 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
781 # define srandom rpl_srandom
783 _GL_FUNCDECL_RPL (srandom
, void, (unsigned int seed
));
784 _GL_CXXALIAS_RPL (srandom
, void, (unsigned int seed
));
787 _GL_FUNCDECL_SYS (srandom
, void, (unsigned int seed
));
789 /* Need to cast, because on FreeBSD, the first parameter is
790 unsigned long seed. */
791 _GL_CXXALIAS_SYS_CAST (srandom
, void, (unsigned int seed
));
793 _GL_CXXALIASWARN (srandom
);
794 #elif defined GNULIB_POSIXCHECK
796 # if HAVE_RAW_DECL_SRANDOM
797 _GL_WARN_ON_USE (srandom
, "srandom is unportable - "
798 "use gnulib module random for portability");
803 # if @REPLACE_INITSTATE@
804 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
806 # define initstate rpl_initstate
808 _GL_FUNCDECL_RPL (initstate
, char *,
809 (unsigned int seed
, char *buf
, size_t buf_size
)
810 _GL_ARG_NONNULL ((2)));
811 _GL_CXXALIAS_RPL (initstate
, char *,
812 (unsigned int seed
, char *buf
, size_t buf_size
));
814 # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
815 _GL_FUNCDECL_SYS (initstate
, char *,
816 (unsigned int seed
, char *buf
, size_t buf_size
)
817 _GL_ARG_NONNULL ((2)));
819 /* Need to cast, because on FreeBSD, the first parameter is
820 unsigned long seed. */
821 _GL_CXXALIAS_SYS_CAST (initstate
, char *,
822 (unsigned int seed
, char *buf
, size_t buf_size
));
824 _GL_CXXALIASWARN (initstate
);
825 #elif defined GNULIB_POSIXCHECK
827 # if HAVE_RAW_DECL_INITSTATE
828 _GL_WARN_ON_USE (initstate
, "initstate is unportable - "
829 "use gnulib module random for portability");
834 # if @REPLACE_SETSTATE@
835 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
837 # define setstate rpl_setstate
839 _GL_FUNCDECL_RPL (setstate
, char *, (char *arg_state
) _GL_ARG_NONNULL ((1)));
840 _GL_CXXALIAS_RPL (setstate
, char *, (char *arg_state
));
842 # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
843 _GL_FUNCDECL_SYS (setstate
, char *, (char *arg_state
) _GL_ARG_NONNULL ((1)));
845 /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
846 is const char *arg_state. */
847 _GL_CXXALIAS_SYS_CAST (setstate
, char *, (char *arg_state
));
849 _GL_CXXALIASWARN (setstate
);
850 #elif defined GNULIB_POSIXCHECK
852 # if HAVE_RAW_DECL_SETSTATE
853 _GL_WARN_ON_USE (setstate
, "setstate is unportable - "
854 "use gnulib module random for portability");
859 #if @GNULIB_RANDOM_R@
860 # if @REPLACE_RANDOM_R@
861 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
863 # define random_r rpl_random_r
865 _GL_FUNCDECL_RPL (random_r
, int, (struct random_data
*buf
, int32_t *result
)
866 _GL_ARG_NONNULL ((1, 2)));
867 _GL_CXXALIAS_RPL (random_r
, int, (struct random_data
*buf
, int32_t *result
));
869 # if !@HAVE_RANDOM_R@
870 _GL_FUNCDECL_SYS (random_r
, int, (struct random_data
*buf
, int32_t *result
)
871 _GL_ARG_NONNULL ((1, 2)));
873 _GL_CXXALIAS_SYS (random_r
, int, (struct random_data
*buf
, int32_t *result
));
875 _GL_CXXALIASWARN (random_r
);
876 #elif defined GNULIB_POSIXCHECK
878 # if HAVE_RAW_DECL_RANDOM_R
879 _GL_WARN_ON_USE (random_r
, "random_r is unportable - "
880 "use gnulib module random_r for portability");
884 #if @GNULIB_RANDOM_R@
885 # if @REPLACE_RANDOM_R@
886 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
888 # define srandom_r rpl_srandom_r
890 _GL_FUNCDECL_RPL (srandom_r
, int,
891 (unsigned int seed
, struct random_data
*rand_state
)
892 _GL_ARG_NONNULL ((2)));
893 _GL_CXXALIAS_RPL (srandom_r
, int,
894 (unsigned int seed
, struct random_data
*rand_state
));
896 # if !@HAVE_RANDOM_R@
897 _GL_FUNCDECL_SYS (srandom_r
, int,
898 (unsigned int seed
, struct random_data
*rand_state
)
899 _GL_ARG_NONNULL ((2)));
901 _GL_CXXALIAS_SYS (srandom_r
, int,
902 (unsigned int seed
, struct random_data
*rand_state
));
904 _GL_CXXALIASWARN (srandom_r
);
905 #elif defined GNULIB_POSIXCHECK
907 # if HAVE_RAW_DECL_SRANDOM_R
908 _GL_WARN_ON_USE (srandom_r
, "srandom_r is unportable - "
909 "use gnulib module random_r for portability");
913 #if @GNULIB_RANDOM_R@
914 # if @REPLACE_RANDOM_R@
915 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
917 # define initstate_r rpl_initstate_r
919 _GL_FUNCDECL_RPL (initstate_r
, int,
920 (unsigned int seed
, char *buf
, size_t buf_size
,
921 struct random_data
*rand_state
)
922 _GL_ARG_NONNULL ((2, 4)));
923 _GL_CXXALIAS_RPL (initstate_r
, int,
924 (unsigned int seed
, char *buf
, size_t buf_size
,
925 struct random_data
*rand_state
));
927 # if !@HAVE_RANDOM_R@
928 _GL_FUNCDECL_SYS (initstate_r
, int,
929 (unsigned int seed
, char *buf
, size_t buf_size
,
930 struct random_data
*rand_state
)
931 _GL_ARG_NONNULL ((2, 4)));
933 /* Need to cast, because on Haiku, the third parameter is
934 unsigned long buf_size. */
935 _GL_CXXALIAS_SYS_CAST (initstate_r
, int,
936 (unsigned int seed
, char *buf
, size_t buf_size
,
937 struct random_data
*rand_state
));
939 _GL_CXXALIASWARN (initstate_r
);
940 #elif defined GNULIB_POSIXCHECK
942 # if HAVE_RAW_DECL_INITSTATE_R
943 _GL_WARN_ON_USE (initstate_r
, "initstate_r is unportable - "
944 "use gnulib module random_r for portability");
948 #if @GNULIB_RANDOM_R@
949 # if @REPLACE_RANDOM_R@
950 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
952 # define setstate_r rpl_setstate_r
954 _GL_FUNCDECL_RPL (setstate_r
, int,
955 (char *arg_state
, struct random_data
*rand_state
)
956 _GL_ARG_NONNULL ((1, 2)));
957 _GL_CXXALIAS_RPL (setstate_r
, int,
958 (char *arg_state
, struct random_data
*rand_state
));
960 # if !@HAVE_RANDOM_R@
961 _GL_FUNCDECL_SYS (setstate_r
, int,
962 (char *arg_state
, struct random_data
*rand_state
)
963 _GL_ARG_NONNULL ((1, 2)));
965 /* Need to cast, because on Haiku, the first parameter is
967 _GL_CXXALIAS_SYS_CAST (setstate_r
, int,
968 (char *arg_state
, struct random_data
*rand_state
));
970 _GL_CXXALIASWARN (setstate_r
);
971 #elif defined GNULIB_POSIXCHECK
973 # if HAVE_RAW_DECL_SETSTATE_R
974 _GL_WARN_ON_USE (setstate_r
, "setstate_r is unportable - "
975 "use gnulib module random_r for portability");
980 #if @GNULIB_REALLOC_POSIX@
981 # if @REPLACE_REALLOC@
982 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
983 || _GL_USE_STDLIB_ALLOC)
985 # define realloc rpl_realloc
987 _GL_FUNCDECL_RPL (realloc
, void *, (void *ptr
, size_t size
));
988 _GL_CXXALIAS_RPL (realloc
, void *, (void *ptr
, size_t size
));
990 _GL_CXXALIAS_SYS (realloc
, void *, (void *ptr
, size_t size
));
993 _GL_CXXALIASWARN (realloc
);
995 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
997 /* Assume realloc is always declared. */
998 _GL_WARN_ON_USE (realloc
, "realloc is not POSIX compliant everywhere - "
999 "use gnulib module realloc-posix for portability");
1003 #if @GNULIB_REALLOCARRAY@
1004 # if ! @HAVE_REALLOCARRAY@
1005 _GL_FUNCDECL_SYS (reallocarray
, void *,
1006 (void *ptr
, size_t nmemb
, size_t size
));
1008 _GL_CXXALIAS_SYS (reallocarray
, void *,
1009 (void *ptr
, size_t nmemb
, size_t size
));
1010 _GL_CXXALIASWARN (reallocarray
);
1011 #elif defined GNULIB_POSIXCHECK
1012 # undef reallocarray
1013 # if HAVE_RAW_DECL_REALLOCARRAY
1014 _GL_WARN_ON_USE (reallocarray
, "reallocarray is not portable - "
1015 "use gnulib module reallocarray for portability");
1019 #if @GNULIB_REALPATH@
1020 # if @REPLACE_REALPATH@
1021 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1022 # define realpath rpl_realpath
1024 _GL_FUNCDECL_RPL (realpath
, char *,
1025 (const char *restrict name
, char *restrict resolved
)
1026 _GL_ARG_NONNULL ((1)));
1027 _GL_CXXALIAS_RPL (realpath
, char *,
1028 (const char *restrict name
, char *restrict resolved
));
1030 # if !@HAVE_REALPATH@
1031 _GL_FUNCDECL_SYS (realpath
, char *,
1032 (const char *restrict name
, char *restrict resolved
)
1033 _GL_ARG_NONNULL ((1)));
1035 _GL_CXXALIAS_SYS (realpath
, char *,
1036 (const char *restrict name
, char *restrict resolved
));
1038 _GL_CXXALIASWARN (realpath
);
1039 #elif defined GNULIB_POSIXCHECK
1041 # if HAVE_RAW_DECL_REALPATH
1042 _GL_WARN_ON_USE (realpath
, "realpath is unportable - use gnulib module "
1043 "canonicalize or canonicalize-lgpl for portability");
1047 #if @GNULIB_RPMATCH@
1048 /* Test a user response to a question.
1049 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
1050 # if !@HAVE_RPMATCH@
1051 _GL_FUNCDECL_SYS (rpmatch
, int, (const char *response
) _GL_ARG_NONNULL ((1)));
1053 _GL_CXXALIAS_SYS (rpmatch
, int, (const char *response
));
1054 _GL_CXXALIASWARN (rpmatch
);
1055 #elif defined GNULIB_POSIXCHECK
1057 # if HAVE_RAW_DECL_RPMATCH
1058 _GL_WARN_ON_USE (rpmatch
, "rpmatch is unportable - "
1059 "use gnulib module rpmatch for portability");
1063 #if @GNULIB_SECURE_GETENV@
1064 /* Look up NAME in the environment, returning 0 in insecure situations. */
1065 # if !@HAVE_SECURE_GETENV@
1066 _GL_FUNCDECL_SYS (secure_getenv
, char *,
1067 (char const *name
) _GL_ARG_NONNULL ((1)));
1069 _GL_CXXALIAS_SYS (secure_getenv
, char *, (char const *name
));
1070 _GL_CXXALIASWARN (secure_getenv
);
1071 #elif defined GNULIB_POSIXCHECK
1072 # undef secure_getenv
1073 # if HAVE_RAW_DECL_SECURE_GETENV
1074 _GL_WARN_ON_USE (secure_getenv
, "secure_getenv is unportable - "
1075 "use gnulib module secure_getenv for portability");
1080 /* Set NAME to VALUE in the environment.
1081 If REPLACE is nonzero, overwrite an existing value. */
1082 # if @REPLACE_SETENV@
1083 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1085 # define setenv rpl_setenv
1087 _GL_FUNCDECL_RPL (setenv
, int,
1088 (const char *name
, const char *value
, int replace
)
1089 _GL_ARG_NONNULL ((1)));
1090 _GL_CXXALIAS_RPL (setenv
, int,
1091 (const char *name
, const char *value
, int replace
));
1093 # if !@HAVE_DECL_SETENV@
1094 _GL_FUNCDECL_SYS (setenv
, int,
1095 (const char *name
, const char *value
, int replace
)
1096 _GL_ARG_NONNULL ((1)));
1098 _GL_CXXALIAS_SYS (setenv
, int,
1099 (const char *name
, const char *value
, int replace
));
1101 # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
1102 _GL_CXXALIASWARN (setenv
);
1104 #elif defined GNULIB_POSIXCHECK
1106 # if HAVE_RAW_DECL_SETENV
1107 _GL_WARN_ON_USE (setenv
, "setenv is unportable - "
1108 "use gnulib module setenv for portability");
1113 /* Parse a double from STRING, updating ENDP if appropriate. */
1114 # if @REPLACE_STRTOD@
1115 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1116 # define strtod rpl_strtod
1118 # define GNULIB_defined_strtod_function 1
1119 _GL_FUNCDECL_RPL (strtod
, double,
1120 (const char *restrict str
, char **restrict endp
)
1121 _GL_ARG_NONNULL ((1)));
1122 _GL_CXXALIAS_RPL (strtod
, double,
1123 (const char *restrict str
, char **restrict endp
));
1126 _GL_FUNCDECL_SYS (strtod
, double,
1127 (const char *restrict str
, char **restrict endp
)
1128 _GL_ARG_NONNULL ((1)));
1130 _GL_CXXALIAS_SYS (strtod
, double,
1131 (const char *restrict str
, char **restrict endp
));
1134 _GL_CXXALIASWARN (strtod
);
1136 #elif defined GNULIB_POSIXCHECK
1138 # if HAVE_RAW_DECL_STRTOD
1139 _GL_WARN_ON_USE (strtod
, "strtod is unportable - "
1140 "use gnulib module strtod for portability");
1144 #if @GNULIB_STRTOLD@
1145 /* Parse a 'long double' from STRING, updating ENDP if appropriate. */
1146 # if @REPLACE_STRTOLD@
1147 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1148 # define strtold rpl_strtold
1150 # define GNULIB_defined_strtold_function 1
1151 _GL_FUNCDECL_RPL (strtold
, long double,
1152 (const char *restrict str
, char **restrict endp
)
1153 _GL_ARG_NONNULL ((1)));
1154 _GL_CXXALIAS_RPL (strtold
, long double,
1155 (const char *restrict str
, char **restrict endp
));
1157 # if !@HAVE_STRTOLD@
1158 _GL_FUNCDECL_SYS (strtold
, long double,
1159 (const char *restrict str
, char **restrict endp
)
1160 _GL_ARG_NONNULL ((1)));
1162 _GL_CXXALIAS_SYS (strtold
, long double,
1163 (const char *restrict str
, char **restrict endp
));
1165 _GL_CXXALIASWARN (strtold
);
1166 #elif defined GNULIB_POSIXCHECK
1168 # if HAVE_RAW_DECL_STRTOLD
1169 _GL_WARN_ON_USE (strtold
, "strtold is unportable - "
1170 "use gnulib module strtold for portability");
1174 #if @GNULIB_STRTOLL@
1175 /* Parse a signed integer whose textual representation starts at STRING.
1176 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1177 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1179 If ENDPTR is not NULL, the address of the first byte after the integer is
1181 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
1183 # if !@HAVE_STRTOLL@
1184 _GL_FUNCDECL_SYS (strtoll
, long long,
1185 (const char *restrict string
, char **restrict endptr
,
1187 _GL_ARG_NONNULL ((1)));
1189 _GL_CXXALIAS_SYS (strtoll
, long long,
1190 (const char *restrict string
, char **restrict endptr
,
1192 _GL_CXXALIASWARN (strtoll
);
1193 #elif defined GNULIB_POSIXCHECK
1195 # if HAVE_RAW_DECL_STRTOLL
1196 _GL_WARN_ON_USE (strtoll
, "strtoll is unportable - "
1197 "use gnulib module strtoll for portability");
1201 #if @GNULIB_STRTOULL@
1202 /* Parse an unsigned integer whose textual representation starts at STRING.
1203 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1204 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1206 If ENDPTR is not NULL, the address of the first byte after the integer is
1208 Upon overflow, the return value is ULLONG_MAX, and errno is set to
1210 # if !@HAVE_STRTOULL@
1211 _GL_FUNCDECL_SYS (strtoull
, unsigned long long,
1212 (const char *restrict string
, char **restrict endptr
,
1214 _GL_ARG_NONNULL ((1)));
1216 _GL_CXXALIAS_SYS (strtoull
, unsigned long long,
1217 (const char *restrict string
, char **restrict endptr
,
1219 _GL_CXXALIASWARN (strtoull
);
1220 #elif defined GNULIB_POSIXCHECK
1222 # if HAVE_RAW_DECL_STRTOULL
1223 _GL_WARN_ON_USE (strtoull
, "strtoull is unportable - "
1224 "use gnulib module strtoull for portability");
1228 #if @GNULIB_UNLOCKPT@
1229 /* Unlock the slave side of the pseudo-terminal whose master side is specified
1230 by FD, so that it can be opened. */
1231 # if !@HAVE_UNLOCKPT@
1232 _GL_FUNCDECL_SYS (unlockpt
, int, (int fd
));
1234 _GL_CXXALIAS_SYS (unlockpt
, int, (int fd
));
1235 _GL_CXXALIASWARN (unlockpt
);
1236 #elif defined GNULIB_POSIXCHECK
1238 # if HAVE_RAW_DECL_UNLOCKPT
1239 _GL_WARN_ON_USE (unlockpt
, "unlockpt is not portable - "
1240 "use gnulib module unlockpt for portability");
1244 #if @GNULIB_UNSETENV@
1245 /* Remove the variable NAME from the environment. */
1246 # if @REPLACE_UNSETENV@
1247 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1249 # define unsetenv rpl_unsetenv
1251 _GL_FUNCDECL_RPL (unsetenv
, int, (const char *name
) _GL_ARG_NONNULL ((1)));
1252 _GL_CXXALIAS_RPL (unsetenv
, int, (const char *name
));
1254 # if !@HAVE_DECL_UNSETENV@
1255 _GL_FUNCDECL_SYS (unsetenv
, int, (const char *name
) _GL_ARG_NONNULL ((1)));
1257 _GL_CXXALIAS_SYS (unsetenv
, int, (const char *name
));
1259 # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
1260 _GL_CXXALIASWARN (unsetenv
);
1262 #elif defined GNULIB_POSIXCHECK
1264 # if HAVE_RAW_DECL_UNSETENV
1265 _GL_WARN_ON_USE (unsetenv
, "unsetenv is unportable - "
1266 "use gnulib module unsetenv for portability");
1270 /* Convert a wide character to a multibyte character. */
1272 # if @REPLACE_WCTOMB@
1273 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1275 # define wctomb rpl_wctomb
1277 _GL_FUNCDECL_RPL (wctomb
, int, (char *s
, wchar_t wc
));
1278 _GL_CXXALIAS_RPL (wctomb
, int, (char *s
, wchar_t wc
));
1280 _GL_CXXALIAS_SYS (wctomb
, int, (char *s
, wchar_t wc
));
1283 _GL_CXXALIASWARN (wctomb
);
1288 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1289 #endif /* _@GUARD_PREFIX@_STDLIB_H */