xref: /csrg-svn/include/stdlib.h (revision 42444)
142008Sbostic /*-
242008Sbostic  * Copyright (c) 1990 The Regents of the University of California.
342008Sbostic  * All rights reserved.
442008Sbostic  *
542008Sbostic  * %sccs.include.redist.c%
642008Sbostic  *
7*42444Sbostic  *	@(#)stdlib.h	5.3 (Berkeley) 05/29/90
842008Sbostic  */
942008Sbostic 
1042008Sbostic #ifndef _STDLIB_H_
1142008Sbostic #define _STDLIB_H_
1242200Sbostic #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 
40*42444Sbostic #if __STDC__ || c_plusplus
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);
6442200Sbostic unsigned long
6542200Sbostic 	 strtoul(const char *_nptr, char **_endptr, int _base);
6642008Sbostic int	 system(const char *_string);
6742008Sbostic 
68*42444Sbostic #ifndef _ANSI_SOURCE
6942200Sbostic void	 cfree(void *_ptr);
7042200Sbostic int	putenv(const char *_string);
7142200Sbostic int	setenv(const char *_string, const char *_value, int _overwrite);
7242200Sbostic #endif
7342200Sbostic 
7442200Sbostic #ifdef NOT_YET_IMPLEMENTED
7542200Sbostic int	mblen(const char *_s, size_t _n);
7642200Sbostic size_t	mbstowcs(wchar_t *_pwcs, const char *_s, size_t _n);
7742200Sbostic int	wctomb(char *_s, wchar_t _wchar);
7842200Sbostic int	mbtowc(wchar_t *_pwc, const char *_s, size_t _n);
7942200Sbostic double	strtod(const char *_nptr, char **_endptr);
8042200Sbostic size_t	wcstombs(char *_s, const wchar_t *_pwcs, size_t _n);
8142200Sbostic #endif
8242200Sbostic 
83*42444Sbostic #else
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();
10542200Sbostic unsigned long
10642200Sbostic 	 strtoul();
10742008Sbostic int	 system();
10842008Sbostic 
109*42444Sbostic #ifndef _ANSI_SOURCE
11042200Sbostic void	 cfree();
11142200Sbostic int	putenv();
11242200Sbostic int	setenv();
11342200Sbostic #endif
11442008Sbostic 
11542008Sbostic #ifdef NOT_YET_IMPLEMENTED
11642200Sbostic int	mblen();
11742200Sbostic size_t	mbstowcs();
11842200Sbostic int	wctomb();
11942200Sbostic int	mbtowc();
12042200Sbostic double	strtod();
12142200Sbostic size_t	wcstombs();
12242008Sbostic #endif
12342008Sbostic 
124*42444Sbostic #endif
12542200Sbostic 
12642008Sbostic #endif /* _STDLIB_H_ */
127