diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-02-12 11:07:18 +0000 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-02-12 11:07:18 +0000 |
commit | bd7029a99b0c2974265c6665638ef14a052f42ab (patch) | |
tree | f5661ba73366d81ef6e91f889ea7fec5ebe07b6b /gl/stdlib.in.h | |
parent | f99612320d6eda67644c07be04bb21aa4d7789db (diff) | |
download | monitoring-plugins-bd7029a99b0c2974265c6665638ef14a052f42ab.tar.gz |
Sync to latest Gnulib
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1925 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'gl/stdlib.in.h')
-rw-r--r-- | gl/stdlib.in.h | 208 |
1 files changed, 208 insertions, 0 deletions
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h new file mode 100644 index 00000000..100ff526 --- /dev/null +++ b/gl/stdlib.in.h | |||
@@ -0,0 +1,208 @@ | |||
1 | /* A GNU-like <stdlib.h>. | ||
2 | |||
3 | Copyright (C) 1995, 2001-2004, 2006-2007 Free Software Foundation, Inc. | ||
4 | |||
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. | ||
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 General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
17 | |||
18 | #if defined __need_malloc_and_calloc | ||
19 | /* Special invocation convention inside glibc header files. */ | ||
20 | |||
21 | #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ | ||
22 | |||
23 | #else | ||
24 | /* Normal invocation convention. */ | ||
25 | |||
26 | #ifndef _GL_STDLIB_H | ||
27 | |||
28 | /* The include_next requires a split double-inclusion guard. */ | ||
29 | #@INCLUDE_NEXT@ @NEXT_STDLIB_H@ | ||
30 | |||
31 | #ifndef _GL_STDLIB_H | ||
32 | #define _GL_STDLIB_H | ||
33 | |||
34 | |||
35 | /* The definition of GL_LINK_WARNING is copied here. */ | ||
36 | |||
37 | |||
38 | /* Some systems do not define EXIT_*, despite otherwise supporting C89. */ | ||
39 | #ifndef EXIT_SUCCESS | ||
40 | # define EXIT_SUCCESS 0 | ||
41 | #endif | ||
42 | /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere | ||
43 | with proper operation of xargs. */ | ||
44 | #ifndef EXIT_FAILURE | ||
45 | # define EXIT_FAILURE 1 | ||
46 | #elif EXIT_FAILURE != 1 | ||
47 | # undef EXIT_FAILURE | ||
48 | # define EXIT_FAILURE 1 | ||
49 | #endif | ||
50 | |||
51 | |||
52 | #ifdef __cplusplus | ||
53 | extern "C" { | ||
54 | #endif | ||
55 | |||
56 | |||
57 | #if @GNULIB_MALLOC_POSIX@ | ||
58 | # if !@HAVE_MALLOC_POSIX@ | ||
59 | # undef malloc | ||
60 | # define malloc rpl_malloc | ||
61 | extern void * malloc (size_t size); | ||
62 | # endif | ||
63 | #elif defined GNULIB_POSIXCHECK | ||
64 | # undef malloc | ||
65 | # define malloc(s) \ | ||
66 | (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \ | ||
67 | "use gnulib module malloc-posix for portability"), \ | ||
68 | malloc (s)) | ||
69 | #endif | ||
70 | |||
71 | |||
72 | #if @GNULIB_REALLOC_POSIX@ | ||
73 | # if !@HAVE_REALLOC_POSIX@ | ||
74 | # undef realloc | ||
75 | # define realloc rpl_realloc | ||
76 | extern void * realloc (void *ptr, size_t size); | ||
77 | # endif | ||
78 | #elif defined GNULIB_POSIXCHECK | ||
79 | # undef realloc | ||
80 | # define realloc(p,s) \ | ||
81 | (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \ | ||
82 | "use gnulib module realloc-posix for portability"), \ | ||
83 | realloc (p, s)) | ||
84 | #endif | ||
85 | |||
86 | |||
87 | #if @GNULIB_CALLOC_POSIX@ | ||
88 | # if !@HAVE_CALLOC_POSIX@ | ||
89 | # undef calloc | ||
90 | # define calloc rpl_calloc | ||
91 | extern void * calloc (size_t nmemb, size_t size); | ||
92 | # endif | ||
93 | #elif defined GNULIB_POSIXCHECK | ||
94 | # undef calloc | ||
95 | # define calloc(n,s) \ | ||
96 | (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \ | ||
97 | "use gnulib module calloc-posix for portability"), \ | ||
98 | calloc (n, s)) | ||
99 | #endif | ||
100 | |||
101 | |||
102 | #if @GNULIB_GETSUBOPT@ | ||
103 | /* Assuming *OPTIONP is a comma separated list of elements of the form | ||
104 | "token" or "token=value", getsubopt parses the first of these elements. | ||
105 | If the first element refers to a "token" that is member of the given | ||
106 | NULL-terminated array of tokens: | ||
107 | - It replaces the comma with a NUL byte, updates *OPTIONP to point past | ||
108 | the first option and the comma, sets *VALUEP to the value of the | ||
109 | element (or NULL if it doesn't contain an "=" sign), | ||
110 | - It returns the index of the "token" in the given array of tokens. | ||
111 | Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. | ||
112 | For more details see the POSIX:2001 specification. | ||
113 | http://www.opengroup.org/susv3xsh/getsubopt.html */ | ||
114 | # if !@HAVE_GETSUBOPT@ | ||
115 | extern int getsubopt (char **optionp, char *const *tokens, char **valuep); | ||
116 | # endif | ||
117 | #elif defined GNULIB_POSIXCHECK | ||
118 | # undef getsubopt | ||
119 | # define getsubopt(o,t,v) \ | ||
120 | (GL_LINK_WARNING ("getsubopt is unportable - " \ | ||
121 | "use gnulib module getsubopt for portability"), \ | ||
122 | getsubopt (o, t, v)) | ||
123 | #endif | ||
124 | |||
125 | |||
126 | #if @GNULIB_MKDTEMP@ | ||
127 | # if !@HAVE_MKDTEMP@ | ||
128 | /* Create a unique temporary directory from TEMPLATE. | ||
129 | The last six characters of TEMPLATE must be "XXXXXX"; | ||
130 | they are replaced with a string that makes the directory name unique. | ||
131 | Returns TEMPLATE, or a null pointer if it cannot get a unique name. | ||
132 | The directory is created mode 700. */ | ||
133 | extern char * mkdtemp (char * /*template*/); | ||
134 | # endif | ||
135 | #elif defined GNULIB_POSIXCHECK | ||
136 | # undef mkdtemp | ||
137 | # define mkdtemp(t) \ | ||
138 | (GL_LINK_WARNING ("mkdtemp is unportable - " \ | ||
139 | "use gnulib module mkdtemp for portability"), \ | ||
140 | mkdtemp (t)) | ||
141 | #endif | ||
142 | |||
143 | |||
144 | #if @GNULIB_MKSTEMP@ | ||
145 | # if @REPLACE_MKSTEMP@ | ||
146 | /* Create a unique temporary file from TEMPLATE. | ||
147 | The last six characters of TEMPLATE must be "XXXXXX"; | ||
148 | they are replaced with a string that makes the file name unique. | ||
149 | The file is then created, ensuring it didn't exist before. | ||
150 | The file is created read-write (mask at least 0600 & ~umask), but it may be | ||
151 | world-readable and world-writable (mask 0666 & ~umask), depending on the | ||
152 | implementation. | ||
153 | Returns the open file descriptor if successful, otherwise -1 and errno | ||
154 | set. */ | ||
155 | # define mkstemp rpl_mkstemp | ||
156 | extern int mkstemp (char * /*template*/); | ||
157 | # else | ||
158 | /* On MacOS X 10.3, only <unistd.h> declares mkstemp. */ | ||
159 | # include <unistd.h> | ||
160 | # endif | ||
161 | #elif defined GNULIB_POSIXCHECK | ||
162 | # undef mkstemp | ||
163 | # define mkstemp(t) \ | ||
164 | (GL_LINK_WARNING ("mkstemp is unportable - " \ | ||
165 | "use gnulib module mkstemp for portability"), \ | ||
166 | mkstemp (t)) | ||
167 | #endif | ||
168 | |||
169 | |||
170 | #if @GNULIB_PUTENV@ | ||
171 | # if @REPLACE_PUTENV@ | ||
172 | # undef putenv | ||
173 | # define putenv rpl_putenv | ||
174 | extern int putenv (char *string); | ||
175 | # endif | ||
176 | #endif | ||
177 | |||
178 | |||
179 | #if @GNULIB_SETENV@ | ||
180 | # if !@HAVE_SETENV@ | ||
181 | /* Set NAME to VALUE in the environment. | ||
182 | If REPLACE is nonzero, overwrite an existing value. */ | ||
183 | extern int setenv (const char *name, const char *value, int replace); | ||
184 | # endif | ||
185 | #endif | ||
186 | |||
187 | |||
188 | #if @GNULIB_UNSETENV@ | ||
189 | # if @HAVE_UNSETENV@ | ||
190 | # if @VOID_UNSETENV@ | ||
191 | /* On some systems, unsetenv() returns void. | ||
192 | This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */ | ||
193 | # define unsetenv(name) ((unsetenv)(name), 0) | ||
194 | # endif | ||
195 | # else | ||
196 | /* Remove the variable NAME from the environment. */ | ||
197 | extern int unsetenv (const char *name); | ||
198 | # endif | ||
199 | #endif | ||
200 | |||
201 | |||
202 | #ifdef __cplusplus | ||
203 | } | ||
204 | #endif | ||
205 | |||
206 | #endif /* _GL_STDLIB_H */ | ||
207 | #endif /* _GL_STDLIB_H */ | ||
208 | #endif | ||