stdlib.in.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. /* A GNU-like <stdlib.h>.
  2. Copyright (C) 1995, 2001-2004, 2006-2011 Free Software Foundation, Inc.
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Lesser General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. #if __GNUC__ >= 3
  14. @PRAGMA_SYSTEM_HEADER@
  15. #endif
  16. @PRAGMA_COLUMNS@
  17. #if defined __need_malloc_and_calloc
  18. /* Special invocation convention inside glibc header files. */
  19. #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
  20. #else
  21. /* Normal invocation convention. */
  22. #ifndef _@GUARD_PREFIX@_STDLIB_H
  23. /* The include_next requires a split double-inclusion guard. */
  24. #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
  25. #ifndef _@GUARD_PREFIX@_STDLIB_H
  26. #define _@GUARD_PREFIX@_STDLIB_H
  27. /* NetBSD 5.0 mis-defines NULL. */
  28. #include <stddef.h>
  29. /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
  30. #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
  31. # include <sys/wait.h>
  32. #endif
  33. /* Solaris declares getloadavg() in <sys/loadavg.h>. */
  34. #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
  35. # include <sys/loadavg.h>
  36. #endif
  37. #if @GNULIB_RANDOM_R@
  38. /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
  39. from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
  40. 'struct random_data'. */
  41. # if @HAVE_RANDOM_H@
  42. # include <random.h>
  43. # endif
  44. # if !@HAVE_STRUCT_RANDOM_DATA@ || !@HAVE_RANDOM_R@
  45. # include <stdint.h>
  46. # endif
  47. # if !@HAVE_STRUCT_RANDOM_DATA@
  48. /* Define 'struct random_data'.
  49. But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
  50. # if !GNULIB_defined_struct_random_data
  51. struct random_data
  52. {
  53. int32_t *fptr; /* Front pointer. */
  54. int32_t *rptr; /* Rear pointer. */
  55. int32_t *state; /* Array of state values. */
  56. int rand_type; /* Type of random number generator. */
  57. int rand_deg; /* Degree of random number generator. */
  58. int rand_sep; /* Distance between front and rear. */
  59. int32_t *end_ptr; /* Pointer behind state table. */
  60. };
  61. # define GNULIB_defined_struct_random_data 1
  62. # endif
  63. # endif
  64. #endif
  65. #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
  66. /* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
  67. /* On MacOS X 10.5, only <unistd.h> declares mkstemps. */
  68. /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
  69. /* But avoid namespace pollution on glibc systems and native Windows. */
  70. # include <unistd.h>
  71. #endif
  72. /* The definition of _Noreturn is copied here. */
  73. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  74. /* The definition of _GL_ARG_NONNULL is copied here. */
  75. /* The definition of _GL_WARN_ON_USE is copied here. */
  76. /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
  77. #ifndef EXIT_SUCCESS
  78. # define EXIT_SUCCESS 0
  79. #endif
  80. /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
  81. with proper operation of xargs. */
  82. #ifndef EXIT_FAILURE
  83. # define EXIT_FAILURE 1
  84. #elif EXIT_FAILURE != 1
  85. # undef EXIT_FAILURE
  86. # define EXIT_FAILURE 1
  87. #endif
  88. #if @GNULIB__EXIT@
  89. /* Terminate the current process with the given return code, without running
  90. the 'atexit' handlers. */
  91. # if !@HAVE__EXIT@
  92. _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
  93. # endif
  94. _GL_CXXALIAS_SYS (_Exit, void, (int status));
  95. _GL_CXXALIASWARN (_Exit);
  96. #elif defined GNULIB_POSIXCHECK
  97. # undef _Exit
  98. # if HAVE_RAW_DECL__EXIT
  99. _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
  100. "use gnulib module _Exit for portability");
  101. # endif
  102. #endif
  103. #if @GNULIB_ATOLL@
  104. /* Parse a signed decimal integer.
  105. Returns the value of the integer. Errors are not detected. */
  106. # if !@HAVE_ATOLL@
  107. _GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1)));
  108. # endif
  109. _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
  110. _GL_CXXALIASWARN (atoll);
  111. #elif defined GNULIB_POSIXCHECK
  112. # undef atoll
  113. # if HAVE_RAW_DECL_ATOLL
  114. _GL_WARN_ON_USE (atoll, "atoll is unportable - "
  115. "use gnulib module atoll for portability");
  116. # endif
  117. #endif
  118. #if @GNULIB_CALLOC_POSIX@
  119. # if @REPLACE_CALLOC@
  120. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  121. # undef calloc
  122. # define calloc rpl_calloc
  123. # endif
  124. _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
  125. _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
  126. # else
  127. _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
  128. # endif
  129. _GL_CXXALIASWARN (calloc);
  130. #elif defined GNULIB_POSIXCHECK
  131. # undef calloc
  132. /* Assume calloc is always declared. */
  133. _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
  134. "use gnulib module calloc-posix for portability");
  135. #endif
  136. #if @GNULIB_CANONICALIZE_FILE_NAME@
  137. # if @REPLACE_CANONICALIZE_FILE_NAME@
  138. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  139. # define canonicalize_file_name rpl_canonicalize_file_name
  140. # endif
  141. _GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
  142. _GL_ARG_NONNULL ((1)));
  143. _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
  144. # else
  145. # if !@HAVE_CANONICALIZE_FILE_NAME@
  146. _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
  147. _GL_ARG_NONNULL ((1)));
  148. # endif
  149. _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
  150. # endif
  151. _GL_CXXALIASWARN (canonicalize_file_name);
  152. #elif defined GNULIB_POSIXCHECK
  153. # undef canonicalize_file_name
  154. # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
  155. _GL_WARN_ON_USE (canonicalize_file_name,
  156. "canonicalize_file_name is unportable - "
  157. "use gnulib module canonicalize-lgpl for portability");
  158. # endif
  159. #endif
  160. #if @GNULIB_GETLOADAVG@
  161. /* Store max(NELEM,3) load average numbers in LOADAVG[].
  162. The three numbers are the load average of the last 1 minute, the last 5
  163. minutes, and the last 15 minutes, respectively.
  164. LOADAVG is an array of NELEM numbers. */
  165. # if !@HAVE_DECL_GETLOADAVG@
  166. _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
  167. _GL_ARG_NONNULL ((1)));
  168. # endif
  169. _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
  170. _GL_CXXALIASWARN (getloadavg);
  171. #elif defined GNULIB_POSIXCHECK
  172. # undef getloadavg
  173. # if HAVE_RAW_DECL_GETLOADAVG
  174. _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
  175. "use gnulib module getloadavg for portability");
  176. # endif
  177. #endif
  178. #if @GNULIB_GETSUBOPT@
  179. /* Assuming *OPTIONP is a comma separated list of elements of the form
  180. "token" or "token=value", getsubopt parses the first of these elements.
  181. If the first element refers to a "token" that is member of the given
  182. NULL-terminated array of tokens:
  183. - It replaces the comma with a NUL byte, updates *OPTIONP to point past
  184. the first option and the comma, sets *VALUEP to the value of the
  185. element (or NULL if it doesn't contain an "=" sign),
  186. - It returns the index of the "token" in the given array of tokens.
  187. Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
  188. For more details see the POSIX:2001 specification.
  189. http://www.opengroup.org/susv3xsh/getsubopt.html */
  190. # if !@HAVE_GETSUBOPT@
  191. _GL_FUNCDECL_SYS (getsubopt, int,
  192. (char **optionp, char *const *tokens, char **valuep)
  193. _GL_ARG_NONNULL ((1, 2, 3)));
  194. # endif
  195. _GL_CXXALIAS_SYS (getsubopt, int,
  196. (char **optionp, char *const *tokens, char **valuep));
  197. _GL_CXXALIASWARN (getsubopt);
  198. #elif defined GNULIB_POSIXCHECK
  199. # undef getsubopt
  200. # if HAVE_RAW_DECL_GETSUBOPT
  201. _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
  202. "use gnulib module getsubopt for portability");
  203. # endif
  204. #endif
  205. #if @GNULIB_GRANTPT@
  206. /* Change the ownership and access permission of the slave side of the
  207. pseudo-terminal whose master side is specified by FD. */
  208. # if !@HAVE_GRANTPT@
  209. _GL_FUNCDECL_SYS (grantpt, int, (int fd));
  210. # endif
  211. _GL_CXXALIAS_SYS (grantpt, int, (int fd));
  212. _GL_CXXALIASWARN (grantpt);
  213. #elif defined GNULIB_POSIXCHECK
  214. # undef grantpt
  215. # if HAVE_RAW_DECL_GRANTPT
  216. _GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
  217. "use gnulib module grantpt for portability");
  218. # endif
  219. #endif
  220. /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
  221. rely on GNU or POSIX semantics for malloc and realloc (for example,
  222. by never specifying a zero size), so it does not need malloc or
  223. realloc to be redefined. */
  224. #if @GNULIB_MALLOC_POSIX@
  225. # if @REPLACE_MALLOC@
  226. # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
  227. || _GL_USE_STDLIB_ALLOC)
  228. # undef malloc
  229. # define malloc rpl_malloc
  230. # endif
  231. _GL_FUNCDECL_RPL (malloc, void *, (size_t size));
  232. _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
  233. # else
  234. _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
  235. # endif
  236. _GL_CXXALIASWARN (malloc);
  237. #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
  238. # undef malloc
  239. /* Assume malloc is always declared. */
  240. _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
  241. "use gnulib module malloc-posix for portability");
  242. #endif
  243. /* Convert a multibyte character to a wide character. */
  244. #if @GNULIB_MBTOWC@
  245. # if @REPLACE_MBTOWC@
  246. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  247. # undef mbtowc
  248. # define mbtowc rpl_mbtowc
  249. # endif
  250. _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
  251. _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
  252. # else
  253. _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
  254. # endif
  255. _GL_CXXALIASWARN (mbtowc);
  256. #endif
  257. #if @GNULIB_MKDTEMP@
  258. /* Create a unique temporary directory from TEMPLATE.
  259. The last six characters of TEMPLATE must be "XXXXXX";
  260. they are replaced with a string that makes the directory name unique.
  261. Returns TEMPLATE, or a null pointer if it cannot get a unique name.
  262. The directory is created mode 700. */
  263. # if !@HAVE_MKDTEMP@
  264. _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
  265. # endif
  266. _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
  267. _GL_CXXALIASWARN (mkdtemp);
  268. #elif defined GNULIB_POSIXCHECK
  269. # undef mkdtemp
  270. # if HAVE_RAW_DECL_MKDTEMP
  271. _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
  272. "use gnulib module mkdtemp for portability");
  273. # endif
  274. #endif
  275. #if @GNULIB_MKOSTEMP@
  276. /* Create a unique temporary file from TEMPLATE.
  277. The last six characters of TEMPLATE must be "XXXXXX";
  278. they are replaced with a string that makes the file name unique.
  279. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
  280. and O_TEXT, O_BINARY (defined in "binary-io.h").
  281. The file is then created, with the specified flags, ensuring it didn't exist
  282. before.
  283. The file is created read-write (mask at least 0600 & ~umask), but it may be
  284. world-readable and world-writable (mask 0666 & ~umask), depending on the
  285. implementation.
  286. Returns the open file descriptor if successful, otherwise -1 and errno
  287. set. */
  288. # if !@HAVE_MKOSTEMP@
  289. _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
  290. _GL_ARG_NONNULL ((1)));
  291. # endif
  292. _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
  293. _GL_CXXALIASWARN (mkostemp);
  294. #elif defined GNULIB_POSIXCHECK
  295. # undef mkostemp
  296. # if HAVE_RAW_DECL_MKOSTEMP
  297. _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
  298. "use gnulib module mkostemp for portability");
  299. # endif
  300. #endif
  301. #if @GNULIB_MKOSTEMPS@
  302. /* Create a unique temporary file from TEMPLATE.
  303. The last six characters of TEMPLATE before a suffix of length
  304. SUFFIXLEN must be "XXXXXX";
  305. they are replaced with a string that makes the file name unique.
  306. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
  307. and O_TEXT, O_BINARY (defined in "binary-io.h").
  308. The file is then created, with the specified flags, ensuring it didn't exist
  309. before.
  310. The file is created read-write (mask at least 0600 & ~umask), but it may be
  311. world-readable and world-writable (mask 0666 & ~umask), depending on the
  312. implementation.
  313. Returns the open file descriptor if successful, otherwise -1 and errno
  314. set. */
  315. # if !@HAVE_MKOSTEMPS@
  316. _GL_FUNCDECL_SYS (mkostemps, int,
  317. (char * /*template*/, int /*suffixlen*/, int /*flags*/)
  318. _GL_ARG_NONNULL ((1)));
  319. # endif
  320. _GL_CXXALIAS_SYS (mkostemps, int,
  321. (char * /*template*/, int /*suffixlen*/, int /*flags*/));
  322. _GL_CXXALIASWARN (mkostemps);
  323. #elif defined GNULIB_POSIXCHECK
  324. # undef mkostemps
  325. # if HAVE_RAW_DECL_MKOSTEMPS
  326. _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
  327. "use gnulib module mkostemps for portability");
  328. # endif
  329. #endif
  330. #if @GNULIB_MKSTEMP@
  331. /* Create a unique temporary file from TEMPLATE.
  332. The last six characters of TEMPLATE must be "XXXXXX";
  333. they are replaced with a string that makes the file name unique.
  334. The file is then created, ensuring it didn't exist before.
  335. The file is created read-write (mask at least 0600 & ~umask), but it may be
  336. world-readable and world-writable (mask 0666 & ~umask), depending on the
  337. implementation.
  338. Returns the open file descriptor if successful, otherwise -1 and errno
  339. set. */
  340. # if @REPLACE_MKSTEMP@
  341. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  342. # define mkstemp rpl_mkstemp
  343. # endif
  344. _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
  345. _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
  346. # else
  347. # if ! @HAVE_MKSTEMP@
  348. _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
  349. # endif
  350. _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
  351. # endif
  352. _GL_CXXALIASWARN (mkstemp);
  353. #elif defined GNULIB_POSIXCHECK
  354. # undef mkstemp
  355. # if HAVE_RAW_DECL_MKSTEMP
  356. _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
  357. "use gnulib module mkstemp for portability");
  358. # endif
  359. #endif
  360. #if @GNULIB_MKSTEMPS@
  361. /* Create a unique temporary file from TEMPLATE.
  362. The last six characters of TEMPLATE prior to a suffix of length
  363. SUFFIXLEN must be "XXXXXX";
  364. they are replaced with a string that makes the file name unique.
  365. The file is then created, ensuring it didn't exist 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_MKSTEMPS@
  372. _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
  373. _GL_ARG_NONNULL ((1)));
  374. # endif
  375. _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
  376. _GL_CXXALIASWARN (mkstemps);
  377. #elif defined GNULIB_POSIXCHECK
  378. # undef mkstemps
  379. # if HAVE_RAW_DECL_MKSTEMPS
  380. _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
  381. "use gnulib module mkstemps for portability");
  382. # endif
  383. #endif
  384. #if @GNULIB_POSIX_OPENPT@
  385. /* Return an FD open to the master side of a pseudo-terminal. Flags should
  386. include O_RDWR, and may also include O_NOCTTY. */
  387. # if !@HAVE_POSIX_OPENPT@
  388. _GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
  389. # endif
  390. _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
  391. _GL_CXXALIASWARN (posix_openpt);
  392. #elif defined GNULIB_POSIXCHECK
  393. # undef posix_openpt
  394. # if HAVE_RAW_DECL_POSIX_OPENPT
  395. _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
  396. "use gnulib module posix_openpt for portability");
  397. # endif
  398. #endif
  399. #if @GNULIB_PTSNAME@
  400. /* Return the pathname of the pseudo-terminal slave associated with
  401. the master FD is open on, or NULL on errors. */
  402. # if !@HAVE_PTSNAME@
  403. _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
  404. # endif
  405. _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
  406. _GL_CXXALIASWARN (ptsname);
  407. #elif defined GNULIB_POSIXCHECK
  408. # undef ptsname
  409. # if HAVE_RAW_DECL_PTSNAME
  410. _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
  411. "use gnulib module ptsname for portability");
  412. # endif
  413. #endif
  414. #if @GNULIB_PUTENV@
  415. # if @REPLACE_PUTENV@
  416. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  417. # undef putenv
  418. # define putenv rpl_putenv
  419. # endif
  420. _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
  421. _GL_CXXALIAS_RPL (putenv, int, (char *string));
  422. # else
  423. _GL_CXXALIAS_SYS (putenv, int, (char *string));
  424. # endif
  425. _GL_CXXALIASWARN (putenv);
  426. #endif
  427. #if @GNULIB_RANDOM_R@
  428. # if !@HAVE_RANDOM_R@
  429. # ifndef RAND_MAX
  430. # define RAND_MAX 2147483647
  431. # endif
  432. # endif
  433. #endif
  434. #if @GNULIB_RANDOM_R@
  435. # if !@HAVE_RANDOM_R@
  436. _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
  437. _GL_ARG_NONNULL ((1, 2)));
  438. # endif
  439. _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
  440. _GL_CXXALIASWARN (random_r);
  441. #elif defined GNULIB_POSIXCHECK
  442. # undef random_r
  443. # if HAVE_RAW_DECL_RANDOM_R
  444. _GL_WARN_ON_USE (random_r, "random_r is unportable - "
  445. "use gnulib module random_r for portability");
  446. # endif
  447. #endif
  448. #if @GNULIB_RANDOM_R@
  449. # if !@HAVE_RANDOM_R@
  450. _GL_FUNCDECL_SYS (srandom_r, int,
  451. (unsigned int seed, struct random_data *rand_state)
  452. _GL_ARG_NONNULL ((2)));
  453. # endif
  454. _GL_CXXALIAS_SYS (srandom_r, int,
  455. (unsigned int seed, struct random_data *rand_state));
  456. _GL_CXXALIASWARN (srandom_r);
  457. #elif defined GNULIB_POSIXCHECK
  458. # undef srandom_r
  459. # if HAVE_RAW_DECL_SRANDOM_R
  460. _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
  461. "use gnulib module random_r for portability");
  462. # endif
  463. #endif
  464. #if @GNULIB_RANDOM_R@
  465. # if !@HAVE_RANDOM_R@
  466. _GL_FUNCDECL_SYS (initstate_r, int,
  467. (unsigned int seed, char *buf, size_t buf_size,
  468. struct random_data *rand_state)
  469. _GL_ARG_NONNULL ((2, 4)));
  470. # endif
  471. _GL_CXXALIAS_SYS (initstate_r, int,
  472. (unsigned int seed, char *buf, size_t buf_size,
  473. struct random_data *rand_state));
  474. _GL_CXXALIASWARN (initstate_r);
  475. #elif defined GNULIB_POSIXCHECK
  476. # undef initstate_r
  477. # if HAVE_RAW_DECL_INITSTATE_R
  478. _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
  479. "use gnulib module random_r for portability");
  480. # endif
  481. #endif
  482. #if @GNULIB_RANDOM_R@
  483. # if !@HAVE_RANDOM_R@
  484. _GL_FUNCDECL_SYS (setstate_r, int,
  485. (char *arg_state, struct random_data *rand_state)
  486. _GL_ARG_NONNULL ((1, 2)));
  487. # endif
  488. _GL_CXXALIAS_SYS (setstate_r, int,
  489. (char *arg_state, struct random_data *rand_state));
  490. _GL_CXXALIASWARN (setstate_r);
  491. #elif defined GNULIB_POSIXCHECK
  492. # undef setstate_r
  493. # if HAVE_RAW_DECL_SETSTATE_R
  494. _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
  495. "use gnulib module random_r for portability");
  496. # endif
  497. #endif
  498. #if @GNULIB_REALLOC_POSIX@
  499. # if @REPLACE_REALLOC@
  500. # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
  501. || _GL_USE_STDLIB_ALLOC)
  502. # undef realloc
  503. # define realloc rpl_realloc
  504. # endif
  505. _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
  506. _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
  507. # else
  508. _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
  509. # endif
  510. _GL_CXXALIASWARN (realloc);
  511. #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
  512. # undef realloc
  513. /* Assume realloc is always declared. */
  514. _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
  515. "use gnulib module realloc-posix for portability");
  516. #endif
  517. #if @GNULIB_REALPATH@
  518. # if @REPLACE_REALPATH@
  519. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  520. # define realpath rpl_realpath
  521. # endif
  522. _GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
  523. _GL_ARG_NONNULL ((1)));
  524. _GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
  525. # else
  526. # if !@HAVE_REALPATH@
  527. _GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
  528. _GL_ARG_NONNULL ((1)));
  529. # endif
  530. _GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
  531. # endif
  532. _GL_CXXALIASWARN (realpath);
  533. #elif defined GNULIB_POSIXCHECK
  534. # undef realpath
  535. # if HAVE_RAW_DECL_REALPATH
  536. _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
  537. "canonicalize or canonicalize-lgpl for portability");
  538. # endif
  539. #endif
  540. #if @GNULIB_RPMATCH@
  541. /* Test a user response to a question.
  542. Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
  543. # if !@HAVE_RPMATCH@
  544. _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
  545. # endif
  546. _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
  547. _GL_CXXALIASWARN (rpmatch);
  548. #elif defined GNULIB_POSIXCHECK
  549. # undef rpmatch
  550. # if HAVE_RAW_DECL_RPMATCH
  551. _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
  552. "use gnulib module rpmatch for portability");
  553. # endif
  554. #endif
  555. #if @GNULIB_SETENV@
  556. /* Set NAME to VALUE in the environment.
  557. If REPLACE is nonzero, overwrite an existing value. */
  558. # if @REPLACE_SETENV@
  559. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  560. # undef setenv
  561. # define setenv rpl_setenv
  562. # endif
  563. _GL_FUNCDECL_RPL (setenv, int,
  564. (const char *name, const char *value, int replace)
  565. _GL_ARG_NONNULL ((1)));
  566. _GL_CXXALIAS_RPL (setenv, int,
  567. (const char *name, const char *value, int replace));
  568. # else
  569. # if !@HAVE_DECL_SETENV@
  570. _GL_FUNCDECL_SYS (setenv, int,
  571. (const char *name, const char *value, int replace)
  572. _GL_ARG_NONNULL ((1)));
  573. # endif
  574. _GL_CXXALIAS_SYS (setenv, int,
  575. (const char *name, const char *value, int replace));
  576. # endif
  577. # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
  578. _GL_CXXALIASWARN (setenv);
  579. # endif
  580. #elif defined GNULIB_POSIXCHECK
  581. # undef setenv
  582. # if HAVE_RAW_DECL_SETENV
  583. _GL_WARN_ON_USE (setenv, "setenv is unportable - "
  584. "use gnulib module setenv for portability");
  585. # endif
  586. #endif
  587. #if @GNULIB_STRTOD@
  588. /* Parse a double from STRING, updating ENDP if appropriate. */
  589. # if @REPLACE_STRTOD@
  590. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  591. # define strtod rpl_strtod
  592. # endif
  593. _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
  594. _GL_ARG_NONNULL ((1)));
  595. _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
  596. # else
  597. # if !@HAVE_STRTOD@
  598. _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
  599. _GL_ARG_NONNULL ((1)));
  600. # endif
  601. _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
  602. # endif
  603. _GL_CXXALIASWARN (strtod);
  604. #elif defined GNULIB_POSIXCHECK
  605. # undef strtod
  606. # if HAVE_RAW_DECL_STRTOD
  607. _GL_WARN_ON_USE (strtod, "strtod is unportable - "
  608. "use gnulib module strtod for portability");
  609. # endif
  610. #endif
  611. #if @GNULIB_STRTOLL@
  612. /* Parse a signed integer whose textual representation starts at STRING.
  613. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
  614. it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
  615. "0x").
  616. If ENDPTR is not NULL, the address of the first byte after the integer is
  617. stored in *ENDPTR.
  618. Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
  619. to ERANGE. */
  620. # if !@HAVE_STRTOLL@
  621. _GL_FUNCDECL_SYS (strtoll, long long,
  622. (const char *string, char **endptr, int base)
  623. _GL_ARG_NONNULL ((1)));
  624. # endif
  625. _GL_CXXALIAS_SYS (strtoll, long long,
  626. (const char *string, char **endptr, int base));
  627. _GL_CXXALIASWARN (strtoll);
  628. #elif defined GNULIB_POSIXCHECK
  629. # undef strtoll
  630. # if HAVE_RAW_DECL_STRTOLL
  631. _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
  632. "use gnulib module strtoll for portability");
  633. # endif
  634. #endif
  635. #if @GNULIB_STRTOULL@
  636. /* Parse an unsigned integer whose textual representation starts at STRING.
  637. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
  638. it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
  639. "0x").
  640. If ENDPTR is not NULL, the address of the first byte after the integer is
  641. stored in *ENDPTR.
  642. Upon overflow, the return value is ULLONG_MAX, and errno is set to
  643. ERANGE. */
  644. # if !@HAVE_STRTOULL@
  645. _GL_FUNCDECL_SYS (strtoull, unsigned long long,
  646. (const char *string, char **endptr, int base)
  647. _GL_ARG_NONNULL ((1)));
  648. # endif
  649. _GL_CXXALIAS_SYS (strtoull, unsigned long long,
  650. (const char *string, char **endptr, int base));
  651. _GL_CXXALIASWARN (strtoull);
  652. #elif defined GNULIB_POSIXCHECK
  653. # undef strtoull
  654. # if HAVE_RAW_DECL_STRTOULL
  655. _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
  656. "use gnulib module strtoull for portability");
  657. # endif
  658. #endif
  659. #if @GNULIB_UNLOCKPT@
  660. /* Unlock the slave side of the pseudo-terminal whose master side is specified
  661. by FD, so that it can be opened. */
  662. # if !@HAVE_UNLOCKPT@
  663. _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
  664. # endif
  665. _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
  666. _GL_CXXALIASWARN (unlockpt);
  667. #elif defined GNULIB_POSIXCHECK
  668. # undef unlockpt
  669. # if HAVE_RAW_DECL_UNLOCKPT
  670. _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
  671. "use gnulib module unlockpt for portability");
  672. # endif
  673. #endif
  674. #if @GNULIB_UNSETENV@
  675. /* Remove the variable NAME from the environment. */
  676. # if @REPLACE_UNSETENV@
  677. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  678. # undef unsetenv
  679. # define unsetenv rpl_unsetenv
  680. # endif
  681. _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
  682. _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
  683. # else
  684. # if !@HAVE_DECL_UNSETENV@
  685. _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
  686. # endif
  687. _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
  688. # endif
  689. # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
  690. _GL_CXXALIASWARN (unsetenv);
  691. # endif
  692. #elif defined GNULIB_POSIXCHECK
  693. # undef unsetenv
  694. # if HAVE_RAW_DECL_UNSETENV
  695. _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
  696. "use gnulib module unsetenv for portability");
  697. # endif
  698. #endif
  699. /* Convert a wide character to a multibyte character. */
  700. #if @GNULIB_WCTOMB@
  701. # if @REPLACE_WCTOMB@
  702. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  703. # undef wctomb
  704. # define wctomb rpl_wctomb
  705. # endif
  706. _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
  707. _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
  708. # else
  709. _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
  710. # endif
  711. _GL_CXXALIASWARN (wctomb);
  712. #endif
  713. #endif /* _@GUARD_PREFIX@_STDLIB_H */
  714. #endif /* _@GUARD_PREFIX@_STDLIB_H */
  715. #endif