xref: /original-bsd/include/stdlib.h (revision 97411546)
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.20 (Berkeley) 06/30/92
8  */
9 
10 #ifndef _STDLIB_H_
11 #define _STDLIB_H_
12 #include <sys/types.h>
13 
14 #ifdef	_BSD_SIZE_T_
15 typedef	_BSD_SIZE_T_	size_t;
16 #undef	_BSD_SIZE_T_
17 #endif
18 
19 #ifdef	_BSD_WCHAR_T_
20 typedef	_BSD_WCHAR_T_	wchar_t;
21 #undef	_BSD_WCHAR_T_
22 #endif
23 
24 typedef struct {
25 	int quot;		/* quotient */
26 	int rem;		/* remainder */
27 } div_t;
28 
29 typedef struct {
30 	long quot;		/* quotient */
31 	long rem;		/* remainder */
32 } ldiv_t;
33 
34 #define	EXIT_FAILURE	1
35 #define	EXIT_SUCCESS	0
36 
37 #define	RAND_MAX	0x7fffffff
38 
39 #define	MB_CUR_MAX	1	/* XXX */
40 
41 #include <sys/cdefs.h>
42 
43 __BEGIN_DECLS
44 __dead void
45 	 abort __P((void));
46 __pure int
47 	 abs __P((int));
48 int	 atexit __P((void (*)(void)));
49 double	 atof __P((const char *));
50 int	 atoi __P((const char *));
51 long	 atol __P((const char *));
52 void	*bsearch __P((const void *, const void *, size_t,
53 	    size_t, int (*)(const void *, const void *)));
54 void	*calloc __P((size_t, size_t));
55 __pure div_t
56 	 div __P((int, int));
57 __dead void
58 	 exit __P((int));
59 void	 free __P((void *));
60 char	*getenv __P((const char *));
61 __pure long
62 	 labs __P((long));
63 __pure ldiv_t
64 	 ldiv __P((long, long));
65 void	*malloc __P((size_t));
66 void	 qsort __P((void *, size_t, size_t,
67 	    int (*)(const void *, const void *)));
68 int	 rand __P((void));
69 void	*realloc __P((void *, size_t));
70 void	 srand __P((unsigned));
71 double	 strtod __P((const char *, char **));
72 long	 strtol __P((const char *, char **, int));
73 unsigned long
74 	 strtoul __P((const char *, char **, int));
75 int	 system __P((const char *));
76 
77 /* These are currently just stubs. */
78 int	 mblen __P((const char *, size_t));
79 size_t	 mbstowcs __P((wchar_t *, const char *, size_t));
80 int	 wctomb __P((char *, wchar_t));
81 int	 mbtowc __P((wchar_t *, const char *, size_t));
82 size_t	 wcstombs __P((char *, const wchar_t *, size_t));
83 
84 #ifndef _ANSI_SOURCE
85 void	 cfree __P((void *));
86 int	 putenv __P((const char *));
87 int	 setenv __P((const char *, const char *, int));
88 #endif
89 
90 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
91 extern char *optarg;			/* getopt(3) external variables */
92 extern int opterr, optind, optopt;
93 int	 getopt __P((int, char * const *, const char *));
94 
95 extern char *suboptarg;			/* getsubopt(3) external variable */
96 int	 getsubopt __P((char **, char * const *, char **));
97 
98 void	*alloca __P((size_t));	/* built-in for gcc */
99 int	 heapsort __P((void *, size_t, size_t,
100 	    int (*)(const void *, const void *)));
101 char	*initstate __P((unsigned, char *, int));
102 int	 radixsort __P((const u_char **, int, const u_char *, u_int));
103 int	 sradixsort __P((const u_char **, int, const u_char *, u_int));
104 long	 random __P((void));
105 char	*setstate __P((char *));
106 void	 srandom __P((unsigned));
107 long long
108 	 strtoq __P((const char *, char **, int));
109 unsigned long long
110 	 strtouq __P((const char *, char **, int));
111 void	 unsetenv __P((const char *));
112 #endif
113 __END_DECLS
114 
115 #endif /* _STDLIB_H_ */
116