xref: /csrg-svn/include/stdlib.h (revision 60543)
142008Sbostic /*-
242008Sbostic  * Copyright (c) 1990 The Regents of the University of California.
342008Sbostic  * All rights reserved.
442008Sbostic  *
542008Sbostic  * %sccs.include.redist.c%
642008Sbostic  *
7*60543Sbostic  *	@(#)stdlib.h	5.28 (Berkeley) 05/28/93
842008Sbostic  */
942008Sbostic 
1042008Sbostic #ifndef _STDLIB_H_
1142008Sbostic #define _STDLIB_H_
1260461Selan 
1356904Sbostic #include <machine/ansi.h>
1442008Sbostic 
1554254Sbostic #ifdef	_BSD_SIZE_T_
1654254Sbostic typedef	_BSD_SIZE_T_	size_t;
1754254Sbostic #undef	_BSD_SIZE_T_
1850458Sbostic #endif
1950458Sbostic 
2054254Sbostic #ifdef	_BSD_WCHAR_T_
21*60543Sbostic #ifndef _ANSI_SOURCE
2260461Selan typedef	_BSD_WCHAR_T_	rune_t;
23*60543Sbostic #endif
2454254Sbostic typedef	_BSD_WCHAR_T_	wchar_t;
2554254Sbostic #undef	_BSD_WCHAR_T_
2642008Sbostic #endif
2742008Sbostic 
2842008Sbostic typedef struct {
2942008Sbostic 	int quot;		/* quotient */
3042008Sbostic 	int rem;		/* remainder */
3142008Sbostic } div_t;
3250458Sbostic 
3342008Sbostic typedef struct {
3442008Sbostic 	long quot;		/* quotient */
3542008Sbostic 	long rem;		/* remainder */
3642008Sbostic } ldiv_t;
3742008Sbostic 
3842008Sbostic #define	EXIT_FAILURE	1
3942008Sbostic #define	EXIT_SUCCESS	0
4042008Sbostic 
4146622Sbostic #define	RAND_MAX	0x7fffffff
4242008Sbostic 
4360461Selan extern int __mb_cur_max;
4460461Selan #define	MB_CUR_MAX	__mb_cur_max
4542008Sbostic 
4646283Sbostic #include <sys/cdefs.h>
4742008Sbostic 
4846283Sbostic __BEGIN_DECLS
4952805Storek __dead void
5052805Storek 	 abort __P((void));
5152805Storek __pure int
5252805Storek 	 abs __P((int));
5346404Sdonn int	 atexit __P((void (*)(void)));
5446515Sdonn double	 atof __P((const char *));
5546515Sdonn int	 atoi __P((const char *));
5646515Sdonn long	 atol __P((const char *));
5746515Sdonn void	*bsearch __P((const void *, const void *, size_t,
5846515Sdonn 	    size_t, int (*)(const void *, const void *)));
5946515Sdonn void	*calloc __P((size_t, size_t));
6052805Storek __pure div_t
6152805Storek 	 div __P((int, int));
6252805Storek __dead void
6352805Storek 	 exit __P((int));
6446515Sdonn void	 free __P((void *));
6546515Sdonn char	*getenv __P((const char *));
6652805Storek __pure long
6752805Storek 	 labs __P((long));
6852805Storek __pure ldiv_t
6952805Storek 	 ldiv __P((long, long));
7046515Sdonn void	*malloc __P((size_t));
7146515Sdonn void	 qsort __P((void *, size_t, size_t,
7246515Sdonn 	    int (*)(const void *, const void *)));
7346283Sbostic int	 rand __P((void));
7446515Sdonn void	*realloc __P((void *, size_t));
7546515Sdonn void	 srand __P((unsigned));
7646515Sdonn double	 strtod __P((const char *, char **));
7746515Sdonn long	 strtol __P((const char *, char **, int));
7842200Sbostic unsigned long
7946515Sdonn 	 strtoul __P((const char *, char **, int));
8046515Sdonn int	 system __P((const char *));
8142008Sbostic 
8250458Sbostic /* These are currently just stubs. */
8346515Sdonn int	 mblen __P((const char *, size_t));
8446515Sdonn size_t	 mbstowcs __P((wchar_t *, const char *, size_t));
8546515Sdonn int	 wctomb __P((char *, wchar_t));
8646515Sdonn int	 mbtowc __P((wchar_t *, const char *, size_t));
8746515Sdonn size_t	 wcstombs __P((char *, const wchar_t *, size_t));
8846446Sdonn 
8942444Sbostic #ifndef _ANSI_SOURCE
9046515Sdonn int	 putenv __P((const char *));
9146515Sdonn int	 setenv __P((const char *, const char *, int));
9250458Sbostic #endif
9342200Sbostic 
9446515Sdonn #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
9559426Sbostic void	*alloca __P((size_t));		/* built-in for gcc */
9655867Sbostic 					/* getcap(3) functions */
9755867Sbostic char	*cgetcap __P((char *, char *, int));
9855867Sbostic int	 cgetclose __P((void));
9955867Sbostic int	 cgetent __P((char **, char **, char *));
10055867Sbostic int	 cgetfirst __P((char **, char **));
10155867Sbostic int	 cgetmatch __P((char *, char *));
10255867Sbostic int	 cgetnext __P((char **, char **));
10355867Sbostic int	 cgetnum __P((char *, char *, long *));
10455867Sbostic int	 cgetset __P((char *));
10555867Sbostic int	 cgetstr __P((char *, char *, char **));
10655867Sbostic int	 cgetustr __P((char *, char *, char **));
10755867Sbostic 
10859426Sbostic int	 daemon __P((int, int));
10959339Sbostic int	 getloadavg __P((double [], int));
11059426Sbostic 
11150458Sbostic extern char *optarg;			/* getopt(3) external variables */
11251837Sbostic extern int opterr, optind, optopt;
11346556Sdonn int	 getopt __P((int, char * const *, const char *));
11450458Sbostic 
11550458Sbostic extern char *suboptarg;			/* getsubopt(3) external variable */
11646625Sbostic int	 getsubopt __P((char **, char * const *, char **));
11750458Sbostic 
11859426Sbostic char	*group_from_gid __P((unsigned long, int));
11949988Sbostic int	 heapsort __P((void *, size_t, size_t,
12049988Sbostic 	    int (*)(const void *, const void *)));
12146515Sdonn char	*initstate __P((unsigned, char *, int));
12256966Sbostic int	 mergesort __P((void *, size_t, size_t,
12356966Sbostic 	    int (*)(const void *, const void *)));
12456904Sbostic int	 radixsort __P((const unsigned char **, int, const unsigned char *,
12556904Sbostic 	    unsigned));
12656904Sbostic int	 sradixsort __P((const unsigned char **, int, const unsigned char *,
12756904Sbostic 	    unsigned));
12846515Sdonn long	 random __P((void));
12946515Sdonn char	*setstate __P((char *));
13046515Sdonn void	 srandom __P((unsigned));
13159426Sbostic char	*user_from_uid __P((unsigned long, int));
13256904Sbostic #ifndef __STRICT_ANSI__
13354418Sbostic long long
13454418Sbostic 	 strtoq __P((const char *, char **, int));
13554418Sbostic unsigned long long
13654418Sbostic 	 strtouq __P((const char *, char **, int));
13756904Sbostic #endif
13846515Sdonn void	 unsetenv __P((const char *));
13950458Sbostic #endif
14046283Sbostic __END_DECLS
14142200Sbostic 
14242008Sbostic #endif /* _STDLIB_H_ */
143