1 /* A GNU-like <stdlib.h>.
3 Copyright (C) 1995, 2001-2004, 2006-2010 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 <http://www.gnu.org/licenses/>. */
19 @PRAGMA_SYSTEM_HEADER@
22 #if defined __need_malloc_and_calloc
23 /* Special invocation convention inside glibc header files. */
25 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
28 /* Normal invocation convention. */
32 /* The include_next requires a split double-inclusion guard. */
33 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
38 /* NetBSD 5.0 mis-defines NULL. */
41 /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
42 #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
43 # include <sys/wait.h>
46 /* Solaris declares getloadavg() in <sys/loadavg.h>. */
47 #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
48 # include <sys/loadavg.h>
51 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
52 from <stdlib.h> if _REENTRANT is defined. Include it always. */
57 #if !@HAVE_STRUCT_RANDOM_DATA@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@) \
58 || defined GNULIB_POSIXCHECK
62 #if !@HAVE_STRUCT_RANDOM_DATA@
65 int32_t *fptr; /* Front pointer. */
66 int32_t *rptr; /* Rear pointer. */
67 int32_t *state; /* Array of state values. */
68 int rand_type; /* Type of random number generator. */
69 int rand_deg; /* Degree of random number generator. */
70 int rand_sep; /* Distance between front and rear. */
71 int32_t *end_ptr; /* Pointer behind state table. */
75 #if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
76 /* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
77 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
78 /* But avoid namespace pollution on glibc systems and native Windows. */
83 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
84 # define __attribute__(Spec) /* empty */
88 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
90 /* The definition of _GL_ARG_NONNULL is copied here. */
92 /* The definition of _GL_WARN_ON_USE is copied here. */
95 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
97 # define EXIT_SUCCESS 0
99 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
100 with proper operation of xargs. */
102 # define EXIT_FAILURE 1
103 #elif EXIT_FAILURE != 1
105 # define EXIT_FAILURE 1
110 /* Terminate the current process with the given return code, without running
111 the 'atexit' handlers. */
113 _GL_FUNCDECL_SYS (_Exit, void, (int status) __attribute__ ((__noreturn__)));
115 _GL_CXXALIAS_SYS (_Exit, void, (int status));
116 _GL_CXXALIASWARN (_Exit);
117 #elif defined GNULIB_POSIXCHECK
119 # if HAVE_RAW_DECL__EXIT
120 _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
121 "use gnulib module _Exit for portability");
127 /* Parse a signed decimal integer.
128 Returns the value of the integer. Errors are not detected. */
130 _GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1)));
132 _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
133 _GL_CXXALIASWARN (atoll);
134 #elif defined GNULIB_POSIXCHECK
136 # if HAVE_RAW_DECL_ATOLL
137 _GL_WARN_ON_USE (atoll, "atoll is unportable - "
138 "use gnulib module atoll for portability");
142 #if @GNULIB_CALLOC_POSIX@
143 # if @REPLACE_CALLOC@
144 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
146 # define calloc rpl_calloc
148 _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
149 _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
151 _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
153 _GL_CXXALIASWARN (calloc);
154 #elif defined GNULIB_POSIXCHECK
156 /* Assume calloc is always declared. */
157 _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
158 "use gnulib module calloc-posix for portability");
161 #if @GNULIB_CANONICALIZE_FILE_NAME@
162 # if @REPLACE_CANONICALIZE_FILE_NAME@
163 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
164 # define canonicalize_file_name rpl_canonicalize_file_name
166 _GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
167 _GL_ARG_NONNULL ((1)));
168 _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
170 # if !@HAVE_CANONICALIZE_FILE_NAME@
171 _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
172 _GL_ARG_NONNULL ((1)));
174 _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
176 _GL_CXXALIASWARN (canonicalize_file_name);
177 #elif defined GNULIB_POSIXCHECK
178 # undef canonicalize_file_name
179 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
180 _GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable - "
181 "use gnulib module canonicalize-lgpl for portability");
185 #if @GNULIB_GETLOADAVG@
186 /* Store max(NELEM,3) load average numbers in LOADAVG[].
187 The three numbers are the load average of the last 1 minute, the last 5
188 minutes, and the last 15 minutes, respectively.
189 LOADAVG is an array of NELEM numbers. */
190 # if !@HAVE_DECL_GETLOADAVG@
191 _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
192 _GL_ARG_NONNULL ((1)));
194 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
195 _GL_CXXALIASWARN (getloadavg);
196 #elif defined GNULIB_POSIXCHECK
198 # if HAVE_RAW_DECL_GETLOADAVG
199 _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
200 "use gnulib module getloadavg for portability");
204 #if @GNULIB_GETSUBOPT@
205 /* Assuming *OPTIONP is a comma separated list of elements of the form
206 "token" or "token=value", getsubopt parses the first of these elements.
207 If the first element refers to a "token" that is member of the given
208 NULL-terminated array of tokens:
209 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
210 the first option and the comma, sets *VALUEP to the value of the
211 element (or NULL if it doesn't contain an "=" sign),
212 - It returns the index of the "token" in the given array of tokens.
213 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
214 For more details see the POSIX:2001 specification.
215 http://www.opengroup.org/susv3xsh/getsubopt.html */
216 # if !@HAVE_GETSUBOPT@
217 _GL_FUNCDECL_SYS (getsubopt, int,
218 (char **optionp, char *const *tokens, char **valuep)
219 _GL_ARG_NONNULL ((1, 2, 3)));
221 _GL_CXXALIAS_SYS (getsubopt, int,
222 (char **optionp, char *const *tokens, char **valuep));
223 _GL_CXXALIASWARN (getsubopt);
224 #elif defined GNULIB_POSIXCHECK
226 # if HAVE_RAW_DECL_GETSUBOPT
227 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
228 "use gnulib module getsubopt for portability");
233 /* Change the ownership and access permission of the slave side of the
234 pseudo-terminal whose master side is specified by FD. */
236 _GL_FUNCDECL_SYS (grantpt, int, (int fd));
238 _GL_CXXALIAS_SYS (grantpt, int, (int fd));
239 _GL_CXXALIASWARN (grantpt);
240 #elif defined GNULIB_POSIXCHECK
242 # if HAVE_RAW_DECL_GRANTPT
243 _GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
244 "use gnulib module grantpt for portability");
248 #if @GNULIB_MALLOC_POSIX@
249 # if @REPLACE_MALLOC@
250 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
252 # define malloc rpl_malloc
254 _GL_FUNCDECL_RPL (malloc, void *, (size_t size));
255 _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
257 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
259 _GL_CXXALIASWARN (malloc);
260 #elif defined GNULIB_POSIXCHECK
262 /* Assume malloc is always declared. */
263 _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
264 "use gnulib module malloc-posix for portability");
268 /* Create a unique temporary directory from TEMPLATE.
269 The last six characters of TEMPLATE must be "XXXXXX";
270 they are replaced with a string that makes the directory name unique.
271 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
272 The directory is created mode 700. */
274 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
276 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
277 _GL_CXXALIASWARN (mkdtemp);
278 #elif defined GNULIB_POSIXCHECK
280 # if HAVE_RAW_DECL_MKDTEMP
281 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
282 "use gnulib module mkdtemp for portability");
286 #if @GNULIB_MKOSTEMP@
287 /* Create a unique temporary file from TEMPLATE.
288 The last six characters of TEMPLATE must be "XXXXXX";
289 they are replaced with a string that makes the file name unique.
290 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
291 and O_TEXT, O_BINARY (defined in "binary-io.h").
292 The file is then created, with the specified flags, ensuring it didn't exist
294 The file is created read-write (mask at least 0600 & ~umask), but it may be
295 world-readable and world-writable (mask 0666 & ~umask), depending on the
297 Returns the open file descriptor if successful, otherwise -1 and errno
299 # if !@HAVE_MKOSTEMP@
300 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
301 _GL_ARG_NONNULL ((1)));
303 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
304 _GL_CXXALIASWARN (mkostemp);
305 #elif defined GNULIB_POSIXCHECK
307 # if HAVE_RAW_DECL_MKOSTEMP
308 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
309 "use gnulib module mkostemp for portability");
313 #if @GNULIB_MKOSTEMPS@
314 /* Create a unique temporary file from TEMPLATE.
315 The last six characters of TEMPLATE before a suffix of length
316 SUFFIXLEN must be "XXXXXX";
317 they are replaced with a string that makes the file name unique.
318 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
319 and O_TEXT, O_BINARY (defined in "binary-io.h").
320 The file is then created, with the specified flags, ensuring it didn't exist
322 The file is created read-write (mask at least 0600 & ~umask), but it may be
323 world-readable and world-writable (mask 0666 & ~umask), depending on the
325 Returns the open file descriptor if successful, otherwise -1 and errno
327 # if !@HAVE_MKOSTEMPS@
328 _GL_FUNCDECL_SYS (mkostemps, int,
329 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
330 _GL_ARG_NONNULL ((1)));
332 _GL_CXXALIAS_SYS (mkostemps, int,
333 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
334 _GL_CXXALIASWARN (mkostemps);
335 #elif defined GNULIB_POSIXCHECK
337 # if HAVE_RAW_DECL_MKOSTEMPS
338 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
339 "use gnulib module mkostemps for portability");
344 /* Create a unique temporary file from TEMPLATE.
345 The last six characters of TEMPLATE must be "XXXXXX";
346 they are replaced with a string that makes the file name unique.
347 The file is then created, ensuring it didn't exist before.
348 The file is created read-write (mask at least 0600 & ~umask), but it may be
349 world-readable and world-writable (mask 0666 & ~umask), depending on the
351 Returns the open file descriptor if successful, otherwise -1 and errno
353 # if @REPLACE_MKSTEMP@
354 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
355 # define mkstemp rpl_mkstemp
357 _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
358 _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
360 # if ! @HAVE_MKSTEMP@
361 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
363 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
365 _GL_CXXALIASWARN (mkstemp);
366 #elif defined GNULIB_POSIXCHECK
368 # if HAVE_RAW_DECL_MKSTEMP
369 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
370 "use gnulib module mkstemp for portability");
374 #if @GNULIB_MKSTEMPS@
375 /* Create a unique temporary file from TEMPLATE.
376 The last six characters of TEMPLATE prior to a suffix of length
377 SUFFIXLEN must be "XXXXXX";
378 they are replaced with a string that makes the file name unique.
379 The file is then created, ensuring it didn't exist before.
380 The file is created read-write (mask at least 0600 & ~umask), but it may be
381 world-readable and world-writable (mask 0666 & ~umask), depending on the
383 Returns the open file descriptor if successful, otherwise -1 and errno
385 # if !@HAVE_MKSTEMPS@
386 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
387 _GL_ARG_NONNULL ((1)));
389 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
390 _GL_CXXALIASWARN (mkstemps);
391 #elif defined GNULIB_POSIXCHECK
393 # if HAVE_RAW_DECL_MKSTEMPS
394 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
395 "use gnulib module mkstemps for portability");
400 /* Return the pathname of the pseudo-terminal slave associated with
401 the master FD is open on, or NULL on errors. */
403 _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
405 _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
406 _GL_CXXALIASWARN (ptsname);
407 #elif defined GNULIB_POSIXCHECK
409 # if HAVE_RAW_DECL_PTSNAME
410 _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
411 "use gnulib module ptsname for portability");
416 # if @REPLACE_PUTENV@
417 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
419 # define putenv rpl_putenv
421 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
422 _GL_CXXALIAS_RPL (putenv, int, (char *string));
424 _GL_CXXALIAS_SYS (putenv, int, (char *string));
426 _GL_CXXALIASWARN (putenv);
430 #if @GNULIB_RANDOM_R@
431 # if !@HAVE_RANDOM_R@
433 # define RAND_MAX 2147483647
438 #if @GNULIB_RANDOM_R@
439 # if !@HAVE_RANDOM_R@
440 _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
441 _GL_ARG_NONNULL ((1, 2)));
443 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
444 _GL_CXXALIASWARN (random_r);
445 #elif defined GNULIB_POSIXCHECK
447 # if HAVE_RAW_DECL_RANDOM_R
448 _GL_WARN_ON_USE (random_r, "random_r is unportable - "
449 "use gnulib module random_r for portability");
453 #if @GNULIB_RANDOM_R@
454 # if !@HAVE_RANDOM_R@
455 _GL_FUNCDECL_SYS (srandom_r, int,
456 (unsigned int seed, struct random_data *rand_state)
457 _GL_ARG_NONNULL ((2)));
459 _GL_CXXALIAS_SYS (srandom_r, int,
460 (unsigned int seed, struct random_data *rand_state));
461 _GL_CXXALIASWARN (srandom_r);
462 #elif defined GNULIB_POSIXCHECK
464 # if HAVE_RAW_DECL_SRANDOM_R
465 _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
466 "use gnulib module random_r for portability");
470 #if @GNULIB_RANDOM_R@
471 # if !@HAVE_RANDOM_R@
472 _GL_FUNCDECL_SYS (initstate_r, int,
473 (unsigned int seed, char *buf, size_t buf_size,
474 struct random_data *rand_state)
475 _GL_ARG_NONNULL ((2, 4)));
477 _GL_CXXALIAS_SYS (initstate_r, int,
478 (unsigned int seed, char *buf, size_t buf_size,
479 struct random_data *rand_state));
480 _GL_CXXALIASWARN (initstate_r);
481 #elif defined GNULIB_POSIXCHECK
483 # if HAVE_RAW_DECL_INITSTATE_R
484 _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
485 "use gnulib module random_r for portability");
489 #if @GNULIB_RANDOM_R@
490 # if !@HAVE_RANDOM_R@
491 _GL_FUNCDECL_SYS (setstate_r, int,
492 (char *arg_state, struct random_data *rand_state)
493 _GL_ARG_NONNULL ((1, 2)));
495 _GL_CXXALIAS_SYS (setstate_r, int,
496 (char *arg_state, struct random_data *rand_state));
497 _GL_CXXALIASWARN (setstate_r);
498 #elif defined GNULIB_POSIXCHECK
500 # if HAVE_RAW_DECL_SETSTATE_R
501 _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
502 "use gnulib module random_r for portability");
507 #if @GNULIB_REALLOC_POSIX@
508 # if @REPLACE_REALLOC@
509 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
511 # define realloc rpl_realloc
513 _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
514 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
516 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
518 _GL_CXXALIASWARN (realloc);
519 #elif defined GNULIB_POSIXCHECK
521 /* Assume realloc is always declared. */
522 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
523 "use gnulib module realloc-posix for portability");
526 #if @GNULIB_REALPATH@
527 # if @REPLACE_REALPATH@
528 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
529 # define realpath rpl_realpath
531 _GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
532 _GL_ARG_NONNULL ((1)));
533 _GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
535 # if !@HAVE_REALPATH@
536 _GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
537 _GL_ARG_NONNULL ((1)));
539 _GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
541 _GL_CXXALIASWARN (realpath);
542 #elif defined GNULIB_POSIXCHECK
544 # if HAVE_RAW_DECL_REALPATH
545 _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
546 "canonicalize or canonicalize-lgpl for portability");
551 /* Test a user response to a question.
552 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
554 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
556 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
557 _GL_CXXALIASWARN (rpmatch);
558 #elif defined GNULIB_POSIXCHECK
560 # if HAVE_RAW_DECL_RPMATCH
561 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
562 "use gnulib module rpmatch for portability");
567 /* Set NAME to VALUE in the environment.
568 If REPLACE is nonzero, overwrite an existing value. */
569 # if @REPLACE_SETENV@
570 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
572 # define setenv rpl_setenv
574 _GL_FUNCDECL_RPL (setenv, int,
575 (const char *name, const char *value, int replace)
576 _GL_ARG_NONNULL ((1)));
577 _GL_CXXALIAS_RPL (setenv, int,
578 (const char *name, const char *value, int replace));
581 _GL_FUNCDECL_SYS (setenv, int,
582 (const char *name, const char *value, int replace)
583 _GL_ARG_NONNULL ((1)));
585 _GL_CXXALIAS_SYS (setenv, int,
586 (const char *name, const char *value, int replace));
588 _GL_CXXALIASWARN (setenv);
589 #elif defined GNULIB_POSIXCHECK
591 # if HAVE_RAW_DECL_SETENV
592 _GL_WARN_ON_USE (setenv, "setenv is unportable - "
593 "use gnulib module setenv for portability");
598 /* Parse a double from STRING, updating ENDP if appropriate. */
599 # if @REPLACE_STRTOD@
600 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
601 # define strtod rpl_strtod
603 _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
604 _GL_ARG_NONNULL ((1)));
605 _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
608 _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
609 _GL_ARG_NONNULL ((1)));
611 _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
613 _GL_CXXALIASWARN (strtod);
614 #elif defined GNULIB_POSIXCHECK
616 # if HAVE_RAW_DECL_STRTOD
617 _GL_WARN_ON_USE (strtod, "strtod is unportable - "
618 "use gnulib module strtod for portability");
623 /* Parse a signed integer whose textual representation starts at STRING.
624 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
625 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
627 If ENDPTR is not NULL, the address of the first byte after the integer is
629 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
632 _GL_FUNCDECL_SYS (strtoll, long long,
633 (const char *string, char **endptr, int base)
634 _GL_ARG_NONNULL ((1)));
636 _GL_CXXALIAS_SYS (strtoll, long long,
637 (const char *string, char **endptr, int base));
638 _GL_CXXALIASWARN (strtoll);
639 #elif defined GNULIB_POSIXCHECK
641 # if HAVE_RAW_DECL_STRTOLL
642 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
643 "use gnulib module strtoll for portability");
647 #if @GNULIB_STRTOULL@
648 /* Parse an unsigned integer whose textual representation starts at STRING.
649 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
650 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
652 If ENDPTR is not NULL, the address of the first byte after the integer is
654 Upon overflow, the return value is ULLONG_MAX, and errno is set to
656 # if !@HAVE_STRTOULL@
657 _GL_FUNCDECL_SYS (strtoull, unsigned long long,
658 (const char *string, char **endptr, int base)
659 _GL_ARG_NONNULL ((1)));
661 _GL_CXXALIAS_SYS (strtoull, unsigned long long,
662 (const char *string, char **endptr, int base));
663 _GL_CXXALIASWARN (strtoull);
664 #elif defined GNULIB_POSIXCHECK
666 # if HAVE_RAW_DECL_STRTOULL
667 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
668 "use gnulib module strtoull for portability");
672 #if @GNULIB_UNLOCKPT@
673 /* Unlock the slave side of the pseudo-terminal whose master side is specified
674 by FD, so that it can be opened. */
675 # if !@HAVE_UNLOCKPT@
676 _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
678 _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
679 _GL_CXXALIASWARN (unlockpt);
680 #elif defined GNULIB_POSIXCHECK
682 # if HAVE_RAW_DECL_UNLOCKPT
683 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
684 "use gnulib module unlockpt for portability");
688 #if @GNULIB_UNSETENV@
689 /* Remove the variable NAME from the environment. */
690 # if @REPLACE_UNSETENV@
691 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
693 # define unsetenv rpl_unsetenv
695 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
696 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
698 # if !@HAVE_UNSETENV@
699 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
701 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
703 _GL_CXXALIASWARN (unsetenv);
704 #elif defined GNULIB_POSIXCHECK
706 # if HAVE_RAW_DECL_UNSETENV
707 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
708 "use gnulib module unsetenv for portability");
713 #endif /* _GL_STDLIB_H */
714 #endif /* _GL_STDLIB_H */