]> git.saurik.com Git - apple/libc.git/blame - include/stdlib.h
Libc-262.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 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*-
23 * Copyright (c) 1990, 1993
24 * The Regents of the University of California. All rights reserved.
25 *
26 * Redistribution and use in source and binary forms, with or without
27 * modification, are permitted provided that the following conditions
28 * are met:
29 * 1. Redistributions of source code must retain the above copyright
30 * notice, this list of conditions and the following disclaimer.
31 * 2. Redistributions in binary form must reproduce the above copyright
32 * notice, this list of conditions and the following disclaimer in the
33 * documentation and/or other materials provided with the distribution.
34 * 3. All advertising materials mentioning features or use of this software
35 * must display the following acknowledgement:
36 * This product includes software developed by the University of
37 * California, Berkeley and its contributors.
38 * 4. Neither the name of the University nor the names of its contributors
39 * may be used to endorse or promote products derived from this software
40 * without specific prior written permission.
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
43 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
46 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
47 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
48 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
50 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
51 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52 * SUCH DAMAGE.
53 *
54 * @(#)stdlib.h 8.5 (Berkeley) 5/19/95
55 */
56
57#ifndef _STDLIB_H_
58#define _STDLIB_H_
59
60#include <machine/ansi.h>
61#include <machine/types.h>
62
63#ifndef _BSD_SIZE_T_DEFINED_
64#define _BSD_SIZE_T_DEFINED_
65typedef _BSD_SIZE_T_ size_t;
66#endif
67
68#if !defined(_ANSI_SOURCE)
69#ifndef _BSD_RUNE_T_DEFINED_
70#define _BSD_RUNE_T_DEFINED_
71typedef _BSD_WCHAR_T_ rune_t;
72#endif
73#endif
74
75#ifndef _BSD_WCHAR_T_DEFINED_
76#define _BSD_WCHAR_T_DEFINED_
77typedef _BSD_WCHAR_T_ wchar_t;
78#endif
79
80typedef struct {
81 int quot; /* quotient */
82 int rem; /* remainder */
83} div_t;
84
85typedef struct {
86 long quot; /* quotient */
87 long rem; /* remainder */
88} ldiv_t;
89
90#ifndef NULL
91#define NULL 0
92#endif
93
94#define EXIT_FAILURE 1
95#define EXIT_SUCCESS 0
96
97#define RAND_MAX 0x7fffffff
98
99extern int __mb_cur_max;
100#define MB_CUR_MAX __mb_cur_max
101
102#include <sys/cdefs.h>
103
104__BEGIN_DECLS
105__dead void
106 abort __P((void));
107__pure int
108 abs __P((int));
109int atexit __P((void (*)(void)));
110double atof __P((const char *));
111int atoi __P((const char *));
112long atol __P((const char *));
113void *bsearch __P((const void *, const void *, size_t,
114 size_t, int (*)(const void *, const void *)));
115void *calloc __P((size_t, size_t));
116__pure div_t
117 div __P((int, int));
118__dead void
119 exit __P((int));
120void free __P((void *));
121char *getenv __P((const char *));
122__pure long
123 labs __P((long));
124__pure ldiv_t
125 ldiv __P((long, long));
126void *malloc __P((size_t));
127void qsort __P((void *, size_t, size_t,
128 int (*)(const void *, const void *)));
129int rand __P((void));
130void *realloc __P((void *, size_t));
131void srand __P((unsigned));
132double strtod __P((const char *, char **));
133long strtol __P((const char *, char **, int));
134unsigned long
135 strtoul __P((const char *, char **, int));
136int system __P((const char *));
137
138/* These are currently just stubs. */
139int mblen __P((const char *, size_t));
140size_t mbstowcs __P((wchar_t *, const char *, size_t));
141int wctomb __P((char *, wchar_t));
142int mbtowc __P((wchar_t *, const char *, size_t));
143size_t wcstombs __P((char *, const wchar_t *, size_t));
144
145#ifndef _ANSI_SOURCE
146int putenv __P((const char *));
147int setenv __P((const char *, const char *, int));
148#endif
149
150#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
151double drand48 __P((void));
152double erand48 __P((unsigned short[3]));
153long jrand48 __P((unsigned short[3]));
154void lcong48 __P((unsigned short[7]));
155long lrand48 __P((void));
156long mrand48 __P((void));
157long nrand48 __P((unsigned short[3]));
158unsigned short
159 *seed48 __P((unsigned short[3]));
160void srand48 __P((long));
161
162void *alloca __P((size_t)); /* built-in for gcc */
163 /* getcap(3) functions */
164u_int32_t
165 arc4random __P((void));
166void arc4random_addrandom __P((unsigned char *dat, int datlen));
167void arc4random_stir __P((void));
168char *getbsize __P((int *, long *));
169char *cgetcap __P((char *, char *, int));
170int cgetclose __P((void));
171int cgetent __P((char **, char **, char *));
172int cgetfirst __P((char **, char **));
173int cgetmatch __P((char *, char *));
174int cgetnext __P((char **, char **));
175int cgetnum __P((char *, char *, long *));
176int cgetset __P((char *));
177int cgetstr __P((char *, char *, char **));
178int cgetustr __P((char *, char *, char **));
179
180int daemon __P((int, int));
181char *devname __P((int, int));
182int getloadavg __P((double [], int));
183
184long a64l __P((const char *));
185char *l64a __P((long));
186
187char *group_from_gid __P((unsigned long, int));
188int heapsort __P((void *, size_t, size_t,
189 int (*)(const void *, const void *)));
190char *initstate __P((unsigned long, char *, long));
191int mergesort __P((void *, size_t, size_t,
192 int (*)(const void *, const void *)));
193int radixsort __P((const unsigned char **, int, const unsigned char *,
194 unsigned));
195int sradixsort __P((const unsigned char **, int, const unsigned char *,
196 unsigned));
197int rand_r __P((unsigned *));
198long random __P((void));
199void *reallocf __P((void *, size_t));
200char *realpath __P((const char *, char resolved_path[]));
201char *setstate __P((char *));
202void srandom __P((unsigned long));
203char *user_from_uid __P((unsigned long, int));
204#ifndef __STRICT_ANSI__
205long long
206 strtoll(const char *, char **, int);
207unsigned long long
208 strtoull(const char *, char **, int);
209long long
210 strtoq __P((const char *, char **, int));
211unsigned long long
212 strtouq __P((const char *, char **, int));
213#endif
214void unsetenv __P((const char *));
215#endif
216__END_DECLS
217
218#endif /* _STDLIB_H_ */