2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 * Copyright (c) 1990, 1993
25 * The Regents of the University of California. All rights reserved.
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
30 * 1. Redistributions of source code must retain the above copyright
31 * notice, this list of conditions and the following disclaimer.
32 * 2. Redistributions in binary form must reproduce the above copyright
33 * notice, this list of conditions and the following disclaimer in the
34 * documentation and/or other materials provided with the distribution.
35 * 3. All advertising materials mentioning features or use of this software
36 * must display the following acknowledgement:
37 * This product includes software developed by the University of
38 * California, Berkeley and its contributors.
39 * 4. Neither the name of the University nor the names of its contributors
40 * may be used to endorse or promote products derived from this software
41 * without specific prior written permission.
43 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
44 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * @(#)stdlib.h 8.5 (Berkeley) 5/19/95
61 #include <machine/ansi.h>
62 #include <machine/types.h>
63 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
67 #ifndef _BSD_SIZE_T_DEFINED_
68 #define _BSD_SIZE_T_DEFINED_
69 typedef _BSD_SIZE_T_
size_t;
72 #if !defined(_ANSI_SOURCE)
73 #ifndef _BSD_CT_RUNE_T_DEFINED_
74 #define _BSD_CT_RUNE_T_DEFINED_
75 typedef _BSD_CT_RUNE_T_ ct_rune_t
;
78 #ifndef _BSD_RUNE_T_DEFINED_
79 #define _BSD_RUNE_T_DEFINED_
80 typedef _BSD_RUNE_T_ rune_t
;
85 #ifndef _BSD_WCHAR_T_DEFINED_
86 #define _BSD_WCHAR_T_DEFINED_
88 typedef __WCHAR_TYPE__
wchar_t;
89 #else /* ! __WCHAR_TYPE__ */
90 typedef _BSD_WCHAR_T_
wchar_t;
91 #endif /* __WCHAR_TYPE__ */
92 #endif /* _BSD_WCHAR_T_DEFINED_ */
93 #endif /* __cplusplus */
95 #ifndef _BSD_WINT_T_DEFINED_
96 #define _BSD_WINT_T_DEFINED_
97 typedef _BSD_WINT_T_
wint_t;
101 int quot
; /* quotient */
102 int rem
; /* remainder */
106 long quot
; /* quotient */
107 long rem
; /* remainder */
114 #define EXIT_FAILURE 1
115 #define EXIT_SUCCESS 0
117 #define RAND_MAX 0x7fffffff
119 extern int __mb_cur_max
;
120 #define MB_CUR_MAX __mb_cur_max
122 #include <sys/cdefs.h>
125 void abort(void) __dead2
;
126 int abs(int) __pure2
;
127 int atexit(void (*)(void));
128 double atof(const char *);
129 int atoi(const char *);
130 long atol(const char *);
131 void *bsearch(const void *, const void *, size_t,
132 size_t, int (*)(const void *, const void *));
133 void *calloc(size_t, size_t);
134 div_t div(int, int) __pure2
;
135 void exit(int) __dead2
;
137 char *getenv(const char *);
138 long labs(long) __pure2
;
139 ldiv_t ldiv(long, long) __pure2
;
140 void *malloc(size_t);
141 int mblen(const char *, size_t);
142 size_t mbstowcs(wchar_t * __restrict
, const char * __restrict
, size_t);
143 int mbtowc(wchar_t * __restrict
, const char * __restrict
, size_t);
144 void qsort(void *, size_t, size_t,
145 int (*)(const void *, const void *));
147 void *realloc(void *, size_t);
148 void srand(unsigned);
149 double strtod(const char *, char **);
150 float strtof(const char *, char **);
151 long strtol(const char *, char **, int);
153 strtold(const char *, char **);
155 strtoul(const char *, char **, int);
156 int system(const char *);
157 void *valloc(size_t);
158 int wctomb(char *, wchar_t);
159 size_t wcstombs(char * __restrict
, const wchar_t * __restrict
, size_t);
162 int putenv(const char *);
163 int setenv(const char *, const char *, int);
166 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
169 void arc4random_addrandom(unsigned char *dat
, int datlen
);
170 void arc4random_stir(void);
171 double drand48(void);
172 double erand48(unsigned short[3]);
173 long jrand48(unsigned short[3]);
174 void lcong48(unsigned short[7]);
177 long nrand48(unsigned short[3]);
179 *seed48(unsigned short[3]);
182 /* getcap(3) functions */
183 char *cgetcap(char *, const char *, int);
185 int cgetent(char **, char **, const char *);
186 int cgetfirst(char **, char **);
187 int cgetmatch(const char *, const char *);
188 int cgetnext(char **, char **);
189 int cgetnum(char *, const char *, long *);
190 int cgetset(const char *);
191 int cgetstr(char *, const char *, char **);
192 int cgetustr(char *, const char *, char **);
194 int daemon(int, int);
195 char *devname(int, int);
196 char *getbsize(int *, long *);
197 int getloadavg(double [], int);
201 long a64l(const char *);
204 /* int grantpt(int); */
205 int heapsort(void *, size_t, size_t,
206 int (*)(const void *, const void *));
207 char *initstate(unsigned long, char *, long);
208 int mergesort(void *, size_t, size_t,
209 int (*)(const void *, const void *));
210 /* int posix_openpt(int); */
211 /* char *ptsname(int); */
212 void qsort_r(void *, size_t, size_t, void *,
213 int (*)(void *, const void *, const void *));
214 int radixsort(const unsigned char **, int, const unsigned char *,
216 void setprogname(const char *);
217 int sradixsort(const unsigned char **, int, const unsigned char *,
220 void srandomdev(void);
221 int rand_r(unsigned *);
223 void *reallocf(void *, size_t);
224 char *realpath(const char *, char resolved_path
[]);
225 char *setstate(char *);
226 void srandom(unsigned long);
227 /* int unlockpt(int); */
228 #ifndef __STRICT_ANSI__
238 lldiv_t
lldiv(long long, long long);
240 strtoll(const char *, char **, int);
242 strtoull(const char *, char **, int);
244 strtoq(const char *, char **, int);
246 strtouq(const char *, char **, int);
248 void unsetenv(const char *);
252 #endif /* _STDLIB_H_ */