1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* A GNU-like <stdlib.h>.
4 Copyright (C) 1995, 2001-2004, 2006-2008 Free Software Foundation, Inc.
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #if defined __need_malloc_and_calloc
20 /* Special invocation convention inside glibc header files. */
22 #include_next <stdlib.h>
25 /* Normal invocation convention. */
29 /* The include_next requires a split double-inclusion guard. */
30 #include_next <stdlib.h>
36 /* The definition of GL_LINK_WARNING is copied here. */
37 /* GL_LINK_WARNING("literal string") arranges to emit the literal string as
38 a linker warning on most glibc systems.
39 We use a linker warning rather than a preprocessor warning, because
40 #warning cannot be used inside macros. */
41 #ifndef GL_LINK_WARNING
42 /* This works on platforms with GNU ld and ELF object format.
43 Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
44 Testing __ELF__ guarantees the ELF object format.
45 Testing __GNUC__ is necessary for the compound expression syntax. */
46 # if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
47 # define GL_LINK_WARNING(message) \
48 GL_LINK_WARNING1 (__FILE__, __LINE__, message)
49 # define GL_LINK_WARNING1(file, line, message) \
50 GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */
51 # define GL_LINK_WARNING2(file, line, message) \
52 GL_LINK_WARNING3 (file ":" #line ": warning: " message)
53 # define GL_LINK_WARNING3(message) \
54 ({ static const char warning[sizeof (message)] \
55 __attribute__ ((__unused__, \
56 __section__ (".gnu.warning"), \
62 # define GL_LINK_WARNING(message) ((void) 0)
67 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
69 # define EXIT_SUCCESS 0
71 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
72 with proper operation of xargs. */
74 # define EXIT_FAILURE 1
75 #elif EXIT_FAILURE != 1
77 # define EXIT_FAILURE 1
89 # define malloc rpl_malloc
90 extern void * malloc (size_t size);
92 #elif defined GNULIB_POSIXCHECK
95 (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
96 "use gnulib module malloc-posix for portability"), \
104 # define realloc rpl_realloc
105 extern void * realloc (void *ptr, size_t size);
107 #elif defined GNULIB_POSIXCHECK
109 # define realloc(p,s) \
110 (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
111 "use gnulib module realloc-posix for portability"), \
119 # define calloc rpl_calloc
120 extern void * calloc (size_t nmemb, size_t size);
122 #elif defined GNULIB_POSIXCHECK
124 # define calloc(n,s) \
125 (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
126 "use gnulib module calloc-posix for portability"), \
132 /* Assuming *OPTIONP is a comma separated list of elements of the form
133 "token" or "token=value", getsubopt parses the first of these elements.
134 If the first element refers to a "token" that is member of the given
135 NULL-terminated array of tokens:
136 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
137 the first option and the comma, sets *VALUEP to the value of the
138 element (or NULL if it doesn't contain an "=" sign),
139 - It returns the index of the "token" in the given array of tokens.
140 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
141 For more details see the POSIX:2001 specification.
142 http://www.opengroup.org/susv3xsh/getsubopt.html */
144 extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
146 #elif defined GNULIB_POSIXCHECK
148 # define getsubopt(o,t,v) \
149 (GL_LINK_WARNING ("getsubopt is unportable - " \
150 "use gnulib module getsubopt for portability"), \
157 /* Create a unique temporary directory from TEMPLATE.
158 The last six characters of TEMPLATE must be "XXXXXX";
159 they are replaced with a string that makes the directory name unique.
160 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
161 The directory is created mode 700. */
162 extern char * mkdtemp (char * /*template*/);
164 #elif defined GNULIB_POSIXCHECK
166 # define mkdtemp(t) \
167 (GL_LINK_WARNING ("mkdtemp is unportable - " \
168 "use gnulib module mkdtemp for portability"), \
175 /* Create a unique temporary file from TEMPLATE.
176 The last six characters of TEMPLATE must be "XXXXXX";
177 they are replaced with a string that makes the file name unique.
178 The file is then created, ensuring it didn't exist before.
179 The file is created read-write (mask at least 0600 & ~umask), but it may be
180 world-readable and world-writable (mask 0666 & ~umask), depending on the
182 Returns the open file descriptor if successful, otherwise -1 and errno
184 # define mkstemp rpl_mkstemp
185 extern int mkstemp (char * /*template*/);
187 /* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
190 #elif defined GNULIB_POSIXCHECK
192 # define mkstemp(t) \
193 (GL_LINK_WARNING ("mkstemp is unportable - " \
194 "use gnulib module mkstemp for portability"), \
202 # define putenv rpl_putenv
203 extern int putenv (char *string);
210 /* Test a user response to a question.
211 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
212 extern int rpmatch (const char *response);
214 #elif defined GNULIB_POSIXCHECK
216 # define rpmatch(r) \
217 (GL_LINK_WARNING ("rpmatch is unportable - " \
218 "use gnulib module rpmatch for portability"), \
225 /* Set NAME to VALUE in the environment.
226 If REPLACE is nonzero, overwrite an existing value. */
227 extern int setenv (const char *name, const char *value, int replace);
235 /* On some systems, unsetenv() returns void.
236 This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */
237 # define unsetenv(name) ((unsetenv)(name), 0)
240 /* Remove the variable NAME from the environment. */
241 extern int unsetenv (const char *name);
248 # define strtod rpl_strtod
251 /* Parse a double from STRING, updating ENDP if appropriate. */
252 extern double strtod (const char *str, char **endp);
254 #elif defined GNULIB_POSIXCHECK
256 # define strtod(s, e) \
257 (GL_LINK_WARNING ("strtod is unportable - " \
258 "use gnulib module strtod for portability"), \
267 #endif /* _GL_STDLIB_H */
268 #endif /* _GL_STDLIB_H */