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