xref: /csrg-svn/include/stdlib.h (revision 42200)
142008Sbostic /*-
242008Sbostic  * Copyright (c) 1990 The Regents of the University of California.
342008Sbostic  * All rights reserved.
442008Sbostic  *
542008Sbostic  * %sccs.include.redist.c%
642008Sbostic  *
7*42200Sbostic  *	@(#)stdlib.h	5.2 (Berkeley) 05/17/90
842008Sbostic  */
942008Sbostic 
1042008Sbostic #ifndef _STDLIB_H_
1142008Sbostic #define _STDLIB_H_
12*42200Sbostic #include <machine/machtypes.h>
1342008Sbostic 
1442008Sbostic #ifdef	_SIZE_T_
1542008Sbostic typedef	_SIZE_T_	size_t;
1642008Sbostic #undef	_SIZE_T_
1742008Sbostic #endif
1842008Sbostic 
1942008Sbostic #ifdef	_WCHAR_T_
2042008Sbostic typedef	_WCHAR_T_	wchar_t;
2142008Sbostic #undef	_WCHAR_T_
2242008Sbostic #endif
2342008Sbostic 
2442008Sbostic typedef struct {
2542008Sbostic 	int quot;		/* quotient */
2642008Sbostic 	int rem;		/* remainder */
2742008Sbostic } div_t;
2842008Sbostic typedef struct {
2942008Sbostic 	long quot;		/* quotient */
3042008Sbostic 	long rem;		/* remainder */
3142008Sbostic } ldiv_t;
3242008Sbostic 
3342008Sbostic #define	EXIT_FAILURE	1
3442008Sbostic #define	EXIT_SUCCESS	0
3542008Sbostic 
3642008Sbostic #define	RAND_MAX	0x7ffffffff
3742008Sbostic 
3842008Sbostic #define	MB_CUR_MAX	1	/* XXX */
3942008Sbostic 
4042008Sbostic #ifdef __STDC__
4142008Sbostic 
4242008Sbostic void	 abort(void);
4342008Sbostic int	 abs(int);
4442008Sbostic int	 atexit(void (*_func)(void));
4542008Sbostic double	 atof(const char *_nptr);
4642008Sbostic int	 atoi(const char *_nptr);
4742008Sbostic long	 atol(const char *_nptr);
4842008Sbostic void	*bsearch(const void *_key, const void *_base, size_t _nmemb,
4942008Sbostic 	    size_t _size, int (*_compar)(const void *, const void *));
5042008Sbostic void	*calloc(size_t _nmemb, size_t _size);
5142008Sbostic div_t	 div(int _numer, int _denom);
5242008Sbostic void	 exit(int _status);
5342008Sbostic void	 free(void *_ptr);
5442008Sbostic char	*getenv(const char *_string);
5542008Sbostic long	 labs(long);
5642008Sbostic ldiv_t	 ldiv(long _numer, long _denom);
5742008Sbostic void	*malloc(size_t _size);
5842008Sbostic void	 qsort(void *_base, size_t _nmemb, size_t _size,
5942008Sbostic 	    int (*_compar)(const void *, const void *));
6042008Sbostic int	 rand(void);
6142008Sbostic void	*realloc(void *_ptr, size_t _size);
6242008Sbostic void	 srand(unsigned _seed);
6342008Sbostic long	 strtol(const char *_nptr, char **_endptr, int _base);
64*42200Sbostic unsigned long
65*42200Sbostic 	 strtoul(const char *_nptr, char **_endptr, int _base);
6642008Sbostic int	 system(const char *_string);
6742008Sbostic 
68*42200Sbostic #ifndef __STDC__
69*42200Sbostic void	 cfree(void *_ptr);
70*42200Sbostic int	putenv(const char *_string);
71*42200Sbostic int	setenv(const char *_string, const char *_value, int _overwrite);
72*42200Sbostic #endif
73*42200Sbostic 
74*42200Sbostic #ifdef NOT_YET_IMPLEMENTED
75*42200Sbostic int	mblen(const char *_s, size_t _n);
76*42200Sbostic size_t	mbstowcs(wchar_t *_pwcs, const char *_s, size_t _n);
77*42200Sbostic int	wctomb(char *_s, wchar_t _wchar);
78*42200Sbostic int	mbtowc(wchar_t *_pwc, const char *_s, size_t _n);
79*42200Sbostic double	strtod(const char *_nptr, char **_endptr);
80*42200Sbostic size_t	wcstombs(char *_s, const wchar_t *_pwcs, size_t _n);
81*42200Sbostic #endif
82*42200Sbostic 
8342008Sbostic #else /* !__STDC__ */
8442008Sbostic 
8542008Sbostic void	 abort();
8642008Sbostic int	 abs();
8742008Sbostic int	 atexit();
8842008Sbostic double	 atof();
8942008Sbostic int	 atoi();
9042008Sbostic long	 atol();
9142008Sbostic void	*bsearch();
9242008Sbostic void	*calloc();
9342008Sbostic div_t	 div();
9442008Sbostic void	 exit();
9542008Sbostic void	 free();
9642008Sbostic char	*getenv();
9742008Sbostic long	 labs();
9842008Sbostic ldiv_t	 ldiv();
9942008Sbostic void	*malloc();
10042008Sbostic void	 qsort();
10142008Sbostic int	 rand();
10242008Sbostic void	*realloc();
10342008Sbostic void	 srand();
10442008Sbostic long	 strtol();
105*42200Sbostic unsigned long
106*42200Sbostic 	 strtoul();
10742008Sbostic int	 system();
10842008Sbostic 
109*42200Sbostic #ifndef __STDC__
110*42200Sbostic void	 cfree();
111*42200Sbostic int	putenv();
112*42200Sbostic int	setenv();
113*42200Sbostic #endif
11442008Sbostic 
11542008Sbostic #ifdef NOT_YET_IMPLEMENTED
116*42200Sbostic int	mblen();
117*42200Sbostic size_t	mbstowcs();
118*42200Sbostic int	wctomb();
119*42200Sbostic int	mbtowc();
120*42200Sbostic double	strtod();
121*42200Sbostic size_t	wcstombs();
12242008Sbostic #endif
12342008Sbostic 
124*42200Sbostic #endif /* __STDC__ */
125*42200Sbostic 
12642008Sbostic #endif /* _STDLIB_H_ */
127