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,
181 "canonicalize_file_name is unportable - "
182 "use gnulib module canonicalize-lgpl for portability");
186 #if @GNULIB_GETLOADAVG@
187 /* Store max(NELEM,3) load average numbers in LOADAVG[].
188 The three numbers are the load average of the last 1 minute, the last 5
189 minutes, and the last 15 minutes, respectively.
190 LOADAVG is an array of NELEM numbers. */
191 # if !@HAVE_DECL_GETLOADAVG@
192 _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
193 _GL_ARG_NONNULL ((1)));
195 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
196 _GL_CXXALIASWARN (getloadavg);
197 #elif defined GNULIB_POSIXCHECK
199 # if HAVE_RAW_DECL_GETLOADAVG
200 _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
201 "use gnulib module getloadavg for portability");
205 #if @GNULIB_GETSUBOPT@
206 /* Assuming *OPTIONP is a comma separated list of elements of the form
207 "token" or "token=value", getsubopt parses the first of these elements.
208 If the first element refers to a "token" that is member of the given
209 NULL-terminated array of tokens:
210 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
211 the first option and the comma, sets *VALUEP to the value of the
212 element (or NULL if it doesn't contain an "=" sign),
213 - It returns the index of the "token" in the given array of tokens.
214 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
215 For more details see the POSIX:2001 specification.
216 http://www.opengroup.org/susv3xsh/getsubopt.html */
217 # if !@HAVE_GETSUBOPT@
218 _GL_FUNCDECL_SYS (getsubopt, int,
219 (char **optionp, char *const *tokens, char **valuep)
220 _GL_ARG_NONNULL ((1, 2, 3)));
222 _GL_CXXALIAS_SYS (getsubopt, int,
223 (char **optionp, char *const *tokens, char **valuep));
224 _GL_CXXALIASWARN (getsubopt);
225 #elif defined GNULIB_POSIXCHECK
227 # if HAVE_RAW_DECL_GETSUBOPT
228 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
229 "use gnulib module getsubopt for portability");
234 /* Change the ownership and access permission of the slave side of the
235 pseudo-terminal whose master side is specified by FD. */
237 _GL_FUNCDECL_SYS (grantpt, int, (int fd));
239 _GL_CXXALIAS_SYS (grantpt, int, (int fd));
240 _GL_CXXALIASWARN (grantpt);
241 #elif defined GNULIB_POSIXCHECK
243 # if HAVE_RAW_DECL_GRANTPT
244 _GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
245 "use gnulib module grantpt for portability");
249 #if @GNULIB_MALLOC_POSIX@
250 # if @REPLACE_MALLOC@
251 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
253 # define malloc rpl_malloc
255 _GL_FUNCDECL_RPL (malloc, void *, (size_t size));
256 _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
258 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
260 _GL_CXXALIASWARN (malloc);
261 #elif defined GNULIB_POSIXCHECK
263 /* Assume malloc is always declared. */
264 _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
265 "use gnulib module malloc-posix for portability");
269 /* Create a unique temporary directory from TEMPLATE.
270 The last six characters of TEMPLATE must be "XXXXXX";
271 they are replaced with a string that makes the directory name unique.
272 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
273 The directory is created mode 700. */
275 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
277 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
278 _GL_CXXALIASWARN (mkdtemp);
279 #elif defined GNULIB_POSIXCHECK
281 # if HAVE_RAW_DECL_MKDTEMP
282 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
283 "use gnulib module mkdtemp for portability");
287 #if @GNULIB_MKOSTEMP@
288 /* Create a unique temporary file from TEMPLATE.
289 The last six characters of TEMPLATE must be "XXXXXX";
290 they are replaced with a string that makes the file name unique.
291 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
292 and O_TEXT, O_BINARY (defined in "binary-io.h").
293 The file is then created, with the specified flags, ensuring it didn't exist
295 The file is created read-write (mask at least 0600 & ~umask), but it may be
296 world-readable and world-writable (mask 0666 & ~umask), depending on the
298 Returns the open file descriptor if successful, otherwise -1 and errno
300 # if !@HAVE_MKOSTEMP@
301 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
302 _GL_ARG_NONNULL ((1)));
304 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
305 _GL_CXXALIASWARN (mkostemp);
306 #elif defined GNULIB_POSIXCHECK
308 # if HAVE_RAW_DECL_MKOSTEMP
309 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
310 "use gnulib module mkostemp for portability");
314 #if @GNULIB_MKOSTEMPS@
315 /* Create a unique temporary file from TEMPLATE.
316 The last six characters of TEMPLATE before a suffix of length
317 SUFFIXLEN must be "XXXXXX";
318 they are replaced with a string that makes the file name unique.
319 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
320 and O_TEXT, O_BINARY (defined in "binary-io.h").
321 The file is then created, with the specified flags, ensuring it didn't exist
323 The file is created read-write (mask at least 0600 & ~umask), but it may be
324 world-readable and world-writable (mask 0666 & ~umask), depending on the
326 Returns the open file descriptor if successful, otherwise -1 and errno
328 # if !@HAVE_MKOSTEMPS@
329 _GL_FUNCDECL_SYS (mkostemps, int,
330 (char * /*template*/, int /*suffixlen*/, int /*flags*/)
331 _GL_ARG_NONNULL ((1)));
333 _GL_CXXALIAS_SYS (mkostemps, int,
334 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
335 _GL_CXXALIASWARN (mkostemps);
336 #elif defined GNULIB_POSIXCHECK
338 # if HAVE_RAW_DECL_MKOSTEMPS
339 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
340 "use gnulib module mkostemps for portability");
345 /* Create a unique temporary file from TEMPLATE.
346 The last six characters of TEMPLATE must be "XXXXXX";
347 they are replaced with a string that makes the file name unique.
348 The file is then created, ensuring it didn't exist before.
349 The file is created read-write (mask at least 0600 & ~umask), but it may be
350 world-readable and world-writable (mask 0666 & ~umask), depending on the
352 Returns the open file descriptor if successful, otherwise -1 and errno
354 # if @REPLACE_MKSTEMP@
355 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
356 # define mkstemp rpl_mkstemp
358 _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
359 _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
361 # if ! @HAVE_MKSTEMP@
362 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
364 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
366 _GL_CXXALIASWARN (mkstemp);
367 #elif defined GNULIB_POSIXCHECK
369 # if HAVE_RAW_DECL_MKSTEMP
370 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
371 "use gnulib module mkstemp for portability");
375 #if @GNULIB_MKSTEMPS@
376 /* Create a unique temporary file from TEMPLATE.
377 The last six characters of TEMPLATE prior to a suffix of length
378 SUFFIXLEN must be "XXXXXX";
379 they are replaced with a string that makes the file name unique.
380 The file is then created, ensuring it didn't exist before.
381 The file is created read-write (mask at least 0600 & ~umask), but it may be
382 world-readable and world-writable (mask 0666 & ~umask), depending on the
384 Returns the open file descriptor if successful, otherwise -1 and errno
386 # if !@HAVE_MKSTEMPS@
387 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
388 _GL_ARG_NONNULL ((1)));
390 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
391 _GL_CXXALIASWARN (mkstemps);
392 #elif defined GNULIB_POSIXCHECK
394 # if HAVE_RAW_DECL_MKSTEMPS
395 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
396 "use gnulib module mkstemps for portability");
401 /* Return the pathname of the pseudo-terminal slave associated with
402 the master FD is open on, or NULL on errors. */
404 _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
406 _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
407 _GL_CXXALIASWARN (ptsname);
408 #elif defined GNULIB_POSIXCHECK
410 # if HAVE_RAW_DECL_PTSNAME
411 _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
412 "use gnulib module ptsname for portability");
417 # if @REPLACE_PUTENV@
418 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
420 # define putenv rpl_putenv
422 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
423 _GL_CXXALIAS_RPL (putenv, int, (char *string));
425 _GL_CXXALIAS_SYS (putenv, int, (char *string));
427 _GL_CXXALIASWARN (putenv);
431 #if @GNULIB_RANDOM_R@
432 # if !@HAVE_RANDOM_R@
434 # define RAND_MAX 2147483647
439 #if @GNULIB_RANDOM_R@
440 # if !@HAVE_RANDOM_R@
441 _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
442 _GL_ARG_NONNULL ((1, 2)));
444 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
445 _GL_CXXALIASWARN (random_r);
446 #elif defined GNULIB_POSIXCHECK
448 # if HAVE_RAW_DECL_RANDOM_R
449 _GL_WARN_ON_USE (random_r, "random_r is unportable - "
450 "use gnulib module random_r for portability");
454 #if @GNULIB_RANDOM_R@
455 # if !@HAVE_RANDOM_R@
456 _GL_FUNCDECL_SYS (srandom_r, int,
457 (unsigned int seed, struct random_data *rand_state)
458 _GL_ARG_NONNULL ((2)));
460 _GL_CXXALIAS_SYS (srandom_r, int,
461 (unsigned int seed, struct random_data *rand_state));
462 _GL_CXXALIASWARN (srandom_r);
463 #elif defined GNULIB_POSIXCHECK
465 # if HAVE_RAW_DECL_SRANDOM_R
466 _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
467 "use gnulib module random_r for portability");
471 #if @GNULIB_RANDOM_R@
472 # if !@HAVE_RANDOM_R@
473 _GL_FUNCDECL_SYS (initstate_r, int,
474 (unsigned int seed, char *buf, size_t buf_size,
475 struct random_data *rand_state)
476 _GL_ARG_NONNULL ((2, 4)));
478 _GL_CXXALIAS_SYS (initstate_r, int,
479 (unsigned int seed, char *buf, size_t buf_size,
480 struct random_data *rand_state));
481 _GL_CXXALIASWARN (initstate_r);
482 #elif defined GNULIB_POSIXCHECK
484 # if HAVE_RAW_DECL_INITSTATE_R
485 _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
486 "use gnulib module random_r for portability");
490 #if @GNULIB_RANDOM_R@
491 # if !@HAVE_RANDOM_R@
492 _GL_FUNCDECL_SYS (setstate_r, int,
493 (char *arg_state, struct random_data *rand_state)
494 _GL_ARG_NONNULL ((1, 2)));
496 _GL_CXXALIAS_SYS (setstate_r, int,
497 (char *arg_state, struct random_data *rand_state));
498 _GL_CXXALIASWARN (setstate_r);
499 #elif defined GNULIB_POSIXCHECK
501 # if HAVE_RAW_DECL_SETSTATE_R
502 _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
503 "use gnulib module random_r for portability");
508 #if @GNULIB_REALLOC_POSIX@
509 # if @REPLACE_REALLOC@
510 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
512 # define realloc rpl_realloc
514 _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
515 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
517 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
519 _GL_CXXALIASWARN (realloc);
520 #elif defined GNULIB_POSIXCHECK
522 /* Assume realloc is always declared. */
523 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
524 "use gnulib module realloc-posix for portability");
527 #if @GNULIB_REALPATH@
528 # if @REPLACE_REALPATH@
529 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
530 # define realpath rpl_realpath
532 _GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
533 _GL_ARG_NONNULL ((1)));
534 _GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
536 # if !@HAVE_REALPATH@
537 _GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
538 _GL_ARG_NONNULL ((1)));
540 _GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
542 _GL_CXXALIASWARN (realpath);
543 #elif defined GNULIB_POSIXCHECK
545 # if HAVE_RAW_DECL_REALPATH
546 _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
547 "canonicalize or canonicalize-lgpl for portability");
552 /* Test a user response to a question.
553 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
555 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
557 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
558 _GL_CXXALIASWARN (rpmatch);
559 #elif defined GNULIB_POSIXCHECK
561 # if HAVE_RAW_DECL_RPMATCH
562 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
563 "use gnulib module rpmatch for portability");
568 /* Set NAME to VALUE in the environment.
569 If REPLACE is nonzero, overwrite an existing value. */
570 # if @REPLACE_SETENV@
571 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
573 # define setenv rpl_setenv
575 _GL_FUNCDECL_RPL (setenv, int,
576 (const char *name, const char *value, int replace)
577 _GL_ARG_NONNULL ((1)));
578 _GL_CXXALIAS_RPL (setenv, int,
579 (const char *name, const char *value, int replace));
582 _GL_FUNCDECL_SYS (setenv, int,
583 (const char *name, const char *value, int replace)
584 _GL_ARG_NONNULL ((1)));
586 _GL_CXXALIAS_SYS (setenv, int,
587 (const char *name, const char *value, int replace));
589 _GL_CXXALIASWARN (setenv);
590 #elif defined GNULIB_POSIXCHECK
592 # if HAVE_RAW_DECL_SETENV
593 _GL_WARN_ON_USE (setenv, "setenv is unportable - "
594 "use gnulib module setenv for portability");
599 /* Parse a double from STRING, updating ENDP if appropriate. */
600 # if @REPLACE_STRTOD@
601 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
602 # define strtod rpl_strtod
604 _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
605 _GL_ARG_NONNULL ((1)));
606 _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
609 _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
610 _GL_ARG_NONNULL ((1)));
612 _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
614 _GL_CXXALIASWARN (strtod);
615 #elif defined GNULIB_POSIXCHECK
617 # if HAVE_RAW_DECL_STRTOD
618 _GL_WARN_ON_USE (strtod, "strtod is unportable - "
619 "use gnulib module strtod for portability");
624 /* Parse a signed integer whose textual representation starts at STRING.
625 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
626 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
628 If ENDPTR is not NULL, the address of the first byte after the integer is
630 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
633 _GL_FUNCDECL_SYS (strtoll, long long,
634 (const char *string, char **endptr, int base)
635 _GL_ARG_NONNULL ((1)));
637 _GL_CXXALIAS_SYS (strtoll, long long,
638 (const char *string, char **endptr, int base));
639 _GL_CXXALIASWARN (strtoll);
640 #elif defined GNULIB_POSIXCHECK
642 # if HAVE_RAW_DECL_STRTOLL
643 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
644 "use gnulib module strtoll for portability");
648 #if @GNULIB_STRTOULL@
649 /* Parse an unsigned integer whose textual representation starts at STRING.
650 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
651 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
653 If ENDPTR is not NULL, the address of the first byte after the integer is
655 Upon overflow, the return value is ULLONG_MAX, and errno is set to
657 # if !@HAVE_STRTOULL@
658 _GL_FUNCDECL_SYS (strtoull, unsigned long long,
659 (const char *string, char **endptr, int base)
660 _GL_ARG_NONNULL ((1)));
662 _GL_CXXALIAS_SYS (strtoull, unsigned long long,
663 (const char *string, char **endptr, int base));
664 _GL_CXXALIASWARN (strtoull);
665 #elif defined GNULIB_POSIXCHECK
667 # if HAVE_RAW_DECL_STRTOULL
668 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
669 "use gnulib module strtoull for portability");
673 #if @GNULIB_UNLOCKPT@
674 /* Unlock the slave side of the pseudo-terminal whose master side is specified
675 by FD, so that it can be opened. */
676 # if !@HAVE_UNLOCKPT@
677 _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
679 _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
680 _GL_CXXALIASWARN (unlockpt);
681 #elif defined GNULIB_POSIXCHECK
683 # if HAVE_RAW_DECL_UNLOCKPT
684 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
685 "use gnulib module unlockpt for portability");
689 #if @GNULIB_UNSETENV@
690 /* Remove the variable NAME from the environment. */
691 # if @REPLACE_UNSETENV@
692 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
694 # define unsetenv rpl_unsetenv
696 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
697 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
699 # if !@HAVE_UNSETENV@
700 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
702 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
704 _GL_CXXALIASWARN (unsetenv);
705 #elif defined GNULIB_POSIXCHECK
707 # if HAVE_RAW_DECL_UNSETENV
708 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
709 "use gnulib module unsetenv for portability");
714 #endif /* _GL_STDLIB_H */
715 #endif /* _GL_STDLIB_H */