stdlib.h revision 2572
1226584Sdim/*-
2226584Sdim * Copyright (c) 1990, 1993
3226584Sdim *	The Regents of the University of California.  All rights reserved.
4226584Sdim *
5226584Sdim * Redistribution and use in source and binary forms, with or without
6226584Sdim * modification, are permitted provided that the following conditions
7226584Sdim * are met:
8226584Sdim * 1. Redistributions of source code must retain the above copyright
9226584Sdim *    notice, this list of conditions and the following disclaimer.
10226584Sdim * 2. Redistributions in binary form must reproduce the above copyright
11226584Sdim *    notice, this list of conditions and the following disclaimer in the
12226584Sdim *    documentation and/or other materials provided with the distribution.
13226584Sdim * 3. All advertising materials mentioning features or use of this software
14226584Sdim *    must display the following acknowledgement:
15226584Sdim *	This product includes software developed by the University of
16226584Sdim *	California, Berkeley and its contributors.
17226584Sdim * 4. Neither the name of the University nor the names of its contributors
18226584Sdim *    may be used to endorse or promote products derived from this software
19226584Sdim *    without specific prior written permission.
20226584Sdim *
21226584Sdim * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22226584Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23252723Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24226584Sdim * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25226584Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26226584Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27226584Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28226584Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29226584Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30226584Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31226584Sdim * SUCH DAMAGE.
32226584Sdim *
33226584Sdim *	@(#)stdlib.h	8.3 (Berkeley) 2/16/94
34226584Sdim */
35226584Sdim
36226584Sdim#ifndef _STDLIB_H_
37226584Sdim#define _STDLIB_H_
38226584Sdim
39226584Sdim#include <machine/ansi.h>
40226584Sdim
41226584Sdim#ifdef	_BSD_SIZE_T_
42226584Sdimtypedef	_BSD_SIZE_T_	size_t;
43226584Sdim#undef	_BSD_SIZE_T_
44226584Sdim#endif
45226584Sdim
46226584Sdim#ifdef	_BSD_WCHAR_T_
47226584Sdim#ifndef _ANSI_SOURCE
48226584Sdimtypedef	_BSD_WCHAR_T_	rune_t;
49226584Sdim#endif
50226584Sdimtypedef	_BSD_WCHAR_T_	wchar_t;
51226584Sdim#undef	_BSD_WCHAR_T_
52226584Sdim#endif
53226584Sdim
54226584Sdimtypedef struct {
55226584Sdim	int quot;		/* quotient */
56226584Sdim	int rem;		/* remainder */
57226584Sdim} div_t;
58226584Sdim
59226584Sdimtypedef struct {
60226584Sdim	long quot;		/* quotient */
61226584Sdim	long rem;		/* remainder */
62226584Sdim} ldiv_t;
63226584Sdim
64226584Sdim#ifndef NULL
65226584Sdim#define	NULL	0
66226584Sdim#endif
67226584Sdim
68226584Sdim#define	EXIT_FAILURE	1
69226584Sdim#define	EXIT_SUCCESS	0
70226584Sdim
71226584Sdim#define	RAND_MAX	0x7fffffff
72226584Sdim
73226584Sdimextern int __mb_cur_max;
74226584Sdim#define	MB_CUR_MAX	__mb_cur_max
75226584Sdim
76226584Sdim#include <sys/cdefs.h>
77226584Sdim
78235633Sdim__BEGIN_DECLS
79226584Sdim__dead void
80226584Sdim	 abort __P((void)) __dead2;
81226584Sdim__pure int
82226584Sdim	 abs __P((int));
83226584Sdimint	 atexit __P((void (*)(void)));
84226584Sdimdouble	 atof __P((const char *));
85226584Sdimint	 atoi __P((const char *));
86226584Sdimlong	 atol __P((const char *));
87226584Sdimvoid	*bsearch __P((const void *, const void *, size_t,
88226584Sdim	    size_t, int (*)(const void *, const void *)));
89226584Sdimvoid	*calloc __P((size_t, size_t));
90226584Sdim__pure div_t
91226584Sdim	 div __P((int, int));
92226584Sdim__dead void
93226584Sdim	 exit __P((int)) __dead2;
94226584Sdimvoid	 free __P((void *));
95226584Sdimchar	*getenv __P((const char *));
96226584Sdim__pure long
97226584Sdim	 labs __P((long));
98226584Sdim__pure ldiv_t
99226584Sdim	 ldiv __P((long, long));
100226584Sdimvoid	*malloc __P((size_t));
101226584Sdimvoid	 qsort __P((void *, size_t, size_t,
102226584Sdim	    int (*)(const void *, const void *)));
103226584Sdimint	 rand __P((void));
104226584Sdimvoid	*realloc __P((void *, size_t));
105226584Sdimvoid	 srand __P((unsigned));
106226584Sdimdouble	 strtod __P((const char *, char **));
107226584Sdimlong	 strtol __P((const char *, char **, int));
108226584Sdimunsigned long
109226584Sdim	 strtoul __P((const char *, char **, int));
110226584Sdimint	 system __P((const char *));
111226584Sdim
112226584Sdim/* These are currently just stubs. */
113226584Sdimint	 mblen __P((const char *, size_t));
114226584Sdimsize_t	 mbstowcs __P((wchar_t *, const char *, size_t));
115226584Sdimint	 wctomb __P((char *, wchar_t));
116226584Sdimint	 mbtowc __P((wchar_t *, const char *, size_t));
117226584Sdimsize_t	 wcstombs __P((char *, const wchar_t *, size_t));
118226584Sdim
119226584Sdim#ifndef _ANSI_SOURCE
120226584Sdimint	 putenv __P((const char *));
121226584Sdimint	 setenv __P((const char *, const char *, int));
122226584Sdim#endif
123226584Sdim
124226584Sdim#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
125226584Sdimvoid	*alloca __P((size_t));		/* built-in for gcc */
126226584Sdim					/* getcap(3) functions */
127226584Sdimchar	*getbsize __P((int *, long *));
128226584Sdimchar	*cgetcap __P((char *, char *, int));
129226584Sdimint	 cgetclose __P((void));
130226584Sdimint	 cgetent __P((char **, char **, char *));
131226584Sdimint	 cgetfirst __P((char **, char **));
132226584Sdimint	 cgetmatch __P((char *, char *));
133226584Sdimint	 cgetnext __P((char **, char **));
134226584Sdimint	 cgetnum __P((char *, char *, long *));
135226584Sdimint	 cgetset __P((char *));
136226584Sdimint	 cgetstr __P((char *, char *, char **));
137226584Sdimint	 cgetustr __P((char *, char *, char **));
138226584Sdim
139226584Sdimint	 daemon __P((int, int));
140226584Sdimchar	*devname __P((int, int));
141226584Sdimint	 getloadavg __P((double [], int));
142245431Sdim
143226584Sdimextern char *optarg;			/* getopt(3) external variables */
144226584Sdimextern int opterr, optind, optopt;
145226584Sdimint	 getopt __P((int, char * const *, const char *));
146226584Sdim
147226584Sdimextern char *suboptarg;			/* getsubopt(3) external variable */
148226584Sdimint	 getsubopt __P((char **, char * const *, char **));
149226584Sdim
150226584Sdimchar	*group_from_gid __P((unsigned long, int));
151226584Sdimint	 heapsort __P((void *, size_t, size_t,
152226584Sdim	    int (*)(const void *, const void *)));
153226584Sdimchar	*initstate __P((unsigned, char *, int));
154226584Sdimint	 mergesort __P((void *, size_t, size_t,
155226584Sdim	    int (*)(const void *, const void *)));
156226584Sdimint	 radixsort __P((const unsigned char **, int, const unsigned char *,
157226584Sdim	    unsigned));
158226584Sdimint	 sradixsort __P((const unsigned char **, int, const unsigned char *,
159226584Sdim	    unsigned));
160226584Sdimlong	 random __P((void));
161226584Sdimchar	*realpath __P((const char *, char resolved_path[]));
162226584Sdimchar	*setstate __P((char *));
163245431Sdimvoid	 srandom __P((unsigned));
164226584Sdimchar	*user_from_uid __P((unsigned long, int));
165226584Sdim#ifndef __STRICT_ANSI__
166226584Sdimlong long
167226584Sdim	 strtoq __P((const char *, char **, int));
168226584Sdimunsigned long long
169226584Sdim	 strtouq __P((const char *, char **, int));
170226584Sdim#endif
171245431Sdimvoid	 unsetenv __P((const char *));
172226584Sdim#endif
173226584Sdim__END_DECLS
174226584Sdim
175226584Sdim#endif /* _STDLIB_H_ */
176