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