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