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 #if @GNULIB_MDA_ECVT@
246 /* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not
247 required. In C++ with GNULIB_NAMESPACE, avoid differences between
248 platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have
250 # if defined _WIN32 && !defined __CYGWIN__
251 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
255 _GL_CXXALIAS_MDA (ecvt
, char *,
256 (double number
, int ndigits
, int *decptp
, int *signp
));
258 # if @HAVE_DECL_ECVT@
259 _GL_CXXALIAS_SYS (ecvt
, char *,
260 (double number
, int ndigits
, int *decptp
, int *signp
));
263 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@
264 _GL_CXXALIASWARN (ecvt
);
268 #if @GNULIB_MDA_FCVT@
269 /* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not
270 required. In C++ with GNULIB_NAMESPACE, avoid differences between
271 platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have
273 # if defined _WIN32 && !defined __CYGWIN__
274 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
278 _GL_CXXALIAS_MDA (fcvt
, char *,
279 (double number
, int ndigits
, int *decptp
, int *signp
));
281 # if @HAVE_DECL_FCVT@
282 _GL_CXXALIAS_SYS (fcvt
, char *,
283 (double number
, int ndigits
, int *decptp
, int *signp
));
286 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@
287 _GL_CXXALIASWARN (fcvt
);
291 #if @GNULIB_FREE_POSIX@
293 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
295 # define free rpl_free
297 _GL_FUNCDECL_RPL (free
, void, (void *ptr
));
298 _GL_CXXALIAS_RPL (free
, void, (void *ptr
));
300 _GL_CXXALIAS_SYS (free
, void, (void *ptr
));
303 _GL_CXXALIASWARN (free
);
305 #elif defined GNULIB_POSIXCHECK
307 /* Assume free is always declared. */
308 _GL_WARN_ON_USE (free
, "free is not future POSIX compliant everywhere - "
309 "use gnulib module free for portability");
312 #if @GNULIB_MDA_GCVT@
313 /* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not
314 required. In C++ with GNULIB_NAMESPACE, avoid differences between
315 platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have
317 # if defined _WIN32 && !defined __CYGWIN__
318 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
322 _GL_CXXALIAS_MDA (gcvt
, char *, (double number
, int ndigits
, char *buf
));
324 # if @HAVE_DECL_GCVT@
325 _GL_CXXALIAS_SYS (gcvt
, char *, (double number
, int ndigits
, char *buf
));
328 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@
329 _GL_CXXALIASWARN (gcvt
);
333 #if @GNULIB_GETLOADAVG@
334 /* Store max(NELEM,3) load average numbers in LOADAVG[].
335 The three numbers are the load average of the last 1 minute, the last 5
336 minutes, and the last 15 minutes, respectively.
337 LOADAVG is an array of NELEM numbers. */
338 # if !@HAVE_DECL_GETLOADAVG@
339 _GL_FUNCDECL_SYS (getloadavg
, int, (double loadavg
[], int nelem
)
340 _GL_ARG_NONNULL ((1)));
342 _GL_CXXALIAS_SYS (getloadavg
, int, (double loadavg
[], int nelem
));
343 _GL_CXXALIASWARN (getloadavg
);
344 #elif defined GNULIB_POSIXCHECK
346 # if HAVE_RAW_DECL_GETLOADAVG
347 _GL_WARN_ON_USE (getloadavg
, "getloadavg is not portable - "
348 "use gnulib module getloadavg for portability");
352 #if @GNULIB_GETSUBOPT@
353 /* Assuming *OPTIONP is a comma separated list of elements of the form
354 "token" or "token=value", getsubopt parses the first of these elements.
355 If the first element refers to a "token" that is member of the given
356 NULL-terminated array of tokens:
357 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
358 the first option and the comma, sets *VALUEP to the value of the
359 element (or NULL if it doesn't contain an "=" sign),
360 - It returns the index of the "token" in the given array of tokens.
361 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
362 For more details see the POSIX specification.
363 https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */
364 # if !@HAVE_GETSUBOPT@
365 _GL_FUNCDECL_SYS (getsubopt
, int,
366 (char **optionp
, char *const *tokens
, char **valuep
)
367 _GL_ARG_NONNULL ((1, 2, 3)));
369 _GL_CXXALIAS_SYS (getsubopt
, int,
370 (char **optionp
, char *const *tokens
, char **valuep
));
371 _GL_CXXALIASWARN (getsubopt
);
372 #elif defined GNULIB_POSIXCHECK
374 # if HAVE_RAW_DECL_GETSUBOPT
375 _GL_WARN_ON_USE (getsubopt
, "getsubopt is unportable - "
376 "use gnulib module getsubopt for portability");
381 /* Change the ownership and access permission of the slave side of the
382 pseudo-terminal whose master side is specified by FD. */
384 _GL_FUNCDECL_SYS (grantpt
, int, (int fd
));
386 _GL_CXXALIAS_SYS (grantpt
, int, (int fd
));
387 _GL_CXXALIASWARN (grantpt
);
388 #elif defined GNULIB_POSIXCHECK
390 # if HAVE_RAW_DECL_GRANTPT
391 _GL_WARN_ON_USE (grantpt
, "grantpt is not portable - "
392 "use gnulib module grantpt for portability");
396 /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
397 rely on GNU or POSIX semantics for malloc and realloc (for example,
398 by never specifying a zero size), so it does not need malloc or
399 realloc to be redefined. */
400 #if @GNULIB_MALLOC_POSIX@
401 # if @REPLACE_MALLOC@
402 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
403 || _GL_USE_STDLIB_ALLOC)
405 # define malloc rpl_malloc
407 _GL_FUNCDECL_RPL (malloc
, void *, (size_t size
));
408 _GL_CXXALIAS_RPL (malloc
, void *, (size_t size
));
410 _GL_CXXALIAS_SYS (malloc
, void *, (size_t size
));
413 _GL_CXXALIASWARN (malloc
);
415 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
417 /* Assume malloc is always declared. */
418 _GL_WARN_ON_USE (malloc
, "malloc is not POSIX compliant everywhere - "
419 "use gnulib module malloc-posix for portability");
422 /* Convert a multibyte character to a wide character. */
424 # if @REPLACE_MBTOWC@
425 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
427 # define mbtowc rpl_mbtowc
429 _GL_FUNCDECL_RPL (mbtowc
, int,
430 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
));
431 _GL_CXXALIAS_RPL (mbtowc
, int,
432 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
));
435 _GL_FUNCDECL_SYS (mbtowc
, int,
436 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
));
438 _GL_CXXALIAS_SYS (mbtowc
, int,
439 (wchar_t *restrict pwc
, const char *restrict s
, size_t n
));
442 _GL_CXXALIASWARN (mbtowc
);
444 #elif defined GNULIB_POSIXCHECK
446 # if HAVE_RAW_DECL_MBTOWC
447 _GL_WARN_ON_USE (mbtowc
, "mbtowc is not portable - "
448 "use gnulib module mbtowc for portability");
453 /* Create a unique temporary directory from TEMPLATE.
454 The last six characters of TEMPLATE must be "XXXXXX";
455 they are replaced with a string that makes the directory name unique.
456 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
457 The directory is created mode 700. */
459 _GL_FUNCDECL_SYS (mkdtemp
, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
461 _GL_CXXALIAS_SYS (mkdtemp
, char *, (char * /*template*/));
462 _GL_CXXALIASWARN (mkdtemp
);
463 #elif defined GNULIB_POSIXCHECK
465 # if HAVE_RAW_DECL_MKDTEMP
466 _GL_WARN_ON_USE (mkdtemp
, "mkdtemp is unportable - "
467 "use gnulib module mkdtemp for portability");
471 #if @GNULIB_MKOSTEMP@
472 /* Create a unique temporary file from TEMPLATE.
473 The last six characters of TEMPLATE must be "XXXXXX";
474 they are replaced with a string that makes the file name unique.
475 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
476 and O_TEXT, O_BINARY (defined in "binary-io.h").
477 The file is then created, with the specified flags, ensuring it didn't exist
479 The file is created read-write (mask at least 0600 & ~umask), but it may be
480 world-readable and world-writable (mask 0666 & ~umask), depending on the
482 Returns the open file descriptor if successful, otherwise -1 and errno
484 # if !@HAVE_MKOSTEMP@
485 _GL_FUNCDECL_SYS (mkostemp
, int, (char * /*template*/, int /*flags*/)
486 _GL_ARG_NONNULL ((1)));
488 _GL_CXXALIAS_SYS (mkostemp
, int, (char * /*template*/, int /*flags*/));
489 _GL_CXXALIASWARN (mkostemp
);
490 #elif defined GNULIB_POSIXCHECK
492 # if HAVE_RAW_DECL_MKOSTEMP
493 _GL_WARN_ON_USE (mkostemp
, "mkostemp is unportable - "
494 "use gnulib module mkostemp for portability");
498 #if @GNULIB_MKOSTEMPS@
499 /* Create a unique temporary file from TEMPLATE.
500 The last six characters of TEMPLATE before a suffix of length
501 SUFFIXLEN must be "XXXXXX";
502 they are replaced with a string that makes the file name unique.
503 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
504 and O_TEXT, O_BINARY (defined in "binary-io.h").
505 The file is then created, with the specified flags, ensuring it didn't exist
507 The file is created read-write (mask at least 0600 & ~umask), but it may be
508 world-readable and world-writable (mask 0666 & ~umask), depending on the
510 Returns the open file descriptor if successful, otherwise -1 and errno
512 # if !@HAVE_MKOSTEMPS@
513 _GL_FUNCDECL_SYS (mkostemps
, int,
514 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
515 _GL_ARG_NONNULL ((1)));
517 _GL_CXXALIAS_SYS (mkostemps
, int,
518 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
519 _GL_CXXALIASWARN (mkostemps
);
520 #elif defined GNULIB_POSIXCHECK
522 # if HAVE_RAW_DECL_MKOSTEMPS
523 _GL_WARN_ON_USE (mkostemps
, "mkostemps is unportable - "
524 "use gnulib module mkostemps for portability");
529 /* Create a unique temporary file from TEMPLATE.
530 The last six characters of TEMPLATE must be "XXXXXX";
531 they are replaced with a string that makes the file name unique.
532 The file is then created, ensuring it didn't exist before.
533 The file is created read-write (mask at least 0600 & ~umask), but it may be
534 world-readable and world-writable (mask 0666 & ~umask), depending on the
536 Returns the open file descriptor if successful, otherwise -1 and errno
538 # if @REPLACE_MKSTEMP@
539 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
540 # define mkstemp rpl_mkstemp
542 _GL_FUNCDECL_RPL (mkstemp
, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
543 _GL_CXXALIAS_RPL (mkstemp
, int, (char * /*template*/));
545 # if ! @HAVE_MKSTEMP@
546 _GL_FUNCDECL_SYS (mkstemp
, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
548 _GL_CXXALIAS_SYS (mkstemp
, int, (char * /*template*/));
550 _GL_CXXALIASWARN (mkstemp
);
551 #elif defined GNULIB_POSIXCHECK
553 # if HAVE_RAW_DECL_MKSTEMP
554 _GL_WARN_ON_USE (mkstemp
, "mkstemp is unportable - "
555 "use gnulib module mkstemp for portability");
559 #if @GNULIB_MKSTEMPS@
560 /* Create a unique temporary file from TEMPLATE.
561 The last six characters of TEMPLATE prior to a suffix of length
562 SUFFIXLEN must be "XXXXXX";
563 they are replaced with a string that makes the file name unique.
564 The file is then created, ensuring it didn't exist before.
565 The file is created read-write (mask at least 0600 & ~umask), but it may be
566 world-readable and world-writable (mask 0666 & ~umask), depending on the
568 Returns the open file descriptor if successful, otherwise -1 and errno
570 # if !@HAVE_MKSTEMPS@
571 _GL_FUNCDECL_SYS (mkstemps
, int, (char * /*template*/, int /*suffixlen*/)
572 _GL_ARG_NONNULL ((1)));
574 _GL_CXXALIAS_SYS (mkstemps
, int, (char * /*template*/, int /*suffixlen*/));
575 _GL_CXXALIASWARN (mkstemps
);
576 #elif defined GNULIB_POSIXCHECK
578 # if HAVE_RAW_DECL_MKSTEMPS
579 _GL_WARN_ON_USE (mkstemps
, "mkstemps is unportable - "
580 "use gnulib module mkstemps for portability");
584 #if @GNULIB_MDA_MKTEMP@
585 /* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not
586 required. In C++ with GNULIB_NAMESPACE, avoid differences between
587 platforms by defining GNULIB_NAMESPACE::mktemp always. */
588 # if defined _WIN32 && !defined __CYGWIN__
589 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
591 # define mktemp _mktemp
593 _GL_CXXALIAS_MDA (mktemp
, char *, (char * /*template*/));
595 _GL_CXXALIAS_SYS (mktemp
, char *, (char * /*template*/));
597 _GL_CXXALIASWARN (mktemp
);
600 /* Allocate memory with indefinite extent and specified alignment. */
601 #if @GNULIB_POSIX_MEMALIGN@
602 # if @REPLACE_POSIX_MEMALIGN@
603 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
604 # undef posix_memalign
605 # define posix_memalign rpl_posix_memalign
607 _GL_FUNCDECL_RPL (posix_memalign
, int,
608 (void **memptr
, size_t alignment
, size_t size
)
609 _GL_ARG_NONNULL ((1)));
610 _GL_CXXALIAS_RPL (posix_memalign
, int,
611 (void **memptr
, size_t alignment
, size_t size
));
613 # if @HAVE_POSIX_MEMALIGN@
614 _GL_CXXALIAS_SYS (posix_memalign
, int,
615 (void **memptr
, size_t alignment
, size_t size
));
618 # if @HAVE_POSIX_MEMALIGN@
619 _GL_CXXALIASWARN (posix_memalign
);
621 #elif defined GNULIB_POSIXCHECK
622 # undef posix_memalign
623 # if HAVE_RAW_DECL_POSIX_MEMALIGN
624 _GL_WARN_ON_USE (posix_memalign
, "posix_memalign is not portable - "
625 "use gnulib module posix_memalign for portability");
629 #if @GNULIB_POSIX_OPENPT@
630 /* Return an FD open to the master side of a pseudo-terminal. Flags should
631 include O_RDWR, and may also include O_NOCTTY. */
632 # if !@HAVE_POSIX_OPENPT@
633 _GL_FUNCDECL_SYS (posix_openpt
, int, (int flags
));
635 _GL_CXXALIAS_SYS (posix_openpt
, int, (int flags
));
636 _GL_CXXALIASWARN (posix_openpt
);
637 #elif defined GNULIB_POSIXCHECK
639 # if HAVE_RAW_DECL_POSIX_OPENPT
640 _GL_WARN_ON_USE (posix_openpt
, "posix_openpt is not portable - "
641 "use gnulib module posix_openpt for portability");
646 /* Return the pathname of the pseudo-terminal slave associated with
647 the master FD is open on, or NULL on errors. */
648 # if @REPLACE_PTSNAME@
649 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
651 # define ptsname rpl_ptsname
653 _GL_FUNCDECL_RPL (ptsname
, char *, (int fd
));
654 _GL_CXXALIAS_RPL (ptsname
, char *, (int fd
));
657 _GL_FUNCDECL_SYS (ptsname
, char *, (int fd
));
659 _GL_CXXALIAS_SYS (ptsname
, char *, (int fd
));
661 _GL_CXXALIASWARN (ptsname
);
662 #elif defined GNULIB_POSIXCHECK
664 # if HAVE_RAW_DECL_PTSNAME
665 _GL_WARN_ON_USE (ptsname
, "ptsname is not portable - "
666 "use gnulib module ptsname for portability");
670 #if @GNULIB_PTSNAME_R@
671 /* Set the pathname of the pseudo-terminal slave associated with
672 the master FD is open on and return 0, or set errno and return
673 non-zero on errors. */
674 # if @REPLACE_PTSNAME_R@
675 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
677 # define ptsname_r rpl_ptsname_r
679 _GL_FUNCDECL_RPL (ptsname_r
, int, (int fd
, char *buf
, size_t len
));
680 _GL_CXXALIAS_RPL (ptsname_r
, int, (int fd
, char *buf
, size_t len
));
682 # if !@HAVE_PTSNAME_R@
683 _GL_FUNCDECL_SYS (ptsname_r
, int, (int fd
, char *buf
, size_t len
));
685 _GL_CXXALIAS_SYS (ptsname_r
, int, (int fd
, char *buf
, size_t len
));
687 # ifndef GNULIB_defined_ptsname_r
688 # define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@)
690 _GL_CXXALIASWARN (ptsname_r
);
691 #elif defined GNULIB_POSIXCHECK
693 # if HAVE_RAW_DECL_PTSNAME_R
694 _GL_WARN_ON_USE (ptsname_r
, "ptsname_r is not portable - "
695 "use gnulib module ptsname_r for portability");
700 # if @REPLACE_PUTENV@
701 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
703 # define putenv rpl_putenv
705 _GL_FUNCDECL_RPL (putenv
, int, (char *string
) _GL_ARG_NONNULL ((1)));
706 _GL_CXXALIAS_RPL (putenv
, int, (char *string
));
707 # elif defined _WIN32 && !defined __CYGWIN__
708 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
710 # define putenv _putenv
712 _GL_CXXALIAS_MDA (putenv
, int, (char *string
));
714 _GL_CXXALIAS_SYS (putenv
, int, (char *string
));
716 _GL_CXXALIASWARN (putenv
);
717 #elif @GNULIB_MDA_PUTENV@
718 /* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not
719 required. In C++ with GNULIB_NAMESPACE, avoid differences between
720 platforms by defining GNULIB_NAMESPACE::putenv always. */
721 # if defined _WIN32 && !defined __CYGWIN__
722 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
724 # define putenv _putenv
726 /* Need to cast, because on mingw, the parameter is either
727 'const char *string' or 'char *string'. */
728 _GL_CXXALIAS_MDA_CAST (putenv
, int, (char *string
));
730 _GL_CXXALIAS_SYS (putenv
, int, (char *string
));
732 _GL_CXXALIASWARN (putenv
);
736 /* Sort an array of NMEMB elements, starting at address BASE, each element
737 occupying SIZE bytes, in ascending order according to the comparison
739 # if @REPLACE_QSORT_R@
740 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
742 # define qsort_r rpl_qsort_r
744 _GL_FUNCDECL_RPL (qsort_r
, void, (void *base
, size_t nmemb
, size_t size
,
745 int (*compare
) (void const *, void const *,
747 void *arg
) _GL_ARG_NONNULL ((1, 4)));
748 _GL_CXXALIAS_RPL (qsort_r
, void, (void *base
, size_t nmemb
, size_t size
,
749 int (*compare
) (void const *, void const *,
754 _GL_FUNCDECL_SYS (qsort_r
, void, (void *base
, size_t nmemb
, size_t size
,
755 int (*compare
) (void const *, void const *,
757 void *arg
) _GL_ARG_NONNULL ((1, 4)));
759 _GL_CXXALIAS_SYS (qsort_r
, void, (void *base
, size_t nmemb
, size_t size
,
760 int (*compare
) (void const *, void const *,
764 _GL_CXXALIASWARN (qsort_r
);
765 #elif defined GNULIB_POSIXCHECK
767 # if HAVE_RAW_DECL_QSORT_R
768 _GL_WARN_ON_USE (qsort_r
, "qsort_r is not portable - "
769 "use gnulib module qsort_r for portability");
774 #if @GNULIB_RANDOM_R@
775 # if !@HAVE_RANDOM_R@
777 # define RAND_MAX 2147483647
784 # if @REPLACE_RANDOM@
785 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
787 # define random rpl_random
789 _GL_FUNCDECL_RPL (random
, long, (void));
790 _GL_CXXALIAS_RPL (random
, long, (void));
793 _GL_FUNCDECL_SYS (random
, long, (void));
795 /* Need to cast, because on Haiku, the return type is
797 _GL_CXXALIAS_SYS_CAST (random
, long, (void));
799 _GL_CXXALIASWARN (random
);
800 #elif defined GNULIB_POSIXCHECK
802 # if HAVE_RAW_DECL_RANDOM
803 _GL_WARN_ON_USE (random
, "random is unportable - "
804 "use gnulib module random for portability");
809 # if @REPLACE_RANDOM@
810 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
812 # define srandom rpl_srandom
814 _GL_FUNCDECL_RPL (srandom
, void, (unsigned int seed
));
815 _GL_CXXALIAS_RPL (srandom
, void, (unsigned int seed
));
818 _GL_FUNCDECL_SYS (srandom
, void, (unsigned int seed
));
820 /* Need to cast, because on FreeBSD, the first parameter is
821 unsigned long seed. */
822 _GL_CXXALIAS_SYS_CAST (srandom
, void, (unsigned int seed
));
824 _GL_CXXALIASWARN (srandom
);
825 #elif defined GNULIB_POSIXCHECK
827 # if HAVE_RAW_DECL_SRANDOM
828 _GL_WARN_ON_USE (srandom
, "srandom is unportable - "
829 "use gnulib module random for portability");
834 # if @REPLACE_INITSTATE@
835 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
837 # define initstate rpl_initstate
839 _GL_FUNCDECL_RPL (initstate
, char *,
840 (unsigned int seed
, char *buf
, size_t buf_size
)
841 _GL_ARG_NONNULL ((2)));
842 _GL_CXXALIAS_RPL (initstate
, char *,
843 (unsigned int seed
, char *buf
, size_t buf_size
));
845 # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
846 _GL_FUNCDECL_SYS (initstate
, char *,
847 (unsigned int seed
, char *buf
, size_t buf_size
)
848 _GL_ARG_NONNULL ((2)));
850 /* Need to cast, because on FreeBSD, the first parameter is
851 unsigned long seed. */
852 _GL_CXXALIAS_SYS_CAST (initstate
, char *,
853 (unsigned int seed
, char *buf
, size_t buf_size
));
855 _GL_CXXALIASWARN (initstate
);
856 #elif defined GNULIB_POSIXCHECK
858 # if HAVE_RAW_DECL_INITSTATE
859 _GL_WARN_ON_USE (initstate
, "initstate is unportable - "
860 "use gnulib module random for portability");
865 # if @REPLACE_SETSTATE@
866 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
868 # define setstate rpl_setstate
870 _GL_FUNCDECL_RPL (setstate
, char *, (char *arg_state
) _GL_ARG_NONNULL ((1)));
871 _GL_CXXALIAS_RPL (setstate
, char *, (char *arg_state
));
873 # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
874 _GL_FUNCDECL_SYS (setstate
, char *, (char *arg_state
) _GL_ARG_NONNULL ((1)));
876 /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
877 is const char *arg_state. */
878 _GL_CXXALIAS_SYS_CAST (setstate
, char *, (char *arg_state
));
880 _GL_CXXALIASWARN (setstate
);
881 #elif defined GNULIB_POSIXCHECK
883 # if HAVE_RAW_DECL_SETSTATE
884 _GL_WARN_ON_USE (setstate
, "setstate is unportable - "
885 "use gnulib module random for portability");
890 #if @GNULIB_RANDOM_R@
891 # if @REPLACE_RANDOM_R@
892 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
894 # define random_r rpl_random_r
896 _GL_FUNCDECL_RPL (random_r
, int, (struct random_data
*buf
, int32_t *result
)
897 _GL_ARG_NONNULL ((1, 2)));
898 _GL_CXXALIAS_RPL (random_r
, int, (struct random_data
*buf
, int32_t *result
));
900 # if !@HAVE_RANDOM_R@
901 _GL_FUNCDECL_SYS (random_r
, int, (struct random_data
*buf
, int32_t *result
)
902 _GL_ARG_NONNULL ((1, 2)));
904 _GL_CXXALIAS_SYS (random_r
, int, (struct random_data
*buf
, int32_t *result
));
906 _GL_CXXALIASWARN (random_r
);
907 #elif defined GNULIB_POSIXCHECK
909 # if HAVE_RAW_DECL_RANDOM_R
910 _GL_WARN_ON_USE (random_r
, "random_r is unportable - "
911 "use gnulib module random_r for portability");
915 #if @GNULIB_RANDOM_R@
916 # if @REPLACE_RANDOM_R@
917 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
919 # define srandom_r rpl_srandom_r
921 _GL_FUNCDECL_RPL (srandom_r
, int,
922 (unsigned int seed
, struct random_data
*rand_state
)
923 _GL_ARG_NONNULL ((2)));
924 _GL_CXXALIAS_RPL (srandom_r
, int,
925 (unsigned int seed
, struct random_data
*rand_state
));
927 # if !@HAVE_RANDOM_R@
928 _GL_FUNCDECL_SYS (srandom_r
, int,
929 (unsigned int seed
, struct random_data
*rand_state
)
930 _GL_ARG_NONNULL ((2)));
932 _GL_CXXALIAS_SYS (srandom_r
, int,
933 (unsigned int seed
, struct random_data
*rand_state
));
935 _GL_CXXALIASWARN (srandom_r
);
936 #elif defined GNULIB_POSIXCHECK
938 # if HAVE_RAW_DECL_SRANDOM_R
939 _GL_WARN_ON_USE (srandom_r
, "srandom_r is unportable - "
940 "use gnulib module random_r for portability");
944 #if @GNULIB_RANDOM_R@
945 # if @REPLACE_RANDOM_R@
946 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
948 # define initstate_r rpl_initstate_r
950 _GL_FUNCDECL_RPL (initstate_r
, int,
951 (unsigned int seed
, char *buf
, size_t buf_size
,
952 struct random_data
*rand_state
)
953 _GL_ARG_NONNULL ((2, 4)));
954 _GL_CXXALIAS_RPL (initstate_r
, int,
955 (unsigned int seed
, char *buf
, size_t buf_size
,
956 struct random_data
*rand_state
));
958 # if !@HAVE_RANDOM_R@
959 _GL_FUNCDECL_SYS (initstate_r
, int,
960 (unsigned int seed
, char *buf
, size_t buf_size
,
961 struct random_data
*rand_state
)
962 _GL_ARG_NONNULL ((2, 4)));
964 /* Need to cast, because on Haiku, the third parameter is
965 unsigned long buf_size. */
966 _GL_CXXALIAS_SYS_CAST (initstate_r
, int,
967 (unsigned int seed
, char *buf
, size_t buf_size
,
968 struct random_data
*rand_state
));
970 _GL_CXXALIASWARN (initstate_r
);
971 #elif defined GNULIB_POSIXCHECK
973 # if HAVE_RAW_DECL_INITSTATE_R
974 _GL_WARN_ON_USE (initstate_r
, "initstate_r is unportable - "
975 "use gnulib module random_r for portability");
979 #if @GNULIB_RANDOM_R@
980 # if @REPLACE_RANDOM_R@
981 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
983 # define setstate_r rpl_setstate_r
985 _GL_FUNCDECL_RPL (setstate_r
, int,
986 (char *arg_state
, struct random_data
*rand_state
)
987 _GL_ARG_NONNULL ((1, 2)));
988 _GL_CXXALIAS_RPL (setstate_r
, int,
989 (char *arg_state
, struct random_data
*rand_state
));
991 # if !@HAVE_RANDOM_R@
992 _GL_FUNCDECL_SYS (setstate_r
, int,
993 (char *arg_state
, struct random_data
*rand_state
)
994 _GL_ARG_NONNULL ((1, 2)));
996 /* Need to cast, because on Haiku, the first parameter is
998 _GL_CXXALIAS_SYS_CAST (setstate_r
, int,
999 (char *arg_state
, struct random_data
*rand_state
));
1001 _GL_CXXALIASWARN (setstate_r
);
1002 #elif defined GNULIB_POSIXCHECK
1004 # if HAVE_RAW_DECL_SETSTATE_R
1005 _GL_WARN_ON_USE (setstate_r
, "setstate_r is unportable - "
1006 "use gnulib module random_r for portability");
1011 #if @GNULIB_REALLOC_POSIX@
1012 # if @REPLACE_REALLOC@
1013 # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
1014 || _GL_USE_STDLIB_ALLOC)
1016 # define realloc rpl_realloc
1018 _GL_FUNCDECL_RPL (realloc
, void *, (void *ptr
, size_t size
));
1019 _GL_CXXALIAS_RPL (realloc
, void *, (void *ptr
, size_t size
));
1021 _GL_CXXALIAS_SYS (realloc
, void *, (void *ptr
, size_t size
));
1024 _GL_CXXALIASWARN (realloc
);
1026 #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
1028 /* Assume realloc is always declared. */
1029 _GL_WARN_ON_USE (realloc
, "realloc is not POSIX compliant everywhere - "
1030 "use gnulib module realloc-posix for portability");
1034 #if @GNULIB_REALLOCARRAY@
1035 # if ! @HAVE_REALLOCARRAY@
1036 _GL_FUNCDECL_SYS (reallocarray
, void *,
1037 (void *ptr
, size_t nmemb
, size_t size
));
1039 _GL_CXXALIAS_SYS (reallocarray
, void *,
1040 (void *ptr
, size_t nmemb
, size_t size
));
1041 _GL_CXXALIASWARN (reallocarray
);
1042 #elif defined GNULIB_POSIXCHECK
1043 # undef reallocarray
1044 # if HAVE_RAW_DECL_REALLOCARRAY
1045 _GL_WARN_ON_USE (reallocarray
, "reallocarray is not portable - "
1046 "use gnulib module reallocarray for portability");
1050 #if @GNULIB_REALPATH@
1051 # if @REPLACE_REALPATH@
1052 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1053 # define realpath rpl_realpath
1055 _GL_FUNCDECL_RPL (realpath
, char *,
1056 (const char *restrict name
, char *restrict resolved
)
1057 _GL_ARG_NONNULL ((1)));
1058 _GL_CXXALIAS_RPL (realpath
, char *,
1059 (const char *restrict name
, char *restrict resolved
));
1061 # if !@HAVE_REALPATH@
1062 _GL_FUNCDECL_SYS (realpath
, char *,
1063 (const char *restrict name
, char *restrict resolved
)
1064 _GL_ARG_NONNULL ((1)));
1066 _GL_CXXALIAS_SYS (realpath
, char *,
1067 (const char *restrict name
, char *restrict resolved
));
1069 _GL_CXXALIASWARN (realpath
);
1070 #elif defined GNULIB_POSIXCHECK
1072 # if HAVE_RAW_DECL_REALPATH
1073 _GL_WARN_ON_USE (realpath
, "realpath is unportable - use gnulib module "
1074 "canonicalize or canonicalize-lgpl for portability");
1078 #if @GNULIB_RPMATCH@
1079 /* Test a user response to a question.
1080 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
1081 # if !@HAVE_RPMATCH@
1082 _GL_FUNCDECL_SYS (rpmatch
, int, (const char *response
) _GL_ARG_NONNULL ((1)));
1084 _GL_CXXALIAS_SYS (rpmatch
, int, (const char *response
));
1085 _GL_CXXALIASWARN (rpmatch
);
1086 #elif defined GNULIB_POSIXCHECK
1088 # if HAVE_RAW_DECL_RPMATCH
1089 _GL_WARN_ON_USE (rpmatch
, "rpmatch is unportable - "
1090 "use gnulib module rpmatch for portability");
1094 #if @GNULIB_SECURE_GETENV@
1095 /* Look up NAME in the environment, returning 0 in insecure situations. */
1096 # if !@HAVE_SECURE_GETENV@
1097 _GL_FUNCDECL_SYS (secure_getenv
, char *,
1098 (char const *name
) _GL_ARG_NONNULL ((1)));
1100 _GL_CXXALIAS_SYS (secure_getenv
, char *, (char const *name
));
1101 _GL_CXXALIASWARN (secure_getenv
);
1102 #elif defined GNULIB_POSIXCHECK
1103 # undef secure_getenv
1104 # if HAVE_RAW_DECL_SECURE_GETENV
1105 _GL_WARN_ON_USE (secure_getenv
, "secure_getenv is unportable - "
1106 "use gnulib module secure_getenv for portability");
1111 /* Set NAME to VALUE in the environment.
1112 If REPLACE is nonzero, overwrite an existing value. */
1113 # if @REPLACE_SETENV@
1114 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1116 # define setenv rpl_setenv
1118 _GL_FUNCDECL_RPL (setenv
, int,
1119 (const char *name
, const char *value
, int replace
)
1120 _GL_ARG_NONNULL ((1)));
1121 _GL_CXXALIAS_RPL (setenv
, int,
1122 (const char *name
, const char *value
, int replace
));
1124 # if !@HAVE_DECL_SETENV@
1125 _GL_FUNCDECL_SYS (setenv
, int,
1126 (const char *name
, const char *value
, int replace
)
1127 _GL_ARG_NONNULL ((1)));
1129 _GL_CXXALIAS_SYS (setenv
, int,
1130 (const char *name
, const char *value
, int replace
));
1132 # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
1133 _GL_CXXALIASWARN (setenv
);
1135 #elif defined GNULIB_POSIXCHECK
1137 # if HAVE_RAW_DECL_SETENV
1138 _GL_WARN_ON_USE (setenv
, "setenv is unportable - "
1139 "use gnulib module setenv for portability");
1144 /* Parse a double from STRING, updating ENDP if appropriate. */
1145 # if @REPLACE_STRTOD@
1146 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1147 # define strtod rpl_strtod
1149 # define GNULIB_defined_strtod_function 1
1150 _GL_FUNCDECL_RPL (strtod
, double,
1151 (const char *restrict str
, char **restrict endp
)
1152 _GL_ARG_NONNULL ((1)));
1153 _GL_CXXALIAS_RPL (strtod
, double,
1154 (const char *restrict str
, char **restrict endp
));
1157 _GL_FUNCDECL_SYS (strtod
, double,
1158 (const char *restrict str
, char **restrict endp
)
1159 _GL_ARG_NONNULL ((1)));
1161 _GL_CXXALIAS_SYS (strtod
, double,
1162 (const char *restrict str
, char **restrict endp
));
1165 _GL_CXXALIASWARN (strtod
);
1167 #elif defined GNULIB_POSIXCHECK
1169 # if HAVE_RAW_DECL_STRTOD
1170 _GL_WARN_ON_USE (strtod
, "strtod is unportable - "
1171 "use gnulib module strtod for portability");
1175 #if @GNULIB_STRTOLD@
1176 /* Parse a 'long double' from STRING, updating ENDP if appropriate. */
1177 # if @REPLACE_STRTOLD@
1178 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1179 # define strtold rpl_strtold
1181 # define GNULIB_defined_strtold_function 1
1182 _GL_FUNCDECL_RPL (strtold
, long double,
1183 (const char *restrict str
, char **restrict endp
)
1184 _GL_ARG_NONNULL ((1)));
1185 _GL_CXXALIAS_RPL (strtold
, long double,
1186 (const char *restrict str
, char **restrict endp
));
1188 # if !@HAVE_STRTOLD@
1189 _GL_FUNCDECL_SYS (strtold
, long double,
1190 (const char *restrict str
, char **restrict endp
)
1191 _GL_ARG_NONNULL ((1)));
1193 _GL_CXXALIAS_SYS (strtold
, long double,
1194 (const char *restrict str
, char **restrict endp
));
1196 _GL_CXXALIASWARN (strtold
);
1197 #elif defined GNULIB_POSIXCHECK
1199 # if HAVE_RAW_DECL_STRTOLD
1200 _GL_WARN_ON_USE (strtold
, "strtold is unportable - "
1201 "use gnulib module strtold for portability");
1205 #if @GNULIB_STRTOLL@
1206 /* Parse a signed integer whose textual representation starts at STRING.
1207 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1208 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1210 If ENDPTR is not NULL, the address of the first byte after the integer is
1212 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
1214 # if !@HAVE_STRTOLL@
1215 _GL_FUNCDECL_SYS (strtoll
, long long,
1216 (const char *restrict string
, char **restrict endptr
,
1218 _GL_ARG_NONNULL ((1)));
1220 _GL_CXXALIAS_SYS (strtoll
, long long,
1221 (const char *restrict string
, char **restrict endptr
,
1223 _GL_CXXALIASWARN (strtoll
);
1224 #elif defined GNULIB_POSIXCHECK
1226 # if HAVE_RAW_DECL_STRTOLL
1227 _GL_WARN_ON_USE (strtoll
, "strtoll is unportable - "
1228 "use gnulib module strtoll for portability");
1232 #if @GNULIB_STRTOULL@
1233 /* Parse an unsigned integer whose textual representation starts at STRING.
1234 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
1235 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
1237 If ENDPTR is not NULL, the address of the first byte after the integer is
1239 Upon overflow, the return value is ULLONG_MAX, and errno is set to
1241 # if !@HAVE_STRTOULL@
1242 _GL_FUNCDECL_SYS (strtoull
, unsigned long long,
1243 (const char *restrict string
, char **restrict endptr
,
1245 _GL_ARG_NONNULL ((1)));
1247 _GL_CXXALIAS_SYS (strtoull
, unsigned long long,
1248 (const char *restrict string
, char **restrict endptr
,
1250 _GL_CXXALIASWARN (strtoull
);
1251 #elif defined GNULIB_POSIXCHECK
1253 # if HAVE_RAW_DECL_STRTOULL
1254 _GL_WARN_ON_USE (strtoull
, "strtoull is unportable - "
1255 "use gnulib module strtoull for portability");
1259 #if @GNULIB_UNLOCKPT@
1260 /* Unlock the slave side of the pseudo-terminal whose master side is specified
1261 by FD, so that it can be opened. */
1262 # if !@HAVE_UNLOCKPT@
1263 _GL_FUNCDECL_SYS (unlockpt
, int, (int fd
));
1265 _GL_CXXALIAS_SYS (unlockpt
, int, (int fd
));
1266 _GL_CXXALIASWARN (unlockpt
);
1267 #elif defined GNULIB_POSIXCHECK
1269 # if HAVE_RAW_DECL_UNLOCKPT
1270 _GL_WARN_ON_USE (unlockpt
, "unlockpt is not portable - "
1271 "use gnulib module unlockpt for portability");
1275 #if @GNULIB_UNSETENV@
1276 /* Remove the variable NAME from the environment. */
1277 # if @REPLACE_UNSETENV@
1278 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1280 # define unsetenv rpl_unsetenv
1282 _GL_FUNCDECL_RPL (unsetenv
, int, (const char *name
) _GL_ARG_NONNULL ((1)));
1283 _GL_CXXALIAS_RPL (unsetenv
, int, (const char *name
));
1285 # if !@HAVE_DECL_UNSETENV@
1286 _GL_FUNCDECL_SYS (unsetenv
, int, (const char *name
) _GL_ARG_NONNULL ((1)));
1288 _GL_CXXALIAS_SYS (unsetenv
, int, (const char *name
));
1290 # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
1291 _GL_CXXALIASWARN (unsetenv
);
1293 #elif defined GNULIB_POSIXCHECK
1295 # if HAVE_RAW_DECL_UNSETENV
1296 _GL_WARN_ON_USE (unsetenv
, "unsetenv is unportable - "
1297 "use gnulib module unsetenv for portability");
1301 /* Convert a wide character to a multibyte character. */
1303 # if @REPLACE_WCTOMB@
1304 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1306 # define wctomb rpl_wctomb
1308 _GL_FUNCDECL_RPL (wctomb
, int, (char *s
, wchar_t wc
));
1309 _GL_CXXALIAS_RPL (wctomb
, int, (char *s
, wchar_t wc
));
1311 _GL_CXXALIAS_SYS (wctomb
, int, (char *s
, wchar_t wc
));
1314 _GL_CXXALIASWARN (wctomb
);
1319 #endif /* _@GUARD_PREFIX@_STDLIB_H */
1320 #endif /* _@GUARD_PREFIX@_STDLIB_H */