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