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