1 | /* A GNU-like <stdlib.h>.
|
---|
2 |
|
---|
3 | Copyright (C) 1995, 2001-2004, 2006-2021 Free Software Foundation, Inc.
|
---|
4 |
|
---|
5 | This file is free software: you can redistribute it and/or modify
|
---|
6 | it under the terms of the GNU Lesser General Public License as
|
---|
7 | published by the Free Software Foundation; either version 2.1 of the
|
---|
8 | License, or (at your option) any later version.
|
---|
9 |
|
---|
10 | This file 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 Lesser General Public License for more details.
|
---|
14 |
|
---|
15 | You should have received a copy of the GNU Lesser General Public License
|
---|
16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
---|
17 |
|
---|
18 | #if __GNUC__ >= 3
|
---|
19 | @PRAGMA_SYSTEM_HEADER@
|
---|
20 | #endif
|
---|
21 | @PRAGMA_COLUMNS@
|
---|
22 |
|
---|
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. */
|
---|
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@
|
---|
50 | /* OpenIndiana has a bug: <sys/time.h> must be included before
|
---|
51 | <sys/loadavg.h>. */
|
---|
52 | # include <sys/time.h>
|
---|
53 | # include <sys/loadavg.h>
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | /* Native Windows platforms declare _mktemp() in <io.h>. */
|
---|
57 | #if defined _WIN32 && !defined __CYGWIN__
|
---|
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 |
|
---|
93 | #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__)
|
---|
94 | /* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
|
---|
95 | /* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
|
---|
96 | /* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps. */
|
---|
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 | #ifndef _GL_ATTRIBUTE_PURE
|
---|
105 | # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
|
---|
106 | # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
---|
107 | # else
|
---|
108 | # define _GL_ATTRIBUTE_PURE /* empty */
|
---|
109 | # endif
|
---|
110 | #endif
|
---|
111 |
|
---|
112 | /* The definition of _Noreturn is copied here. */
|
---|
113 |
|
---|
114 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
---|
115 |
|
---|
116 | /* The definition of _GL_ARG_NONNULL is copied here. */
|
---|
117 |
|
---|
118 | /* The definition of _GL_WARN_ON_USE is copied here. */
|
---|
119 |
|
---|
120 |
|
---|
121 | /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
|
---|
122 | #ifndef EXIT_SUCCESS
|
---|
123 | # define EXIT_SUCCESS 0
|
---|
124 | #endif
|
---|
125 | /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
|
---|
126 | with proper operation of xargs. */
|
---|
127 | #ifndef EXIT_FAILURE
|
---|
128 | # define EXIT_FAILURE 1
|
---|
129 | #elif EXIT_FAILURE != 1
|
---|
130 | # undef EXIT_FAILURE
|
---|
131 | # define EXIT_FAILURE 1
|
---|
132 | #endif
|
---|
133 |
|
---|
134 |
|
---|
135 | #if @GNULIB__EXIT@
|
---|
136 | /* Terminate the current process with the given return code, without running
|
---|
137 | the 'atexit' handlers. */
|
---|
138 | # if !@HAVE__EXIT@
|
---|
139 | _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
|
---|
140 | # endif
|
---|
141 | _GL_CXXALIAS_SYS (_Exit, void, (int status));
|
---|
142 | _GL_CXXALIASWARN (_Exit);
|
---|
143 | #elif defined GNULIB_POSIXCHECK
|
---|
144 | # undef _Exit
|
---|
145 | # if HAVE_RAW_DECL__EXIT
|
---|
146 | _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
|
---|
147 | "use gnulib module _Exit for portability");
|
---|
148 | # endif
|
---|
149 | #endif
|
---|
150 |
|
---|
151 |
|
---|
152 | #if @GNULIB_FREE_POSIX@
|
---|
153 | # if @REPLACE_FREE@
|
---|
154 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
155 | # undef free
|
---|
156 | # define free rpl_free
|
---|
157 | # endif
|
---|
158 | _GL_FUNCDECL_RPL (free, void, (void *ptr));
|
---|
159 | _GL_CXXALIAS_RPL (free, void, (void *ptr));
|
---|
160 | # else
|
---|
161 | _GL_CXXALIAS_SYS (free, void, (void *ptr));
|
---|
162 | # endif
|
---|
163 | # if __GLIBC__ >= 2
|
---|
164 | _GL_CXXALIASWARN (free);
|
---|
165 | # endif
|
---|
166 | #elif defined GNULIB_POSIXCHECK
|
---|
167 | # undef free
|
---|
168 | /* Assume free is always declared. */
|
---|
169 | _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
|
---|
170 | "use gnulib module free for portability");
|
---|
171 | #endif
|
---|
172 |
|
---|
173 |
|
---|
174 | /* Allocate memory with indefinite extent and specified alignment. */
|
---|
175 | #if @GNULIB_ALIGNED_ALLOC@
|
---|
176 | # if @REPLACE_ALIGNED_ALLOC@
|
---|
177 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
178 | # undef aligned_alloc
|
---|
179 | # define aligned_alloc rpl_aligned_alloc
|
---|
180 | # endif
|
---|
181 | _GL_FUNCDECL_RPL (aligned_alloc, void *,
|
---|
182 | (size_t alignment, size_t size)
|
---|
183 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
184 | _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
|
---|
185 | # else
|
---|
186 | # if @HAVE_ALIGNED_ALLOC@
|
---|
187 | # if __GNUC__ >= 11
|
---|
188 | /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
|
---|
189 | _GL_FUNCDECL_SYS (aligned_alloc, void *,
|
---|
190 | (size_t alignment, size_t size)
|
---|
191 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
192 | # endif
|
---|
193 | _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
|
---|
194 | # endif
|
---|
195 | # endif
|
---|
196 | # if @HAVE_ALIGNED_ALLOC@
|
---|
197 | _GL_CXXALIASWARN (aligned_alloc);
|
---|
198 | # endif
|
---|
199 | #else
|
---|
200 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc
|
---|
201 | /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
|
---|
202 | _GL_FUNCDECL_SYS (aligned_alloc, void *,
|
---|
203 | (size_t alignment, size_t size)
|
---|
204 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
205 | # endif
|
---|
206 | # if defined GNULIB_POSIXCHECK
|
---|
207 | # undef aligned_alloc
|
---|
208 | # if HAVE_RAW_DECL_ALIGNED_ALLOC
|
---|
209 | _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
|
---|
210 | "use gnulib module aligned_alloc for portability");
|
---|
211 | # endif
|
---|
212 | # endif
|
---|
213 | #endif
|
---|
214 |
|
---|
215 | #if @GNULIB_ATOLL@
|
---|
216 | /* Parse a signed decimal integer.
|
---|
217 | Returns the value of the integer. Errors are not detected. */
|
---|
218 | # if !@HAVE_ATOLL@
|
---|
219 | _GL_FUNCDECL_SYS (atoll, long long, (const char *string)
|
---|
220 | _GL_ATTRIBUTE_PURE
|
---|
221 | _GL_ARG_NONNULL ((1)));
|
---|
222 | # endif
|
---|
223 | _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
|
---|
224 | _GL_CXXALIASWARN (atoll);
|
---|
225 | #elif defined GNULIB_POSIXCHECK
|
---|
226 | # undef atoll
|
---|
227 | # if HAVE_RAW_DECL_ATOLL
|
---|
228 | _GL_WARN_ON_USE (atoll, "atoll is unportable - "
|
---|
229 | "use gnulib module atoll for portability");
|
---|
230 | # endif
|
---|
231 | #endif
|
---|
232 |
|
---|
233 | #if @GNULIB_CALLOC_POSIX@
|
---|
234 | # if @REPLACE_CALLOC@
|
---|
235 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
236 | # undef calloc
|
---|
237 | # define calloc rpl_calloc
|
---|
238 | # endif
|
---|
239 | _GL_FUNCDECL_RPL (calloc, void *,
|
---|
240 | (size_t nmemb, size_t size)
|
---|
241 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
242 | _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
|
---|
243 | # else
|
---|
244 | # if __GNUC__ >= 11
|
---|
245 | /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
|
---|
246 | _GL_FUNCDECL_SYS (calloc, void *,
|
---|
247 | (size_t nmemb, size_t size)
|
---|
248 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
249 | # endif
|
---|
250 | _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
|
---|
251 | # endif
|
---|
252 | # if __GLIBC__ >= 2
|
---|
253 | _GL_CXXALIASWARN (calloc);
|
---|
254 | # endif
|
---|
255 | #else
|
---|
256 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc
|
---|
257 | /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
|
---|
258 | _GL_FUNCDECL_SYS (calloc, void *,
|
---|
259 | (size_t nmemb, size_t size)
|
---|
260 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
261 | # endif
|
---|
262 | # if defined GNULIB_POSIXCHECK
|
---|
263 | # undef calloc
|
---|
264 | /* Assume calloc is always declared. */
|
---|
265 | _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
|
---|
266 | "use gnulib module calloc-posix for portability");
|
---|
267 | # endif
|
---|
268 | #endif
|
---|
269 |
|
---|
270 | #if @GNULIB_CANONICALIZE_FILE_NAME@
|
---|
271 | # if @REPLACE_CANONICALIZE_FILE_NAME@
|
---|
272 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
273 | # define canonicalize_file_name rpl_canonicalize_file_name
|
---|
274 | # endif
|
---|
275 | _GL_FUNCDECL_RPL (canonicalize_file_name, char *,
|
---|
276 | (const char *name)
|
---|
277 | _GL_ARG_NONNULL ((1))
|
---|
278 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
279 | _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
|
---|
280 | # else
|
---|
281 | # if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11
|
---|
282 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
|
---|
283 | (const char *name)
|
---|
284 | _GL_ARG_NONNULL ((1))
|
---|
285 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
286 | # endif
|
---|
287 | _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
|
---|
288 | # endif
|
---|
289 | # ifndef GNULIB_defined_canonicalize_file_name
|
---|
290 | # define GNULIB_defined_canonicalize_file_name \
|
---|
291 | (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@)
|
---|
292 | # endif
|
---|
293 | _GL_CXXALIASWARN (canonicalize_file_name);
|
---|
294 | #else
|
---|
295 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name
|
---|
296 | /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
|
---|
297 | rpl_free. */
|
---|
298 | _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
|
---|
299 | (const char *name)
|
---|
300 | _GL_ARG_NONNULL ((1))
|
---|
301 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
302 | # endif
|
---|
303 | # if defined GNULIB_POSIXCHECK
|
---|
304 | # undef canonicalize_file_name
|
---|
305 | # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
|
---|
306 | _GL_WARN_ON_USE (canonicalize_file_name,
|
---|
307 | "canonicalize_file_name is unportable - "
|
---|
308 | "use gnulib module canonicalize-lgpl for portability");
|
---|
309 | # endif
|
---|
310 | # endif
|
---|
311 | #endif
|
---|
312 |
|
---|
313 | #if @GNULIB_MDA_ECVT@
|
---|
314 | /* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not
|
---|
315 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
316 | platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have
|
---|
317 | it. */
|
---|
318 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
319 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
320 | # undef ecvt
|
---|
321 | # define ecvt _ecvt
|
---|
322 | # endif
|
---|
323 | _GL_CXXALIAS_MDA (ecvt, char *,
|
---|
324 | (double number, int ndigits, int *decptp, int *signp));
|
---|
325 | # else
|
---|
326 | # if @HAVE_DECL_ECVT@
|
---|
327 | _GL_CXXALIAS_SYS (ecvt, char *,
|
---|
328 | (double number, int ndigits, int *decptp, int *signp));
|
---|
329 | # endif
|
---|
330 | # endif
|
---|
331 | # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@
|
---|
332 | _GL_CXXALIASWARN (ecvt);
|
---|
333 | # endif
|
---|
334 | #endif
|
---|
335 |
|
---|
336 | #if @GNULIB_MDA_FCVT@
|
---|
337 | /* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not
|
---|
338 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
339 | platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have
|
---|
340 | it. */
|
---|
341 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
342 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
343 | # undef fcvt
|
---|
344 | # define fcvt _fcvt
|
---|
345 | # endif
|
---|
346 | _GL_CXXALIAS_MDA (fcvt, char *,
|
---|
347 | (double number, int ndigits, int *decptp, int *signp));
|
---|
348 | # else
|
---|
349 | # if @HAVE_DECL_FCVT@
|
---|
350 | _GL_CXXALIAS_SYS (fcvt, char *,
|
---|
351 | (double number, int ndigits, int *decptp, int *signp));
|
---|
352 | # endif
|
---|
353 | # endif
|
---|
354 | # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@
|
---|
355 | _GL_CXXALIASWARN (fcvt);
|
---|
356 | # endif
|
---|
357 | #endif
|
---|
358 |
|
---|
359 | #if @GNULIB_MDA_GCVT@
|
---|
360 | /* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not
|
---|
361 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
362 | platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have
|
---|
363 | it. */
|
---|
364 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
365 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
366 | # undef gcvt
|
---|
367 | # define gcvt _gcvt
|
---|
368 | # endif
|
---|
369 | _GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf));
|
---|
370 | # else
|
---|
371 | # if @HAVE_DECL_GCVT@
|
---|
372 | _GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf));
|
---|
373 | # endif
|
---|
374 | # endif
|
---|
375 | # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@
|
---|
376 | _GL_CXXALIASWARN (gcvt);
|
---|
377 | # endif
|
---|
378 | #endif
|
---|
379 |
|
---|
380 | #if @GNULIB_GETLOADAVG@
|
---|
381 | /* Store max(NELEM,3) load average numbers in LOADAVG[].
|
---|
382 | The three numbers are the load average of the last 1 minute, the last 5
|
---|
383 | minutes, and the last 15 minutes, respectively.
|
---|
384 | LOADAVG is an array of NELEM numbers. */
|
---|
385 | # if !@HAVE_DECL_GETLOADAVG@
|
---|
386 | _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
|
---|
387 | _GL_ARG_NONNULL ((1)));
|
---|
388 | # endif
|
---|
389 | _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
|
---|
390 | _GL_CXXALIASWARN (getloadavg);
|
---|
391 | #elif defined GNULIB_POSIXCHECK
|
---|
392 | # undef getloadavg
|
---|
393 | # if HAVE_RAW_DECL_GETLOADAVG
|
---|
394 | _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
|
---|
395 | "use gnulib module getloadavg for portability");
|
---|
396 | # endif
|
---|
397 | #endif
|
---|
398 |
|
---|
399 | #if @GNULIB_GETSUBOPT@
|
---|
400 | /* Assuming *OPTIONP is a comma separated list of elements of the form
|
---|
401 | "token" or "token=value", getsubopt parses the first of these elements.
|
---|
402 | If the first element refers to a "token" that is member of the given
|
---|
403 | NULL-terminated array of tokens:
|
---|
404 | - It replaces the comma with a NUL byte, updates *OPTIONP to point past
|
---|
405 | the first option and the comma, sets *VALUEP to the value of the
|
---|
406 | element (or NULL if it doesn't contain an "=" sign),
|
---|
407 | - It returns the index of the "token" in the given array of tokens.
|
---|
408 | Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
|
---|
409 | For more details see the POSIX specification.
|
---|
410 | https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */
|
---|
411 | # if !@HAVE_GETSUBOPT@
|
---|
412 | _GL_FUNCDECL_SYS (getsubopt, int,
|
---|
413 | (char **optionp, char *const *tokens, char **valuep)
|
---|
414 | _GL_ARG_NONNULL ((1, 2, 3)));
|
---|
415 | # endif
|
---|
416 | _GL_CXXALIAS_SYS (getsubopt, int,
|
---|
417 | (char **optionp, char *const *tokens, char **valuep));
|
---|
418 | _GL_CXXALIASWARN (getsubopt);
|
---|
419 | #elif defined GNULIB_POSIXCHECK
|
---|
420 | # undef getsubopt
|
---|
421 | # if HAVE_RAW_DECL_GETSUBOPT
|
---|
422 | _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
|
---|
423 | "use gnulib module getsubopt for portability");
|
---|
424 | # endif
|
---|
425 | #endif
|
---|
426 |
|
---|
427 | #if @GNULIB_GRANTPT@
|
---|
428 | /* Change the ownership and access permission of the slave side of the
|
---|
429 | pseudo-terminal whose master side is specified by FD. */
|
---|
430 | # if !@HAVE_GRANTPT@
|
---|
431 | _GL_FUNCDECL_SYS (grantpt, int, (int fd));
|
---|
432 | # endif
|
---|
433 | _GL_CXXALIAS_SYS (grantpt, int, (int fd));
|
---|
434 | _GL_CXXALIASWARN (grantpt);
|
---|
435 | #elif defined GNULIB_POSIXCHECK
|
---|
436 | # undef grantpt
|
---|
437 | # if HAVE_RAW_DECL_GRANTPT
|
---|
438 | _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
|
---|
439 | "use gnulib module grantpt for portability");
|
---|
440 | # endif
|
---|
441 | #endif
|
---|
442 |
|
---|
443 | /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
|
---|
444 | rely on GNU or POSIX semantics for malloc and realloc (for example,
|
---|
445 | by never specifying a zero size), so it does not need malloc or
|
---|
446 | realloc to be redefined. */
|
---|
447 | #if @GNULIB_MALLOC_POSIX@
|
---|
448 | # if @REPLACE_MALLOC@
|
---|
449 | # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
|
---|
450 | || _GL_USE_STDLIB_ALLOC)
|
---|
451 | # undef malloc
|
---|
452 | # define malloc rpl_malloc
|
---|
453 | # endif
|
---|
454 | _GL_FUNCDECL_RPL (malloc, void *,
|
---|
455 | (size_t size)
|
---|
456 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
457 | _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
|
---|
458 | # else
|
---|
459 | # if __GNUC__ >= 11
|
---|
460 | /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
|
---|
461 | _GL_FUNCDECL_SYS (malloc, void *,
|
---|
462 | (size_t size)
|
---|
463 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
464 | # endif
|
---|
465 | _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
|
---|
466 | # endif
|
---|
467 | # if __GLIBC__ >= 2
|
---|
468 | _GL_CXXALIASWARN (malloc);
|
---|
469 | # endif
|
---|
470 | #else
|
---|
471 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc
|
---|
472 | /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
|
---|
473 | _GL_FUNCDECL_SYS (malloc, void *,
|
---|
474 | (size_t size)
|
---|
475 | _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
476 | # endif
|
---|
477 | # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
|
---|
478 | # undef malloc
|
---|
479 | /* Assume malloc is always declared. */
|
---|
480 | _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
|
---|
481 | "use gnulib module malloc-posix for portability");
|
---|
482 | # endif
|
---|
483 | #endif
|
---|
484 |
|
---|
485 | /* Convert a multibyte character to a wide character. */
|
---|
486 | #if @GNULIB_MBTOWC@
|
---|
487 | # if @REPLACE_MBTOWC@
|
---|
488 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
489 | # undef mbtowc
|
---|
490 | # define mbtowc rpl_mbtowc
|
---|
491 | # endif
|
---|
492 | _GL_FUNCDECL_RPL (mbtowc, int,
|
---|
493 | (wchar_t *restrict pwc, const char *restrict s, size_t n));
|
---|
494 | _GL_CXXALIAS_RPL (mbtowc, int,
|
---|
495 | (wchar_t *restrict pwc, const char *restrict s, size_t n));
|
---|
496 | # else
|
---|
497 | # if !@HAVE_MBTOWC@
|
---|
498 | _GL_FUNCDECL_SYS (mbtowc, int,
|
---|
499 | (wchar_t *restrict pwc, const char *restrict s, size_t n));
|
---|
500 | # endif
|
---|
501 | _GL_CXXALIAS_SYS (mbtowc, int,
|
---|
502 | (wchar_t *restrict pwc, const char *restrict s, size_t n));
|
---|
503 | # endif
|
---|
504 | # if __GLIBC__ >= 2
|
---|
505 | _GL_CXXALIASWARN (mbtowc);
|
---|
506 | # endif
|
---|
507 | #elif defined GNULIB_POSIXCHECK
|
---|
508 | # undef mbtowc
|
---|
509 | # if HAVE_RAW_DECL_MBTOWC
|
---|
510 | _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
|
---|
511 | "use gnulib module mbtowc for portability");
|
---|
512 | # endif
|
---|
513 | #endif
|
---|
514 |
|
---|
515 | #if @GNULIB_MKDTEMP@
|
---|
516 | /* Create a unique temporary directory from TEMPLATE.
|
---|
517 | The last six characters of TEMPLATE must be "XXXXXX";
|
---|
518 | they are replaced with a string that makes the directory name unique.
|
---|
519 | Returns TEMPLATE, or a null pointer if it cannot get a unique name.
|
---|
520 | The directory is created mode 700. */
|
---|
521 | # if !@HAVE_MKDTEMP@
|
---|
522 | _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
|
---|
523 | # endif
|
---|
524 | _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
|
---|
525 | _GL_CXXALIASWARN (mkdtemp);
|
---|
526 | #elif defined GNULIB_POSIXCHECK
|
---|
527 | # undef mkdtemp
|
---|
528 | # if HAVE_RAW_DECL_MKDTEMP
|
---|
529 | _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
|
---|
530 | "use gnulib module mkdtemp for portability");
|
---|
531 | # endif
|
---|
532 | #endif
|
---|
533 |
|
---|
534 | #if @GNULIB_MKOSTEMP@
|
---|
535 | /* Create a unique temporary file from TEMPLATE.
|
---|
536 | The last six characters of TEMPLATE must be "XXXXXX";
|
---|
537 | they are replaced with a string that makes the file name unique.
|
---|
538 | The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
|
---|
539 | and O_TEXT, O_BINARY (defined in "binary-io.h").
|
---|
540 | The file is then created, with the specified flags, ensuring it didn't exist
|
---|
541 | before.
|
---|
542 | The file is created read-write (mask at least 0600 & ~umask), but it may be
|
---|
543 | world-readable and world-writable (mask 0666 & ~umask), depending on the
|
---|
544 | implementation.
|
---|
545 | Returns the open file descriptor if successful, otherwise -1 and errno
|
---|
546 | set. */
|
---|
547 | # if !@HAVE_MKOSTEMP@
|
---|
548 | _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
|
---|
549 | _GL_ARG_NONNULL ((1)));
|
---|
550 | # endif
|
---|
551 | _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
|
---|
552 | _GL_CXXALIASWARN (mkostemp);
|
---|
553 | #elif defined GNULIB_POSIXCHECK
|
---|
554 | # undef mkostemp
|
---|
555 | # if HAVE_RAW_DECL_MKOSTEMP
|
---|
556 | _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
|
---|
557 | "use gnulib module mkostemp for portability");
|
---|
558 | # endif
|
---|
559 | #endif
|
---|
560 |
|
---|
561 | #if @GNULIB_MKOSTEMPS@
|
---|
562 | /* Create a unique temporary file from TEMPLATE.
|
---|
563 | The last six characters of TEMPLATE before a suffix of length
|
---|
564 | SUFFIXLEN must be "XXXXXX";
|
---|
565 | they are replaced with a string that makes the file name unique.
|
---|
566 | The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
|
---|
567 | and O_TEXT, O_BINARY (defined in "binary-io.h").
|
---|
568 | The file is then created, with the specified flags, ensuring it didn't exist
|
---|
569 | before.
|
---|
570 | The file is created read-write (mask at least 0600 & ~umask), but it may be
|
---|
571 | world-readable and world-writable (mask 0666 & ~umask), depending on the
|
---|
572 | implementation.
|
---|
573 | Returns the open file descriptor if successful, otherwise -1 and errno
|
---|
574 | set. */
|
---|
575 | # if !@HAVE_MKOSTEMPS@
|
---|
576 | _GL_FUNCDECL_SYS (mkostemps, int,
|
---|
577 | (char * /*template*/, int /*suffixlen*/, int /*flags*/)
|
---|
578 | _GL_ARG_NONNULL ((1)));
|
---|
579 | # endif
|
---|
580 | _GL_CXXALIAS_SYS (mkostemps, int,
|
---|
581 | (char * /*template*/, int /*suffixlen*/, int /*flags*/));
|
---|
582 | _GL_CXXALIASWARN (mkostemps);
|
---|
583 | #elif defined GNULIB_POSIXCHECK
|
---|
584 | # undef mkostemps
|
---|
585 | # if HAVE_RAW_DECL_MKOSTEMPS
|
---|
586 | _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
|
---|
587 | "use gnulib module mkostemps for portability");
|
---|
588 | # endif
|
---|
589 | #endif
|
---|
590 |
|
---|
591 | #if @GNULIB_MKSTEMP@
|
---|
592 | /* Create a unique temporary file from TEMPLATE.
|
---|
593 | The last six characters of TEMPLATE must be "XXXXXX";
|
---|
594 | they are replaced with a string that makes the file name unique.
|
---|
595 | The file is then created, ensuring it didn't exist before.
|
---|
596 | The file is created read-write (mask at least 0600 & ~umask), but it may be
|
---|
597 | world-readable and world-writable (mask 0666 & ~umask), depending on the
|
---|
598 | implementation.
|
---|
599 | Returns the open file descriptor if successful, otherwise -1 and errno
|
---|
600 | set. */
|
---|
601 | # if @REPLACE_MKSTEMP@
|
---|
602 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
603 | # define mkstemp rpl_mkstemp
|
---|
604 | # endif
|
---|
605 | _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
|
---|
606 | _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
|
---|
607 | # else
|
---|
608 | # if ! @HAVE_MKSTEMP@
|
---|
609 | _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
|
---|
610 | # endif
|
---|
611 | _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
|
---|
612 | # endif
|
---|
613 | _GL_CXXALIASWARN (mkstemp);
|
---|
614 | #elif defined GNULIB_POSIXCHECK
|
---|
615 | # undef mkstemp
|
---|
616 | # if HAVE_RAW_DECL_MKSTEMP
|
---|
617 | _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
|
---|
618 | "use gnulib module mkstemp for portability");
|
---|
619 | # endif
|
---|
620 | #endif
|
---|
621 |
|
---|
622 | #if @GNULIB_MKSTEMPS@
|
---|
623 | /* Create a unique temporary file from TEMPLATE.
|
---|
624 | The last six characters of TEMPLATE prior to a suffix of length
|
---|
625 | SUFFIXLEN must be "XXXXXX";
|
---|
626 | they are replaced with a string that makes the file name unique.
|
---|
627 | The file is then created, ensuring it didn't exist before.
|
---|
628 | The file is created read-write (mask at least 0600 & ~umask), but it may be
|
---|
629 | world-readable and world-writable (mask 0666 & ~umask), depending on the
|
---|
630 | implementation.
|
---|
631 | Returns the open file descriptor if successful, otherwise -1 and errno
|
---|
632 | set. */
|
---|
633 | # if !@HAVE_MKSTEMPS@
|
---|
634 | _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
|
---|
635 | _GL_ARG_NONNULL ((1)));
|
---|
636 | # endif
|
---|
637 | _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
|
---|
638 | _GL_CXXALIASWARN (mkstemps);
|
---|
639 | #elif defined GNULIB_POSIXCHECK
|
---|
640 | # undef mkstemps
|
---|
641 | # if HAVE_RAW_DECL_MKSTEMPS
|
---|
642 | _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
|
---|
643 | "use gnulib module mkstemps for portability");
|
---|
644 | # endif
|
---|
645 | #endif
|
---|
646 |
|
---|
647 | #if @GNULIB_MDA_MKTEMP@
|
---|
648 | /* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not
|
---|
649 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
650 | platforms by defining GNULIB_NAMESPACE::mktemp always. */
|
---|
651 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
652 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
653 | # undef mktemp
|
---|
654 | # define mktemp _mktemp
|
---|
655 | # endif
|
---|
656 | _GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/));
|
---|
657 | # else
|
---|
658 | _GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/));
|
---|
659 | # endif
|
---|
660 | _GL_CXXALIASWARN (mktemp);
|
---|
661 | #endif
|
---|
662 |
|
---|
663 | /* Allocate memory with indefinite extent and specified alignment. */
|
---|
664 | #if @GNULIB_POSIX_MEMALIGN@
|
---|
665 | # if @REPLACE_POSIX_MEMALIGN@
|
---|
666 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
667 | # undef posix_memalign
|
---|
668 | # define posix_memalign rpl_posix_memalign
|
---|
669 | # endif
|
---|
670 | _GL_FUNCDECL_RPL (posix_memalign, int,
|
---|
671 | (void **memptr, size_t alignment, size_t size)
|
---|
672 | _GL_ARG_NONNULL ((1)));
|
---|
673 | _GL_CXXALIAS_RPL (posix_memalign, int,
|
---|
674 | (void **memptr, size_t alignment, size_t size));
|
---|
675 | # else
|
---|
676 | # if @HAVE_POSIX_MEMALIGN@
|
---|
677 | _GL_CXXALIAS_SYS (posix_memalign, int,
|
---|
678 | (void **memptr, size_t alignment, size_t size));
|
---|
679 | # endif
|
---|
680 | # endif
|
---|
681 | # if @HAVE_POSIX_MEMALIGN@
|
---|
682 | _GL_CXXALIASWARN (posix_memalign);
|
---|
683 | # endif
|
---|
684 | #elif defined GNULIB_POSIXCHECK
|
---|
685 | # undef posix_memalign
|
---|
686 | # if HAVE_RAW_DECL_POSIX_MEMALIGN
|
---|
687 | _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
|
---|
688 | "use gnulib module posix_memalign for portability");
|
---|
689 | # endif
|
---|
690 | #endif
|
---|
691 |
|
---|
692 | #if @GNULIB_POSIX_OPENPT@
|
---|
693 | /* Return an FD open to the master side of a pseudo-terminal. Flags should
|
---|
694 | include O_RDWR, and may also include O_NOCTTY. */
|
---|
695 | # if !@HAVE_POSIX_OPENPT@
|
---|
696 | _GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
|
---|
697 | # endif
|
---|
698 | _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
|
---|
699 | _GL_CXXALIASWARN (posix_openpt);
|
---|
700 | #elif defined GNULIB_POSIXCHECK
|
---|
701 | # undef posix_openpt
|
---|
702 | # if HAVE_RAW_DECL_POSIX_OPENPT
|
---|
703 | _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
|
---|
704 | "use gnulib module posix_openpt for portability");
|
---|
705 | # endif
|
---|
706 | #endif
|
---|
707 |
|
---|
708 | #if @GNULIB_PTSNAME@
|
---|
709 | /* Return the pathname of the pseudo-terminal slave associated with
|
---|
710 | the master FD is open on, or NULL on errors. */
|
---|
711 | # if @REPLACE_PTSNAME@
|
---|
712 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
713 | # undef ptsname
|
---|
714 | # define ptsname rpl_ptsname
|
---|
715 | # endif
|
---|
716 | _GL_FUNCDECL_RPL (ptsname, char *, (int fd));
|
---|
717 | _GL_CXXALIAS_RPL (ptsname, char *, (int fd));
|
---|
718 | # else
|
---|
719 | # if !@HAVE_PTSNAME@
|
---|
720 | _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
|
---|
721 | # endif
|
---|
722 | _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
|
---|
723 | # endif
|
---|
724 | _GL_CXXALIASWARN (ptsname);
|
---|
725 | #elif defined GNULIB_POSIXCHECK
|
---|
726 | # undef ptsname
|
---|
727 | # if HAVE_RAW_DECL_PTSNAME
|
---|
728 | _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
|
---|
729 | "use gnulib module ptsname for portability");
|
---|
730 | # endif
|
---|
731 | #endif
|
---|
732 |
|
---|
733 | #if @GNULIB_PTSNAME_R@
|
---|
734 | /* Set the pathname of the pseudo-terminal slave associated with
|
---|
735 | the master FD is open on and return 0, or set errno and return
|
---|
736 | non-zero on errors. */
|
---|
737 | # if @REPLACE_PTSNAME_R@
|
---|
738 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
739 | # undef ptsname_r
|
---|
740 | # define ptsname_r rpl_ptsname_r
|
---|
741 | # endif
|
---|
742 | _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
|
---|
743 | _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
|
---|
744 | # else
|
---|
745 | # if !@HAVE_PTSNAME_R@
|
---|
746 | _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
|
---|
747 | # endif
|
---|
748 | _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
|
---|
749 | # endif
|
---|
750 | # ifndef GNULIB_defined_ptsname_r
|
---|
751 | # define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@)
|
---|
752 | # endif
|
---|
753 | _GL_CXXALIASWARN (ptsname_r);
|
---|
754 | #elif defined GNULIB_POSIXCHECK
|
---|
755 | # undef ptsname_r
|
---|
756 | # if HAVE_RAW_DECL_PTSNAME_R
|
---|
757 | _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
|
---|
758 | "use gnulib module ptsname_r for portability");
|
---|
759 | # endif
|
---|
760 | #endif
|
---|
761 |
|
---|
762 | #if @GNULIB_PUTENV@
|
---|
763 | # if @REPLACE_PUTENV@
|
---|
764 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
765 | # undef putenv
|
---|
766 | # define putenv rpl_putenv
|
---|
767 | # endif
|
---|
768 | _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
|
---|
769 | _GL_CXXALIAS_RPL (putenv, int, (char *string));
|
---|
770 | # elif defined _WIN32 && !defined __CYGWIN__
|
---|
771 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
772 | # undef putenv
|
---|
773 | # define putenv _putenv
|
---|
774 | # endif
|
---|
775 | _GL_CXXALIAS_MDA (putenv, int, (char *string));
|
---|
776 | # else
|
---|
777 | _GL_CXXALIAS_SYS (putenv, int, (char *string));
|
---|
778 | # endif
|
---|
779 | _GL_CXXALIASWARN (putenv);
|
---|
780 | #elif @GNULIB_MDA_PUTENV@
|
---|
781 | /* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not
|
---|
782 | required. In C++ with GNULIB_NAMESPACE, avoid differences between
|
---|
783 | platforms by defining GNULIB_NAMESPACE::putenv always. */
|
---|
784 | # if defined _WIN32 && !defined __CYGWIN__
|
---|
785 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
786 | # undef putenv
|
---|
787 | # define putenv _putenv
|
---|
788 | # endif
|
---|
789 | /* Need to cast, because on mingw, the parameter is either
|
---|
790 | 'const char *string' or 'char *string'. */
|
---|
791 | _GL_CXXALIAS_MDA_CAST (putenv, int, (char *string));
|
---|
792 | # else
|
---|
793 | _GL_CXXALIAS_SYS (putenv, int, (char *string));
|
---|
794 | # endif
|
---|
795 | _GL_CXXALIASWARN (putenv);
|
---|
796 | #endif
|
---|
797 |
|
---|
798 | #if @GNULIB_QSORT_R@
|
---|
799 | /* Sort an array of NMEMB elements, starting at address BASE, each element
|
---|
800 | occupying SIZE bytes, in ascending order according to the comparison
|
---|
801 | function COMPARE. */
|
---|
802 | # if @REPLACE_QSORT_R@
|
---|
803 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
804 | # undef qsort_r
|
---|
805 | # define qsort_r rpl_qsort_r
|
---|
806 | # endif
|
---|
807 | _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
|
---|
808 | int (*compare) (void const *, void const *,
|
---|
809 | void *),
|
---|
810 | void *arg) _GL_ARG_NONNULL ((1, 4)));
|
---|
811 | _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
|
---|
812 | int (*compare) (void const *, void const *,
|
---|
813 | void *),
|
---|
814 | void *arg));
|
---|
815 | # else
|
---|
816 | # if !@HAVE_QSORT_R@
|
---|
817 | _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
|
---|
818 | int (*compare) (void const *, void const *,
|
---|
819 | void *),
|
---|
820 | void *arg) _GL_ARG_NONNULL ((1, 4)));
|
---|
821 | # endif
|
---|
822 | _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
|
---|
823 | int (*compare) (void const *, void const *,
|
---|
824 | void *),
|
---|
825 | void *arg));
|
---|
826 | # endif
|
---|
827 | _GL_CXXALIASWARN (qsort_r);
|
---|
828 | #elif defined GNULIB_POSIXCHECK
|
---|
829 | # undef qsort_r
|
---|
830 | # if HAVE_RAW_DECL_QSORT_R
|
---|
831 | _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
|
---|
832 | "use gnulib module qsort_r for portability");
|
---|
833 | # endif
|
---|
834 | #endif
|
---|
835 |
|
---|
836 |
|
---|
837 | #if @GNULIB_RANDOM_R@
|
---|
838 | # if !@HAVE_RANDOM_R@
|
---|
839 | # ifndef RAND_MAX
|
---|
840 | # define RAND_MAX 2147483647
|
---|
841 | # endif
|
---|
842 | # endif
|
---|
843 | #endif
|
---|
844 |
|
---|
845 |
|
---|
846 | #if @GNULIB_RANDOM@
|
---|
847 | # if @REPLACE_RANDOM@
|
---|
848 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
849 | # undef random
|
---|
850 | # define random rpl_random
|
---|
851 | # endif
|
---|
852 | _GL_FUNCDECL_RPL (random, long, (void));
|
---|
853 | _GL_CXXALIAS_RPL (random, long, (void));
|
---|
854 | # else
|
---|
855 | # if !@HAVE_RANDOM@
|
---|
856 | _GL_FUNCDECL_SYS (random, long, (void));
|
---|
857 | # endif
|
---|
858 | /* Need to cast, because on Haiku, the return type is
|
---|
859 | int. */
|
---|
860 | _GL_CXXALIAS_SYS_CAST (random, long, (void));
|
---|
861 | # endif
|
---|
862 | _GL_CXXALIASWARN (random);
|
---|
863 | #elif defined GNULIB_POSIXCHECK
|
---|
864 | # undef random
|
---|
865 | # if HAVE_RAW_DECL_RANDOM
|
---|
866 | _GL_WARN_ON_USE (random, "random is unportable - "
|
---|
867 | "use gnulib module random for portability");
|
---|
868 | # endif
|
---|
869 | #endif
|
---|
870 |
|
---|
871 | #if @GNULIB_RANDOM@
|
---|
872 | # if @REPLACE_RANDOM@
|
---|
873 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
874 | # undef srandom
|
---|
875 | # define srandom rpl_srandom
|
---|
876 | # endif
|
---|
877 | _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed));
|
---|
878 | _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
|
---|
879 | # else
|
---|
880 | # if !@HAVE_RANDOM@
|
---|
881 | _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
|
---|
882 | # endif
|
---|
883 | /* Need to cast, because on FreeBSD, the first parameter is
|
---|
884 | unsigned long seed. */
|
---|
885 | _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
|
---|
886 | # endif
|
---|
887 | _GL_CXXALIASWARN (srandom);
|
---|
888 | #elif defined GNULIB_POSIXCHECK
|
---|
889 | # undef srandom
|
---|
890 | # if HAVE_RAW_DECL_SRANDOM
|
---|
891 | _GL_WARN_ON_USE (srandom, "srandom is unportable - "
|
---|
892 | "use gnulib module random for portability");
|
---|
893 | # endif
|
---|
894 | #endif
|
---|
895 |
|
---|
896 | #if @GNULIB_RANDOM@
|
---|
897 | # if @REPLACE_INITSTATE@
|
---|
898 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
899 | # undef initstate
|
---|
900 | # define initstate rpl_initstate
|
---|
901 | # endif
|
---|
902 | _GL_FUNCDECL_RPL (initstate, char *,
|
---|
903 | (unsigned int seed, char *buf, size_t buf_size)
|
---|
904 | _GL_ARG_NONNULL ((2)));
|
---|
905 | _GL_CXXALIAS_RPL (initstate, char *,
|
---|
906 | (unsigned int seed, char *buf, size_t buf_size));
|
---|
907 | # else
|
---|
908 | # if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
|
---|
909 | _GL_FUNCDECL_SYS (initstate, char *,
|
---|
910 | (unsigned int seed, char *buf, size_t buf_size)
|
---|
911 | _GL_ARG_NONNULL ((2)));
|
---|
912 | # endif
|
---|
913 | /* Need to cast, because on FreeBSD, the first parameter is
|
---|
914 | unsigned long seed. */
|
---|
915 | _GL_CXXALIAS_SYS_CAST (initstate, char *,
|
---|
916 | (unsigned int seed, char *buf, size_t buf_size));
|
---|
917 | # endif
|
---|
918 | _GL_CXXALIASWARN (initstate);
|
---|
919 | #elif defined GNULIB_POSIXCHECK
|
---|
920 | # undef initstate
|
---|
921 | # if HAVE_RAW_DECL_INITSTATE
|
---|
922 | _GL_WARN_ON_USE (initstate, "initstate is unportable - "
|
---|
923 | "use gnulib module random for portability");
|
---|
924 | # endif
|
---|
925 | #endif
|
---|
926 |
|
---|
927 | #if @GNULIB_RANDOM@
|
---|
928 | # if @REPLACE_SETSTATE@
|
---|
929 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
930 | # undef setstate
|
---|
931 | # define setstate rpl_setstate
|
---|
932 | # endif
|
---|
933 | _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
|
---|
934 | _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
|
---|
935 | # else
|
---|
936 | # if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
|
---|
937 | _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
|
---|
938 | # endif
|
---|
939 | /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
|
---|
940 | is const char *arg_state. */
|
---|
941 | _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
|
---|
942 | # endif
|
---|
943 | _GL_CXXALIASWARN (setstate);
|
---|
944 | #elif defined GNULIB_POSIXCHECK
|
---|
945 | # undef setstate
|
---|
946 | # if HAVE_RAW_DECL_SETSTATE
|
---|
947 | _GL_WARN_ON_USE (setstate, "setstate is unportable - "
|
---|
948 | "use gnulib module random for portability");
|
---|
949 | # endif
|
---|
950 | #endif
|
---|
951 |
|
---|
952 |
|
---|
953 | #if @GNULIB_RANDOM_R@
|
---|
954 | # if @REPLACE_RANDOM_R@
|
---|
955 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
956 | # undef random_r
|
---|
957 | # define random_r rpl_random_r
|
---|
958 | # endif
|
---|
959 | _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
|
---|
960 | _GL_ARG_NONNULL ((1, 2)));
|
---|
961 | _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
|
---|
962 | # else
|
---|
963 | # if !@HAVE_RANDOM_R@
|
---|
964 | _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
|
---|
965 | _GL_ARG_NONNULL ((1, 2)));
|
---|
966 | # endif
|
---|
967 | _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
|
---|
968 | # endif
|
---|
969 | _GL_CXXALIASWARN (random_r);
|
---|
970 | #elif defined GNULIB_POSIXCHECK
|
---|
971 | # undef random_r
|
---|
972 | # if HAVE_RAW_DECL_RANDOM_R
|
---|
973 | _GL_WARN_ON_USE (random_r, "random_r is unportable - "
|
---|
974 | "use gnulib module random_r for portability");
|
---|
975 | # endif
|
---|
976 | #endif
|
---|
977 |
|
---|
978 | #if @GNULIB_RANDOM_R@
|
---|
979 | # if @REPLACE_RANDOM_R@
|
---|
980 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
981 | # undef srandom_r
|
---|
982 | # define srandom_r rpl_srandom_r
|
---|
983 | # endif
|
---|
984 | _GL_FUNCDECL_RPL (srandom_r, int,
|
---|
985 | (unsigned int seed, struct random_data *rand_state)
|
---|
986 | _GL_ARG_NONNULL ((2)));
|
---|
987 | _GL_CXXALIAS_RPL (srandom_r, int,
|
---|
988 | (unsigned int seed, struct random_data *rand_state));
|
---|
989 | # else
|
---|
990 | # if !@HAVE_RANDOM_R@
|
---|
991 | _GL_FUNCDECL_SYS (srandom_r, int,
|
---|
992 | (unsigned int seed, struct random_data *rand_state)
|
---|
993 | _GL_ARG_NONNULL ((2)));
|
---|
994 | # endif
|
---|
995 | _GL_CXXALIAS_SYS (srandom_r, int,
|
---|
996 | (unsigned int seed, struct random_data *rand_state));
|
---|
997 | # endif
|
---|
998 | _GL_CXXALIASWARN (srandom_r);
|
---|
999 | #elif defined GNULIB_POSIXCHECK
|
---|
1000 | # undef srandom_r
|
---|
1001 | # if HAVE_RAW_DECL_SRANDOM_R
|
---|
1002 | _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
|
---|
1003 | "use gnulib module random_r for portability");
|
---|
1004 | # endif
|
---|
1005 | #endif
|
---|
1006 |
|
---|
1007 | #if @GNULIB_RANDOM_R@
|
---|
1008 | # if @REPLACE_RANDOM_R@
|
---|
1009 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1010 | # undef initstate_r
|
---|
1011 | # define initstate_r rpl_initstate_r
|
---|
1012 | # endif
|
---|
1013 | _GL_FUNCDECL_RPL (initstate_r, int,
|
---|
1014 | (unsigned int seed, char *buf, size_t buf_size,
|
---|
1015 | struct random_data *rand_state)
|
---|
1016 | _GL_ARG_NONNULL ((2, 4)));
|
---|
1017 | _GL_CXXALIAS_RPL (initstate_r, int,
|
---|
1018 | (unsigned int seed, char *buf, size_t buf_size,
|
---|
1019 | struct random_data *rand_state));
|
---|
1020 | # else
|
---|
1021 | # if !@HAVE_RANDOM_R@
|
---|
1022 | _GL_FUNCDECL_SYS (initstate_r, int,
|
---|
1023 | (unsigned int seed, char *buf, size_t buf_size,
|
---|
1024 | struct random_data *rand_state)
|
---|
1025 | _GL_ARG_NONNULL ((2, 4)));
|
---|
1026 | # endif
|
---|
1027 | /* Need to cast, because on Haiku, the third parameter is
|
---|
1028 | unsigned long buf_size. */
|
---|
1029 | _GL_CXXALIAS_SYS_CAST (initstate_r, int,
|
---|
1030 | (unsigned int seed, char *buf, size_t buf_size,
|
---|
1031 | struct random_data *rand_state));
|
---|
1032 | # endif
|
---|
1033 | _GL_CXXALIASWARN (initstate_r);
|
---|
1034 | #elif defined GNULIB_POSIXCHECK
|
---|
1035 | # undef initstate_r
|
---|
1036 | # if HAVE_RAW_DECL_INITSTATE_R
|
---|
1037 | _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
|
---|
1038 | "use gnulib module random_r for portability");
|
---|
1039 | # endif
|
---|
1040 | #endif
|
---|
1041 |
|
---|
1042 | #if @GNULIB_RANDOM_R@
|
---|
1043 | # if @REPLACE_RANDOM_R@
|
---|
1044 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1045 | # undef setstate_r
|
---|
1046 | # define setstate_r rpl_setstate_r
|
---|
1047 | # endif
|
---|
1048 | _GL_FUNCDECL_RPL (setstate_r, int,
|
---|
1049 | (char *arg_state, struct random_data *rand_state)
|
---|
1050 | _GL_ARG_NONNULL ((1, 2)));
|
---|
1051 | _GL_CXXALIAS_RPL (setstate_r, int,
|
---|
1052 | (char *arg_state, struct random_data *rand_state));
|
---|
1053 | # else
|
---|
1054 | # if !@HAVE_RANDOM_R@
|
---|
1055 | _GL_FUNCDECL_SYS (setstate_r, int,
|
---|
1056 | (char *arg_state, struct random_data *rand_state)
|
---|
1057 | _GL_ARG_NONNULL ((1, 2)));
|
---|
1058 | # endif
|
---|
1059 | /* Need to cast, because on Haiku, the first parameter is
|
---|
1060 | void *arg_state. */
|
---|
1061 | _GL_CXXALIAS_SYS_CAST (setstate_r, int,
|
---|
1062 | (char *arg_state, struct random_data *rand_state));
|
---|
1063 | # endif
|
---|
1064 | _GL_CXXALIASWARN (setstate_r);
|
---|
1065 | #elif defined GNULIB_POSIXCHECK
|
---|
1066 | # undef setstate_r
|
---|
1067 | # if HAVE_RAW_DECL_SETSTATE_R
|
---|
1068 | _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
|
---|
1069 | "use gnulib module random_r for portability");
|
---|
1070 | # endif
|
---|
1071 | #endif
|
---|
1072 |
|
---|
1073 |
|
---|
1074 | #if @GNULIB_REALLOC_POSIX@
|
---|
1075 | # if @REPLACE_REALLOC@
|
---|
1076 | # if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
|
---|
1077 | || _GL_USE_STDLIB_ALLOC)
|
---|
1078 | # undef realloc
|
---|
1079 | # define realloc rpl_realloc
|
---|
1080 | # endif
|
---|
1081 | _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)
|
---|
1082 | _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
1083 | _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
|
---|
1084 | # else
|
---|
1085 | # if __GNUC__ >= 11
|
---|
1086 | /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
|
---|
1087 | _GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size)
|
---|
1088 | _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
1089 | # endif
|
---|
1090 | _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
|
---|
1091 | # endif
|
---|
1092 | # if __GLIBC__ >= 2
|
---|
1093 | _GL_CXXALIASWARN (realloc);
|
---|
1094 | # endif
|
---|
1095 | #else
|
---|
1096 | # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc
|
---|
1097 | /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
|
---|
1098 | _GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size)
|
---|
1099 | _GL_ATTRIBUTE_DEALLOC_FREE);
|
---|
1100 | # endif
|
---|
1101 | # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
|
---|
1102 | # undef realloc
|
---|
1103 | /* Assume realloc is always declared. */
|
---|
1104 | _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
|
---|
1105 | "use gnulib module realloc-posix for portability");
|
---|
1106 | # endif
|
---|
1107 | #endif
|
---|
1108 |
|
---|
1109 |
|
---|
1110 | #if @GNULIB_REALLOCARRAY@
|
---|
1111 | # if @REPLACE_REALLOCARRAY@
|
---|
1112 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1113 | # undef reallocarray
|
---|
1114 | # define reallocarray rpl_reallocarray
|
---|
1115 | # endif
|
---|
1116 | _GL_FUNCDECL_RPL (reallocarray, void *,
|
---|
1117 | (void *ptr, size_t nmemb, size_t size));
|
---|
1118 | _GL_CXXALIAS_RPL (reallocarray, void *,
|
---|
1119 | (void *ptr, size_t nmemb, size_t size));
|
---|
1120 | # else
|
---|
1121 | # if ! @HAVE_REALLOCARRAY@
|
---|
1122 | _GL_FUNCDECL_SYS (reallocarray, void *,
|
---|
1123 | (void *ptr, size_t nmemb, size_t size));
|
---|
1124 | # endif
|
---|
1125 | _GL_CXXALIAS_SYS (reallocarray, void *,
|
---|
1126 | (void *ptr, size_t nmemb, size_t size));
|
---|
1127 | # endif
|
---|
1128 | _GL_CXXALIASWARN (reallocarray);
|
---|
1129 | #elif defined GNULIB_POSIXCHECK
|
---|
1130 | # undef reallocarray
|
---|
1131 | # if HAVE_RAW_DECL_REALLOCARRAY
|
---|
1132 | _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
|
---|
1133 | "use gnulib module reallocarray for portability");
|
---|
1134 | # endif
|
---|
1135 | #endif
|
---|
1136 |
|
---|
1137 | #if @GNULIB_REALPATH@
|
---|
1138 | # if @REPLACE_REALPATH@
|
---|
1139 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1140 | # define realpath rpl_realpath
|
---|
1141 | # endif
|
---|
1142 | _GL_FUNCDECL_RPL (realpath, char *,
|
---|
1143 | (const char *restrict name, char *restrict resolved)
|
---|
1144 | _GL_ARG_NONNULL ((1)));
|
---|
1145 | _GL_CXXALIAS_RPL (realpath, char *,
|
---|
1146 | (const char *restrict name, char *restrict resolved));
|
---|
1147 | # else
|
---|
1148 | # if !@HAVE_REALPATH@
|
---|
1149 | _GL_FUNCDECL_SYS (realpath, char *,
|
---|
1150 | (const char *restrict name, char *restrict resolved)
|
---|
1151 | _GL_ARG_NONNULL ((1)));
|
---|
1152 | # endif
|
---|
1153 | _GL_CXXALIAS_SYS (realpath, char *,
|
---|
1154 | (const char *restrict name, char *restrict resolved));
|
---|
1155 | # endif
|
---|
1156 | _GL_CXXALIASWARN (realpath);
|
---|
1157 | #elif defined GNULIB_POSIXCHECK
|
---|
1158 | # undef realpath
|
---|
1159 | # if HAVE_RAW_DECL_REALPATH
|
---|
1160 | _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
|
---|
1161 | "canonicalize or canonicalize-lgpl for portability");
|
---|
1162 | # endif
|
---|
1163 | #endif
|
---|
1164 |
|
---|
1165 | #if @GNULIB_RPMATCH@
|
---|
1166 | /* Test a user response to a question.
|
---|
1167 | Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
|
---|
1168 | # if !@HAVE_RPMATCH@
|
---|
1169 | _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
|
---|
1170 | # endif
|
---|
1171 | _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
|
---|
1172 | _GL_CXXALIASWARN (rpmatch);
|
---|
1173 | #elif defined GNULIB_POSIXCHECK
|
---|
1174 | # undef rpmatch
|
---|
1175 | # if HAVE_RAW_DECL_RPMATCH
|
---|
1176 | _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
|
---|
1177 | "use gnulib module rpmatch for portability");
|
---|
1178 | # endif
|
---|
1179 | #endif
|
---|
1180 |
|
---|
1181 | #if @GNULIB_SECURE_GETENV@
|
---|
1182 | /* Look up NAME in the environment, returning 0 in insecure situations. */
|
---|
1183 | # if !@HAVE_SECURE_GETENV@
|
---|
1184 | _GL_FUNCDECL_SYS (secure_getenv, char *,
|
---|
1185 | (char const *name) _GL_ARG_NONNULL ((1)));
|
---|
1186 | # endif
|
---|
1187 | _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
|
---|
1188 | _GL_CXXALIASWARN (secure_getenv);
|
---|
1189 | #elif defined GNULIB_POSIXCHECK
|
---|
1190 | # undef secure_getenv
|
---|
1191 | # if HAVE_RAW_DECL_SECURE_GETENV
|
---|
1192 | _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
|
---|
1193 | "use gnulib module secure_getenv for portability");
|
---|
1194 | # endif
|
---|
1195 | #endif
|
---|
1196 |
|
---|
1197 | #if @GNULIB_SETENV@
|
---|
1198 | /* Set NAME to VALUE in the environment.
|
---|
1199 | If REPLACE is nonzero, overwrite an existing value. */
|
---|
1200 | # if @REPLACE_SETENV@
|
---|
1201 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1202 | # undef setenv
|
---|
1203 | # define setenv rpl_setenv
|
---|
1204 | # endif
|
---|
1205 | _GL_FUNCDECL_RPL (setenv, int,
|
---|
1206 | (const char *name, const char *value, int replace)
|
---|
1207 | _GL_ARG_NONNULL ((1)));
|
---|
1208 | _GL_CXXALIAS_RPL (setenv, int,
|
---|
1209 | (const char *name, const char *value, int replace));
|
---|
1210 | # else
|
---|
1211 | # if !@HAVE_DECL_SETENV@
|
---|
1212 | _GL_FUNCDECL_SYS (setenv, int,
|
---|
1213 | (const char *name, const char *value, int replace)
|
---|
1214 | _GL_ARG_NONNULL ((1)));
|
---|
1215 | # endif
|
---|
1216 | _GL_CXXALIAS_SYS (setenv, int,
|
---|
1217 | (const char *name, const char *value, int replace));
|
---|
1218 | # endif
|
---|
1219 | # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
|
---|
1220 | _GL_CXXALIASWARN (setenv);
|
---|
1221 | # endif
|
---|
1222 | #elif defined GNULIB_POSIXCHECK
|
---|
1223 | # undef setenv
|
---|
1224 | # if HAVE_RAW_DECL_SETENV
|
---|
1225 | _GL_WARN_ON_USE (setenv, "setenv is unportable - "
|
---|
1226 | "use gnulib module setenv for portability");
|
---|
1227 | # endif
|
---|
1228 | #endif
|
---|
1229 |
|
---|
1230 | #if @GNULIB_STRTOD@
|
---|
1231 | /* Parse a double from STRING, updating ENDP if appropriate. */
|
---|
1232 | # if @REPLACE_STRTOD@
|
---|
1233 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1234 | # define strtod rpl_strtod
|
---|
1235 | # endif
|
---|
1236 | # define GNULIB_defined_strtod_function 1
|
---|
1237 | _GL_FUNCDECL_RPL (strtod, double,
|
---|
1238 | (const char *restrict str, char **restrict endp)
|
---|
1239 | _GL_ARG_NONNULL ((1)));
|
---|
1240 | _GL_CXXALIAS_RPL (strtod, double,
|
---|
1241 | (const char *restrict str, char **restrict endp));
|
---|
1242 | # else
|
---|
1243 | # if !@HAVE_STRTOD@
|
---|
1244 | _GL_FUNCDECL_SYS (strtod, double,
|
---|
1245 | (const char *restrict str, char **restrict endp)
|
---|
1246 | _GL_ARG_NONNULL ((1)));
|
---|
1247 | # endif
|
---|
1248 | _GL_CXXALIAS_SYS (strtod, double,
|
---|
1249 | (const char *restrict str, char **restrict endp));
|
---|
1250 | # endif
|
---|
1251 | # if __GLIBC__ >= 2
|
---|
1252 | _GL_CXXALIASWARN (strtod);
|
---|
1253 | # endif
|
---|
1254 | #elif defined GNULIB_POSIXCHECK
|
---|
1255 | # undef strtod
|
---|
1256 | # if HAVE_RAW_DECL_STRTOD
|
---|
1257 | _GL_WARN_ON_USE (strtod, "strtod is unportable - "
|
---|
1258 | "use gnulib module strtod for portability");
|
---|
1259 | # endif
|
---|
1260 | #endif
|
---|
1261 |
|
---|
1262 | #if @GNULIB_STRTOLD@
|
---|
1263 | /* Parse a 'long double' from STRING, updating ENDP if appropriate. */
|
---|
1264 | # if @REPLACE_STRTOLD@
|
---|
1265 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1266 | # define strtold rpl_strtold
|
---|
1267 | # endif
|
---|
1268 | # define GNULIB_defined_strtold_function 1
|
---|
1269 | _GL_FUNCDECL_RPL (strtold, long double,
|
---|
1270 | (const char *restrict str, char **restrict endp)
|
---|
1271 | _GL_ARG_NONNULL ((1)));
|
---|
1272 | _GL_CXXALIAS_RPL (strtold, long double,
|
---|
1273 | (const char *restrict str, char **restrict endp));
|
---|
1274 | # else
|
---|
1275 | # if !@HAVE_STRTOLD@
|
---|
1276 | _GL_FUNCDECL_SYS (strtold, long double,
|
---|
1277 | (const char *restrict str, char **restrict endp)
|
---|
1278 | _GL_ARG_NONNULL ((1)));
|
---|
1279 | # endif
|
---|
1280 | _GL_CXXALIAS_SYS (strtold, long double,
|
---|
1281 | (const char *restrict str, char **restrict endp));
|
---|
1282 | # endif
|
---|
1283 | _GL_CXXALIASWARN (strtold);
|
---|
1284 | #elif defined GNULIB_POSIXCHECK
|
---|
1285 | # undef strtold
|
---|
1286 | # if HAVE_RAW_DECL_STRTOLD
|
---|
1287 | _GL_WARN_ON_USE (strtold, "strtold is unportable - "
|
---|
1288 | "use gnulib module strtold for portability");
|
---|
1289 | # endif
|
---|
1290 | #endif
|
---|
1291 |
|
---|
1292 | #if @GNULIB_STRTOL@
|
---|
1293 | /* Parse a signed integer whose textual representation starts at STRING.
|
---|
1294 | The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
|
---|
1295 | it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
|
---|
1296 | "0x").
|
---|
1297 | If ENDPTR is not NULL, the address of the first byte after the integer is
|
---|
1298 | stored in *ENDPTR.
|
---|
1299 | Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set
|
---|
1300 | to ERANGE. */
|
---|
1301 | # if @REPLACE_STRTOL@
|
---|
1302 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1303 | # define strtol rpl_strtol
|
---|
1304 | # endif
|
---|
1305 | # define GNULIB_defined_strtol_function 1
|
---|
1306 | _GL_FUNCDECL_RPL (strtol, long,
|
---|
1307 | (const char *restrict string, char **restrict endptr,
|
---|
1308 | int base)
|
---|
1309 | _GL_ARG_NONNULL ((1)));
|
---|
1310 | _GL_CXXALIAS_RPL (strtol, long,
|
---|
1311 | (const char *restrict string, char **restrict endptr,
|
---|
1312 | int base));
|
---|
1313 | # else
|
---|
1314 | # if !@HAVE_STRTOL@
|
---|
1315 | _GL_FUNCDECL_SYS (strtol, long,
|
---|
1316 | (const char *restrict string, char **restrict endptr,
|
---|
1317 | int base)
|
---|
1318 | _GL_ARG_NONNULL ((1)));
|
---|
1319 | # endif
|
---|
1320 | _GL_CXXALIAS_SYS (strtol, long,
|
---|
1321 | (const char *restrict string, char **restrict endptr,
|
---|
1322 | int base));
|
---|
1323 | # endif
|
---|
1324 | _GL_CXXALIASWARN (strtol);
|
---|
1325 | #elif defined GNULIB_POSIXCHECK
|
---|
1326 | # undef strtol
|
---|
1327 | # if HAVE_RAW_DECL_STRTOL
|
---|
1328 | _GL_WARN_ON_USE (strtol, "strtol is unportable - "
|
---|
1329 | "use gnulib module strtol for portability");
|
---|
1330 | # endif
|
---|
1331 | #endif
|
---|
1332 |
|
---|
1333 | #if @GNULIB_STRTOLL@
|
---|
1334 | /* Parse a signed integer whose textual representation starts at STRING.
|
---|
1335 | The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
|
---|
1336 | it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
|
---|
1337 | "0x").
|
---|
1338 | If ENDPTR is not NULL, the address of the first byte after the integer is
|
---|
1339 | stored in *ENDPTR.
|
---|
1340 | Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
|
---|
1341 | to ERANGE. */
|
---|
1342 | # if @REPLACE_STRTOLL@
|
---|
1343 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1344 | # define strtoll rpl_strtoll
|
---|
1345 | # endif
|
---|
1346 | # define GNULIB_defined_strtoll_function 1
|
---|
1347 | _GL_FUNCDECL_RPL (strtoll, long long,
|
---|
1348 | (const char *restrict string, char **restrict endptr,
|
---|
1349 | int base)
|
---|
1350 | _GL_ARG_NONNULL ((1)));
|
---|
1351 | _GL_CXXALIAS_RPL (strtoll, long long,
|
---|
1352 | (const char *restrict string, char **restrict endptr,
|
---|
1353 | int base));
|
---|
1354 | # else
|
---|
1355 | # if !@HAVE_STRTOLL@
|
---|
1356 | _GL_FUNCDECL_SYS (strtoll, long long,
|
---|
1357 | (const char *restrict string, char **restrict endptr,
|
---|
1358 | int base)
|
---|
1359 | _GL_ARG_NONNULL ((1)));
|
---|
1360 | # endif
|
---|
1361 | _GL_CXXALIAS_SYS (strtoll, long long,
|
---|
1362 | (const char *restrict string, char **restrict endptr,
|
---|
1363 | int base));
|
---|
1364 | # endif
|
---|
1365 | _GL_CXXALIASWARN (strtoll);
|
---|
1366 | #elif defined GNULIB_POSIXCHECK
|
---|
1367 | # undef strtoll
|
---|
1368 | # if HAVE_RAW_DECL_STRTOLL
|
---|
1369 | _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
|
---|
1370 | "use gnulib module strtoll for portability");
|
---|
1371 | # endif
|
---|
1372 | #endif
|
---|
1373 |
|
---|
1374 | #if @GNULIB_STRTOUL@
|
---|
1375 | /* Parse an unsigned integer whose textual representation starts at STRING.
|
---|
1376 | The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
|
---|
1377 | it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
|
---|
1378 | "0x").
|
---|
1379 | If ENDPTR is not NULL, the address of the first byte after the integer is
|
---|
1380 | stored in *ENDPTR.
|
---|
1381 | Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE. */
|
---|
1382 | # if @REPLACE_STRTOUL@
|
---|
1383 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1384 | # define strtoul rpl_strtoul
|
---|
1385 | # endif
|
---|
1386 | # define GNULIB_defined_strtoul_function 1
|
---|
1387 | _GL_FUNCDECL_RPL (strtoul, unsigned long,
|
---|
1388 | (const char *restrict string, char **restrict endptr,
|
---|
1389 | int base)
|
---|
1390 | _GL_ARG_NONNULL ((1)));
|
---|
1391 | _GL_CXXALIAS_RPL (strtoul, unsigned long,
|
---|
1392 | (const char *restrict string, char **restrict endptr,
|
---|
1393 | int base));
|
---|
1394 | # else
|
---|
1395 | # if !@HAVE_STRTOUL@
|
---|
1396 | _GL_FUNCDECL_SYS (strtoul, unsigned long,
|
---|
1397 | (const char *restrict string, char **restrict endptr,
|
---|
1398 | int base)
|
---|
1399 | _GL_ARG_NONNULL ((1)));
|
---|
1400 | # endif
|
---|
1401 | _GL_CXXALIAS_SYS (strtoul, unsigned long,
|
---|
1402 | (const char *restrict string, char **restrict endptr,
|
---|
1403 | int base));
|
---|
1404 | # endif
|
---|
1405 | _GL_CXXALIASWARN (strtoul);
|
---|
1406 | #elif defined GNULIB_POSIXCHECK
|
---|
1407 | # undef strtoul
|
---|
1408 | # if HAVE_RAW_DECL_STRTOUL
|
---|
1409 | _GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
|
---|
1410 | "use gnulib module strtoul for portability");
|
---|
1411 | # endif
|
---|
1412 | #endif
|
---|
1413 |
|
---|
1414 | #if @GNULIB_STRTOULL@
|
---|
1415 | /* Parse an unsigned integer whose textual representation starts at STRING.
|
---|
1416 | The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
|
---|
1417 | it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
|
---|
1418 | "0x").
|
---|
1419 | If ENDPTR is not NULL, the address of the first byte after the integer is
|
---|
1420 | stored in *ENDPTR.
|
---|
1421 | Upon overflow, the return value is ULLONG_MAX, and errno is set to
|
---|
1422 | ERANGE. */
|
---|
1423 | # if @REPLACE_STRTOULL@
|
---|
1424 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1425 | # define strtoull rpl_strtoull
|
---|
1426 | # endif
|
---|
1427 | # define GNULIB_defined_strtoull_function 1
|
---|
1428 | _GL_FUNCDECL_RPL (strtoull, unsigned long long,
|
---|
1429 | (const char *restrict string, char **restrict endptr,
|
---|
1430 | int base)
|
---|
1431 | _GL_ARG_NONNULL ((1)));
|
---|
1432 | _GL_CXXALIAS_RPL (strtoull, unsigned long long,
|
---|
1433 | (const char *restrict string, char **restrict endptr,
|
---|
1434 | int base));
|
---|
1435 | # else
|
---|
1436 | # if !@HAVE_STRTOULL@
|
---|
1437 | _GL_FUNCDECL_SYS (strtoull, unsigned long long,
|
---|
1438 | (const char *restrict string, char **restrict endptr,
|
---|
1439 | int base)
|
---|
1440 | _GL_ARG_NONNULL ((1)));
|
---|
1441 | # endif
|
---|
1442 | _GL_CXXALIAS_SYS (strtoull, unsigned long long,
|
---|
1443 | (const char *restrict string, char **restrict endptr,
|
---|
1444 | int base));
|
---|
1445 | # endif
|
---|
1446 | _GL_CXXALIASWARN (strtoull);
|
---|
1447 | #elif defined GNULIB_POSIXCHECK
|
---|
1448 | # undef strtoull
|
---|
1449 | # if HAVE_RAW_DECL_STRTOULL
|
---|
1450 | _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
|
---|
1451 | "use gnulib module strtoull for portability");
|
---|
1452 | # endif
|
---|
1453 | #endif
|
---|
1454 |
|
---|
1455 | #if @GNULIB_UNLOCKPT@
|
---|
1456 | /* Unlock the slave side of the pseudo-terminal whose master side is specified
|
---|
1457 | by FD, so that it can be opened. */
|
---|
1458 | # if !@HAVE_UNLOCKPT@
|
---|
1459 | _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
|
---|
1460 | # endif
|
---|
1461 | _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
|
---|
1462 | _GL_CXXALIASWARN (unlockpt);
|
---|
1463 | #elif defined GNULIB_POSIXCHECK
|
---|
1464 | # undef unlockpt
|
---|
1465 | # if HAVE_RAW_DECL_UNLOCKPT
|
---|
1466 | _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
|
---|
1467 | "use gnulib module unlockpt for portability");
|
---|
1468 | # endif
|
---|
1469 | #endif
|
---|
1470 |
|
---|
1471 | #if @GNULIB_UNSETENV@
|
---|
1472 | /* Remove the variable NAME from the environment. */
|
---|
1473 | # if @REPLACE_UNSETENV@
|
---|
1474 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1475 | # undef unsetenv
|
---|
1476 | # define unsetenv rpl_unsetenv
|
---|
1477 | # endif
|
---|
1478 | _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
|
---|
1479 | _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
|
---|
1480 | # else
|
---|
1481 | # if !@HAVE_DECL_UNSETENV@
|
---|
1482 | _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
|
---|
1483 | # endif
|
---|
1484 | _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
|
---|
1485 | # endif
|
---|
1486 | # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
|
---|
1487 | _GL_CXXALIASWARN (unsetenv);
|
---|
1488 | # endif
|
---|
1489 | #elif defined GNULIB_POSIXCHECK
|
---|
1490 | # undef unsetenv
|
---|
1491 | # if HAVE_RAW_DECL_UNSETENV
|
---|
1492 | _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
|
---|
1493 | "use gnulib module unsetenv for portability");
|
---|
1494 | # endif
|
---|
1495 | #endif
|
---|
1496 |
|
---|
1497 | /* Convert a wide character to a multibyte character. */
|
---|
1498 | #if @GNULIB_WCTOMB@
|
---|
1499 | # if @REPLACE_WCTOMB@
|
---|
1500 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
1501 | # undef wctomb
|
---|
1502 | # define wctomb rpl_wctomb
|
---|
1503 | # endif
|
---|
1504 | _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
|
---|
1505 | _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
|
---|
1506 | # else
|
---|
1507 | _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
|
---|
1508 | # endif
|
---|
1509 | # if __GLIBC__ >= 2
|
---|
1510 | _GL_CXXALIASWARN (wctomb);
|
---|
1511 | # endif
|
---|
1512 | #endif
|
---|
1513 |
|
---|
1514 |
|
---|
1515 | #endif /* _@GUARD_PREFIX@_STDLIB_H */
|
---|
1516 | #endif /* _@GUARD_PREFIX@_STDLIB_H */
|
---|
1517 | #endif
|
---|