Commit | Line | Data |
---|---|---|
98399780 YQ |
1 | /* A GNU-like <stdlib.h>. |
2 | ||
c0c3707f | 3 | Copyright (C) 1995, 2001-2004, 2006-2019 Free Software Foundation, Inc. |
98399780 YQ |
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 | |
c0c3707f | 16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
98399780 YQ |
17 | |
18 | #if __GNUC__ >= 3 | |
19 | @PRAGMA_SYSTEM_HEADER@ | |
20 | #endif | |
21 | @PRAGMA_COLUMNS@ | |
22 | ||
4a626d0a PA |
23 | #if defined __need_system_stdlib_h || defined __need_malloc_and_calloc |
24 | /* Special invocation conventions inside some gnulib header files, | |
25 | and inside some glibc header files, respectively. */ | |
98399780 YQ |
26 | |
27 | #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ | |
28 | ||
29 | #else | |
30 | /* Normal invocation convention. */ | |
31 | ||
32 | #ifndef _@GUARD_PREFIX@_STDLIB_H | |
33 | ||
34 | /* The include_next requires a split double-inclusion guard. */ | |
35 | #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ | |
36 | ||
37 | #ifndef _@GUARD_PREFIX@_STDLIB_H | |
38 | #define _@GUARD_PREFIX@_STDLIB_H | |
39 | ||
40 | /* NetBSD 5.0 mis-defines NULL. */ | |
41 | #include <stddef.h> | |
42 | ||
43 | /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */ | |
44 | #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS | |
45 | # include <sys/wait.h> | |
46 | #endif | |
47 | ||
48 | /* Solaris declares getloadavg() in <sys/loadavg.h>. */ | |
49 | #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ | |
c0c3707f CB |
50 | /* OpenIndiana has a bug: <sys/time.h> must be included before |
51 | <sys/loadavg.h>. */ | |
52 | # include <sys/time.h> | |
98399780 YQ |
53 | # include <sys/loadavg.h> |
54 | #endif | |
55 | ||
56 | /* Native Windows platforms declare mktemp() in <io.h>. */ | |
c0c3707f | 57 | #if 0 && (defined _WIN32 && ! defined __CYGWIN__) |
98399780 YQ |
58 | # include <io.h> |
59 | #endif | |
60 | ||
61 | #if @GNULIB_RANDOM_R@ | |
62 | ||
63 | /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included | |
64 | from <stdlib.h> if _REENTRANT is defined. Include it whenever we need | |
65 | 'struct random_data'. */ | |
66 | # if @HAVE_RANDOM_H@ | |
67 | # include <random.h> | |
68 | # endif | |
69 | ||
70 | # if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@ | |
71 | # include <stdint.h> | |
72 | # endif | |
73 | ||
74 | # if !@HAVE_STRUCT_RANDOM_DATA@ | |
75 | /* Define 'struct random_data'. | |
76 | But allow multiple gnulib generated <stdlib.h> replacements to coexist. */ | |
77 | # if !GNULIB_defined_struct_random_data | |
78 | struct random_data | |
79 | { | |
80 | int32_t *fptr; /* Front pointer. */ | |
81 | int32_t *rptr; /* Rear pointer. */ | |
82 | int32_t *state; /* Array of state values. */ | |
83 | int rand_type; /* Type of random number generator. */ | |
84 | int rand_deg; /* Degree of random number generator. */ | |
85 | int rand_sep; /* Distance between front and rear. */ | |
86 | int32_t *end_ptr; /* Pointer behind state table. */ | |
87 | }; | |
88 | # define GNULIB_defined_struct_random_data 1 | |
89 | # endif | |
90 | # endif | |
91 | #endif | |
92 | ||
c0c3707f | 93 | #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__) |
98399780 YQ |
94 | /* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */ |
95 | /* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */ | |
b3279b60 | 96 | /* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */ |
98399780 YQ |
97 | /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */ |
98 | /* But avoid namespace pollution on glibc systems and native Windows. */ | |
99 | # include <unistd.h> | |
100 | #endif | |
101 | ||
102 | /* The __attribute__ feature is available in gcc versions 2.5 and later. | |
103 | The attribute __pure__ was added in gcc 2.96. */ | |
104 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) | |
105 | # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) | |
106 | #else | |
107 | # define _GL_ATTRIBUTE_PURE /* empty */ | |
108 | #endif | |
109 | ||
110 | /* The definition of _Noreturn is copied here. */ | |
111 | ||
112 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | |
113 | ||
114 | /* The definition of _GL_ARG_NONNULL is copied here. */ | |
115 | ||
116 | /* The definition of _GL_WARN_ON_USE is copied here. */ | |
117 | ||
118 | ||
119 | /* Some systems do not define EXIT_*, despite otherwise supporting C89. */ | |
120 | #ifndef EXIT_SUCCESS | |
121 | # define EXIT_SUCCESS 0 | |
122 | #endif | |
123 | /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere | |
124 | with proper operation of xargs. */ | |
125 | #ifndef EXIT_FAILURE | |
126 | # define EXIT_FAILURE 1 | |
127 | #elif EXIT_FAILURE != 1 | |
128 | # undef EXIT_FAILURE | |
129 | # define EXIT_FAILURE 1 | |
130 | #endif | |
131 | ||
132 | ||
133 | #if @GNULIB__EXIT@ | |
134 | /* Terminate the current process with the given return code, without running | |
135 | the 'atexit' handlers. */ | |
136 | # if !@HAVE__EXIT@ | |
137 | _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); | |
138 | # endif | |
139 | _GL_CXXALIAS_SYS (_Exit, void, (int status)); | |
140 | _GL_CXXALIASWARN (_Exit); | |
141 | #elif defined GNULIB_POSIXCHECK | |
142 | # undef _Exit | |
143 | # if HAVE_RAW_DECL__EXIT | |
144 | _GL_WARN_ON_USE (_Exit, "_Exit is unportable - " | |
145 | "use gnulib module _Exit for portability"); | |
146 | # endif | |
147 | #endif | |
148 | ||
149 | ||
150 | #if @GNULIB_ATOLL@ | |
151 | /* Parse a signed decimal integer. | |
152 | Returns the value of the integer. Errors are not detected. */ | |
153 | # if !@HAVE_ATOLL@ | |
154 | _GL_FUNCDECL_SYS (atoll, long long, (const char *string) | |
155 | _GL_ATTRIBUTE_PURE | |
156 | _GL_ARG_NONNULL ((1))); | |
157 | # endif | |
158 | _GL_CXXALIAS_SYS (atoll, long long, (const char *string)); | |
159 | _GL_CXXALIASWARN (atoll); | |
160 | #elif defined GNULIB_POSIXCHECK | |
161 | # undef atoll | |
162 | # if HAVE_RAW_DECL_ATOLL | |
163 | _GL_WARN_ON_USE (atoll, "atoll is unportable - " | |
164 | "use gnulib module atoll for portability"); | |
165 | # endif | |
166 | #endif | |
167 | ||
168 | #if @GNULIB_CALLOC_POSIX@ | |
169 | # if @REPLACE_CALLOC@ | |
170 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
171 | # undef calloc | |
172 | # define calloc rpl_calloc | |
173 | # endif | |
174 | _GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size)); | |
175 | _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); | |
176 | # else | |
177 | _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); | |
178 | # endif | |
c0c3707f | 179 | # if __GLIBC__ >= 2 |
98399780 | 180 | _GL_CXXALIASWARN (calloc); |
c0c3707f | 181 | # endif |
98399780 YQ |
182 | #elif defined GNULIB_POSIXCHECK |
183 | # undef calloc | |
184 | /* Assume calloc is always declared. */ | |
185 | _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " | |
186 | "use gnulib module calloc-posix for portability"); | |
187 | #endif | |
188 | ||
189 | #if @GNULIB_CANONICALIZE_FILE_NAME@ | |
190 | # if @REPLACE_CANONICALIZE_FILE_NAME@ | |
191 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
192 | # define canonicalize_file_name rpl_canonicalize_file_name | |
193 | # endif | |
194 | _GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name) | |
195 | _GL_ARG_NONNULL ((1))); | |
196 | _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); | |
197 | # else | |
198 | # if !@HAVE_CANONICALIZE_FILE_NAME@ | |
199 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name) | |
200 | _GL_ARG_NONNULL ((1))); | |
201 | # endif | |
202 | _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); | |
203 | # endif | |
204 | _GL_CXXALIASWARN (canonicalize_file_name); | |
205 | #elif defined GNULIB_POSIXCHECK | |
206 | # undef canonicalize_file_name | |
207 | # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME | |
208 | _GL_WARN_ON_USE (canonicalize_file_name, | |
209 | "canonicalize_file_name is unportable - " | |
210 | "use gnulib module canonicalize-lgpl for portability"); | |
211 | # endif | |
212 | #endif | |
213 | ||
214 | #if @GNULIB_GETLOADAVG@ | |
215 | /* Store max(NELEM,3) load average numbers in LOADAVG[]. | |
216 | The three numbers are the load average of the last 1 minute, the last 5 | |
217 | minutes, and the last 15 minutes, respectively. | |
218 | LOADAVG is an array of NELEM numbers. */ | |
219 | # if !@HAVE_DECL_GETLOADAVG@ | |
220 | _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) | |
221 | _GL_ARG_NONNULL ((1))); | |
222 | # endif | |
223 | _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); | |
224 | _GL_CXXALIASWARN (getloadavg); | |
225 | #elif defined GNULIB_POSIXCHECK | |
226 | # undef getloadavg | |
227 | # if HAVE_RAW_DECL_GETLOADAVG | |
228 | _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " | |
229 | "use gnulib module getloadavg for portability"); | |
230 | # endif | |
231 | #endif | |
232 | ||
233 | #if @GNULIB_GETSUBOPT@ | |
234 | /* Assuming *OPTIONP is a comma separated list of elements of the form | |
235 | "token" or "token=value", getsubopt parses the first of these elements. | |
236 | If the first element refers to a "token" that is member of the given | |
237 | NULL-terminated array of tokens: | |
238 | - It replaces the comma with a NUL byte, updates *OPTIONP to point past | |
239 | the first option and the comma, sets *VALUEP to the value of the | |
240 | element (or NULL if it doesn't contain an "=" sign), | |
241 | - It returns the index of the "token" in the given array of tokens. | |
242 | Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. | |
c0c3707f CB |
243 | For more details see the POSIX specification. |
244 | https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */ | |
98399780 YQ |
245 | # if !@HAVE_GETSUBOPT@ |
246 | _GL_FUNCDECL_SYS (getsubopt, int, | |
247 | (char **optionp, char *const *tokens, char **valuep) | |
248 | _GL_ARG_NONNULL ((1, 2, 3))); | |
249 | # endif | |
250 | _GL_CXXALIAS_SYS (getsubopt, int, | |
251 | (char **optionp, char *const *tokens, char **valuep)); | |
252 | _GL_CXXALIASWARN (getsubopt); | |
253 | #elif defined GNULIB_POSIXCHECK | |
254 | # undef getsubopt | |
255 | # if HAVE_RAW_DECL_GETSUBOPT | |
256 | _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " | |
257 | "use gnulib module getsubopt for portability"); | |
258 | # endif | |
259 | #endif | |
260 | ||
261 | #if @GNULIB_GRANTPT@ | |
262 | /* Change the ownership and access permission of the slave side of the | |
263 | pseudo-terminal whose master side is specified by FD. */ | |
264 | # if !@HAVE_GRANTPT@ | |
265 | _GL_FUNCDECL_SYS (grantpt, int, (int fd)); | |
266 | # endif | |
267 | _GL_CXXALIAS_SYS (grantpt, int, (int fd)); | |
268 | _GL_CXXALIASWARN (grantpt); | |
269 | #elif defined GNULIB_POSIXCHECK | |
270 | # undef grantpt | |
271 | # if HAVE_RAW_DECL_GRANTPT | |
272 | _GL_WARN_ON_USE (grantpt, "grantpt is not portable - " | |
273 | "use gnulib module grantpt for portability"); | |
274 | # endif | |
275 | #endif | |
276 | ||
277 | /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not | |
278 | rely on GNU or POSIX semantics for malloc and realloc (for example, | |
279 | by never specifying a zero size), so it does not need malloc or | |
280 | realloc to be redefined. */ | |
281 | #if @GNULIB_MALLOC_POSIX@ | |
282 | # if @REPLACE_MALLOC@ | |
283 | # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ | |
284 | || _GL_USE_STDLIB_ALLOC) | |
285 | # undef malloc | |
286 | # define malloc rpl_malloc | |
287 | # endif | |
288 | _GL_FUNCDECL_RPL (malloc, void *, (size_t size)); | |
289 | _GL_CXXALIAS_RPL (malloc, void *, (size_t size)); | |
290 | # else | |
291 | _GL_CXXALIAS_SYS (malloc, void *, (size_t size)); | |
292 | # endif | |
c0c3707f | 293 | # if __GLIBC__ >= 2 |
98399780 | 294 | _GL_CXXALIASWARN (malloc); |
c0c3707f | 295 | # endif |
98399780 YQ |
296 | #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC |
297 | # undef malloc | |
298 | /* Assume malloc is always declared. */ | |
299 | _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " | |
300 | "use gnulib module malloc-posix for portability"); | |
301 | #endif | |
302 | ||
303 | /* Convert a multibyte character to a wide character. */ | |
304 | #if @GNULIB_MBTOWC@ | |
305 | # if @REPLACE_MBTOWC@ | |
306 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
307 | # undef mbtowc | |
308 | # define mbtowc rpl_mbtowc | |
309 | # endif | |
310 | _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); | |
311 | _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); | |
312 | # else | |
c0c3707f CB |
313 | # if !@HAVE_MBTOWC@ |
314 | _GL_FUNCDECL_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); | |
315 | # endif | |
98399780 YQ |
316 | _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); |
317 | # endif | |
c0c3707f | 318 | # if __GLIBC__ >= 2 |
98399780 | 319 | _GL_CXXALIASWARN (mbtowc); |
c0c3707f CB |
320 | # endif |
321 | #elif defined GNULIB_POSIXCHECK | |
322 | # undef mbtowc | |
323 | # if HAVE_RAW_DECL_MBTOWC | |
324 | _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " | |
325 | "use gnulib module mbtowc for portability"); | |
326 | # endif | |
98399780 YQ |
327 | #endif |
328 | ||
329 | #if @GNULIB_MKDTEMP@ | |
330 | /* Create a unique temporary directory from TEMPLATE. | |
331 | The last six characters of TEMPLATE must be "XXXXXX"; | |
332 | they are replaced with a string that makes the directory name unique. | |
333 | Returns TEMPLATE, or a null pointer if it cannot get a unique name. | |
334 | The directory is created mode 700. */ | |
335 | # if !@HAVE_MKDTEMP@ | |
336 | _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); | |
337 | # endif | |
338 | _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); | |
339 | _GL_CXXALIASWARN (mkdtemp); | |
340 | #elif defined GNULIB_POSIXCHECK | |
341 | # undef mkdtemp | |
342 | # if HAVE_RAW_DECL_MKDTEMP | |
343 | _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " | |
344 | "use gnulib module mkdtemp for portability"); | |
345 | # endif | |
346 | #endif | |
347 | ||
348 | #if @GNULIB_MKOSTEMP@ | |
349 | /* Create a unique temporary file from TEMPLATE. | |
350 | The last six characters of TEMPLATE must be "XXXXXX"; | |
351 | they are replaced with a string that makes the file name unique. | |
352 | The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) | |
353 | and O_TEXT, O_BINARY (defined in "binary-io.h"). | |
354 | The file is then created, with the specified flags, ensuring it didn't exist | |
355 | before. | |
356 | The file is created read-write (mask at least 0600 & ~umask), but it may be | |
357 | world-readable and world-writable (mask 0666 & ~umask), depending on the | |
358 | implementation. | |
359 | Returns the open file descriptor if successful, otherwise -1 and errno | |
360 | set. */ | |
361 | # if !@HAVE_MKOSTEMP@ | |
362 | _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) | |
363 | _GL_ARG_NONNULL ((1))); | |
364 | # endif | |
365 | _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); | |
366 | _GL_CXXALIASWARN (mkostemp); | |
367 | #elif defined GNULIB_POSIXCHECK | |
368 | # undef mkostemp | |
369 | # if HAVE_RAW_DECL_MKOSTEMP | |
370 | _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " | |
371 | "use gnulib module mkostemp for portability"); | |
372 | # endif | |
373 | #endif | |
374 | ||
375 | #if @GNULIB_MKOSTEMPS@ | |
376 | /* Create a unique temporary file from TEMPLATE. | |
377 | The last six characters of TEMPLATE before a suffix of length | |
378 | SUFFIXLEN must be "XXXXXX"; | |
379 | they are replaced with a string that makes the file name unique. | |
380 | The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>) | |
381 | and O_TEXT, O_BINARY (defined in "binary-io.h"). | |
382 | The file is then created, with the specified flags, ensuring it didn't exist | |
383 | before. | |
384 | The file is created read-write (mask at least 0600 & ~umask), but it may be | |
385 | world-readable and world-writable (mask 0666 & ~umask), depending on the | |
386 | implementation. | |
387 | Returns the open file descriptor if successful, otherwise -1 and errno | |
388 | set. */ | |
389 | # if !@HAVE_MKOSTEMPS@ | |
390 | _GL_FUNCDECL_SYS (mkostemps, int, | |
391 | (char * /*template*/, int /*suffixlen*/, int /*flags*/) | |
392 | _GL_ARG_NONNULL ((1))); | |
393 | # endif | |
394 | _GL_CXXALIAS_SYS (mkostemps, int, | |
395 | (char * /*template*/, int /*suffixlen*/, int /*flags*/)); | |
396 | _GL_CXXALIASWARN (mkostemps); | |
397 | #elif defined GNULIB_POSIXCHECK | |
398 | # undef mkostemps | |
399 | # if HAVE_RAW_DECL_MKOSTEMPS | |
400 | _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " | |
401 | "use gnulib module mkostemps for portability"); | |
402 | # endif | |
403 | #endif | |
404 | ||
405 | #if @GNULIB_MKSTEMP@ | |
406 | /* Create a unique temporary file from TEMPLATE. | |
407 | The last six characters of TEMPLATE must be "XXXXXX"; | |
408 | they are replaced with a string that makes the file name unique. | |
409 | The file is then created, ensuring it didn't exist before. | |
410 | The file is created read-write (mask at least 0600 & ~umask), but it may be | |
411 | world-readable and world-writable (mask 0666 & ~umask), depending on the | |
412 | implementation. | |
413 | Returns the open file descriptor if successful, otherwise -1 and errno | |
414 | set. */ | |
415 | # if @REPLACE_MKSTEMP@ | |
416 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
417 | # define mkstemp rpl_mkstemp | |
418 | # endif | |
419 | _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); | |
420 | _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); | |
421 | # else | |
422 | # if ! @HAVE_MKSTEMP@ | |
423 | _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); | |
424 | # endif | |
425 | _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); | |
426 | # endif | |
427 | _GL_CXXALIASWARN (mkstemp); | |
428 | #elif defined GNULIB_POSIXCHECK | |
429 | # undef mkstemp | |
430 | # if HAVE_RAW_DECL_MKSTEMP | |
431 | _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " | |
432 | "use gnulib module mkstemp for portability"); | |
433 | # endif | |
434 | #endif | |
435 | ||
436 | #if @GNULIB_MKSTEMPS@ | |
437 | /* Create a unique temporary file from TEMPLATE. | |
438 | The last six characters of TEMPLATE prior to a suffix of length | |
439 | SUFFIXLEN must be "XXXXXX"; | |
440 | they are replaced with a string that makes the file name unique. | |
441 | The file is then created, ensuring it didn't exist before. | |
442 | The file is created read-write (mask at least 0600 & ~umask), but it may be | |
443 | world-readable and world-writable (mask 0666 & ~umask), depending on the | |
444 | implementation. | |
445 | Returns the open file descriptor if successful, otherwise -1 and errno | |
446 | set. */ | |
447 | # if !@HAVE_MKSTEMPS@ | |
448 | _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) | |
449 | _GL_ARG_NONNULL ((1))); | |
450 | # endif | |
451 | _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); | |
452 | _GL_CXXALIASWARN (mkstemps); | |
453 | #elif defined GNULIB_POSIXCHECK | |
454 | # undef mkstemps | |
455 | # if HAVE_RAW_DECL_MKSTEMPS | |
456 | _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " | |
457 | "use gnulib module mkstemps for portability"); | |
458 | # endif | |
459 | #endif | |
460 | ||
461 | #if @GNULIB_POSIX_OPENPT@ | |
462 | /* Return an FD open to the master side of a pseudo-terminal. Flags should | |
463 | include O_RDWR, and may also include O_NOCTTY. */ | |
464 | # if !@HAVE_POSIX_OPENPT@ | |
465 | _GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); | |
466 | # endif | |
467 | _GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); | |
468 | _GL_CXXALIASWARN (posix_openpt); | |
469 | #elif defined GNULIB_POSIXCHECK | |
470 | # undef posix_openpt | |
471 | # if HAVE_RAW_DECL_POSIX_OPENPT | |
472 | _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " | |
473 | "use gnulib module posix_openpt for portability"); | |
474 | # endif | |
475 | #endif | |
476 | ||
477 | #if @GNULIB_PTSNAME@ | |
478 | /* Return the pathname of the pseudo-terminal slave associated with | |
479 | the master FD is open on, or NULL on errors. */ | |
480 | # if @REPLACE_PTSNAME@ | |
481 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
482 | # undef ptsname | |
483 | # define ptsname rpl_ptsname | |
484 | # endif | |
485 | _GL_FUNCDECL_RPL (ptsname, char *, (int fd)); | |
486 | _GL_CXXALIAS_RPL (ptsname, char *, (int fd)); | |
487 | # else | |
488 | # if !@HAVE_PTSNAME@ | |
489 | _GL_FUNCDECL_SYS (ptsname, char *, (int fd)); | |
490 | # endif | |
491 | _GL_CXXALIAS_SYS (ptsname, char *, (int fd)); | |
492 | # endif | |
493 | _GL_CXXALIASWARN (ptsname); | |
494 | #elif defined GNULIB_POSIXCHECK | |
495 | # undef ptsname | |
496 | # if HAVE_RAW_DECL_PTSNAME | |
497 | _GL_WARN_ON_USE (ptsname, "ptsname is not portable - " | |
498 | "use gnulib module ptsname for portability"); | |
499 | # endif | |
500 | #endif | |
501 | ||
502 | #if @GNULIB_PTSNAME_R@ | |
503 | /* Set the pathname of the pseudo-terminal slave associated with | |
504 | the master FD is open on and return 0, or set errno and return | |
505 | non-zero on errors. */ | |
506 | # if @REPLACE_PTSNAME_R@ | |
507 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
508 | # undef ptsname_r | |
509 | # define ptsname_r rpl_ptsname_r | |
510 | # endif | |
511 | _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); | |
512 | _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); | |
513 | # else | |
514 | # if !@HAVE_PTSNAME_R@ | |
515 | _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); | |
516 | # endif | |
517 | _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); | |
518 | # endif | |
519 | _GL_CXXALIASWARN (ptsname_r); | |
520 | #elif defined GNULIB_POSIXCHECK | |
521 | # undef ptsname_r | |
522 | # if HAVE_RAW_DECL_PTSNAME_R | |
523 | _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " | |
524 | "use gnulib module ptsname_r for portability"); | |
525 | # endif | |
526 | #endif | |
527 | ||
528 | #if @GNULIB_PUTENV@ | |
529 | # if @REPLACE_PUTENV@ | |
530 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
531 | # undef putenv | |
532 | # define putenv rpl_putenv | |
533 | # endif | |
534 | _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); | |
535 | _GL_CXXALIAS_RPL (putenv, int, (char *string)); | |
536 | # else | |
537 | _GL_CXXALIAS_SYS (putenv, int, (char *string)); | |
538 | # endif | |
539 | _GL_CXXALIASWARN (putenv); | |
540 | #endif | |
541 | ||
4a626d0a | 542 | #if @GNULIB_QSORT_R@ |
4c62b19f PA |
543 | /* Sort an array of NMEMB elements, starting at address BASE, each element |
544 | occupying SIZE bytes, in ascending order according to the comparison | |
545 | function COMPARE. */ | |
4a626d0a PA |
546 | # if @REPLACE_QSORT_R@ |
547 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
548 | # undef qsort_r | |
549 | # define qsort_r rpl_qsort_r | |
550 | # endif | |
551 | _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, | |
552 | int (*compare) (void const *, void const *, | |
553 | void *), | |
554 | void *arg) _GL_ARG_NONNULL ((1, 4))); | |
555 | _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, | |
556 | int (*compare) (void const *, void const *, | |
557 | void *), | |
558 | void *arg)); | |
559 | # else | |
4c62b19f PA |
560 | # if !@HAVE_QSORT_R@ |
561 | _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, | |
562 | int (*compare) (void const *, void const *, | |
563 | void *), | |
564 | void *arg) _GL_ARG_NONNULL ((1, 4))); | |
565 | # endif | |
4a626d0a PA |
566 | _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, |
567 | int (*compare) (void const *, void const *, | |
568 | void *), | |
569 | void *arg)); | |
570 | # endif | |
571 | _GL_CXXALIASWARN (qsort_r); | |
4c62b19f PA |
572 | #elif defined GNULIB_POSIXCHECK |
573 | # undef qsort_r | |
574 | # if HAVE_RAW_DECL_QSORT_R | |
575 | _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " | |
576 | "use gnulib module qsort_r for portability"); | |
577 | # endif | |
4a626d0a PA |
578 | #endif |
579 | ||
98399780 YQ |
580 | |
581 | #if @GNULIB_RANDOM_R@ | |
582 | # if !@HAVE_RANDOM_R@ | |
583 | # ifndef RAND_MAX | |
584 | # define RAND_MAX 2147483647 | |
585 | # endif | |
586 | # endif | |
587 | #endif | |
588 | ||
589 | ||
590 | #if @GNULIB_RANDOM@ | |
c0c3707f CB |
591 | # if @REPLACE_RANDOM@ |
592 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
593 | # undef random | |
594 | # define random rpl_random | |
595 | # endif | |
596 | _GL_FUNCDECL_RPL (random, long, (void)); | |
597 | _GL_CXXALIAS_RPL (random, long, (void)); | |
598 | # else | |
599 | # if !@HAVE_RANDOM@ | |
98399780 | 600 | _GL_FUNCDECL_SYS (random, long, (void)); |
c0c3707f CB |
601 | # endif |
602 | /* Need to cast, because on Haiku, the return type is | |
603 | int. */ | |
604 | _GL_CXXALIAS_SYS_CAST (random, long, (void)); | |
98399780 | 605 | # endif |
98399780 YQ |
606 | _GL_CXXALIASWARN (random); |
607 | #elif defined GNULIB_POSIXCHECK | |
608 | # undef random | |
609 | # if HAVE_RAW_DECL_RANDOM | |
610 | _GL_WARN_ON_USE (random, "random is unportable - " | |
611 | "use gnulib module random for portability"); | |
612 | # endif | |
613 | #endif | |
614 | ||
615 | #if @GNULIB_RANDOM@ | |
c0c3707f CB |
616 | # if @REPLACE_RANDOM@ |
617 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
618 | # undef srandom | |
619 | # define srandom rpl_srandom | |
620 | # endif | |
621 | _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); | |
622 | _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); | |
623 | # else | |
624 | # if !@HAVE_RANDOM@ | |
98399780 | 625 | _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); |
c0c3707f CB |
626 | # endif |
627 | /* Need to cast, because on FreeBSD, the first parameter is | |
628 | unsigned long seed. */ | |
629 | _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed)); | |
98399780 | 630 | # endif |
98399780 YQ |
631 | _GL_CXXALIASWARN (srandom); |
632 | #elif defined GNULIB_POSIXCHECK | |
633 | # undef srandom | |
634 | # if HAVE_RAW_DECL_SRANDOM | |
635 | _GL_WARN_ON_USE (srandom, "srandom is unportable - " | |
636 | "use gnulib module random for portability"); | |
637 | # endif | |
638 | #endif | |
639 | ||
640 | #if @GNULIB_RANDOM@ | |
c0c3707f CB |
641 | # if @REPLACE_INITSTATE@ |
642 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
643 | # undef initstate | |
644 | # define initstate rpl_initstate | |
645 | # endif | |
646 | _GL_FUNCDECL_RPL (initstate, char *, | |
647 | (unsigned int seed, char *buf, size_t buf_size) | |
648 | _GL_ARG_NONNULL ((2))); | |
649 | _GL_CXXALIAS_RPL (initstate, char *, | |
650 | (unsigned int seed, char *buf, size_t buf_size)); | |
651 | # else | |
652 | # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ | |
98399780 YQ |
653 | _GL_FUNCDECL_SYS (initstate, char *, |
654 | (unsigned int seed, char *buf, size_t buf_size) | |
655 | _GL_ARG_NONNULL ((2))); | |
c0c3707f CB |
656 | # endif |
657 | /* Need to cast, because on FreeBSD, the first parameter is | |
658 | unsigned long seed. */ | |
659 | _GL_CXXALIAS_SYS_CAST (initstate, char *, | |
660 | (unsigned int seed, char *buf, size_t buf_size)); | |
98399780 | 661 | # endif |
98399780 YQ |
662 | _GL_CXXALIASWARN (initstate); |
663 | #elif defined GNULIB_POSIXCHECK | |
664 | # undef initstate | |
c0c3707f | 665 | # if HAVE_RAW_DECL_INITSTATE |
98399780 YQ |
666 | _GL_WARN_ON_USE (initstate, "initstate is unportable - " |
667 | "use gnulib module random for portability"); | |
668 | # endif | |
669 | #endif | |
670 | ||
671 | #if @GNULIB_RANDOM@ | |
c0c3707f CB |
672 | # if @REPLACE_SETSTATE@ |
673 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
674 | # undef setstate | |
675 | # define setstate rpl_setstate | |
676 | # endif | |
677 | _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); | |
678 | _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); | |
679 | # else | |
680 | # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ | |
98399780 | 681 | _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); |
c0c3707f CB |
682 | # endif |
683 | /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter | |
684 | is const char *arg_state. */ | |
685 | _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state)); | |
98399780 | 686 | # endif |
98399780 YQ |
687 | _GL_CXXALIASWARN (setstate); |
688 | #elif defined GNULIB_POSIXCHECK | |
689 | # undef setstate | |
c0c3707f | 690 | # if HAVE_RAW_DECL_SETSTATE |
98399780 YQ |
691 | _GL_WARN_ON_USE (setstate, "setstate is unportable - " |
692 | "use gnulib module random for portability"); | |
693 | # endif | |
694 | #endif | |
695 | ||
696 | ||
697 | #if @GNULIB_RANDOM_R@ | |
698 | # if @REPLACE_RANDOM_R@ | |
699 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
700 | # undef random_r | |
701 | # define random_r rpl_random_r | |
702 | # endif | |
703 | _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) | |
704 | _GL_ARG_NONNULL ((1, 2))); | |
705 | _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); | |
706 | # else | |
707 | # if !@HAVE_RANDOM_R@ | |
708 | _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) | |
709 | _GL_ARG_NONNULL ((1, 2))); | |
710 | # endif | |
711 | _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); | |
712 | # endif | |
713 | _GL_CXXALIASWARN (random_r); | |
714 | #elif defined GNULIB_POSIXCHECK | |
715 | # undef random_r | |
716 | # if HAVE_RAW_DECL_RANDOM_R | |
717 | _GL_WARN_ON_USE (random_r, "random_r is unportable - " | |
718 | "use gnulib module random_r for portability"); | |
719 | # endif | |
720 | #endif | |
721 | ||
722 | #if @GNULIB_RANDOM_R@ | |
723 | # if @REPLACE_RANDOM_R@ | |
724 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
725 | # undef srandom_r | |
726 | # define srandom_r rpl_srandom_r | |
727 | # endif | |
728 | _GL_FUNCDECL_RPL (srandom_r, int, | |
729 | (unsigned int seed, struct random_data *rand_state) | |
730 | _GL_ARG_NONNULL ((2))); | |
731 | _GL_CXXALIAS_RPL (srandom_r, int, | |
732 | (unsigned int seed, struct random_data *rand_state)); | |
733 | # else | |
734 | # if !@HAVE_RANDOM_R@ | |
735 | _GL_FUNCDECL_SYS (srandom_r, int, | |
736 | (unsigned int seed, struct random_data *rand_state) | |
737 | _GL_ARG_NONNULL ((2))); | |
738 | # endif | |
739 | _GL_CXXALIAS_SYS (srandom_r, int, | |
740 | (unsigned int seed, struct random_data *rand_state)); | |
741 | # endif | |
742 | _GL_CXXALIASWARN (srandom_r); | |
743 | #elif defined GNULIB_POSIXCHECK | |
744 | # undef srandom_r | |
745 | # if HAVE_RAW_DECL_SRANDOM_R | |
746 | _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " | |
747 | "use gnulib module random_r for portability"); | |
748 | # endif | |
749 | #endif | |
750 | ||
751 | #if @GNULIB_RANDOM_R@ | |
752 | # if @REPLACE_RANDOM_R@ | |
753 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
754 | # undef initstate_r | |
755 | # define initstate_r rpl_initstate_r | |
756 | # endif | |
757 | _GL_FUNCDECL_RPL (initstate_r, int, | |
758 | (unsigned int seed, char *buf, size_t buf_size, | |
759 | struct random_data *rand_state) | |
760 | _GL_ARG_NONNULL ((2, 4))); | |
761 | _GL_CXXALIAS_RPL (initstate_r, int, | |
762 | (unsigned int seed, char *buf, size_t buf_size, | |
763 | struct random_data *rand_state)); | |
764 | # else | |
765 | # if !@HAVE_RANDOM_R@ | |
766 | _GL_FUNCDECL_SYS (initstate_r, int, | |
767 | (unsigned int seed, char *buf, size_t buf_size, | |
768 | struct random_data *rand_state) | |
769 | _GL_ARG_NONNULL ((2, 4))); | |
770 | # endif | |
c0c3707f CB |
771 | /* Need to cast, because on Haiku, the third parameter is |
772 | unsigned long buf_size. */ | |
773 | _GL_CXXALIAS_SYS_CAST (initstate_r, int, | |
774 | (unsigned int seed, char *buf, size_t buf_size, | |
775 | struct random_data *rand_state)); | |
98399780 YQ |
776 | # endif |
777 | _GL_CXXALIASWARN (initstate_r); | |
778 | #elif defined GNULIB_POSIXCHECK | |
779 | # undef initstate_r | |
780 | # if HAVE_RAW_DECL_INITSTATE_R | |
781 | _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " | |
782 | "use gnulib module random_r for portability"); | |
783 | # endif | |
784 | #endif | |
785 | ||
786 | #if @GNULIB_RANDOM_R@ | |
787 | # if @REPLACE_RANDOM_R@ | |
788 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
789 | # undef setstate_r | |
790 | # define setstate_r rpl_setstate_r | |
791 | # endif | |
792 | _GL_FUNCDECL_RPL (setstate_r, int, | |
793 | (char *arg_state, struct random_data *rand_state) | |
794 | _GL_ARG_NONNULL ((1, 2))); | |
795 | _GL_CXXALIAS_RPL (setstate_r, int, | |
796 | (char *arg_state, struct random_data *rand_state)); | |
797 | # else | |
798 | # if !@HAVE_RANDOM_R@ | |
799 | _GL_FUNCDECL_SYS (setstate_r, int, | |
800 | (char *arg_state, struct random_data *rand_state) | |
801 | _GL_ARG_NONNULL ((1, 2))); | |
802 | # endif | |
c0c3707f CB |
803 | /* Need to cast, because on Haiku, the first parameter is |
804 | void *arg_state. */ | |
805 | _GL_CXXALIAS_SYS_CAST (setstate_r, int, | |
806 | (char *arg_state, struct random_data *rand_state)); | |
98399780 YQ |
807 | # endif |
808 | _GL_CXXALIASWARN (setstate_r); | |
809 | #elif defined GNULIB_POSIXCHECK | |
810 | # undef setstate_r | |
811 | # if HAVE_RAW_DECL_SETSTATE_R | |
812 | _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " | |
813 | "use gnulib module random_r for portability"); | |
814 | # endif | |
815 | #endif | |
816 | ||
817 | ||
818 | #if @GNULIB_REALLOC_POSIX@ | |
819 | # if @REPLACE_REALLOC@ | |
820 | # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ | |
821 | || _GL_USE_STDLIB_ALLOC) | |
822 | # undef realloc | |
823 | # define realloc rpl_realloc | |
824 | # endif | |
825 | _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)); | |
826 | _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); | |
827 | # else | |
828 | _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); | |
829 | # endif | |
c0c3707f | 830 | # if __GLIBC__ >= 2 |
98399780 | 831 | _GL_CXXALIASWARN (realloc); |
c0c3707f | 832 | # endif |
98399780 YQ |
833 | #elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC |
834 | # undef realloc | |
835 | /* Assume realloc is always declared. */ | |
836 | _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " | |
837 | "use gnulib module realloc-posix for portability"); | |
838 | #endif | |
839 | ||
c0c3707f CB |
840 | |
841 | #if @GNULIB_REALLOCARRAY@ | |
842 | # if ! @HAVE_REALLOCARRAY@ | |
843 | _GL_FUNCDECL_SYS (reallocarray, void *, | |
844 | (void *ptr, size_t nmemb, size_t size)); | |
845 | # endif | |
846 | _GL_CXXALIAS_SYS (reallocarray, void *, | |
847 | (void *ptr, size_t nmemb, size_t size)); | |
848 | _GL_CXXALIASWARN (reallocarray); | |
849 | #elif defined GNULIB_POSIXCHECK | |
850 | # undef reallocarray | |
851 | # if HAVE_RAW_DECL_REALLOCARRAY | |
852 | _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " | |
853 | "use gnulib module reallocarray for portability"); | |
854 | # endif | |
855 | #endif | |
856 | ||
98399780 YQ |
857 | #if @GNULIB_REALPATH@ |
858 | # if @REPLACE_REALPATH@ | |
859 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
860 | # define realpath rpl_realpath | |
861 | # endif | |
862 | _GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved) | |
863 | _GL_ARG_NONNULL ((1))); | |
864 | _GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved)); | |
865 | # else | |
866 | # if !@HAVE_REALPATH@ | |
867 | _GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved) | |
868 | _GL_ARG_NONNULL ((1))); | |
869 | # endif | |
870 | _GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved)); | |
871 | # endif | |
872 | _GL_CXXALIASWARN (realpath); | |
873 | #elif defined GNULIB_POSIXCHECK | |
874 | # undef realpath | |
875 | # if HAVE_RAW_DECL_REALPATH | |
876 | _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " | |
877 | "canonicalize or canonicalize-lgpl for portability"); | |
878 | # endif | |
879 | #endif | |
880 | ||
881 | #if @GNULIB_RPMATCH@ | |
882 | /* Test a user response to a question. | |
883 | Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ | |
884 | # if !@HAVE_RPMATCH@ | |
885 | _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); | |
886 | # endif | |
887 | _GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); | |
888 | _GL_CXXALIASWARN (rpmatch); | |
889 | #elif defined GNULIB_POSIXCHECK | |
890 | # undef rpmatch | |
891 | # if HAVE_RAW_DECL_RPMATCH | |
892 | _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " | |
893 | "use gnulib module rpmatch for portability"); | |
894 | # endif | |
895 | #endif | |
896 | ||
4a626d0a PA |
897 | #if @GNULIB_SECURE_GETENV@ |
898 | /* Look up NAME in the environment, returning 0 in insecure situations. */ | |
899 | # if !@HAVE_SECURE_GETENV@ | |
900 | _GL_FUNCDECL_SYS (secure_getenv, char *, | |
901 | (char const *name) _GL_ARG_NONNULL ((1))); | |
902 | # endif | |
903 | _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); | |
904 | _GL_CXXALIASWARN (secure_getenv); | |
905 | #elif defined GNULIB_POSIXCHECK | |
906 | # undef secure_getenv | |
907 | # if HAVE_RAW_DECL_SECURE_GETENV | |
908 | _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " | |
909 | "use gnulib module secure_getenv for portability"); | |
910 | # endif | |
911 | #endif | |
912 | ||
98399780 YQ |
913 | #if @GNULIB_SETENV@ |
914 | /* Set NAME to VALUE in the environment. | |
915 | If REPLACE is nonzero, overwrite an existing value. */ | |
916 | # if @REPLACE_SETENV@ | |
917 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
918 | # undef setenv | |
919 | # define setenv rpl_setenv | |
920 | # endif | |
921 | _GL_FUNCDECL_RPL (setenv, int, | |
922 | (const char *name, const char *value, int replace) | |
923 | _GL_ARG_NONNULL ((1))); | |
924 | _GL_CXXALIAS_RPL (setenv, int, | |
925 | (const char *name, const char *value, int replace)); | |
926 | # else | |
927 | # if !@HAVE_DECL_SETENV@ | |
928 | _GL_FUNCDECL_SYS (setenv, int, | |
929 | (const char *name, const char *value, int replace) | |
930 | _GL_ARG_NONNULL ((1))); | |
931 | # endif | |
932 | _GL_CXXALIAS_SYS (setenv, int, | |
933 | (const char *name, const char *value, int replace)); | |
934 | # endif | |
935 | # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@) | |
936 | _GL_CXXALIASWARN (setenv); | |
937 | # endif | |
938 | #elif defined GNULIB_POSIXCHECK | |
939 | # undef setenv | |
940 | # if HAVE_RAW_DECL_SETENV | |
941 | _GL_WARN_ON_USE (setenv, "setenv is unportable - " | |
942 | "use gnulib module setenv for portability"); | |
943 | # endif | |
944 | #endif | |
945 | ||
946 | #if @GNULIB_STRTOD@ | |
947 | /* Parse a double from STRING, updating ENDP if appropriate. */ | |
948 | # if @REPLACE_STRTOD@ | |
949 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
950 | # define strtod rpl_strtod | |
951 | # endif | |
c0c3707f | 952 | # define GNULIB_defined_strtod_function 1 |
98399780 YQ |
953 | _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp) |
954 | _GL_ARG_NONNULL ((1))); | |
955 | _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp)); | |
956 | # else | |
957 | # if !@HAVE_STRTOD@ | |
958 | _GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp) | |
959 | _GL_ARG_NONNULL ((1))); | |
960 | # endif | |
961 | _GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp)); | |
962 | # endif | |
c0c3707f | 963 | # if __GLIBC__ >= 2 |
98399780 | 964 | _GL_CXXALIASWARN (strtod); |
c0c3707f | 965 | # endif |
98399780 YQ |
966 | #elif defined GNULIB_POSIXCHECK |
967 | # undef strtod | |
968 | # if HAVE_RAW_DECL_STRTOD | |
969 | _GL_WARN_ON_USE (strtod, "strtod is unportable - " | |
970 | "use gnulib module strtod for portability"); | |
971 | # endif | |
972 | #endif | |
973 | ||
c0c3707f CB |
974 | #if @GNULIB_STRTOLD@ |
975 | /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ | |
976 | # if @REPLACE_STRTOLD@ | |
977 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
978 | # define strtold rpl_strtold | |
979 | # endif | |
980 | # define GNULIB_defined_strtold_function 1 | |
981 | _GL_FUNCDECL_RPL (strtold, long double, (const char *str, char **endp) | |
982 | _GL_ARG_NONNULL ((1))); | |
983 | _GL_CXXALIAS_RPL (strtold, long double, (const char *str, char **endp)); | |
984 | # else | |
985 | # if !@HAVE_STRTOLD@ | |
986 | _GL_FUNCDECL_SYS (strtold, long double, (const char *str, char **endp) | |
987 | _GL_ARG_NONNULL ((1))); | |
988 | # endif | |
989 | _GL_CXXALIAS_SYS (strtold, long double, (const char *str, char **endp)); | |
990 | # endif | |
991 | _GL_CXXALIASWARN (strtold); | |
992 | #elif defined GNULIB_POSIXCHECK | |
993 | # undef strtold | |
994 | # if HAVE_RAW_DECL_STRTOLD | |
995 | _GL_WARN_ON_USE (strtold, "strtold is unportable - " | |
996 | "use gnulib module strtold for portability"); | |
997 | # endif | |
998 | #endif | |
999 | ||
98399780 YQ |
1000 | #if @GNULIB_STRTOLL@ |
1001 | /* Parse a signed integer whose textual representation starts at STRING. | |
1002 | The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, | |
1003 | it may be decimal or octal (with prefix "0") or hexadecimal (with prefix | |
1004 | "0x"). | |
1005 | If ENDPTR is not NULL, the address of the first byte after the integer is | |
1006 | stored in *ENDPTR. | |
1007 | Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set | |
1008 | to ERANGE. */ | |
1009 | # if !@HAVE_STRTOLL@ | |
1010 | _GL_FUNCDECL_SYS (strtoll, long long, | |
1011 | (const char *string, char **endptr, int base) | |
1012 | _GL_ARG_NONNULL ((1))); | |
1013 | # endif | |
1014 | _GL_CXXALIAS_SYS (strtoll, long long, | |
1015 | (const char *string, char **endptr, int base)); | |
1016 | _GL_CXXALIASWARN (strtoll); | |
1017 | #elif defined GNULIB_POSIXCHECK | |
1018 | # undef strtoll | |
1019 | # if HAVE_RAW_DECL_STRTOLL | |
1020 | _GL_WARN_ON_USE (strtoll, "strtoll is unportable - " | |
1021 | "use gnulib module strtoll for portability"); | |
1022 | # endif | |
1023 | #endif | |
1024 | ||
1025 | #if @GNULIB_STRTOULL@ | |
1026 | /* Parse an unsigned integer whose textual representation starts at STRING. | |
1027 | The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, | |
1028 | it may be decimal or octal (with prefix "0") or hexadecimal (with prefix | |
1029 | "0x"). | |
1030 | If ENDPTR is not NULL, the address of the first byte after the integer is | |
1031 | stored in *ENDPTR. | |
1032 | Upon overflow, the return value is ULLONG_MAX, and errno is set to | |
1033 | ERANGE. */ | |
1034 | # if !@HAVE_STRTOULL@ | |
1035 | _GL_FUNCDECL_SYS (strtoull, unsigned long long, | |
1036 | (const char *string, char **endptr, int base) | |
1037 | _GL_ARG_NONNULL ((1))); | |
1038 | # endif | |
1039 | _GL_CXXALIAS_SYS (strtoull, unsigned long long, | |
1040 | (const char *string, char **endptr, int base)); | |
1041 | _GL_CXXALIASWARN (strtoull); | |
1042 | #elif defined GNULIB_POSIXCHECK | |
1043 | # undef strtoull | |
1044 | # if HAVE_RAW_DECL_STRTOULL | |
1045 | _GL_WARN_ON_USE (strtoull, "strtoull is unportable - " | |
1046 | "use gnulib module strtoull for portability"); | |
1047 | # endif | |
1048 | #endif | |
1049 | ||
1050 | #if @GNULIB_UNLOCKPT@ | |
1051 | /* Unlock the slave side of the pseudo-terminal whose master side is specified | |
1052 | by FD, so that it can be opened. */ | |
1053 | # if !@HAVE_UNLOCKPT@ | |
1054 | _GL_FUNCDECL_SYS (unlockpt, int, (int fd)); | |
1055 | # endif | |
1056 | _GL_CXXALIAS_SYS (unlockpt, int, (int fd)); | |
1057 | _GL_CXXALIASWARN (unlockpt); | |
1058 | #elif defined GNULIB_POSIXCHECK | |
1059 | # undef unlockpt | |
1060 | # if HAVE_RAW_DECL_UNLOCKPT | |
1061 | _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " | |
1062 | "use gnulib module unlockpt for portability"); | |
1063 | # endif | |
1064 | #endif | |
1065 | ||
1066 | #if @GNULIB_UNSETENV@ | |
1067 | /* Remove the variable NAME from the environment. */ | |
1068 | # if @REPLACE_UNSETENV@ | |
1069 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
1070 | # undef unsetenv | |
1071 | # define unsetenv rpl_unsetenv | |
1072 | # endif | |
1073 | _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); | |
1074 | _GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); | |
1075 | # else | |
1076 | # if !@HAVE_DECL_UNSETENV@ | |
1077 | _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); | |
1078 | # endif | |
1079 | _GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); | |
1080 | # endif | |
1081 | # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@) | |
1082 | _GL_CXXALIASWARN (unsetenv); | |
1083 | # endif | |
1084 | #elif defined GNULIB_POSIXCHECK | |
1085 | # undef unsetenv | |
1086 | # if HAVE_RAW_DECL_UNSETENV | |
1087 | _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " | |
1088 | "use gnulib module unsetenv for portability"); | |
1089 | # endif | |
1090 | #endif | |
1091 | ||
1092 | /* Convert a wide character to a multibyte character. */ | |
1093 | #if @GNULIB_WCTOMB@ | |
1094 | # if @REPLACE_WCTOMB@ | |
1095 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
1096 | # undef wctomb | |
1097 | # define wctomb rpl_wctomb | |
1098 | # endif | |
1099 | _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); | |
1100 | _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); | |
1101 | # else | |
1102 | _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); | |
1103 | # endif | |
c0c3707f | 1104 | # if __GLIBC__ >= 2 |
98399780 | 1105 | _GL_CXXALIASWARN (wctomb); |
c0c3707f | 1106 | # endif |
98399780 YQ |
1107 | #endif |
1108 | ||
1109 | ||
1110 | #endif /* _@GUARD_PREFIX@_STDLIB_H */ | |
1111 | #endif /* _@GUARD_PREFIX@_STDLIB_H */ | |
1112 | #endif |