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