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@
23 #if defined __need_malloc_and_calloc
24 /* Special invocation convention inside glibc header files. */
26 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
29 /* Normal invocation convention. */
33 /* The include_next requires a split double-inclusion guard. */
34 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
39 /* NetBSD 5.0 mis-defines NULL. */
42 /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
43 #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
44 # include <sys/wait.h>
47 /* Solaris declares getloadavg() in <sys/loadavg.h>. */
48 #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
49 # include <sys/loadavg.h>
52 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
53 from <stdlib.h> if _REENTRANT is defined. Include it always. */
58 #if !@HAVE_STRUCT_RANDOM_DATA@ || (@GNULIB_RANDOM_R@ && !@HAVE_RANDOM_R@) \
59 || defined GNULIB_POSIXCHECK
63 #if !@HAVE_STRUCT_RANDOM_DATA@
66 int32_t *fptr; /* Front pointer. */
67 int32_t *rptr; /* Rear pointer. */
68 int32_t *state; /* Array of state values. */
69 int rand_type; /* Type of random number generator. */
70 int rand_deg; /* Degree of random number generator. */
71 int rand_sep; /* Distance between front and rear. */
72 int32_t *end_ptr; /* Pointer behind state table. */
76 #if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
77 /* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
78 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
79 /* But avoid namespace pollution on glibc systems and native Windows. */
84 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
85 # define __attribute__(Spec) /* empty */
89 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
91 /* The definition of _GL_ARG_NONNULL is copied here. */
93 /* The definition of _GL_WARN_ON_USE is copied here. */
96 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
98 # define EXIT_SUCCESS 0
100 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
101 with proper operation of xargs. */
103 # define EXIT_FAILURE 1
104 #elif EXIT_FAILURE != 1
106 # define EXIT_FAILURE 1
111 /* Terminate the current process with the given return code, without running
112 the 'atexit' handlers. */
114 _GL_FUNCDECL_SYS (_Exit, void, (int status) __attribute__ ((__noreturn__)));
116 _GL_CXXALIAS_SYS (_Exit, void, (int status));
117 _GL_CXXALIASWARN (_Exit);
118 #elif defined GNULIB_POSIXCHECK
120 # if HAVE_RAW_DECL__EXIT
121 _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
122 "use gnulib module _Exit for portability");
128 /* Parse a signed decimal integer.
129 Returns the value of the integer. Errors are not detected. */
131 _GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1)));
133 _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
134 _GL_CXXALIASWARN (atoll);
135 #elif defined GNULIB_POSIXCHECK
137 # if HAVE_RAW_DECL_ATOLL
138 _GL_WARN_ON_USE (atoll, "atoll is unportable - "
139 "use gnulib module atoll for portability");
143 #if @GNULIB_CALLOC_POSIX@
144 # if @REPLACE_CALLOC@
145 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
147 # define calloc rpl_calloc
149 _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
150 _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
152 _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
154 _GL_CXXALIASWARN (calloc);
155 #elif defined GNULIB_POSIXCHECK
157 /* Assume calloc is always declared. */
158 _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
159 "use gnulib module calloc-posix for portability");
162 #if @GNULIB_CANONICALIZE_FILE_NAME@
163 # if @REPLACE_CANONICALIZE_FILE_NAME@
164 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
165 # define canonicalize_file_name rpl_canonicalize_file_name
167 _GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
168 _GL_ARG_NONNULL ((1)));
169 _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
171 # if !@HAVE_CANONICALIZE_FILE_NAME@
172 _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
173 _GL_ARG_NONNULL ((1)));
175 _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
177 _GL_CXXALIASWARN (canonicalize_file_name);
178 #elif defined GNULIB_POSIXCHECK
179 # undef canonicalize_file_name
180 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
181 _GL_WARN_ON_USE (canonicalize_file_name,
182 "canonicalize_file_name is unportable - "
183 "use gnulib module canonicalize-lgpl for portability");
187 #if @GNULIB_GETLOADAVG@
188 /* Store max(NELEM,3) load average numbers in LOADAVG[].
189 The three numbers are the load average of the last 1 minute, the last 5
190 minutes, and the last 15 minutes, respectively.
191 LOADAVG is an array of NELEM numbers. */
192 # if !@HAVE_DECL_GETLOADAVG@
193 _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
194 _GL_ARG_NONNULL ((1)));
196 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
197 _GL_CXXALIASWARN (getloadavg);
198 #elif defined GNULIB_POSIXCHECK
200 # if HAVE_RAW_DECL_GETLOADAVG
201 _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
202 "use gnulib module getloadavg for portability");
206 #if @GNULIB_GETSUBOPT@
207 /* Assuming *OPTIONP is a comma separated list of elements of the form
208 "token" or "token=value", getsubopt parses the first of these elements.
209 If the first element refers to a "token" that is member of the given
210 NULL-terminated array of tokens:
211 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
212 the first option and the comma, sets *VALUEP to the value of the
213 element (or NULL if it doesn't contain an "=" sign),
214 - It returns the index of the "token" in the given array of tokens.
215 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
216 For more details see the POSIX:2001 specification.
217 http://www.opengroup.org/susv3xsh/getsubopt.html */
218 # if !@HAVE_GETSUBOPT@
219 _GL_FUNCDECL_SYS (getsubopt, int,
220 (char **optionp, char *const *tokens, char **valuep)
221 _GL_ARG_NONNULL ((1, 2, 3)));
223 _GL_CXXALIAS_SYS (getsubopt, int,
224 (char **optionp, char *const *tokens, char **valuep));
225 _GL_CXXALIASWARN (getsubopt);
226 #elif defined GNULIB_POSIXCHECK
228 # if HAVE_RAW_DECL_GETSUBOPT
229 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
230 "use gnulib module getsubopt for portability");
235 /* Change the ownership and access permission of the slave side of the
236 pseudo-terminal whose master side is specified by FD. */
238 _GL_FUNCDECL_SYS (grantpt, int, (int fd));
240 _GL_CXXALIAS_SYS (grantpt, int, (int fd));
241 _GL_CXXALIASWARN (grantpt);
242 #elif defined GNULIB_POSIXCHECK
244 # if HAVE_RAW_DECL_GRANTPT
245 _GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
246 "use gnulib module grantpt for portability");
250 #if @GNULIB_MALLOC_POSIX@
251 # if @REPLACE_MALLOC@
252 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
254 # define malloc rpl_malloc
256 _GL_FUNCDECL_RPL (malloc, void *, (size_t size));
257 _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
259 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
261 _GL_CXXALIASWARN (malloc);
262 #elif defined GNULIB_POSIXCHECK
264 /* Assume malloc is always declared. */
265 _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
266 "use gnulib module malloc-posix for portability");
270 /* Create a unique temporary directory from TEMPLATE.
271 The last six characters of TEMPLATE must be "XXXXXX";
272 they are replaced with a string that makes the directory name unique.
273 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
274 The directory is created mode 700. */
276 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
278 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
279 _GL_CXXALIASWARN (mkdtemp);
280 #elif defined GNULIB_POSIXCHECK
282 # if HAVE_RAW_DECL_MKDTEMP
283 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
284 "use gnulib module mkdtemp for portability");
288 #if @GNULIB_MKOSTEMP@
289 /* Create a unique temporary file from TEMPLATE.
290 The last six characters of TEMPLATE must be "XXXXXX";
291 they are replaced with a string that makes the file name unique.
292 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
293 and O_TEXT, O_BINARY (defined in "binary-io.h").
294 The file is then created, with the specified flags, ensuring it didn't exist
296 The file is created read-write (mask at least 0600 & ~umask), but it may be
297 world-readable and world-writable (mask 0666 & ~umask), depending on the
299 Returns the open file descriptor if successful, otherwise -1 and errno
301 # if !@HAVE_MKOSTEMP@
302 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
303 _GL_ARG_NONNULL ((1)));
305 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
306 _GL_CXXALIASWARN (mkostemp);
307 #elif defined GNULIB_POSIXCHECK
309 # if HAVE_RAW_DECL_MKOSTEMP
310 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
311 "use gnulib module mkostemp for portability");
315 #if @GNULIB_MKOSTEMPS@
316 /* Create a unique temporary file from TEMPLATE.
317 The last six characters of TEMPLATE before a suffix of length
318 SUFFIXLEN must be "XXXXXX";
319 they are replaced with a string that makes the file name unique.
320 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
321 and O_TEXT, O_BINARY (defined in "binary-io.h").
322 The file is then created, with the specified flags, ensuring it didn't exist
324 The file is created read-write (mask at least 0600 & ~umask), but it may be
325 world-readable and world-writable (mask 0666 & ~umask), depending on the
327 Returns the open file descriptor if successful, otherwise -1 and errno
329 # if !@HAVE_MKOSTEMPS@
330 _GL_FUNCDECL_SYS (mkostemps, int,
331 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
332 _GL_ARG_NONNULL ((1)));
334 _GL_CXXALIAS_SYS (mkostemps, int,
335 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
336 _GL_CXXALIASWARN (mkostemps);
337 #elif defined GNULIB_POSIXCHECK
339 # if HAVE_RAW_DECL_MKOSTEMPS
340 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
341 "use gnulib module mkostemps for portability");
346 /* Create a unique temporary file from TEMPLATE.
347 The last six characters of TEMPLATE must be "XXXXXX";
348 they are replaced with a string that makes the file name unique.
349 The file is then created, ensuring it didn't exist before.
350 The file is created read-write (mask at least 0600 & ~umask), but it may be
351 world-readable and world-writable (mask 0666 & ~umask), depending on the
353 Returns the open file descriptor if successful, otherwise -1 and errno
355 # if @REPLACE_MKSTEMP@
356 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
357 # define mkstemp rpl_mkstemp
359 _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
360 _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
362 # if ! @HAVE_MKSTEMP@
363 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
365 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
367 _GL_CXXALIASWARN (mkstemp);
368 #elif defined GNULIB_POSIXCHECK
370 # if HAVE_RAW_DECL_MKSTEMP
371 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
372 "use gnulib module mkstemp for portability");
376 #if @GNULIB_MKSTEMPS@
377 /* Create a unique temporary file from TEMPLATE.
378 The last six characters of TEMPLATE prior to a suffix of length
379 SUFFIXLEN must be "XXXXXX";
380 they are replaced with a string that makes the file name unique.
381 The file is then created, ensuring it didn't exist before.
382 The file is created read-write (mask at least 0600 & ~umask), but it may be
383 world-readable and world-writable (mask 0666 & ~umask), depending on the
385 Returns the open file descriptor if successful, otherwise -1 and errno
387 # if !@HAVE_MKSTEMPS@
388 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
389 _GL_ARG_NONNULL ((1)));
391 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
392 _GL_CXXALIASWARN (mkstemps);
393 #elif defined GNULIB_POSIXCHECK
395 # if HAVE_RAW_DECL_MKSTEMPS
396 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
397 "use gnulib module mkstemps for portability");
402 /* Return the pathname of the pseudo-terminal slave associated with
403 the master FD is open on, or NULL on errors. */
405 _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
407 _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
408 _GL_CXXALIASWARN (ptsname);
409 #elif defined GNULIB_POSIXCHECK
411 # if HAVE_RAW_DECL_PTSNAME
412 _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
413 "use gnulib module ptsname for portability");
418 # if @REPLACE_PUTENV@
419 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
421 # define putenv rpl_putenv
423 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
424 _GL_CXXALIAS_RPL (putenv, int, (char *string));
426 _GL_CXXALIAS_SYS (putenv, int, (char *string));
428 _GL_CXXALIASWARN (putenv);
432 #if @GNULIB_RANDOM_R@
433 # if !@HAVE_RANDOM_R@
435 # define RAND_MAX 2147483647
440 #if @GNULIB_RANDOM_R@
441 # if !@HAVE_RANDOM_R@
442 _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
443 _GL_ARG_NONNULL ((1, 2)));
445 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
446 _GL_CXXALIASWARN (random_r);
447 #elif defined GNULIB_POSIXCHECK
449 # if HAVE_RAW_DECL_RANDOM_R
450 _GL_WARN_ON_USE (random_r, "random_r is unportable - "
451 "use gnulib module random_r for portability");
455 #if @GNULIB_RANDOM_R@
456 # if !@HAVE_RANDOM_R@
457 _GL_FUNCDECL_SYS (srandom_r, int,
458 (unsigned int seed, struct random_data *rand_state)
459 _GL_ARG_NONNULL ((2)));
461 _GL_CXXALIAS_SYS (srandom_r, int,
462 (unsigned int seed, struct random_data *rand_state));
463 _GL_CXXALIASWARN (srandom_r);
464 #elif defined GNULIB_POSIXCHECK
466 # if HAVE_RAW_DECL_SRANDOM_R
467 _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
468 "use gnulib module random_r for portability");
472 #if @GNULIB_RANDOM_R@
473 # if !@HAVE_RANDOM_R@
474 _GL_FUNCDECL_SYS (initstate_r, int,
475 (unsigned int seed, char *buf, size_t buf_size,
476 struct random_data *rand_state)
477 _GL_ARG_NONNULL ((2, 4)));
479 _GL_CXXALIAS_SYS (initstate_r, int,
480 (unsigned int seed, char *buf, size_t buf_size,
481 struct random_data *rand_state));
482 _GL_CXXALIASWARN (initstate_r);
483 #elif defined GNULIB_POSIXCHECK
485 # if HAVE_RAW_DECL_INITSTATE_R
486 _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
487 "use gnulib module random_r for portability");
491 #if @GNULIB_RANDOM_R@
492 # if !@HAVE_RANDOM_R@
493 _GL_FUNCDECL_SYS (setstate_r, int,
494 (char *arg_state, struct random_data *rand_state)
495 _GL_ARG_NONNULL ((1, 2)));
497 _GL_CXXALIAS_SYS (setstate_r, int,
498 (char *arg_state, struct random_data *rand_state));
499 _GL_CXXALIASWARN (setstate_r);
500 #elif defined GNULIB_POSIXCHECK
502 # if HAVE_RAW_DECL_SETSTATE_R
503 _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
504 "use gnulib module random_r for portability");
509 #if @GNULIB_REALLOC_POSIX@
510 # if @REPLACE_REALLOC@
511 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
513 # define realloc rpl_realloc
515 _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
516 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
518 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
520 _GL_CXXALIASWARN (realloc);
521 #elif defined GNULIB_POSIXCHECK
523 /* Assume realloc is always declared. */
524 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
525 "use gnulib module realloc-posix for portability");
528 #if @GNULIB_REALPATH@
529 # if @REPLACE_REALPATH@
530 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
531 # define realpath rpl_realpath
533 _GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
534 _GL_ARG_NONNULL ((1)));
535 _GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
537 # if !@HAVE_REALPATH@
538 _GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
539 _GL_ARG_NONNULL ((1)));
541 _GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
543 _GL_CXXALIASWARN (realpath);
544 #elif defined GNULIB_POSIXCHECK
546 # if HAVE_RAW_DECL_REALPATH
547 _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
548 "canonicalize or canonicalize-lgpl for portability");
553 /* Test a user response to a question.
554 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
556 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
558 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
559 _GL_CXXALIASWARN (rpmatch);
560 #elif defined GNULIB_POSIXCHECK
562 # if HAVE_RAW_DECL_RPMATCH
563 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
564 "use gnulib module rpmatch for portability");
569 /* Set NAME to VALUE in the environment.
570 If REPLACE is nonzero, overwrite an existing value. */
571 # if @REPLACE_SETENV@
572 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
574 # define setenv rpl_setenv
576 _GL_FUNCDECL_RPL (setenv, int,
577 (const char *name, const char *value, int replace)
578 _GL_ARG_NONNULL ((1)));
579 _GL_CXXALIAS_RPL (setenv, int,
580 (const char *name, const char *value, int replace));
583 _GL_FUNCDECL_SYS (setenv, int,
584 (const char *name, const char *value, int replace)
585 _GL_ARG_NONNULL ((1)));
587 _GL_CXXALIAS_SYS (setenv, int,
588 (const char *name, const char *value, int replace));
590 _GL_CXXALIASWARN (setenv);
591 #elif defined GNULIB_POSIXCHECK
593 # if HAVE_RAW_DECL_SETENV
594 _GL_WARN_ON_USE (setenv, "setenv is unportable - "
595 "use gnulib module setenv for portability");
600 /* Parse a double from STRING, updating ENDP if appropriate. */
601 # if @REPLACE_STRTOD@
602 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
603 # define strtod rpl_strtod
605 _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
606 _GL_ARG_NONNULL ((1)));
607 _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
610 _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
611 _GL_ARG_NONNULL ((1)));
613 _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
615 _GL_CXXALIASWARN (strtod);
616 #elif defined GNULIB_POSIXCHECK
618 # if HAVE_RAW_DECL_STRTOD
619 _GL_WARN_ON_USE (strtod, "strtod is unportable - "
620 "use gnulib module strtod for portability");
625 /* Parse a signed integer whose textual representation starts at STRING.
626 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
627 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
629 If ENDPTR is not NULL, the address of the first byte after the integer is
631 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
634 _GL_FUNCDECL_SYS (strtoll, long long,
635 (const char *string, char **endptr, int base)
636 _GL_ARG_NONNULL ((1)));
638 _GL_CXXALIAS_SYS (strtoll, long long,
639 (const char *string, char **endptr, int base));
640 _GL_CXXALIASWARN (strtoll);
641 #elif defined GNULIB_POSIXCHECK
643 # if HAVE_RAW_DECL_STRTOLL
644 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
645 "use gnulib module strtoll for portability");
649 #if @GNULIB_STRTOULL@
650 /* Parse an unsigned integer whose textual representation starts at STRING.
651 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
652 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
654 If ENDPTR is not NULL, the address of the first byte after the integer is
656 Upon overflow, the return value is ULLONG_MAX, and errno is set to
658 # if !@HAVE_STRTOULL@
659 _GL_FUNCDECL_SYS (strtoull, unsigned long long,
660 (const char *string, char **endptr, int base)
661 _GL_ARG_NONNULL ((1)));
663 _GL_CXXALIAS_SYS (strtoull, unsigned long long,
664 (const char *string, char **endptr, int base));
665 _GL_CXXALIASWARN (strtoull);
666 #elif defined GNULIB_POSIXCHECK
668 # if HAVE_RAW_DECL_STRTOULL
669 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
670 "use gnulib module strtoull for portability");
674 #if @GNULIB_UNLOCKPT@
675 /* Unlock the slave side of the pseudo-terminal whose master side is specified
676 by FD, so that it can be opened. */
677 # if !@HAVE_UNLOCKPT@
678 _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
680 _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
681 _GL_CXXALIASWARN (unlockpt);
682 #elif defined GNULIB_POSIXCHECK
684 # if HAVE_RAW_DECL_UNLOCKPT
685 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
686 "use gnulib module unlockpt for portability");
690 #if @GNULIB_UNSETENV@
691 /* Remove the variable NAME from the environment. */
692 # if @REPLACE_UNSETENV@
693 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
695 # define unsetenv rpl_unsetenv
697 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
698 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
700 # if !@HAVE_UNSETENV@
701 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
703 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
705 _GL_CXXALIASWARN (unsetenv);
706 #elif defined GNULIB_POSIXCHECK
708 # if HAVE_RAW_DECL_UNSETENV
709 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
710 "use gnulib module unsetenv for portability");
715 #endif /* _GL_STDLIB_H */
716 #endif /* _GL_STDLIB_H */