Mercurial > hg > octave-nkf > gnulib-hg
annotate lib/stdlib_.h @ 8646:27dec01819aa
Fix problem with Compaq (ex-DEC) Desktop C compiler on Tru64.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Fri, 06 Apr 2007 12:25:54 +0000 |
parents | 530f0ba2b795 |
children | 57a6a395deae |
rev | line source |
---|---|
8190 | 1 /* A GNU-like <stdlib.h>. |
2 | |
3 Copyright (C) 1995, 2001-2002, 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 2, or (at your option) | |
8 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, write to the Free Software Foundation, | |
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | |
18 | |
8195
a62b8c6b0bcb
Work around an ugly glibc hack.
Bruno Haible <bruno@clisp.org>
parents:
8190
diff
changeset
|
19 #if defined __need_malloc_and_calloc |
a62b8c6b0bcb
Work around an ugly glibc hack.
Bruno Haible <bruno@clisp.org>
parents:
8190
diff
changeset
|
20 /* Special invocation convention inside glibc header files. */ |
8203
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
21 |
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
22 /* This #pragma avoids a warning with "gcc -Wall" on some glibc systems |
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
23 on which <stdlib.h> has an inappropriate declaration, see |
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
24 <http://sourceware.org/bugzilla/show_bug.cgi?id=1079>. */ |
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
25 #ifdef __GNUC__ |
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
26 # pragma GCC system_header |
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
27 #endif |
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
28 |
8195
a62b8c6b0bcb
Work around an ugly glibc hack.
Bruno Haible <bruno@clisp.org>
parents:
8190
diff
changeset
|
29 #include @ABSOLUTE_STDLIB_H@ |
8203
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
30 |
8195
a62b8c6b0bcb
Work around an ugly glibc hack.
Bruno Haible <bruno@clisp.org>
parents:
8190
diff
changeset
|
31 #else |
a62b8c6b0bcb
Work around an ugly glibc hack.
Bruno Haible <bruno@clisp.org>
parents:
8190
diff
changeset
|
32 /* Normal invocation convention. */ |
8646
27dec01819aa
Fix problem with Compaq (ex-DEC) Desktop C compiler on Tru64.
Bruno Haible <bruno@clisp.org>
parents:
8459
diff
changeset
|
33 |
27dec01819aa
Fix problem with Compaq (ex-DEC) Desktop C compiler on Tru64.
Bruno Haible <bruno@clisp.org>
parents:
8459
diff
changeset
|
34 #ifdef __DECC |
27dec01819aa
Fix problem with Compaq (ex-DEC) Desktop C compiler on Tru64.
Bruno Haible <bruno@clisp.org>
parents:
8459
diff
changeset
|
35 # include_next <stdlib.h> |
27dec01819aa
Fix problem with Compaq (ex-DEC) Desktop C compiler on Tru64.
Bruno Haible <bruno@clisp.org>
parents:
8459
diff
changeset
|
36 #endif |
27dec01819aa
Fix problem with Compaq (ex-DEC) Desktop C compiler on Tru64.
Bruno Haible <bruno@clisp.org>
parents:
8459
diff
changeset
|
37 |
8190 | 38 #ifndef _GL_STDLIB_H |
39 #define _GL_STDLIB_H | |
40 | |
8203
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
41 /* This #pragma avoids a warning with "gcc -Wall" on some glibc systems |
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
42 on which <stdlib.h> has an inappropriate declaration, see |
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
43 <http://sourceware.org/bugzilla/show_bug.cgi?id=1079>. */ |
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
44 #ifdef __GNUC__ |
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
45 # pragma GCC system_header |
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
46 #endif |
96f4287dd956
Suppress some gcc warnings in glibc header files.
Bruno Haible <bruno@clisp.org>
parents:
8198
diff
changeset
|
47 |
8646
27dec01819aa
Fix problem with Compaq (ex-DEC) Desktop C compiler on Tru64.
Bruno Haible <bruno@clisp.org>
parents:
8459
diff
changeset
|
48 #ifndef __DECC |
27dec01819aa
Fix problem with Compaq (ex-DEC) Desktop C compiler on Tru64.
Bruno Haible <bruno@clisp.org>
parents:
8459
diff
changeset
|
49 # include @ABSOLUTE_STDLIB_H@ |
27dec01819aa
Fix problem with Compaq (ex-DEC) Desktop C compiler on Tru64.
Bruno Haible <bruno@clisp.org>
parents:
8459
diff
changeset
|
50 #endif |
8190 | 51 |
52 | |
53 /* The definition of GL_LINK_WARNING is copied here. */ | |
54 | |
55 | |
56 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */ | |
57 #ifndef EXIT_SUCCESS | |
58 # define EXIT_SUCCESS 0 | |
59 #endif | |
8399
b6e248728b1a
* lib/stdlib_.h (EXIT_FAILURE): GNU code expects this to be 1, in
Eric Blake <ebb9@byu.net>
parents:
8208
diff
changeset
|
60 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere |
b6e248728b1a
* lib/stdlib_.h (EXIT_FAILURE): GNU code expects this to be 1, in
Eric Blake <ebb9@byu.net>
parents:
8208
diff
changeset
|
61 with proper operation of xargs. */ |
8190 | 62 #ifndef EXIT_FAILURE |
63 # define EXIT_FAILURE 1 | |
8399
b6e248728b1a
* lib/stdlib_.h (EXIT_FAILURE): GNU code expects this to be 1, in
Eric Blake <ebb9@byu.net>
parents:
8208
diff
changeset
|
64 #elif EXIT_FAILURE != 1 |
b6e248728b1a
* lib/stdlib_.h (EXIT_FAILURE): GNU code expects this to be 1, in
Eric Blake <ebb9@byu.net>
parents:
8208
diff
changeset
|
65 # undef EXIT_FAILURE |
b6e248728b1a
* lib/stdlib_.h (EXIT_FAILURE): GNU code expects this to be 1, in
Eric Blake <ebb9@byu.net>
parents:
8208
diff
changeset
|
66 # define EXIT_FAILURE 1 |
8190 | 67 #endif |
68 | |
69 | |
70 #ifdef __cplusplus | |
71 extern "C" { | |
72 #endif | |
73 | |
74 | |
8198
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
75 #if @GNULIB_GETSUBOPT@ |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
76 /* Assuming *OPTIONP is a comma separated list of elements of the form |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
77 "token" or "token=value", getsubopt parses the first of these elements. |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
78 If the first element refers to a "token" that is member of the given |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
79 NULL-terminated array of tokens: |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
80 - It replaces the comma with a NUL byte, updates *OPTIONP to point past |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
81 the first option and the comma, sets *VALUEP to the value of the |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
82 element (or NULL if it doesn't contain an "=" sign), |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
83 - It returns the index of the "token" in the given array of tokens. |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
84 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined. |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
85 For more details see the POSIX:2001 specification. |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
86 http://www.opengroup.org/susv3xsh/getsubopt.html */ |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
87 # if !@HAVE_GETSUBOPT@ |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
88 extern int getsubopt (char **optionp, char *const *tokens, char **valuep); |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
89 # endif |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
90 #elif defined GNULIB_POSIXCHECK |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
91 # undef getsubopt |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
92 # define getsubopt(o,t,v) \ |
8208
dd1cc9788db5
Whitespace change in macros.
Bruno Haible <bruno@clisp.org>
parents:
8203
diff
changeset
|
93 (GL_LINK_WARNING ("getsubopt is unportable - " \ |
8198
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
94 "use gnulib module getsubopt for portability"), \ |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
95 getsubopt (o, t, v)) |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
96 #endif |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
97 |
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
98 |
8190 | 99 #if @GNULIB_MKDTEMP@ |
100 # if !@HAVE_MKDTEMP@ | |
101 /* Create a unique temporary directory from TEMPLATE. | |
102 The last six characters of TEMPLATE must be "XXXXXX"; | |
103 they are replaced with a string that makes the directory name unique. | |
104 Returns TEMPLATE, or a null pointer if it cannot get a unique name. | |
105 The directory is created mode 700. */ | |
106 extern char * mkdtemp (char *template); | |
107 # endif | |
108 #elif defined GNULIB_POSIXCHECK | |
109 # undef mkdtemp | |
110 # define mkdtemp(t) \ | |
8208
dd1cc9788db5
Whitespace change in macros.
Bruno Haible <bruno@clisp.org>
parents:
8203
diff
changeset
|
111 (GL_LINK_WARNING ("mkdtemp is unportable - " \ |
8190 | 112 "use gnulib module mkdtemp for portability"), \ |
113 mkdtemp (t)) | |
114 #endif | |
115 | |
8198
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8195
diff
changeset
|
116 |
8190 | 117 #if @GNULIB_MKSTEMP@ |
118 # if @REPLACE_MKSTEMP@ | |
119 /* Create a unique temporary file from TEMPLATE. | |
120 The last six characters of TEMPLATE must be "XXXXXX"; | |
121 they are replaced with a string that makes the file name unique. | |
122 The file is then created, ensuring it didn't exist before. | |
123 The file is created read-write (mask at least 0600 & ~umask), but it may be | |
124 world-readable and world-writable (mask 0666 & ~umask), depending on the | |
125 implementation. | |
126 Returns the open file descriptor if successful, otherwise -1 and errno | |
127 set. */ | |
128 # define mkstemp rpl_mkstemp | |
129 extern int mkstemp (char *template); | |
8459
530f0ba2b795
Ensure we get the mkstemp() declaration. On MacOS X, it comes from <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents:
8399
diff
changeset
|
130 # else |
530f0ba2b795
Ensure we get the mkstemp() declaration. On MacOS X, it comes from <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents:
8399
diff
changeset
|
131 /* On MacOS X 10.3, only <unistd.h> declares mkstemp. */ |
530f0ba2b795
Ensure we get the mkstemp() declaration. On MacOS X, it comes from <unistd.h>.
Bruno Haible <bruno@clisp.org>
parents:
8399
diff
changeset
|
132 # include <unistd.h> |
8190 | 133 # endif |
134 #elif defined GNULIB_POSIXCHECK | |
135 # undef mkstemp | |
136 # define mkstemp(t) \ | |
8208
dd1cc9788db5
Whitespace change in macros.
Bruno Haible <bruno@clisp.org>
parents:
8203
diff
changeset
|
137 (GL_LINK_WARNING ("mkstemp is unportable - " \ |
8190 | 138 "use gnulib module mkstemp for portability"), \ |
139 mkstemp (t)) | |
140 #endif | |
141 | |
142 | |
143 #ifdef __cplusplus | |
144 } | |
145 #endif | |
146 | |
8195
a62b8c6b0bcb
Work around an ugly glibc hack.
Bruno Haible <bruno@clisp.org>
parents:
8190
diff
changeset
|
147 #endif /* _GL_STDLIB_H */ |
8190 | 148 #endif |