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