~ubuntu-branches/ubuntu/natty/shishi/natty

« back to all changes in this revision

Viewing changes to gl/stdlib_.h

  • Committer: Bazaar Package Importer
  • Author(s): Simon Josefsson, Simon Josefsson
  • Date: 2008-03-17 14:08:46 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080317140846-lygpkn2d5r2kjb0q
Tags: 0.0.36-2
[ Simon Josefsson ]
Change doc-base manual section from Apps/Net to System/Security (for
main Shishi manual) and Programming/C (for API reference manual),
to fix lintian warning doc-base-unknown-section.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
19
 
#if defined __need_malloc_and_calloc
20
 
/* Special invocation convention inside glibc header files.  */
21
 
 
22
 
#@INCLUDE_NEXT@ @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@ @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
 
 
38
 
 
39
 
/* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
40
 
#ifndef EXIT_SUCCESS
41
 
# define EXIT_SUCCESS 0
42
 
#endif
43
 
/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
44
 
   with proper operation of xargs.  */
45
 
#ifndef EXIT_FAILURE
46
 
# define EXIT_FAILURE 1
47
 
#elif EXIT_FAILURE != 1
48
 
# undef EXIT_FAILURE
49
 
# define EXIT_FAILURE 1
50
 
#endif
51
 
 
52
 
 
53
 
#ifdef __cplusplus
54
 
extern "C" {
55
 
#endif
56
 
 
57
 
 
58
 
#if @GNULIB_MALLOC_POSIX@
59
 
# if !@HAVE_MALLOC_POSIX@
60
 
#  undef malloc
61
 
#  define malloc rpl_malloc
62
 
extern void * malloc (size_t size);
63
 
# endif
64
 
#elif defined GNULIB_POSIXCHECK
65
 
# undef malloc
66
 
# define malloc(s) \
67
 
    (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
68
 
                      "use gnulib module malloc-posix for portability"), \
69
 
     malloc (s))
70
 
#endif
71
 
 
72
 
 
73
 
#if @GNULIB_REALLOC_POSIX@
74
 
# if !@HAVE_REALLOC_POSIX@
75
 
#  undef realloc
76
 
#  define realloc rpl_realloc
77
 
extern void * realloc (void *ptr, size_t size);
78
 
# endif
79
 
#elif defined GNULIB_POSIXCHECK
80
 
# undef realloc
81
 
# define realloc(p,s) \
82
 
    (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
83
 
                      "use gnulib module realloc-posix for portability"), \
84
 
     realloc (p, s))
85
 
#endif
86
 
 
87
 
 
88
 
#if @GNULIB_CALLOC_POSIX@
89
 
# if !@HAVE_CALLOC_POSIX@
90
 
#  undef calloc
91
 
#  define calloc rpl_calloc
92
 
extern void * calloc (size_t nmemb, size_t size);
93
 
# endif
94
 
#elif defined GNULIB_POSIXCHECK
95
 
# undef calloc
96
 
# define calloc(n,s) \
97
 
    (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
98
 
                      "use gnulib module calloc-posix for portability"), \
99
 
     calloc (n, s))
100
 
#endif
101
 
 
102
 
 
103
 
#if @GNULIB_GETSUBOPT@
104
 
/* Assuming *OPTIONP is a comma separated list of elements of the form
105
 
   "token" or "token=value", getsubopt parses the first of these elements.
106
 
   If the first element refers to a "token" that is member of the given
107
 
   NULL-terminated array of tokens:
108
 
     - It replaces the comma with a NUL byte, updates *OPTIONP to point past
109
 
       the first option and the comma, sets *VALUEP to the value of the
110
 
       element (or NULL if it doesn't contain an "=" sign),
111
 
     - It returns the index of the "token" in the given array of tokens.
112
 
   Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
113
 
   For more details see the POSIX:2001 specification.
114
 
   http://www.opengroup.org/susv3xsh/getsubopt.html */
115
 
# if !@HAVE_GETSUBOPT@
116
 
extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
117
 
# endif
118
 
#elif defined GNULIB_POSIXCHECK
119
 
# undef getsubopt
120
 
# define getsubopt(o,t,v) \
121
 
    (GL_LINK_WARNING ("getsubopt is unportable - " \
122
 
                      "use gnulib module getsubopt for portability"), \
123
 
     getsubopt (o, t, v))
124
 
#endif
125
 
 
126
 
 
127
 
#if @GNULIB_MKDTEMP@
128
 
# if !@HAVE_MKDTEMP@
129
 
/* Create a unique temporary directory from TEMPLATE.
130
 
   The last six characters of TEMPLATE must be "XXXXXX";
131
 
   they are replaced with a string that makes the directory name unique.
132
 
   Returns TEMPLATE, or a null pointer if it cannot get a unique name.
133
 
   The directory is created mode 700.  */
134
 
extern char * mkdtemp (char * /*template*/);
135
 
# endif
136
 
#elif defined GNULIB_POSIXCHECK
137
 
# undef mkdtemp
138
 
# define mkdtemp(t) \
139
 
    (GL_LINK_WARNING ("mkdtemp is unportable - " \
140
 
                      "use gnulib module mkdtemp for portability"), \
141
 
     mkdtemp (t))
142
 
#endif
143
 
 
144
 
 
145
 
#if @GNULIB_MKSTEMP@
146
 
# if @REPLACE_MKSTEMP@
147
 
/* Create a unique temporary file from TEMPLATE.
148
 
   The last six characters of TEMPLATE must be "XXXXXX";
149
 
   they are replaced with a string that makes the file name unique.
150
 
   The file is then created, ensuring it didn't exist before.
151
 
   The file is created read-write (mask at least 0600 & ~umask), but it may be
152
 
   world-readable and world-writable (mask 0666 & ~umask), depending on the
153
 
   implementation.
154
 
   Returns the open file descriptor if successful, otherwise -1 and errno
155
 
   set.  */
156
 
#  define mkstemp rpl_mkstemp
157
 
extern int mkstemp (char * /*template*/);
158
 
# else
159
 
/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
160
 
#  include <unistd.h>
161
 
# endif
162
 
#elif defined GNULIB_POSIXCHECK
163
 
# undef mkstemp
164
 
# define mkstemp(t) \
165
 
    (GL_LINK_WARNING ("mkstemp is unportable - " \
166
 
                      "use gnulib module mkstemp for portability"), \
167
 
     mkstemp (t))
168
 
#endif
169
 
 
170
 
 
171
 
#ifdef __cplusplus
172
 
}
173
 
#endif
174
 
 
175
 
#endif /* _GL_STDLIB_H */
176
 
#endif /* _GL_STDLIB_H */
177
 
#endif