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