stdlib.h revision 1539
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.3 (Berkeley) 2/16/94
34 */
35
36#ifndef _STDLIB_H_
37#define _STDLIB_H_
38
39#include <machine/ansi.h>
40
41#ifdef	_BSD_SIZE_T_
42typedef	_BSD_SIZE_T_	size_t;
43#undef	_BSD_SIZE_T_
44#endif
45
46#ifdef	_BSD_WCHAR_T_
47#ifndef _ANSI_SOURCE
48typedef	_BSD_WCHAR_T_	rune_t;
49#endif
50typedef	_BSD_WCHAR_T_	wchar_t;
51#undef	_BSD_WCHAR_T_
52#endif
53
54typedef struct {
55	int quot;		/* quotient */
56	int rem;		/* remainder */
57} div_t;
58
59typedef struct {
60	long quot;		/* quotient */
61	long rem;		/* remainder */
62} ldiv_t;
63
64#ifndef NULL
65#define	NULL	0
66#endif
67
68#define	EXIT_FAILURE	1
69#define	EXIT_SUCCESS	0
70
71#define	RAND_MAX	0x7fffffff
72
73extern int __mb_cur_max;
74#define	MB_CUR_MAX	__mb_cur_max
75
76#include <sys/cdefs.h>
77
78__BEGIN_DECLS
79__dead void
80	 abort __P((void));
81__pure int
82	 abs __P((int));
83int	 atexit __P((void (*)(void)));
84double	 atof __P((const char *));
85int	 atoi __P((const char *));
86long	 atol __P((const char *));
87void	*bsearch __P((const void *, const void *, size_t,
88	    size_t, int (*)(const void *, const void *)));
89void	*calloc __P((size_t, size_t));
90__pure div_t
91	 div __P((int, int));
92__dead void
93	 exit __P((int));
94void	 free __P((void *));
95char	*getenv __P((const char *));
96__pure long
97	 labs __P((long));
98__pure ldiv_t
99	 ldiv __P((long, long));
100void	*malloc __P((size_t));
101void	 qsort __P((void *, size_t, size_t,
102	    int (*)(const void *, const void *)));
103int	 rand __P((void));
104void	*realloc __P((void *, size_t));
105void	 srand __P((unsigned));
106double	 strtod __P((const char *, char **));
107long	 strtol __P((const char *, char **, int));
108unsigned long
109	 strtoul __P((const char *, char **, int));
110int	 system __P((const char *));
111
112/* These are currently just stubs. */
113int	 mblen __P((const char *, size_t));
114size_t	 mbstowcs __P((wchar_t *, const char *, size_t));
115int	 wctomb __P((char *, wchar_t));
116int	 mbtowc __P((wchar_t *, const char *, size_t));
117size_t	 wcstombs __P((char *, const wchar_t *, size_t));
118
119#ifndef _ANSI_SOURCE
120int	 putenv __P((const char *));
121int	 setenv __P((const char *, const char *, int));
122#endif
123
124#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
125void	*alloca __P((size_t));		/* built-in for gcc */
126					/* getcap(3) functions */
127char	*getbsize __P((int *, long *));
128char	*cgetcap __P((char *, char *, int));
129int	 cgetclose __P((void));
130int	 cgetent __P((char **, char **, char *));
131int	 cgetfirst __P((char **, char **));
132int	 cgetmatch __P((char *, char *));
133int	 cgetnext __P((char **, char **));
134int	 cgetnum __P((char *, char *, long *));
135int	 cgetset __P((char *));
136int	 cgetstr __P((char *, char *, char **));
137int	 cgetustr __P((char *, char *, char **));
138
139int	 daemon __P((int, int));
140char	*devname __P((int, int));
141int	 getloadavg __P((double [], int));
142
143extern char *optarg;			/* getopt(3) external variables */
144extern int opterr, optind, optopt;
145int	 getopt __P((int, char * const *, const char *));
146
147extern char *suboptarg;			/* getsubopt(3) external variable */
148int	 getsubopt __P((char **, char * const *, char **));
149
150char	*group_from_gid __P((unsigned long, int));
151int	 heapsort __P((void *, size_t, size_t,
152	    int (*)(const void *, const void *)));
153char	*initstate __P((unsigned, char *, int));
154int	 mergesort __P((void *, size_t, size_t,
155	    int (*)(const void *, const void *)));
156int	 radixsort __P((const unsigned char **, int, const unsigned char *,
157	    unsigned));
158int	 sradixsort __P((const unsigned char **, int, const unsigned char *,
159	    unsigned));
160long	 random __P((void));
161char	*realpath __P((const char *, char resolved_path[]));
162char	*setstate __P((char *));
163void	 srandom __P((unsigned));
164char	*user_from_uid __P((unsigned long, int));
165#ifndef __STRICT_ANSI__
166long long
167	 strtoq __P((const char *, char **, int));
168unsigned long long
169	 strtouq __P((const char *, char **, int));
170#endif
171void	 unsetenv __P((const char *));
172#endif
173__END_DECLS
174
175#endif /* _STDLIB_H_ */
176