1 /* A GNU-like <stdlib.h>.
3 Copyright (C) 1995, 2001-2002, 2006-2007 Free Software Foundation, Inc.
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)
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.
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. */
19 #if defined __need_malloc_and_calloc
20 /* Special invocation convention inside glibc header files. */
22 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
25 /* Normal invocation convention. */
29 /* The include_next requires a split double-inclusion guard. */
30 #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
36 /* The definition of GL_LINK_WARNING is copied here. */
39 /* Some systems do not define EXIT_*, despite otherwise supporting C89. */
41 # define EXIT_SUCCESS 0
43 /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
44 with proper operation of xargs. */
46 # define EXIT_FAILURE 1
47 #elif EXIT_FAILURE != 1
49 # define EXIT_FAILURE 1
58 #if @GNULIB_GETSUBOPT@
59 /* Assuming *OPTIONP is a comma separated list of elements of the form
60 "token" or "token=value", getsubopt parses the first of these elements.
61 If the first element refers to a "token" that is member of the given
62 NULL-terminated array of tokens:
63 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
64 the first option and the comma, sets *VALUEP to the value of the
65 element (or NULL if it doesn't contain an "=" sign),
66 - It returns the index of the "token" in the given array of tokens.
67 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
68 For more details see the POSIX:2001 specification.
69 http://www.opengroup.org/susv3xsh/getsubopt.html */
70 # if !@HAVE_GETSUBOPT@
71 extern int getsubopt (char **optionp
, char *const *tokens
, char **valuep
);
73 #elif defined GNULIB_POSIXCHECK
75 # define getsubopt(o,t,v) \
76 (GL_LINK_WARNING ("getsubopt is unportable - " \
77 "use gnulib module getsubopt for portability"), \
84 /* Create a unique temporary directory from TEMPLATE.
85 The last six characters of TEMPLATE must be "XXXXXX";
86 they are replaced with a string that makes the directory name unique.
87 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
88 The directory is created mode 700. */
89 extern char * mkdtemp (char * /*template*/);
91 #elif defined GNULIB_POSIXCHECK
94 (GL_LINK_WARNING ("mkdtemp is unportable - " \
95 "use gnulib module mkdtemp for portability"), \
101 # if @REPLACE_MKSTEMP@
102 /* Create a unique temporary file from TEMPLATE.
103 The last six characters of TEMPLATE must be "XXXXXX";
104 they are replaced with a string that makes the file name unique.
105 The file is then created, ensuring it didn't exist before.
106 The file is created read-write (mask at least 0600 & ~umask), but it may be
107 world-readable and world-writable (mask 0666 & ~umask), depending on the
109 Returns the open file descriptor if successful, otherwise -1 and errno
111 # define mkstemp rpl_mkstemp
112 extern int mkstemp (char * /*template*/);
114 /* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
117 #elif defined GNULIB_POSIXCHECK
119 # define mkstemp(t) \
120 (GL_LINK_WARNING ("mkstemp is unportable - " \
121 "use gnulib module mkstemp for portability"), \
130 #endif /* _GL_STDLIB_H */
131 #endif /* _GL_STDLIB_H */