stdlib.h revision 26630
1/*-
2 * Copyright (c) 1990, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 *    must display the following acknowledgement:
15 *	This product includes software developed by the University of
16 *	California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 *    may be used to endorse or promote products derived from this software
19 *    without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 *	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
34 */
35
36#ifndef _STDLIB_H_
37#define	_STDLIB_H_
38
39#include <machine/ansi.h>
40#include <machine/types.h>
41
42#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
43#ifdef	_BSD_RUNE_T_
44typedef	_BSD_RUNE_T_	rune_t;
45#undef	_BSD_RUNE_T_
46#endif
47#endif
48
49#ifdef	_BSD_SIZE_T_
50typedef	_BSD_SIZE_T_	size_t;
51#undef	_BSD_SIZE_T_
52#endif
53
54#ifdef	_BSD_WCHAR_T_
55typedef	_BSD_WCHAR_T_	wchar_t;
56#undef	_BSD_WCHAR_T_
57#endif
58
59typedef struct {
60	int quot;		/* quotient */
61	int rem;		/* remainder */
62} div_t;
63
64typedef struct {
65	long quot;		/* quotient */
66	long rem;		/* remainder */
67} ldiv_t;
68
69#ifndef NULL
70#define	NULL	0
71#endif
72
73#define	EXIT_FAILURE	1
74#define	EXIT_SUCCESS	0
75
76#define	RAND_MAX	0x7fffffff
77
78extern int __mb_cur_max;
79#define	MB_CUR_MAX	__mb_cur_max
80
81#include <sys/cdefs.h>
82
83__BEGIN_DECLS
84void	 abort __P((void)) __dead2;
85int	 abs __P((int)) __pure2;
86int	 atexit __P((void (*)(void)));
87double	 atof __P((const char *));
88int	 atoi __P((const char *));
89long	 atol __P((const char *));
90void	*bsearch __P((const void *, const void *, size_t,
91	    size_t, int (*)(const void *, const void *)));
92void	*calloc __P((size_t, size_t));
93div_t	 div __P((int, int)) __pure2;
94void	 exit __P((int)) __dead2;
95void	 free __P((void *));
96char	*getenv __P((const char *));
97long	 labs __P((long)) __pure2;
98ldiv_t	 ldiv __P((long, long)) __pure2;
99void	*malloc __P((size_t));
100void	 qsort __P((void *, size_t, size_t,
101	    int (*)(const void *, const void *)));
102int	 rand __P((void));
103void	*realloc __P((void *, size_t));
104void	 srand __P((unsigned));
105double	 strtod __P((const char *, char **));
106long	 strtol __P((const char *, char **, int));
107unsigned long
108	 strtoul __P((const char *, char **, int));
109int	 system __P((const char *));
110
111int	 mblen __P((const char *, size_t));
112size_t	 mbstowcs __P((wchar_t *, const char *, size_t));
113int	 wctomb __P((char *, wchar_t));
114int	 mbtowc __P((wchar_t *, const char *, size_t));
115size_t	 wcstombs __P((char *, const wchar_t *, size_t));
116
117#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
118int	 putenv __P((const char *));
119int	 setenv __P((const char *, const char *, int));
120
121double	 drand48 __P((void));
122double	 erand48 __P((unsigned short[3]));
123long	 jrand48 __P((unsigned short[3]));
124void	 lcong48 __P((unsigned short[7]));
125long	 lrand48 __P((void));
126long	 mrand48 __P((void));
127long	 nrand48 __P((unsigned short[3]));
128unsigned short
129	*seed48 __P((unsigned short[3]));
130void	 srand48 __P((long));
131
132void	*alloca __P((size_t));		/* built-in for gcc */
133					/* getcap(3) functions */
134u_int32_t
135	 arc4random __P((void));
136void	 arc4random_stir __P((void));
137void	 arc4random_addrandom __P((unsigned char *dat, int datlen));
138char	*getbsize __P((int *, long *));
139char	*cgetcap __P((char *, char *, int));
140int	 cgetclose __P((void));
141int	 cgetent __P((char **, char **, char *));
142int	 cgetfirst __P((char **, char **));
143int	 cgetmatch __P((char *, char *));
144int	 cgetnext __P((char **, char **));
145int	 cgetnum __P((char *, char *, long *));
146int	 cgetset __P((char *));
147int	 cgetstr __P((char *, char *, char **));
148int	 cgetustr __P((char *, char *, char **));
149
150int	 daemon __P((int, int));
151char	*devname __P((int, int));
152int	 getloadavg __P((double [], int));
153
154char	*group_from_gid __P((unsigned long, int));
155int	 heapsort __P((void *, size_t, size_t,
156	    int (*)(const void *, const void *)));
157char	*initstate __P((unsigned long, char *, long));
158int	 mergesort __P((void *, size_t, size_t,
159	    int (*)(const void *, const void *)));
160int	 radixsort __P((const unsigned char **, int, const unsigned char *,
161	    unsigned));
162int	 sradixsort __P((const unsigned char **, int, const unsigned char *,
163	    unsigned));
164long	 random __P((void));
165char	*realpath __P((const char *, char resolved_path[]));
166char	*setstate __P((char *));
167void	 srandom __P((unsigned long));
168void	 srandomdev __P((void));
169char	*user_from_uid __P((unsigned long, int));
170#ifndef __STRICT_ANSI__
171long long
172	 strtoq __P((const char *, char **, int));
173unsigned long long
174	 strtouq __P((const char *, char **, int));
175#endif
176void	 unsetenv __P((const char *));
177#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
178__END_DECLS
179
180#endif /* !_STDLIB_H_ */
181