]> git.saurik.com Git - apple/libc.git/blame - include/stdlib.h
Libc-262.3.2.tar.gz
[apple/libc.git] / include / stdlib.h
CommitLineData
5b2abdfb
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
734aad71 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
5b2abdfb 7 *
734aad71
A
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
13 * file.
14 *
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
5b2abdfb
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
734aad71
A
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.
5b2abdfb
A
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25/*-
26 * Copyright (c) 1990, 1993
27 * The Regents of the University of California. All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
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.
44 *
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
55 * SUCH DAMAGE.
56 *
57 * @(#)stdlib.h 8.5 (Berkeley) 5/19/95
58 */
59
60#ifndef _STDLIB_H_
61#define _STDLIB_H_
62
63#include <machine/ansi.h>
64#include <machine/types.h>
65
66#ifndef _BSD_SIZE_T_DEFINED_
67#define _BSD_SIZE_T_DEFINED_
68typedef _BSD_SIZE_T_ size_t;
69#endif
70
71#if !defined(_ANSI_SOURCE)
72#ifndef _BSD_RUNE_T_DEFINED_
73#define _BSD_RUNE_T_DEFINED_
74typedef _BSD_WCHAR_T_ rune_t;
75#endif
76#endif
77
78#ifndef _BSD_WCHAR_T_DEFINED_
79#define _BSD_WCHAR_T_DEFINED_
80typedef _BSD_WCHAR_T_ wchar_t;
81#endif
82
83typedef struct {
84 int quot; /* quotient */
85 int rem; /* remainder */
86} div_t;
87
88typedef struct {
89 long quot; /* quotient */
90 long rem; /* remainder */
91} ldiv_t;
92
93#ifndef NULL
94#define NULL 0
95#endif
96
97#define EXIT_FAILURE 1
98#define EXIT_SUCCESS 0
99
100#define RAND_MAX 0x7fffffff
101
102extern int __mb_cur_max;
103#define MB_CUR_MAX __mb_cur_max
104
105#include <sys/cdefs.h>
106
107__BEGIN_DECLS
108__dead void
109 abort __P((void));
110__pure int
111 abs __P((int));
112int atexit __P((void (*)(void)));
113double atof __P((const char *));
114int atoi __P((const char *));
115long atol __P((const char *));
116void *bsearch __P((const void *, const void *, size_t,
117 size_t, int (*)(const void *, const void *)));
118void *calloc __P((size_t, size_t));
119__pure div_t
120 div __P((int, int));
121__dead void
122 exit __P((int));
123void free __P((void *));
124char *getenv __P((const char *));
125__pure long
126 labs __P((long));
127__pure ldiv_t
128 ldiv __P((long, long));
129void *malloc __P((size_t));
130void qsort __P((void *, size_t, size_t,
131 int (*)(const void *, const void *)));
132int rand __P((void));
133void *realloc __P((void *, size_t));
134void srand __P((unsigned));
135double strtod __P((const char *, char **));
136long strtol __P((const char *, char **, int));
137unsigned long
138 strtoul __P((const char *, char **, int));
139int system __P((const char *));
140
141/* These are currently just stubs. */
142int mblen __P((const char *, size_t));
143size_t mbstowcs __P((wchar_t *, const char *, size_t));
144int wctomb __P((char *, wchar_t));
145int mbtowc __P((wchar_t *, const char *, size_t));
146size_t wcstombs __P((char *, const wchar_t *, size_t));
147
148#ifndef _ANSI_SOURCE
149int putenv __P((const char *));
150int setenv __P((const char *, const char *, int));
151#endif
152
153#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
154double drand48 __P((void));
155double erand48 __P((unsigned short[3]));
156long jrand48 __P((unsigned short[3]));
157void lcong48 __P((unsigned short[7]));
158long lrand48 __P((void));
159long mrand48 __P((void));
160long nrand48 __P((unsigned short[3]));
161unsigned short
162 *seed48 __P((unsigned short[3]));
163void srand48 __P((long));
164
165void *alloca __P((size_t)); /* built-in for gcc */
166 /* getcap(3) functions */
167u_int32_t
168 arc4random __P((void));
169void arc4random_addrandom __P((unsigned char *dat, int datlen));
170void arc4random_stir __P((void));
171char *getbsize __P((int *, long *));
172char *cgetcap __P((char *, char *, int));
173int cgetclose __P((void));
174int cgetent __P((char **, char **, char *));
175int cgetfirst __P((char **, char **));
176int cgetmatch __P((char *, char *));
177int cgetnext __P((char **, char **));
178int cgetnum __P((char *, char *, long *));
179int cgetset __P((char *));
180int cgetstr __P((char *, char *, char **));
181int cgetustr __P((char *, char *, char **));
182
183int daemon __P((int, int));
184char *devname __P((int, int));
185int getloadavg __P((double [], int));
186
187long a64l __P((const char *));
188char *l64a __P((long));
189
190char *group_from_gid __P((unsigned long, int));
191int heapsort __P((void *, size_t, size_t,
192 int (*)(const void *, const void *)));
193char *initstate __P((unsigned long, char *, long));
194int mergesort __P((void *, size_t, size_t,
195 int (*)(const void *, const void *)));
196int radixsort __P((const unsigned char **, int, const unsigned char *,
197 unsigned));
198int sradixsort __P((const unsigned char **, int, const unsigned char *,
199 unsigned));
200int rand_r __P((unsigned *));
201long random __P((void));
202void *reallocf __P((void *, size_t));
203char *realpath __P((const char *, char resolved_path[]));
204char *setstate __P((char *));
205void srandom __P((unsigned long));
206char *user_from_uid __P((unsigned long, int));
207#ifndef __STRICT_ANSI__
208long long
209 strtoll(const char *, char **, int);
210unsigned long long
211 strtoull(const char *, char **, int);
212long long
213 strtoq __P((const char *, char **, int));
214unsigned long long
215 strtouq __P((const char *, char **, int));
216#endif
217void unsetenv __P((const char *));
218#endif
219__END_DECLS
220
221#endif /* _STDLIB_H_ */