xref: /original-bsd/include/stdlib.h (revision 83b98e62)
19234c7d4Sbostic /*-
23cd9f84aSbostic  * Copyright (c) 1990, 1993
33cd9f84aSbostic  *	The Regents of the University of California.  All rights reserved.
49234c7d4Sbostic  *
59234c7d4Sbostic  * %sccs.include.redist.c%
69234c7d4Sbostic  *
7*83b98e62Smckusick  *	@(#)stdlib.h	8.5 (Berkeley) 05/19/95
89234c7d4Sbostic  */
99234c7d4Sbostic 
109234c7d4Sbostic #ifndef _STDLIB_H_
119234c7d4Sbostic #define _STDLIB_H_
12b28c3715Selan 
13cb9ea6caSbostic #include <machine/ansi.h>
149234c7d4Sbostic 
159ca7ec54Sbostic #ifdef	_BSD_SIZE_T_
169ca7ec54Sbostic typedef	_BSD_SIZE_T_	size_t;
179ca7ec54Sbostic #undef	_BSD_SIZE_T_
18b3c5ccf3Sbostic #endif
19b3c5ccf3Sbostic 
209ca7ec54Sbostic #ifdef	_BSD_WCHAR_T_
21d79ad435Sbostic #ifndef _ANSI_SOURCE
22b28c3715Selan typedef	_BSD_WCHAR_T_	rune_t;
23d79ad435Sbostic #endif
249ca7ec54Sbostic typedef	_BSD_WCHAR_T_	wchar_t;
259ca7ec54Sbostic #undef	_BSD_WCHAR_T_
269234c7d4Sbostic #endif
279234c7d4Sbostic 
289234c7d4Sbostic typedef struct {
299234c7d4Sbostic 	int quot;		/* quotient */
309234c7d4Sbostic 	int rem;		/* remainder */
319234c7d4Sbostic } div_t;
32b3c5ccf3Sbostic 
339234c7d4Sbostic typedef struct {
349234c7d4Sbostic 	long quot;		/* quotient */
359234c7d4Sbostic 	long rem;		/* remainder */
369234c7d4Sbostic } ldiv_t;
379234c7d4Sbostic 
3893086a2fStorek #ifndef NULL
3993086a2fStorek #define	NULL	0
4093086a2fStorek #endif
4193086a2fStorek 
429234c7d4Sbostic #define	EXIT_FAILURE	1
439234c7d4Sbostic #define	EXIT_SUCCESS	0
449234c7d4Sbostic 
451219422aSbostic #define	RAND_MAX	0x7fffffff
469234c7d4Sbostic 
47b28c3715Selan extern int __mb_cur_max;
48b28c3715Selan #define	MB_CUR_MAX	__mb_cur_max
499234c7d4Sbostic 
50ac5db891Sbostic #include <sys/cdefs.h>
519234c7d4Sbostic 
52ac5db891Sbostic __BEGIN_DECLS
53d6ea7affStorek __dead void
54d6ea7affStorek 	 abort __P((void));
55d6ea7affStorek __pure int
56d6ea7affStorek 	 abs __P((int));
57f9cd873eSdonn int	 atexit __P((void (*)(void)));
58b7f4e790Sdonn double	 atof __P((const char *));
59b7f4e790Sdonn int	 atoi __P((const char *));
60b7f4e790Sdonn long	 atol __P((const char *));
61b7f4e790Sdonn void	*bsearch __P((const void *, const void *, size_t,
62b7f4e790Sdonn 	    size_t, int (*)(const void *, const void *)));
63b7f4e790Sdonn void	*calloc __P((size_t, size_t));
64d6ea7affStorek __pure div_t
65d6ea7affStorek 	 div __P((int, int));
66d6ea7affStorek __dead void
67d6ea7affStorek 	 exit __P((int));
68b7f4e790Sdonn void	 free __P((void *));
69b7f4e790Sdonn char	*getenv __P((const char *));
70d6ea7affStorek __pure long
71d6ea7affStorek 	 labs __P((long));
72d6ea7affStorek __pure ldiv_t
73d6ea7affStorek 	 ldiv __P((long, long));
74b7f4e790Sdonn void	*malloc __P((size_t));
75b7f4e790Sdonn void	 qsort __P((void *, size_t, size_t,
76b7f4e790Sdonn 	    int (*)(const void *, const void *)));
77ac5db891Sbostic int	 rand __P((void));
78b7f4e790Sdonn void	*realloc __P((void *, size_t));
79b7f4e790Sdonn void	 srand __P((unsigned));
80b7f4e790Sdonn double	 strtod __P((const char *, char **));
81b7f4e790Sdonn long	 strtol __P((const char *, char **, int));
8214e51224Sbostic unsigned long
83b7f4e790Sdonn 	 strtoul __P((const char *, char **, int));
84b7f4e790Sdonn int	 system __P((const char *));
859234c7d4Sbostic 
86b3c5ccf3Sbostic /* These are currently just stubs. */
87b7f4e790Sdonn int	 mblen __P((const char *, size_t));
88b7f4e790Sdonn size_t	 mbstowcs __P((wchar_t *, const char *, size_t));
89b7f4e790Sdonn int	 wctomb __P((char *, wchar_t));
90b7f4e790Sdonn int	 mbtowc __P((wchar_t *, const char *, size_t));
91b7f4e790Sdonn size_t	 wcstombs __P((char *, const wchar_t *, size_t));
92d78f05a4Sdonn 
93c219ce36Sbostic #ifndef _ANSI_SOURCE
94b7f4e790Sdonn int	 putenv __P((const char *));
95b7f4e790Sdonn int	 setenv __P((const char *, const char *, int));
96b3c5ccf3Sbostic #endif
9714e51224Sbostic 
98b7f4e790Sdonn #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
99b1fc3569Sbostic void	*alloca __P((size_t));		/* built-in for gcc */
1007d798152Sbostic 					/* getcap(3) functions */
101ee33d28eSmckusick char	*getbsize __P((int *, long *));
1027d798152Sbostic char	*cgetcap __P((char *, char *, int));
1037d798152Sbostic int	 cgetclose __P((void));
1047d798152Sbostic int	 cgetent __P((char **, char **, char *));
1057d798152Sbostic int	 cgetfirst __P((char **, char **));
1067d798152Sbostic int	 cgetmatch __P((char *, char *));
1077d798152Sbostic int	 cgetnext __P((char **, char **));
1087d798152Sbostic int	 cgetnum __P((char *, char *, long *));
1097d798152Sbostic int	 cgetset __P((char *));
1107d798152Sbostic int	 cgetstr __P((char *, char *, char **));
1117d798152Sbostic int	 cgetustr __P((char *, char *, char **));
1127d798152Sbostic 
113b1fc3569Sbostic int	 daemon __P((int, int));
114ee33d28eSmckusick char	*devname __P((int, int));
1154ea8451eSbostic int	 getloadavg __P((double [], int));
116b1fc3569Sbostic 
117b1fc3569Sbostic char	*group_from_gid __P((unsigned long, int));
118618b9aafSbostic int	 heapsort __P((void *, size_t, size_t,
119618b9aafSbostic 	    int (*)(const void *, const void *)));
120*83b98e62Smckusick char	*initstate __P((unsigned long, char *, long));
121a6c1d0faSbostic int	 mergesort __P((void *, size_t, size_t,
122a6c1d0faSbostic 	    int (*)(const void *, const void *)));
123cb9ea6caSbostic int	 radixsort __P((const unsigned char **, int, const unsigned char *,
124cb9ea6caSbostic 	    unsigned));
125cb9ea6caSbostic int	 sradixsort __P((const unsigned char **, int, const unsigned char *,
126cb9ea6caSbostic 	    unsigned));
127b7f4e790Sdonn long	 random __P((void));
1283b235cedSbostic char	*realpath __P((const char *, char resolved_path[]));
129b7f4e790Sdonn char	*setstate __P((char *));
130*83b98e62Smckusick void	 srandom __P((unsigned long));
131b1fc3569Sbostic char	*user_from_uid __P((unsigned long, int));
132cb9ea6caSbostic #ifndef __STRICT_ANSI__
133784a75edSbostic long long
134784a75edSbostic 	 strtoq __P((const char *, char **, int));
135784a75edSbostic unsigned long long
136784a75edSbostic 	 strtouq __P((const char *, char **, int));
137cb9ea6caSbostic #endif
138b7f4e790Sdonn void	 unsetenv __P((const char *));
139b3c5ccf3Sbostic #endif
140ac5db891Sbostic __END_DECLS
14114e51224Sbostic 
1429234c7d4Sbostic #endif /* _STDLIB_H_ */
143