diff options
Diffstat (limited to 'gl/stdlib.h')
| -rw-r--r-- | gl/stdlib.h | 237 |
1 files changed, 237 insertions, 0 deletions
diff --git a/gl/stdlib.h b/gl/stdlib.h new file mode 100644 index 00000000..86da899f --- /dev/null +++ b/gl/stdlib.h | |||
| @@ -0,0 +1,237 @@ | |||
| 1 | /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ | ||
| 2 | /* A GNU-like <stdlib.h>. | ||
| 3 | |||
| 4 | Copyright (C) 1995, 2001-2004, 2006-2007 Free Software Foundation, Inc. | ||
| 5 | |||
| 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. | ||
| 10 | |||
| 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. | ||
| 15 | |||
| 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/>. */ | ||
| 18 | |||
| 19 | #if defined __need_malloc_and_calloc | ||
| 20 | /* Special invocation convention inside glibc header files. */ | ||
| 21 | |||
| 22 | #include_next <stdlib.h> | ||
| 23 | |||
| 24 | #else | ||
| 25 | /* Normal invocation convention. */ | ||
| 26 | |||
| 27 | #ifndef _GL_STDLIB_H | ||
| 28 | |||
| 29 | /* The include_next requires a split double-inclusion guard. */ | ||
| 30 | #include_next <stdlib.h> | ||
| 31 | |||
| 32 | #ifndef _GL_STDLIB_H | ||
| 33 | #define _GL_STDLIB_H | ||
| 34 | |||
| 35 | |||
| 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"), \ | ||
| 57 | __aligned__ (1))) \ | ||
| 58 | = message "\n"; \ | ||
| 59 | (void)0; \ | ||
| 60 | }) | ||
| 61 | # else | ||
| 62 | # define GL_LINK_WARNING(message) ((void) 0) | ||
| 63 | # endif | ||
| 64 | #endif | ||
| 65 | |||
| 66 | |||
| 67 | /* Some systems do not define EXIT_*, despite otherwise supporting C89. */ | ||
| 68 | #ifndef EXIT_SUCCESS | ||
| 69 | # define EXIT_SUCCESS 0 | ||
| 70 | #endif | ||
| 71 | /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere | ||
| 72 | with proper operation of xargs. */ | ||
| 73 | #ifndef EXIT_FAILURE | ||
| 74 | # define EXIT_FAILURE 1 | ||
| 75 | #elif EXIT_FAILURE != 1 | ||
| 76 | # undef EXIT_FAILURE | ||
| 77 | # define EXIT_FAILURE 1 | ||
| 78 | #endif | ||
| 79 | |||
| 80 | |||
| 81 | #ifdef __cplusplus | ||
| 82 | extern "C" { | ||
| 83 | #endif | ||
| 84 | |||
| 85 | |||
| 86 | #if 1 | ||
| 87 | # if !1 | ||
| 88 | # undef malloc | ||
| 89 | # define malloc rpl_malloc | ||
| 90 | extern void * malloc (size_t size); | ||
| 91 | # endif | ||
| 92 | #elif defined GNULIB_POSIXCHECK | ||
| 93 | # undef malloc | ||
| 94 | # define malloc(s) \ | ||
| 95 | (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \ | ||
| 96 | "use gnulib module malloc-posix for portability"), \ | ||
| 97 | malloc (s)) | ||
| 98 | #endif | ||
| 99 | |||
| 100 | |||
| 101 | #if 0 | ||
| 102 | # if !1 | ||
| 103 | # undef realloc | ||
| 104 | # define realloc rpl_realloc | ||
| 105 | extern void * realloc (void *ptr, size_t size); | ||
| 106 | # endif | ||
| 107 | #elif defined GNULIB_POSIXCHECK | ||
| 108 | # undef realloc | ||
| 109 | # define realloc(p,s) \ | ||
| 110 | (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \ | ||
| 111 | "use gnulib module realloc-posix for portability"), \ | ||
| 112 | realloc (p, s)) | ||
| 113 | #endif | ||
| 114 | |||
| 115 | |||
| 116 | #if 0 | ||
| 117 | # if !1 | ||
| 118 | # undef calloc | ||
| 119 | # define calloc rpl_calloc | ||
| 120 | extern void * calloc (size_t nmemb, size_t size); | ||
| 121 | # endif | ||
| 122 | #elif defined GNULIB_POSIXCHECK | ||
| 123 | # undef calloc | ||
| 124 | # define calloc(n,s) \ | ||
| 125 | (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \ | ||
| 126 | "use gnulib module calloc-posix for portability"), \ | ||
| 127 | calloc (n, s)) | ||
| 128 | #endif | ||
| 129 | |||
| 130 | |||
| 131 | #if 0 | ||
| 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 */ | ||
| 143 | # if !1 | ||
| 144 | extern int getsubopt (char **optionp, char *const *tokens, char **valuep); | ||
| 145 | # endif | ||
| 146 | #elif defined GNULIB_POSIXCHECK | ||
| 147 | # undef getsubopt | ||
| 148 | # define getsubopt(o,t,v) \ | ||
| 149 | (GL_LINK_WARNING ("getsubopt is unportable - " \ | ||
| 150 | "use gnulib module getsubopt for portability"), \ | ||
| 151 | getsubopt (o, t, v)) | ||
| 152 | #endif | ||
| 153 | |||
| 154 | |||
| 155 | #if 0 | ||
| 156 | # if !1 | ||
| 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*/); | ||
| 163 | # endif | ||
| 164 | #elif defined GNULIB_POSIXCHECK | ||
| 165 | # undef mkdtemp | ||
| 166 | # define mkdtemp(t) \ | ||
| 167 | (GL_LINK_WARNING ("mkdtemp is unportable - " \ | ||
| 168 | "use gnulib module mkdtemp for portability"), \ | ||
| 169 | mkdtemp (t)) | ||
| 170 | #endif | ||
| 171 | |||
| 172 | |||
| 173 | #if 0 | ||
| 174 | # if 0 | ||
| 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 | ||
| 181 | implementation. | ||
| 182 | Returns the open file descriptor if successful, otherwise -1 and errno | ||
| 183 | set. */ | ||
| 184 | # define mkstemp rpl_mkstemp | ||
| 185 | extern int mkstemp (char * /*template*/); | ||
| 186 | # else | ||
| 187 | /* On MacOS X 10.3, only <unistd.h> declares mkstemp. */ | ||
| 188 | # include <unistd.h> | ||
| 189 | # endif | ||
| 190 | #elif defined GNULIB_POSIXCHECK | ||
| 191 | # undef mkstemp | ||
| 192 | # define mkstemp(t) \ | ||
| 193 | (GL_LINK_WARNING ("mkstemp is unportable - " \ | ||
| 194 | "use gnulib module mkstemp for portability"), \ | ||
| 195 | mkstemp (t)) | ||
| 196 | #endif | ||
| 197 | |||
| 198 | |||
| 199 | #if 0 | ||
| 200 | # if 0 | ||
| 201 | # undef putenv | ||
| 202 | # define putenv rpl_putenv | ||
| 203 | extern int putenv (char *string); | ||
| 204 | # endif | ||
| 205 | #endif | ||
| 206 | |||
| 207 | |||
| 208 | #if 0 | ||
| 209 | # if !1 | ||
| 210 | /* Set NAME to VALUE in the environment. | ||
| 211 | If REPLACE is nonzero, overwrite an existing value. */ | ||
| 212 | extern int setenv (const char *name, const char *value, int replace); | ||
| 213 | # endif | ||
| 214 | #endif | ||
| 215 | |||
| 216 | |||
| 217 | #if 0 | ||
| 218 | # if 1 | ||
| 219 | # if 0 | ||
| 220 | /* On some systems, unsetenv() returns void. | ||
| 221 | This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */ | ||
| 222 | # define unsetenv(name) ((unsetenv)(name), 0) | ||
| 223 | # endif | ||
| 224 | # else | ||
| 225 | /* Remove the variable NAME from the environment. */ | ||
| 226 | extern int unsetenv (const char *name); | ||
| 227 | # endif | ||
| 228 | #endif | ||
| 229 | |||
| 230 | |||
| 231 | #ifdef __cplusplus | ||
| 232 | } | ||
| 233 | #endif | ||
| 234 | |||
| 235 | #endif /* _GL_STDLIB_H */ | ||
| 236 | #endif /* _GL_STDLIB_H */ | ||
| 237 | #endif | ||
