xref: /original-bsd/include/stdlib.h (revision c6d5c0d7)
1 /*-
2  * Copyright (c) 1990 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)stdlib.h	5.8 (Berkeley) 02/22/91
8  */
9 
10 #ifndef _STDLIB_H_
11 #define _STDLIB_H_
12 #include <machine/types.h>
13 
14 #ifdef	_SIZE_T_
15 typedef	_SIZE_T_	size_t;
16 #undef	_SIZE_T_
17 #endif
18 
19 #ifdef	_WCHAR_T_
20 typedef	_WCHAR_T_	wchar_t;
21 #undef	_WCHAR_T_
22 #endif
23 
24 typedef struct {
25 	int quot;		/* quotient */
26 	int rem;		/* remainder */
27 } div_t;
28 typedef struct {
29 	long quot;		/* quotient */
30 	long rem;		/* remainder */
31 } ldiv_t;
32 
33 #define	EXIT_FAILURE	1
34 #define	EXIT_SUCCESS	0
35 
36 #define	RAND_MAX	0x7ffffffff
37 
38 #define	MB_CUR_MAX	1	/* XXX */
39 
40 #include <sys/cdefs.h>
41 
42 __BEGIN_DECLS
43 void	 abort __P((void));
44 int	 abs __P((int));
45 int	 atexit __P((void (*)(void)));
46 double	 atof __P((const char *));
47 int	 atoi __P((const char *));
48 long	 atol __P((const char *));
49 void	*bsearch __P((const void *, const void *, size_t,
50 	    size_t, int (*)(const void *, const void *)));
51 void	*calloc __P((size_t, size_t));
52 div_t	 div __P((int, int));
53 void	 exit __P((int));
54 void	 free __P((void *));
55 char	*getenv __P((const char *));
56 long	 labs __P((long));
57 ldiv_t	 ldiv __P((long, long));
58 void	*malloc __P((size_t));
59 void	 qsort __P((void *, size_t, size_t,
60 	    int (*)(const void *, const void *)));
61 int	 rand __P((void));
62 void	*realloc __P((void *, size_t));
63 void	 srand __P((unsigned));
64 double	 strtod __P((const char *, char **));
65 long	 strtol __P((const char *, char **, int));
66 unsigned long
67 	 strtoul __P((const char *, char **, int));
68 int	 system __P((const char *));
69 
70 /* these are currently just stubs */
71 int	 mblen __P((const char *, size_t));
72 size_t	 mbstowcs __P((wchar_t *, const char *, size_t));
73 int	 wctomb __P((char *, wchar_t));
74 int	 mbtowc __P((wchar_t *, const char *, size_t));
75 size_t	 wcstombs __P((char *, const wchar_t *, size_t));
76 
77 #ifndef _ANSI_SOURCE
78 void	 cfree __P((void *));
79 int	 putenv __P((const char *));
80 int	 setenv __P((const char *, const char *, int));
81 #endif /* not ANSI */
82 
83 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
84 void	*alloca __P((size_t));	/* built-in for gcc */
85 int	 getopt __P((int, const char * const *, const char *));
86 char	*initstate __P((unsigned, char *, int));
87 int	 radixsort __P((const u_char **, int, const u_char *, u_char));
88 long	 random __P((void));
89 char	*setstate __P((char *));
90 void	 srandom __P((unsigned));
91 void	 unsetenv __P((const char *));
92 #endif /* neither ANSI nor POSIX */
93 
94 __END_DECLS
95 
96 #endif /* _STDLIB_H_ */
97