1/* A GNU-like <stdlib.h>. 2 3 Copyright (C) 1995, 2001-2004, 2006-2020 Free Software Foundation, Inc. 4 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. 9 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. 14 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/>. */ 17 18#if __GNUC__ >= 3 19@PRAGMA_SYSTEM_HEADER@ 20#endif 21@PRAGMA_COLUMNS@ 22 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. */ 26 27#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ 28 29#else 30/* Normal invocation convention. */ 31 32#ifndef _@GUARD_PREFIX@_STDLIB_H 33 34/* The include_next requires a split double-inclusion guard. */ 35#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ 36 37#ifndef _@GUARD_PREFIX@_STDLIB_H 38#define _@GUARD_PREFIX@_STDLIB_H 39 40/* NetBSD 5.0 mis-defines NULL. */ 41#include <stddef.h> 42 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> 46#endif 47 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 51 <sys/loadavg.h>. */ 52# include <sys/time.h> 53# include <sys/loadavg.h> 54#endif 55 56/* Native Windows platforms declare mktemp() in <io.h>. */ 57#if 0 && (defined _WIN32 && ! defined __CYGWIN__) 58# include <io.h> 59#endif 60 61#if @GNULIB_RANDOM_R@ 62 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'. */ 66# if @HAVE_RANDOM_H@ 67# include <random.h> 68# endif 69 70# if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@ 71# include <stdint.h> 72# endif 73 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 78struct random_data 79{ 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. */ 87}; 88# define GNULIB_defined_struct_random_data 1 89# endif 90# endif 91#endif 92 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. */ 99# include <unistd.h> 100#endif 101 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) 106# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) 107# else 108# define _GL_ATTRIBUTE_PURE /* empty */ 109# endif 110#endif 111 112/* The definition of _Noreturn is copied here. */ 113 114/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 115 116/* The definition of _GL_ARG_NONNULL is copied here. */ 117 118/* The definition of _GL_WARN_ON_USE is copied here. */ 119 120 121/* Some systems do not define EXIT_*, despite otherwise supporting C89. */ 122#ifndef EXIT_SUCCESS 123# define EXIT_SUCCESS 0 124#endif 125/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere 126 with proper operation of xargs. */ 127#ifndef EXIT_FAILURE 128# define EXIT_FAILURE 1 129#elif EXIT_FAILURE != 1 130# undef EXIT_FAILURE 131# define EXIT_FAILURE 1 132#endif 133 134 135#if @GNULIB__EXIT@ 136/* Terminate the current process with the given return code, without running 137 the 'atexit' handlers. */ 138# if !@HAVE__EXIT@ 139_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); 140# endif 141_GL_CXXALIAS_SYS (_Exit, void, (int status)); 142_GL_CXXALIASWARN (_Exit); 143#elif defined GNULIB_POSIXCHECK 144# undef _Exit 145# if HAVE_RAW_DECL__EXIT 146_GL_WARN_ON_USE (_Exit, "_Exit is unportable - " 147 "use gnulib module _Exit for portability"); 148# endif 149#endif 150 151 152#if @GNULIB_ATOLL@ 153/* Parse a signed decimal integer. 154 Returns the value of the integer. Errors are not detected. */ 155# if !@HAVE_ATOLL@ 156_GL_FUNCDECL_SYS (atoll, long long, (const char *string) 157 _GL_ATTRIBUTE_PURE 158 _GL_ARG_NONNULL ((1))); 159# endif 160_GL_CXXALIAS_SYS (atoll, long long, (const char *string)); 161_GL_CXXALIASWARN (atoll); 162#elif defined GNULIB_POSIXCHECK 163# undef atoll 164# if HAVE_RAW_DECL_ATOLL 165_GL_WARN_ON_USE (atoll, "atoll is unportable - " 166 "use gnulib module atoll for portability"); 167# endif 168#endif 169 170#if @GNULIB_CALLOC_POSIX@ 171# if @REPLACE_CALLOC@ 172# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 173# undef calloc 174# define calloc rpl_calloc 175# endif 176_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size)); 177_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); 178# else 179_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); 180# endif 181# if __GLIBC__ >= 2 182_GL_CXXALIASWARN (calloc); 183# endif 184#elif defined GNULIB_POSIXCHECK 185# undef calloc 186/* Assume calloc is always declared. */ 187_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " 188 "use gnulib module calloc-posix for portability"); 189#endif 190 191#if @GNULIB_CANONICALIZE_FILE_NAME@ 192# if @REPLACE_CANONICALIZE_FILE_NAME@ 193# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 194# define canonicalize_file_name rpl_canonicalize_file_name 195# endif 196_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name) 197 _GL_ARG_NONNULL ((1))); 198_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); 199# else 200# if !@HAVE_CANONICALIZE_FILE_NAME@ 201_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) 202 _GL_ARG_NONNULL ((1))); 203# endif 204_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); 205# endif 206# ifndef GNULIB_defined_canonicalize_file_name 207# define GNULIB_defined_canonicalize_file_name \ 208 (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@) 209# endif 210_GL_CXXALIASWARN (canonicalize_file_name); 211#elif defined GNULIB_POSIXCHECK 212# undef canonicalize_file_name 213# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME 214_GL_WARN_ON_USE (canonicalize_file_name, 215 "canonicalize_file_name is unportable - " 216 "use gnulib module canonicalize-lgpl for portability"); 217# endif 218#endif 219 220#if @GNULIB_GETLOADAVG@ 221/* Store max(NELEM,3) load average numbers in LOADAVG[]. 222 The three numbers are the load average of the last 1 minute, the last 5 223 minutes, and the last 15 minutes, respectively. 224 LOADAVG is an array of NELEM numbers. */ 225# if !@HAVE_DECL_GETLOADAVG@ 226_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) 227 _GL_ARG_NONNULL ((1))); 228# endif 229_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); 230_GL_CXXALIASWARN (getloadavg); 231#elif defined GNULIB_POSIXCHECK 232# undef getloadavg 233# if HAVE_RAW_DECL_GETLOADAVG 234_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " 235 "use gnulib module getloadavg for portability"); 236# endif 237#endif 238 239#if @GNULIB_GETSUBOPT@ 240/* Assuming *OPTIONP is a comma separated list of elements of the form 241 "token" or "token=value", getsubopt parses the first of these elements. 242 If the first element refers to a "token" that is member of the given 243 NULL-terminated array of tokens: 244 - It replaces the comma with a NUL byte, updates *OPTIONP to point past 245 the first option and the comma, sets *VALUEP to the value of the 246 element (or NULL if it doesn't contain an "=" sign), 247 - It returns the index of the "token" in the given array of tokens. 248 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. 249 For more details see the POSIX specification. 250 https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */ 251# if !@HAVE_GETSUBOPT@ 252_GL_FUNCDECL_SYS (getsubopt, int, 253 (char **optionp, char *const *tokens, char **valuep) 254 _GL_ARG_NONNULL ((1, 2, 3))); 255# endif 256_GL_CXXALIAS_SYS (getsubopt, int, 257 (char **optionp, char *const *tokens, char **valuep)); 258_GL_CXXALIASWARN (getsubopt); 259#elif defined GNULIB_POSIXCHECK 260# undef getsubopt 261# if HAVE_RAW_DECL_GETSUBOPT 262_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " 263 "use gnulib module getsubopt for portability"); 264# endif 265#endif 266 267#if @GNULIB_GRANTPT@ 268/* Change the ownership and access permission of the slave side of the 269 pseudo-terminal whose master side is specified by FD. */ 270# if !@HAVE_GRANTPT@ 271_GL_FUNCDECL_SYS (grantpt, int, (int fd)); 272# endif 273_GL_CXXALIAS_SYS (grantpt, int, (int fd)); 274_GL_CXXALIASWARN (grantpt); 275#elif defined GNULIB_POSIXCHECK 276# undef grantpt 277# if HAVE_RAW_DECL_GRANTPT 278_GL_WARN_ON_USE (grantpt, "grantpt is not portable - " 279 "use gnulib module grantpt for portability"); 280# endif 281#endif 282 283/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not 284 rely on GNU or POSIX semantics for malloc and realloc (for example, 285 by never specifying a zero size), so it does not need malloc or 286 realloc to be redefined. */ 287#if @GNULIB_MALLOC_POSIX@ 288# if @REPLACE_MALLOC@ 289# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 290 || _GL_USE_STDLIB_ALLOC) 291# undef malloc 292# define malloc rpl_malloc 293# endif 294_GL_FUNCDECL_RPL (malloc, void *, (size_t size)); 295_GL_CXXALIAS_RPL (malloc, void *, (size_t size)); 296# else 297_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); 298# endif 299# if __GLIBC__ >= 2 300_GL_CXXALIASWARN (malloc); 301# endif 302#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 303# undef malloc 304/* Assume malloc is always declared. */ 305_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " 306 "use gnulib module malloc-posix for portability"); 307#endif 308 309/* Convert a multibyte character to a wide character. */ 310#if @GNULIB_MBTOWC@ 311# if @REPLACE_MBTOWC@ 312# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 313# undef mbtowc 314# define mbtowc rpl_mbtowc 315# endif 316_GL_FUNCDECL_RPL (mbtowc, int, 317 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 318_GL_CXXALIAS_RPL (mbtowc, int, 319 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 320# else 321# if !@HAVE_MBTOWC@ 322_GL_FUNCDECL_SYS (mbtowc, int, 323 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 324# endif 325_GL_CXXALIAS_SYS (mbtowc, int, 326 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 327# endif 328# if __GLIBC__ >= 2 329_GL_CXXALIASWARN (mbtowc); 330# endif 331#elif defined GNULIB_POSIXCHECK 332# undef mbtowc 333# if HAVE_RAW_DECL_MBTOWC 334_GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " 335 "use gnulib module mbtowc for portability"); 336# endif 337#endif 338 339#if @GNULIB_MKDTEMP@ 340/* Create a unique temporary directory from TEMPLATE. 341 The last six characters of TEMPLATE must be "XXXXXX"; 342 they are replaced with a string that makes the directory name unique. 343 Returns TEMPLATE, or a null pointer if it cannot get a unique name. 344 The directory is created mode 700. */ 345# if !@HAVE_MKDTEMP@ 346_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); 347# endif 348_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); 349_GL_CXXALIASWARN (mkdtemp); 350#elif defined GNULIB_POSIXCHECK 351# undef mkdtemp 352# if HAVE_RAW_DECL_MKDTEMP 353_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " 354 "use gnulib module mkdtemp for portability"); 355# endif 356#endif 357 358#if @GNULIB_MKOSTEMP@ 359/* Create a unique temporary file from TEMPLATE. 360 The last six characters of TEMPLATE must be "XXXXXX"; 361 they are replaced with a string that makes the file name unique. 362 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 363 and O_TEXT, O_BINARY (defined in "binary-io.h"). 364 The file is then created, with the specified flags, ensuring it didn't exist 365 before. 366 The file is created read-write (mask at least 0600 & ~umask), but it may be 367 world-readable and world-writable (mask 0666 & ~umask), depending on the 368 implementation. 369 Returns the open file descriptor if successful, otherwise -1 and errno 370 set. */ 371# if !@HAVE_MKOSTEMP@ 372_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) 373 _GL_ARG_NONNULL ((1))); 374# endif 375_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); 376_GL_CXXALIASWARN (mkostemp); 377#elif defined GNULIB_POSIXCHECK 378# undef mkostemp 379# if HAVE_RAW_DECL_MKOSTEMP 380_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " 381 "use gnulib module mkostemp for portability"); 382# endif 383#endif 384 385#if @GNULIB_MKOSTEMPS@ 386/* Create a unique temporary file from TEMPLATE. 387 The last six characters of TEMPLATE before a suffix of length 388 SUFFIXLEN must be "XXXXXX"; 389 they are replaced with a string that makes the file name unique. 390 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) 391 and O_TEXT, O_BINARY (defined in "binary-io.h"). 392 The file is then created, with the specified flags, ensuring it didn't exist 393 before. 394 The file is created read-write (mask at least 0600 & ~umask), but it may be 395 world-readable and world-writable (mask 0666 & ~umask), depending on the 396 implementation. 397 Returns the open file descriptor if successful, otherwise -1 and errno 398 set. */ 399# if !@HAVE_MKOSTEMPS@ 400_GL_FUNCDECL_SYS (mkostemps, int, 401 (char * /*template*/, int /*suffixlen*/, int /*flags*/) 402 _GL_ARG_NONNULL ((1))); 403# endif 404_GL_CXXALIAS_SYS (mkostemps, int, 405 (char * /*template*/, int /*suffixlen*/, int /*flags*/)); 406_GL_CXXALIASWARN (mkostemps); 407#elif defined GNULIB_POSIXCHECK 408# undef mkostemps 409# if HAVE_RAW_DECL_MKOSTEMPS 410_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " 411 "use gnulib module mkostemps for portability"); 412# endif 413#endif 414 415#if @GNULIB_MKSTEMP@ 416/* Create a unique temporary file from TEMPLATE. 417 The last six characters of TEMPLATE must be "XXXXXX"; 418 they are replaced with a string that makes the file name unique. 419 The file is then created, ensuring it didn't exist before. 420 The file is created read-write (mask at least 0600 & ~umask), but it may be 421 world-readable and world-writable (mask 0666 & ~umask), depending on the 422 implementation. 423 Returns the open file descriptor if successful, otherwise -1 and errno 424 set. */ 425# if @REPLACE_MKSTEMP@ 426# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 427# define mkstemp rpl_mkstemp 428# endif 429_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 430_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); 431# else 432# if ! @HAVE_MKSTEMP@ 433_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 434# endif 435_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); 436# endif 437_GL_CXXALIASWARN (mkstemp); 438#elif defined GNULIB_POSIXCHECK 439# undef mkstemp 440# if HAVE_RAW_DECL_MKSTEMP 441_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " 442 "use gnulib module mkstemp for portability"); 443# endif 444#endif 445 446#if @GNULIB_MKSTEMPS@ 447/* Create a unique temporary file from TEMPLATE. 448 The last six characters of TEMPLATE prior to a suffix of length 449 SUFFIXLEN must be "XXXXXX"; 450 they are replaced with a string that makes the file name unique. 451 The file is then created, ensuring it didn't exist before. 452 The file is created read-write (mask at least 0600 & ~umask), but it may be 453 world-readable and world-writable (mask 0666 & ~umask), depending on the 454 implementation. 455 Returns the open file descriptor if successful, otherwise -1 and errno 456 set. */ 457# if !@HAVE_MKSTEMPS@ 458_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) 459 _GL_ARG_NONNULL ((1))); 460# endif 461_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); 462_GL_CXXALIASWARN (mkstemps); 463#elif defined GNULIB_POSIXCHECK 464# undef mkstemps 465# if HAVE_RAW_DECL_MKSTEMPS 466_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " 467 "use gnulib module mkstemps for portability"); 468# endif 469#endif 470 471#if @GNULIB_POSIX_OPENPT@ 472/* Return an FD open to the master side of a pseudo-terminal. Flags should 473 include O_RDWR, and may also include O_NOCTTY. */ 474# if !@HAVE_POSIX_OPENPT@ 475_GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); 476# endif 477_GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); 478_GL_CXXALIASWARN (posix_openpt); 479#elif defined GNULIB_POSIXCHECK 480# undef posix_openpt 481# if HAVE_RAW_DECL_POSIX_OPENPT 482_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " 483 "use gnulib module posix_openpt for portability"); 484# endif 485#endif 486 487#if @GNULIB_PTSNAME@ 488/* Return the pathname of the pseudo-terminal slave associated with 489 the master FD is open on, or NULL on errors. */ 490# if @REPLACE_PTSNAME@ 491# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 492# undef ptsname 493# define ptsname rpl_ptsname 494# endif 495_GL_FUNCDECL_RPL (ptsname, char *, (int fd)); 496_GL_CXXALIAS_RPL (ptsname, char *, (int fd)); 497# else 498# if !@HAVE_PTSNAME@ 499_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); 500# endif 501_GL_CXXALIAS_SYS (ptsname, char *, (int fd)); 502# endif 503_GL_CXXALIASWARN (ptsname); 504#elif defined GNULIB_POSIXCHECK 505# undef ptsname 506# if HAVE_RAW_DECL_PTSNAME 507_GL_WARN_ON_USE (ptsname, "ptsname is not portable - " 508 "use gnulib module ptsname for portability"); 509# endif 510#endif 511 512#if @GNULIB_PTSNAME_R@ 513/* Set the pathname of the pseudo-terminal slave associated with 514 the master FD is open on and return 0, or set errno and return 515 non-zero on errors. */ 516# if @REPLACE_PTSNAME_R@ 517# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 518# undef ptsname_r 519# define ptsname_r rpl_ptsname_r 520# endif 521_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); 522_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); 523# else 524# if !@HAVE_PTSNAME_R@ 525_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 526# endif 527_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 528# endif 529# ifndef GNULIB_defined_ptsname_r 530# define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@) 531# endif 532_GL_CXXALIASWARN (ptsname_r); 533#elif defined GNULIB_POSIXCHECK 534# undef ptsname_r 535# if HAVE_RAW_DECL_PTSNAME_R 536_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " 537 "use gnulib module ptsname_r for portability"); 538# endif 539#endif 540 541#if @GNULIB_PUTENV@ 542# if @REPLACE_PUTENV@ 543# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 544# undef putenv 545# define putenv rpl_putenv 546# endif 547_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); 548_GL_CXXALIAS_RPL (putenv, int, (char *string)); 549# else 550_GL_CXXALIAS_SYS (putenv, int, (char *string)); 551# endif 552_GL_CXXALIASWARN (putenv); 553#endif 554 555#if @GNULIB_QSORT_R@ 556/* Sort an array of NMEMB elements, starting at address BASE, each element 557 occupying SIZE bytes, in ascending order according to the comparison 558 function COMPARE. */ 559# if @REPLACE_QSORT_R@ 560# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 561# undef qsort_r 562# define qsort_r rpl_qsort_r 563# endif 564_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 565 int (*compare) (void const *, void const *, 566 void *), 567 void *arg) _GL_ARG_NONNULL ((1, 4))); 568_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 569 int (*compare) (void const *, void const *, 570 void *), 571 void *arg)); 572# else 573# if !@HAVE_QSORT_R@ 574_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 575 int (*compare) (void const *, void const *, 576 void *), 577 void *arg) _GL_ARG_NONNULL ((1, 4))); 578# endif 579_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 580 int (*compare) (void const *, void const *, 581 void *), 582 void *arg)); 583# endif 584_GL_CXXALIASWARN (qsort_r); 585#elif defined GNULIB_POSIXCHECK 586# undef qsort_r 587# if HAVE_RAW_DECL_QSORT_R 588_GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " 589 "use gnulib module qsort_r for portability"); 590# endif 591#endif 592 593 594#if @GNULIB_RANDOM_R@ 595# if !@HAVE_RANDOM_R@ 596# ifndef RAND_MAX 597# define RAND_MAX 2147483647 598# endif 599# endif 600#endif 601 602 603#if @GNULIB_RANDOM@ 604# if @REPLACE_RANDOM@ 605# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 606# undef random 607# define random rpl_random 608# endif 609_GL_FUNCDECL_RPL (random, long, (void)); 610_GL_CXXALIAS_RPL (random, long, (void)); 611# else 612# if !@HAVE_RANDOM@ 613_GL_FUNCDECL_SYS (random, long, (void)); 614# endif 615/* Need to cast, because on Haiku, the return type is 616 int. */ 617_GL_CXXALIAS_SYS_CAST (random, long, (void)); 618# endif 619_GL_CXXALIASWARN (random); 620#elif defined GNULIB_POSIXCHECK 621# undef random 622# if HAVE_RAW_DECL_RANDOM 623_GL_WARN_ON_USE (random, "random is unportable - " 624 "use gnulib module random for portability"); 625# endif 626#endif 627 628#if @GNULIB_RANDOM@ 629# if @REPLACE_RANDOM@ 630# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 631# undef srandom 632# define srandom rpl_srandom 633# endif 634_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); 635_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); 636# else 637# if !@HAVE_RANDOM@ 638_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); 639# endif 640/* Need to cast, because on FreeBSD, the first parameter is 641 unsigned long seed. */ 642_GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); 643# endif 644_GL_CXXALIASWARN (srandom); 645#elif defined GNULIB_POSIXCHECK 646# undef srandom 647# if HAVE_RAW_DECL_SRANDOM 648_GL_WARN_ON_USE (srandom, "srandom is unportable - " 649 "use gnulib module random for portability"); 650# endif 651#endif 652 653#if @GNULIB_RANDOM@ 654# if @REPLACE_INITSTATE@ 655# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 656# undef initstate 657# define initstate rpl_initstate 658# endif 659_GL_FUNCDECL_RPL (initstate, char *, 660 (unsigned int seed, char *buf, size_t buf_size) 661 _GL_ARG_NONNULL ((2))); 662_GL_CXXALIAS_RPL (initstate, char *, 663 (unsigned int seed, char *buf, size_t buf_size)); 664# else 665# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ 666_GL_FUNCDECL_SYS (initstate, char *, 667 (unsigned int seed, char *buf, size_t buf_size) 668 _GL_ARG_NONNULL ((2))); 669# endif 670/* Need to cast, because on FreeBSD, the first parameter is 671 unsigned long seed. */ 672_GL_CXXALIAS_SYS_CAST (initstate, char *, 673 (unsigned int seed, char *buf, size_t buf_size)); 674# endif 675_GL_CXXALIASWARN (initstate); 676#elif defined GNULIB_POSIXCHECK 677# undef initstate 678# if HAVE_RAW_DECL_INITSTATE 679_GL_WARN_ON_USE (initstate, "initstate is unportable - " 680 "use gnulib module random for portability"); 681# endif 682#endif 683 684#if @GNULIB_RANDOM@ 685# if @REPLACE_SETSTATE@ 686# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 687# undef setstate 688# define setstate rpl_setstate 689# endif 690_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 691_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); 692# else 693# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ 694_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 695# endif 696/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter 697 is const char *arg_state. */ 698_GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state)); 699# endif 700_GL_CXXALIASWARN (setstate); 701#elif defined GNULIB_POSIXCHECK 702# undef setstate 703# if HAVE_RAW_DECL_SETSTATE 704_GL_WARN_ON_USE (setstate, "setstate is unportable - " 705 "use gnulib module random for portability"); 706# endif 707#endif 708 709 710#if @GNULIB_RANDOM_R@ 711# if @REPLACE_RANDOM_R@ 712# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 713# undef random_r 714# define random_r rpl_random_r 715# endif 716_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) 717 _GL_ARG_NONNULL ((1, 2))); 718_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); 719# else 720# if !@HAVE_RANDOM_R@ 721_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) 722 _GL_ARG_NONNULL ((1, 2))); 723# endif 724_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); 725# endif 726_GL_CXXALIASWARN (random_r); 727#elif defined GNULIB_POSIXCHECK 728# undef random_r 729# if HAVE_RAW_DECL_RANDOM_R 730_GL_WARN_ON_USE (random_r, "random_r is unportable - " 731 "use gnulib module random_r for portability"); 732# endif 733#endif 734 735#if @GNULIB_RANDOM_R@ 736# if @REPLACE_RANDOM_R@ 737# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 738# undef srandom_r 739# define srandom_r rpl_srandom_r 740# endif 741_GL_FUNCDECL_RPL (srandom_r, int, 742 (unsigned int seed, struct random_data *rand_state) 743 _GL_ARG_NONNULL ((2))); 744_GL_CXXALIAS_RPL (srandom_r, int, 745 (unsigned int seed, struct random_data *rand_state)); 746# else 747# if !@HAVE_RANDOM_R@ 748_GL_FUNCDECL_SYS (srandom_r, int, 749 (unsigned int seed, struct random_data *rand_state) 750 _GL_ARG_NONNULL ((2))); 751# endif 752_GL_CXXALIAS_SYS (srandom_r, int, 753 (unsigned int seed, struct random_data *rand_state)); 754# endif 755_GL_CXXALIASWARN (srandom_r); 756#elif defined GNULIB_POSIXCHECK 757# undef srandom_r 758# if HAVE_RAW_DECL_SRANDOM_R 759_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " 760 "use gnulib module random_r for portability"); 761# endif 762#endif 763 764#if @GNULIB_RANDOM_R@ 765# if @REPLACE_RANDOM_R@ 766# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 767# undef initstate_r 768# define initstate_r rpl_initstate_r 769# endif 770_GL_FUNCDECL_RPL (initstate_r, int, 771 (unsigned int seed, char *buf, size_t buf_size, 772 struct random_data *rand_state) 773 _GL_ARG_NONNULL ((2, 4))); 774_GL_CXXALIAS_RPL (initstate_r, int, 775 (unsigned int seed, char *buf, size_t buf_size, 776 struct random_data *rand_state)); 777# else 778# if !@HAVE_RANDOM_R@ 779_GL_FUNCDECL_SYS (initstate_r, int, 780 (unsigned int seed, char *buf, size_t buf_size, 781 struct random_data *rand_state) 782 _GL_ARG_NONNULL ((2, 4))); 783# endif 784/* Need to cast, because on Haiku, the third parameter is 785 unsigned long buf_size. */ 786_GL_CXXALIAS_SYS_CAST (initstate_r, int, 787 (unsigned int seed, char *buf, size_t buf_size, 788 struct random_data *rand_state)); 789# endif 790_GL_CXXALIASWARN (initstate_r); 791#elif defined GNULIB_POSIXCHECK 792# undef initstate_r 793# if HAVE_RAW_DECL_INITSTATE_R 794_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " 795 "use gnulib module random_r for portability"); 796# endif 797#endif 798 799#if @GNULIB_RANDOM_R@ 800# if @REPLACE_RANDOM_R@ 801# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 802# undef setstate_r 803# define setstate_r rpl_setstate_r 804# endif 805_GL_FUNCDECL_RPL (setstate_r, int, 806 (char *arg_state, struct random_data *rand_state) 807 _GL_ARG_NONNULL ((1, 2))); 808_GL_CXXALIAS_RPL (setstate_r, int, 809 (char *arg_state, struct random_data *rand_state)); 810# else 811# if !@HAVE_RANDOM_R@ 812_GL_FUNCDECL_SYS (setstate_r, int, 813 (char *arg_state, struct random_data *rand_state) 814 _GL_ARG_NONNULL ((1, 2))); 815# endif 816/* Need to cast, because on Haiku, the first parameter is 817 void *arg_state. */ 818_GL_CXXALIAS_SYS_CAST (setstate_r, int, 819 (char *arg_state, struct random_data *rand_state)); 820# endif 821_GL_CXXALIASWARN (setstate_r); 822#elif defined GNULIB_POSIXCHECK 823# undef setstate_r 824# if HAVE_RAW_DECL_SETSTATE_R 825_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " 826 "use gnulib module random_r for portability"); 827# endif 828#endif 829 830 831#if @GNULIB_REALLOC_POSIX@ 832# if @REPLACE_REALLOC@ 833# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 834 || _GL_USE_STDLIB_ALLOC) 835# undef realloc 836# define realloc rpl_realloc 837# endif 838_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); 839_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); 840# else 841_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); 842# endif 843# if __GLIBC__ >= 2 844_GL_CXXALIASWARN (realloc); 845# endif 846#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 847# undef realloc 848/* Assume realloc is always declared. */ 849_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " 850 "use gnulib module realloc-posix for portability"); 851#endif 852 853 854#if @GNULIB_REALLOCARRAY@ 855# if ! @HAVE_REALLOCARRAY@ 856_GL_FUNCDECL_SYS (reallocarray, void *, 857 (void *ptr, size_t nmemb, size_t size)); 858# endif 859_GL_CXXALIAS_SYS (reallocarray, void *, 860 (void *ptr, size_t nmemb, size_t size)); 861_GL_CXXALIASWARN (reallocarray); 862#elif defined GNULIB_POSIXCHECK 863# undef reallocarray 864# if HAVE_RAW_DECL_REALLOCARRAY 865_GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " 866 "use gnulib module reallocarray for portability"); 867# endif 868#endif 869 870#if @GNULIB_REALPATH@ 871# if @REPLACE_REALPATH@ 872# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 873# define realpath rpl_realpath 874# endif 875_GL_FUNCDECL_RPL (realpath, char *, 876 (const char *restrict name, char *restrict resolved) 877 _GL_ARG_NONNULL ((1))); 878_GL_CXXALIAS_RPL (realpath, char *, 879 (const char *restrict name, char *restrict resolved)); 880# else 881# if !@HAVE_REALPATH@ 882_GL_FUNCDECL_SYS (realpath, char *, 883 (const char *restrict name, char *restrict resolved) 884 _GL_ARG_NONNULL ((1))); 885# endif 886_GL_CXXALIAS_SYS (realpath, char *, 887 (const char *restrict name, char *restrict resolved)); 888# endif 889_GL_CXXALIASWARN (realpath); 890#elif defined GNULIB_POSIXCHECK 891# undef realpath 892# if HAVE_RAW_DECL_REALPATH 893_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " 894 "canonicalize or canonicalize-lgpl for portability"); 895# endif 896#endif 897 898#if @GNULIB_RPMATCH@ 899/* Test a user response to a question. 900 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ 901# if !@HAVE_RPMATCH@ 902_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); 903# endif 904_GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); 905_GL_CXXALIASWARN (rpmatch); 906#elif defined GNULIB_POSIXCHECK 907# undef rpmatch 908# if HAVE_RAW_DECL_RPMATCH 909_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " 910 "use gnulib module rpmatch for portability"); 911# endif 912#endif 913 914#if @GNULIB_SECURE_GETENV@ 915/* Look up NAME in the environment, returning 0 in insecure situations. */ 916# if !@HAVE_SECURE_GETENV@ 917_GL_FUNCDECL_SYS (secure_getenv, char *, 918 (char const *name) _GL_ARG_NONNULL ((1))); 919# endif 920_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); 921_GL_CXXALIASWARN (secure_getenv); 922#elif defined GNULIB_POSIXCHECK 923# undef secure_getenv 924# if HAVE_RAW_DECL_SECURE_GETENV 925_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " 926 "use gnulib module secure_getenv for portability"); 927# endif 928#endif 929 930#if @GNULIB_SETENV@ 931/* Set NAME to VALUE in the environment. 932 If REPLACE is nonzero, overwrite an existing value. */ 933# if @REPLACE_SETENV@ 934# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 935# undef setenv 936# define setenv rpl_setenv 937# endif 938_GL_FUNCDECL_RPL (setenv, int, 939 (const char *name, const char *value, int replace) 940 _GL_ARG_NONNULL ((1))); 941_GL_CXXALIAS_RPL (setenv, int, 942 (const char *name, const char *value, int replace)); 943# else 944# if !@HAVE_DECL_SETENV@ 945_GL_FUNCDECL_SYS (setenv, int, 946 (const char *name, const char *value, int replace) 947 _GL_ARG_NONNULL ((1))); 948# endif 949_GL_CXXALIAS_SYS (setenv, int, 950 (const char *name, const char *value, int replace)); 951# endif 952# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@) 953_GL_CXXALIASWARN (setenv); 954# endif 955#elif defined GNULIB_POSIXCHECK 956# undef setenv 957# if HAVE_RAW_DECL_SETENV 958_GL_WARN_ON_USE (setenv, "setenv is unportable - " 959 "use gnulib module setenv for portability"); 960# endif 961#endif 962 963#if @GNULIB_STRTOD@ 964 /* Parse a double from STRING, updating ENDP if appropriate. */ 965# if @REPLACE_STRTOD@ 966# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 967# define strtod rpl_strtod 968# endif 969# define GNULIB_defined_strtod_function 1 970_GL_FUNCDECL_RPL (strtod, double, 971 (const char *restrict str, char **restrict endp) 972 _GL_ARG_NONNULL ((1))); 973_GL_CXXALIAS_RPL (strtod, double, 974 (const char *restrict str, char **restrict endp)); 975# else 976# if !@HAVE_STRTOD@ 977_GL_FUNCDECL_SYS (strtod, double, 978 (const char *restrict str, char **restrict endp) 979 _GL_ARG_NONNULL ((1))); 980# endif 981_GL_CXXALIAS_SYS (strtod, double, 982 (const char *restrict str, char **restrict endp)); 983# endif 984# if __GLIBC__ >= 2 985_GL_CXXALIASWARN (strtod); 986# endif 987#elif defined GNULIB_POSIXCHECK 988# undef strtod 989# if HAVE_RAW_DECL_STRTOD 990_GL_WARN_ON_USE (strtod, "strtod is unportable - " 991 "use gnulib module strtod for portability"); 992# endif 993#endif 994 995#if @GNULIB_STRTOLD@ 996 /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ 997# if @REPLACE_STRTOLD@ 998# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 999# define strtold rpl_strtold 1000# endif 1001# define GNULIB_defined_strtold_function 1 1002_GL_FUNCDECL_RPL (strtold, long double, 1003 (const char *restrict str, char **restrict endp) 1004 _GL_ARG_NONNULL ((1))); 1005_GL_CXXALIAS_RPL (strtold, long double, 1006 (const char *restrict str, char **restrict endp)); 1007# else 1008# if !@HAVE_STRTOLD@ 1009_GL_FUNCDECL_SYS (strtold, long double, 1010 (const char *restrict str, char **restrict endp) 1011 _GL_ARG_NONNULL ((1))); 1012# endif 1013_GL_CXXALIAS_SYS (strtold, long double, 1014 (const char *restrict str, char **restrict endp)); 1015# endif 1016_GL_CXXALIASWARN (strtold); 1017#elif defined GNULIB_POSIXCHECK 1018# undef strtold 1019# if HAVE_RAW_DECL_STRTOLD 1020_GL_WARN_ON_USE (strtold, "strtold is unportable - " 1021 "use gnulib module strtold for portability"); 1022# endif 1023#endif 1024 1025#if @GNULIB_STRTOLL@ 1026/* Parse a signed integer whose textual representation starts at STRING. 1027 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, 1028 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix 1029 "0x"). 1030 If ENDPTR is not NULL, the address of the first byte after the integer is 1031 stored in *ENDPTR. 1032 Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set 1033 to ERANGE. */ 1034# if !@HAVE_STRTOLL@ 1035_GL_FUNCDECL_SYS (strtoll, long long, 1036 (const char *restrict string, char **restrict endptr, 1037 int base) 1038 _GL_ARG_NONNULL ((1))); 1039# endif 1040_GL_CXXALIAS_SYS (strtoll, long long, 1041 (const char *restrict string, char **restrict endptr, 1042 int base)); 1043_GL_CXXALIASWARN (strtoll); 1044#elif defined GNULIB_POSIXCHECK 1045# undef strtoll 1046# if HAVE_RAW_DECL_STRTOLL 1047_GL_WARN_ON_USE (strtoll, "strtoll is unportable - " 1048 "use gnulib module strtoll for portability"); 1049# endif 1050#endif 1051 1052#if @GNULIB_STRTOULL@ 1053/* Parse an unsigned integer whose textual representation starts at STRING. 1054 The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, 1055 it may be decimal or octal (with prefix "0") or hexadecimal (with prefix 1056 "0x"). 1057 If ENDPTR is not NULL, the address of the first byte after the integer is 1058 stored in *ENDPTR. 1059 Upon overflow, the return value is ULLONG_MAX, and errno is set to 1060 ERANGE. */ 1061# if !@HAVE_STRTOULL@ 1062_GL_FUNCDECL_SYS (strtoull, unsigned long long, 1063 (const char *restrict string, char **restrict endptr, 1064 int base) 1065 _GL_ARG_NONNULL ((1))); 1066# endif 1067_GL_CXXALIAS_SYS (strtoull, unsigned long long, 1068 (const char *restrict string, char **restrict endptr, 1069 int base)); 1070_GL_CXXALIASWARN (strtoull); 1071#elif defined GNULIB_POSIXCHECK 1072# undef strtoull 1073# if HAVE_RAW_DECL_STRTOULL 1074_GL_WARN_ON_USE (strtoull, "strtoull is unportable - " 1075 "use gnulib module strtoull for portability"); 1076# endif 1077#endif 1078 1079#if @GNULIB_UNLOCKPT@ 1080/* Unlock the slave side of the pseudo-terminal whose master side is specified 1081 by FD, so that it can be opened. */ 1082# if !@HAVE_UNLOCKPT@ 1083_GL_FUNCDECL_SYS (unlockpt, int, (int fd)); 1084# endif 1085_GL_CXXALIAS_SYS (unlockpt, int, (int fd)); 1086_GL_CXXALIASWARN (unlockpt); 1087#elif defined GNULIB_POSIXCHECK 1088# undef unlockpt 1089# if HAVE_RAW_DECL_UNLOCKPT 1090_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " 1091 "use gnulib module unlockpt for portability"); 1092# endif 1093#endif 1094 1095#if @GNULIB_UNSETENV@ 1096/* Remove the variable NAME from the environment. */ 1097# if @REPLACE_UNSETENV@ 1098# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1099# undef unsetenv 1100# define unsetenv rpl_unsetenv 1101# endif 1102_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1103_GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); 1104# else 1105# if !@HAVE_DECL_UNSETENV@ 1106_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1107# endif 1108_GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); 1109# endif 1110# if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@) 1111_GL_CXXALIASWARN (unsetenv); 1112# endif 1113#elif defined GNULIB_POSIXCHECK 1114# undef unsetenv 1115# if HAVE_RAW_DECL_UNSETENV 1116_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " 1117 "use gnulib module unsetenv for portability"); 1118# endif 1119#endif 1120 1121/* Convert a wide character to a multibyte character. */ 1122#if @GNULIB_WCTOMB@ 1123# if @REPLACE_WCTOMB@ 1124# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1125# undef wctomb 1126# define wctomb rpl_wctomb 1127# endif 1128_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); 1129_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); 1130# else 1131_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); 1132# endif 1133# if __GLIBC__ >= 2 1134_GL_CXXALIASWARN (wctomb); 1135# endif 1136#endif 1137 1138 1139#endif /* _@GUARD_PREFIX@_STDLIB_H */ 1140#endif /* _@GUARD_PREFIX@_STDLIB_H */ 1141#endif 1142