10efdcadb7fbccd62939d721eb0e4d713a7797bd
[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 #if @GNULIB_SYSTEM_POSIX@ && !defined 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,
181                  "canonicalize_file_name is unportable - "
182                  "use gnulib module canonicalize-lgpl for portability");
183 # endif
184 #endif
185
186 #if @GNULIB_GETLOADAVG@
187 /* Store max(NELEM,3) load average numbers in LOADAVG[].
188    The three numbers are the load average of the last 1 minute, the last 5
189    minutes, and the last 15 minutes, respectively.
190    LOADAVG is an array of NELEM numbers.  */
191 # if !@HAVE_DECL_GETLOADAVG@
192 _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
193                                    _GL_ARG_NONNULL ((1)));
194 # endif
195 _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
196 _GL_CXXALIASWARN (getloadavg);
197 #elif defined GNULIB_POSIXCHECK
198 # undef getloadavg
199 # if HAVE_RAW_DECL_GETLOADAVG
200 _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
201                  "use gnulib module getloadavg for portability");
202 # endif
203 #endif
204
205 #if @GNULIB_GETSUBOPT@
206 /* Assuming *OPTIONP is a comma separated list of elements of the form
207    "token" or "token=value", getsubopt parses the first of these elements.
208    If the first element refers to a "token" that is member of the given
209    NULL-terminated array of tokens:
210      - It replaces the comma with a NUL byte, updates *OPTIONP to point past
211        the first option and the comma, sets *VALUEP to the value of the
212        element (or NULL if it doesn't contain an "=" sign),
213      - It returns the index of the "token" in the given array of tokens.
214    Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
215    For more details see the POSIX:2001 specification.
216    http://www.opengroup.org/susv3xsh/getsubopt.html */
217 # if !@HAVE_GETSUBOPT@
218 _GL_FUNCDECL_SYS (getsubopt, int,
219                   (char **optionp, char *const *tokens, char **valuep)
220                   _GL_ARG_NONNULL ((1, 2, 3)));
221 # endif
222 _GL_CXXALIAS_SYS (getsubopt, int,
223                   (char **optionp, char *const *tokens, char **valuep));
224 _GL_CXXALIASWARN (getsubopt);
225 #elif defined GNULIB_POSIXCHECK
226 # undef getsubopt
227 # if HAVE_RAW_DECL_GETSUBOPT
228 _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
229                  "use gnulib module getsubopt for portability");
230 # endif
231 #endif
232
233 #if @GNULIB_GRANTPT@
234 /* Change the ownership and access permission of the slave side of the
235    pseudo-terminal whose master side is specified by FD.  */
236 # if !@HAVE_GRANTPT@
237 _GL_FUNCDECL_SYS (grantpt, int, (int fd));
238 # endif
239 _GL_CXXALIAS_SYS (grantpt, int, (int fd));
240 _GL_CXXALIASWARN (grantpt);
241 #elif defined GNULIB_POSIXCHECK
242 # undef grantpt
243 # if HAVE_RAW_DECL_GRANTPT
244 _GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
245                  "use gnulib module grantpt for portability");
246 # endif
247 #endif
248
249 #if @GNULIB_MALLOC_POSIX@
250 # if @REPLACE_MALLOC@
251 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
252 #   undef malloc
253 #   define malloc rpl_malloc
254 #  endif
255 _GL_FUNCDECL_RPL (malloc, void *, (size_t size));
256 _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
257 # else
258 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
259 # endif
260 _GL_CXXALIASWARN (malloc);
261 #elif defined GNULIB_POSIXCHECK
262 # undef malloc
263 /* Assume malloc is always declared.  */
264 _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
265                  "use gnulib module malloc-posix for portability");
266 #endif
267
268 #if @GNULIB_MKDTEMP@
269 /* Create a unique temporary directory from TEMPLATE.
270    The last six characters of TEMPLATE must be "XXXXXX";
271    they are replaced with a string that makes the directory name unique.
272    Returns TEMPLATE, or a null pointer if it cannot get a unique name.
273    The directory is created mode 700.  */
274 # if !@HAVE_MKDTEMP@
275 _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
276 # endif
277 _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
278 _GL_CXXALIASWARN (mkdtemp);
279 #elif defined GNULIB_POSIXCHECK
280 # undef mkdtemp
281 # if HAVE_RAW_DECL_MKDTEMP
282 _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
283                  "use gnulib module mkdtemp for portability");
284 # endif
285 #endif
286
287 #if @GNULIB_MKOSTEMP@
288 /* Create a unique temporary file from TEMPLATE.
289    The last six characters of TEMPLATE must be "XXXXXX";
290    they are replaced with a string that makes the file name unique.
291    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
292    and O_TEXT, O_BINARY (defined in "binary-io.h").
293    The file is then created, with the specified flags, ensuring it didn't exist
294    before.
295    The file is created read-write (mask at least 0600 & ~umask), but it may be
296    world-readable and world-writable (mask 0666 & ~umask), depending on the
297    implementation.
298    Returns the open file descriptor if successful, otherwise -1 and errno
299    set.  */
300 # if !@HAVE_MKOSTEMP@
301 _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
302                                  _GL_ARG_NONNULL ((1)));
303 # endif
304 _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
305 _GL_CXXALIASWARN (mkostemp);
306 #elif defined GNULIB_POSIXCHECK
307 # undef mkostemp
308 # if HAVE_RAW_DECL_MKOSTEMP
309 _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
310                  "use gnulib module mkostemp for portability");
311 # endif
312 #endif
313
314 #if @GNULIB_MKOSTEMPS@
315 /* Create a unique temporary file from TEMPLATE.
316    The last six characters of TEMPLATE before a suffix of length
317    SUFFIXLEN must be "XXXXXX";
318    they are replaced with a string that makes the file name unique.
319    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
320    and O_TEXT, O_BINARY (defined in "binary-io.h").
321    The file is then created, with the specified flags, ensuring it didn't exist
322    before.
323    The file is created read-write (mask at least 0600 & ~umask), but it may be
324    world-readable and world-writable (mask 0666 & ~umask), depending on the
325    implementation.
326    Returns the open file descriptor if successful, otherwise -1 and errno
327    set.  */
328 # if !@HAVE_MKOSTEMPS@
329 _GL_FUNCDECL_SYS (mkostemps, int,
330                   (char * /*template*/, int /*suffixlen*/, int /*flags*/)
331                   _GL_ARG_NONNULL ((1)));
332 # endif
333 _GL_CXXALIAS_SYS (mkostemps, int,
334                   (char * /*template*/, int /*suffixlen*/, int /*flags*/));
335 _GL_CXXALIASWARN (mkostemps);
336 #elif defined GNULIB_POSIXCHECK
337 # undef mkostemps
338 # if HAVE_RAW_DECL_MKOSTEMPS
339 _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
340                  "use gnulib module mkostemps for portability");
341 # endif
342 #endif
343
344 #if @GNULIB_MKSTEMP@
345 /* Create a unique temporary file from TEMPLATE.
346    The last six characters of TEMPLATE must be "XXXXXX";
347    they are replaced with a string that makes the file name unique.
348    The file is then created, ensuring it didn't exist before.
349    The file is created read-write (mask at least 0600 & ~umask), but it may be
350    world-readable and world-writable (mask 0666 & ~umask), depending on the
351    implementation.
352    Returns the open file descriptor if successful, otherwise -1 and errno
353    set.  */
354 # if @REPLACE_MKSTEMP@
355 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
356 #   define mkstemp rpl_mkstemp
357 #  endif
358 _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
359 _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
360 # else
361 #  if ! @HAVE_MKSTEMP@
362 _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
363 #  endif
364 _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
365 # endif
366 _GL_CXXALIASWARN (mkstemp);
367 #elif defined GNULIB_POSIXCHECK
368 # undef mkstemp
369 # if HAVE_RAW_DECL_MKSTEMP
370 _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
371                  "use gnulib module mkstemp for portability");
372 # endif
373 #endif
374
375 #if @GNULIB_MKSTEMPS@
376 /* Create a unique temporary file from TEMPLATE.
377    The last six characters of TEMPLATE prior to a suffix of length
378    SUFFIXLEN must be "XXXXXX";
379    they are replaced with a string that makes the file name unique.
380    The file is then created, ensuring it didn't exist before.
381    The file is created read-write (mask at least 0600 & ~umask), but it may be
382    world-readable and world-writable (mask 0666 & ~umask), depending on the
383    implementation.
384    Returns the open file descriptor if successful, otherwise -1 and errno
385    set.  */
386 # if !@HAVE_MKSTEMPS@
387 _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
388                                  _GL_ARG_NONNULL ((1)));
389 # endif
390 _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
391 _GL_CXXALIASWARN (mkstemps);
392 #elif defined GNULIB_POSIXCHECK
393 # undef mkstemps
394 # if HAVE_RAW_DECL_MKSTEMPS
395 _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
396                  "use gnulib module mkstemps for portability");
397 # endif
398 #endif
399
400 #if @GNULIB_PTSNAME@
401 /* Return the pathname of the pseudo-terminal slave associated with
402    the master FD is open on, or NULL on errors.  */
403 # if !@HAVE_PTSNAME@
404 _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
405 # endif
406 _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
407 _GL_CXXALIASWARN (ptsname);
408 #elif defined GNULIB_POSIXCHECK
409 # undef ptsname
410 # if HAVE_RAW_DECL_PTSNAME
411 _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
412                  "use gnulib module ptsname for portability");
413 # endif
414 #endif
415
416 #if @GNULIB_PUTENV@
417 # if @REPLACE_PUTENV@
418 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
419 #   undef putenv
420 #   define putenv rpl_putenv
421 #  endif
422 _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
423 _GL_CXXALIAS_RPL (putenv, int, (char *string));
424 # else
425 _GL_CXXALIAS_SYS (putenv, int, (char *string));
426 # endif
427 _GL_CXXALIASWARN (putenv);
428 #endif
429
430
431 #if @GNULIB_RANDOM_R@
432 # if !@HAVE_RANDOM_R@
433 #  ifndef RAND_MAX
434 #   define RAND_MAX 2147483647
435 #  endif
436 # endif
437 #endif
438
439 #if @GNULIB_RANDOM_R@
440 # if !@HAVE_RANDOM_R@
441 _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
442                                  _GL_ARG_NONNULL ((1, 2)));
443 # endif
444 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
445 _GL_CXXALIASWARN (random_r);
446 #elif defined GNULIB_POSIXCHECK
447 # undef random_r
448 # if HAVE_RAW_DECL_RANDOM_R
449 _GL_WARN_ON_USE (random_r, "random_r is unportable - "
450                  "use gnulib module random_r for portability");
451 # endif
452 #endif
453
454 #if @GNULIB_RANDOM_R@
455 # if !@HAVE_RANDOM_R@
456 _GL_FUNCDECL_SYS (srandom_r, int,
457                   (unsigned int seed, struct random_data *rand_state)
458                   _GL_ARG_NONNULL ((2)));
459 # endif
460 _GL_CXXALIAS_SYS (srandom_r, int,
461                   (unsigned int seed, struct random_data *rand_state));
462 _GL_CXXALIASWARN (srandom_r);
463 #elif defined GNULIB_POSIXCHECK
464 # undef srandom_r
465 # if HAVE_RAW_DECL_SRANDOM_R
466 _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
467                  "use gnulib module random_r for portability");
468 # endif
469 #endif
470
471 #if @GNULIB_RANDOM_R@
472 # if !@HAVE_RANDOM_R@
473 _GL_FUNCDECL_SYS (initstate_r, int,
474                   (unsigned int seed, char *buf, size_t buf_size,
475                    struct random_data *rand_state)
476                   _GL_ARG_NONNULL ((2, 4)));
477 # endif
478 _GL_CXXALIAS_SYS (initstate_r, int,
479                   (unsigned int seed, char *buf, size_t buf_size,
480                    struct random_data *rand_state));
481 _GL_CXXALIASWARN (initstate_r);
482 #elif defined GNULIB_POSIXCHECK
483 # undef initstate_r
484 # if HAVE_RAW_DECL_INITSTATE_R
485 _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
486                  "use gnulib module random_r for portability");
487 # endif
488 #endif
489
490 #if @GNULIB_RANDOM_R@
491 # if !@HAVE_RANDOM_R@
492 _GL_FUNCDECL_SYS (setstate_r, int,
493                   (char *arg_state, struct random_data *rand_state)
494                   _GL_ARG_NONNULL ((1, 2)));
495 # endif
496 _GL_CXXALIAS_SYS (setstate_r, int,
497                   (char *arg_state, struct random_data *rand_state));
498 _GL_CXXALIASWARN (setstate_r);
499 #elif defined GNULIB_POSIXCHECK
500 # undef setstate_r
501 # if HAVE_RAW_DECL_SETSTATE_R
502 _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
503                  "use gnulib module random_r for portability");
504 # endif
505 #endif
506
507
508 #if @GNULIB_REALLOC_POSIX@
509 # if @REPLACE_REALLOC@
510 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
511 #   undef realloc
512 #   define realloc rpl_realloc
513 #  endif
514 _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
515 _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
516 # else
517 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
518 # endif
519 _GL_CXXALIASWARN (realloc);
520 #elif defined GNULIB_POSIXCHECK
521 # undef realloc
522 /* Assume realloc is always declared.  */
523 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
524                  "use gnulib module realloc-posix for portability");
525 #endif
526
527 #if @GNULIB_REALPATH@
528 # if @REPLACE_REALPATH@
529 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
530 #   define realpath rpl_realpath
531 #  endif
532 _GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
533                                     _GL_ARG_NONNULL ((1)));
534 _GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
535 # else
536 #  if !@HAVE_REALPATH@
537 _GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
538                                     _GL_ARG_NONNULL ((1)));
539 #  endif
540 _GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
541 # endif
542 _GL_CXXALIASWARN (realpath);
543 #elif defined GNULIB_POSIXCHECK
544 # undef realpath
545 # if HAVE_RAW_DECL_REALPATH
546 _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
547                  "canonicalize or canonicalize-lgpl for portability");
548 # endif
549 #endif
550
551 #if @GNULIB_RPMATCH@
552 /* Test a user response to a question.
553    Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear.  */
554 # if !@HAVE_RPMATCH@
555 _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
556 # endif
557 _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
558 _GL_CXXALIASWARN (rpmatch);
559 #elif defined GNULIB_POSIXCHECK
560 # undef rpmatch
561 # if HAVE_RAW_DECL_RPMATCH
562 _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
563                  "use gnulib module rpmatch for portability");
564 # endif
565 #endif
566
567 #if @GNULIB_SETENV@
568 /* Set NAME to VALUE in the environment.
569    If REPLACE is nonzero, overwrite an existing value.  */
570 # if @REPLACE_SETENV@
571 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
572 #   undef setenv
573 #   define setenv rpl_setenv
574 #  endif
575 _GL_FUNCDECL_RPL (setenv, int,
576                   (const char *name, const char *value, int replace)
577                   _GL_ARG_NONNULL ((1)));
578 _GL_CXXALIAS_RPL (setenv, int,
579                   (const char *name, const char *value, int replace));
580 # else
581 #  if !@HAVE_SETENV@
582 _GL_FUNCDECL_SYS (setenv, int,
583                   (const char *name, const char *value, int replace)
584                   _GL_ARG_NONNULL ((1)));
585 #  endif
586 _GL_CXXALIAS_SYS (setenv, int,
587                   (const char *name, const char *value, int replace));
588 # endif
589 _GL_CXXALIASWARN (setenv);
590 #elif defined GNULIB_POSIXCHECK
591 # undef setenv
592 # if HAVE_RAW_DECL_SETENV
593 _GL_WARN_ON_USE (setenv, "setenv is unportable - "
594                  "use gnulib module setenv for portability");
595 # endif
596 #endif
597
598 #if @GNULIB_STRTOD@
599  /* Parse a double from STRING, updating ENDP if appropriate.  */
600 # if @REPLACE_STRTOD@
601 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
602 #   define strtod rpl_strtod
603 #  endif
604 _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
605                                   _GL_ARG_NONNULL ((1)));
606 _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
607 # else
608 #  if !@HAVE_STRTOD@
609 _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
610                                   _GL_ARG_NONNULL ((1)));
611 #  endif
612 _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
613 # endif
614 _GL_CXXALIASWARN (strtod);
615 #elif defined GNULIB_POSIXCHECK
616 # undef strtod
617 # if HAVE_RAW_DECL_STRTOD
618 _GL_WARN_ON_USE (strtod, "strtod is unportable - "
619                  "use gnulib module strtod for portability");
620 # endif
621 #endif
622
623 #if @GNULIB_STRTOLL@
624 /* Parse a signed integer whose textual representation starts at STRING.
625    The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
626    it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
627    "0x").
628    If ENDPTR is not NULL, the address of the first byte after the integer is
629    stored in *ENDPTR.
630    Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
631    to ERANGE.  */
632 # if !@HAVE_STRTOLL@
633 _GL_FUNCDECL_SYS (strtoll, long long,
634                   (const char *string, char **endptr, int base)
635                   _GL_ARG_NONNULL ((1)));
636 # endif
637 _GL_CXXALIAS_SYS (strtoll, long long,
638                   (const char *string, char **endptr, int base));
639 _GL_CXXALIASWARN (strtoll);
640 #elif defined GNULIB_POSIXCHECK
641 # undef strtoll
642 # if HAVE_RAW_DECL_STRTOLL
643 _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
644                  "use gnulib module strtoll for portability");
645 # endif
646 #endif
647
648 #if @GNULIB_STRTOULL@
649 /* Parse an unsigned integer whose textual representation starts at STRING.
650    The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
651    it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
652    "0x").
653    If ENDPTR is not NULL, the address of the first byte after the integer is
654    stored in *ENDPTR.
655    Upon overflow, the return value is ULLONG_MAX, and errno is set to
656    ERANGE.  */
657 # if !@HAVE_STRTOULL@
658 _GL_FUNCDECL_SYS (strtoull, unsigned long long,
659                   (const char *string, char **endptr, int base)
660                   _GL_ARG_NONNULL ((1)));
661 # endif
662 _GL_CXXALIAS_SYS (strtoull, unsigned long long,
663                   (const char *string, char **endptr, int base));
664 _GL_CXXALIASWARN (strtoull);
665 #elif defined GNULIB_POSIXCHECK
666 # undef strtoull
667 # if HAVE_RAW_DECL_STRTOULL
668 _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
669                  "use gnulib module strtoull for portability");
670 # endif
671 #endif
672
673 #if @GNULIB_UNLOCKPT@
674 /* Unlock the slave side of the pseudo-terminal whose master side is specified
675    by FD, so that it can be opened.  */
676 # if !@HAVE_UNLOCKPT@
677 _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
678 # endif
679 _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
680 _GL_CXXALIASWARN (unlockpt);
681 #elif defined GNULIB_POSIXCHECK
682 # undef unlockpt
683 # if HAVE_RAW_DECL_UNLOCKPT
684 _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
685                  "use gnulib module unlockpt for portability");
686 # endif
687 #endif
688
689 #if @GNULIB_UNSETENV@
690 /* Remove the variable NAME from the environment.  */
691 # if @REPLACE_UNSETENV@
692 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
693 #   undef unsetenv
694 #   define unsetenv rpl_unsetenv
695 #  endif
696 _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
697 _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
698 # else
699 #  if !@HAVE_UNSETENV@
700 _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
701 #  endif
702 _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
703 # endif
704 _GL_CXXALIASWARN (unsetenv);
705 #elif defined GNULIB_POSIXCHECK
706 # undef unsetenv
707 # if HAVE_RAW_DECL_UNSETENV
708 _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
709                  "use gnulib module unsetenv for portability");
710 # endif
711 #endif
712
713
714 #endif /* _GL_STDLIB_H */
715 #endif /* _GL_STDLIB_H */
716 #endif