xref: /csrg-svn/include/stdlib.h (revision 59426)
142008Sbostic /*-
242008Sbostic  * Copyright (c) 1990 The Regents of the University of California.
342008Sbostic  * All rights reserved.
442008Sbostic  *
542008Sbostic  * %sccs.include.redist.c%
642008Sbostic  *
7*59426Sbostic  *	@(#)stdlib.h	5.26 (Berkeley) 04/27/93
842008Sbostic  */
942008Sbostic 
1042008Sbostic #ifndef _STDLIB_H_
1142008Sbostic #define _STDLIB_H_
1256904Sbostic #include <machine/ansi.h>
1342008Sbostic 
1454254Sbostic #ifdef	_BSD_SIZE_T_
1554254Sbostic typedef	_BSD_SIZE_T_	size_t;
1654254Sbostic #undef	_BSD_SIZE_T_
1750458Sbostic #endif
1850458Sbostic 
1954254Sbostic #ifdef	_BSD_WCHAR_T_
2054254Sbostic typedef	_BSD_WCHAR_T_	wchar_t;
2154254Sbostic #undef	_BSD_WCHAR_T_
2242008Sbostic #endif
2342008Sbostic 
2442008Sbostic typedef struct {
2542008Sbostic 	int quot;		/* quotient */
2642008Sbostic 	int rem;		/* remainder */
2742008Sbostic } div_t;
2850458Sbostic 
2942008Sbostic typedef struct {
3042008Sbostic 	long quot;		/* quotient */
3142008Sbostic 	long rem;		/* remainder */
3242008Sbostic } ldiv_t;
3342008Sbostic 
3442008Sbostic #define	EXIT_FAILURE	1
3542008Sbostic #define	EXIT_SUCCESS	0
3642008Sbostic 
3746622Sbostic #define	RAND_MAX	0x7fffffff
3842008Sbostic 
3942008Sbostic #define	MB_CUR_MAX	1	/* XXX */
4042008Sbostic 
4146283Sbostic #include <sys/cdefs.h>
4242008Sbostic 
4346283Sbostic __BEGIN_DECLS
4452805Storek __dead void
4552805Storek 	 abort __P((void));
4652805Storek __pure int
4752805Storek 	 abs __P((int));
4846404Sdonn int	 atexit __P((void (*)(void)));
4946515Sdonn double	 atof __P((const char *));
5046515Sdonn int	 atoi __P((const char *));
5146515Sdonn long	 atol __P((const char *));
5246515Sdonn void	*bsearch __P((const void *, const void *, size_t,
5346515Sdonn 	    size_t, int (*)(const void *, const void *)));
5446515Sdonn void	*calloc __P((size_t, size_t));
5552805Storek __pure div_t
5652805Storek 	 div __P((int, int));
5752805Storek __dead void
5852805Storek 	 exit __P((int));
5946515Sdonn void	 free __P((void *));
6046515Sdonn char	*getenv __P((const char *));
6152805Storek __pure long
6252805Storek 	 labs __P((long));
6352805Storek __pure ldiv_t
6452805Storek 	 ldiv __P((long, long));
6546515Sdonn void	*malloc __P((size_t));
6646515Sdonn void	 qsort __P((void *, size_t, size_t,
6746515Sdonn 	    int (*)(const void *, const void *)));
6846283Sbostic int	 rand __P((void));
6946515Sdonn void	*realloc __P((void *, size_t));
7046515Sdonn void	 srand __P((unsigned));
7146515Sdonn double	 strtod __P((const char *, char **));
7246515Sdonn long	 strtol __P((const char *, char **, int));
7342200Sbostic unsigned long
7446515Sdonn 	 strtoul __P((const char *, char **, int));
7546515Sdonn int	 system __P((const char *));
7642008Sbostic 
7750458Sbostic /* These are currently just stubs. */
7846515Sdonn int	 mblen __P((const char *, size_t));
7946515Sdonn size_t	 mbstowcs __P((wchar_t *, const char *, size_t));
8046515Sdonn int	 wctomb __P((char *, wchar_t));
8146515Sdonn int	 mbtowc __P((wchar_t *, const char *, size_t));
8246515Sdonn size_t	 wcstombs __P((char *, const wchar_t *, size_t));
8346446Sdonn 
8442444Sbostic #ifndef _ANSI_SOURCE
8546515Sdonn int	 putenv __P((const char *));
8646515Sdonn int	 setenv __P((const char *, const char *, int));
8750458Sbostic #endif
8842200Sbostic 
8946515Sdonn #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
90*59426Sbostic void	*alloca __P((size_t));		/* built-in for gcc */
9155867Sbostic 					/* getcap(3) functions */
9255867Sbostic char	*cgetcap __P((char *, char *, int));
9355867Sbostic int	 cgetclose __P((void));
9455867Sbostic int	 cgetent __P((char **, char **, char *));
9555867Sbostic int	 cgetfirst __P((char **, char **));
9655867Sbostic int	 cgetmatch __P((char *, char *));
9755867Sbostic int	 cgetnext __P((char **, char **));
9855867Sbostic int	 cgetnum __P((char *, char *, long *));
9955867Sbostic int	 cgetset __P((char *));
10055867Sbostic int	 cgetstr __P((char *, char *, char **));
10155867Sbostic int	 cgetustr __P((char *, char *, char **));
10255867Sbostic 
103*59426Sbostic int	 daemon __P((int, int));
10459339Sbostic int	 getloadavg __P((double [], int));
105*59426Sbostic 
10650458Sbostic extern char *optarg;			/* getopt(3) external variables */
10751837Sbostic extern int opterr, optind, optopt;
10846556Sdonn int	 getopt __P((int, char * const *, const char *));
10950458Sbostic 
11050458Sbostic extern char *suboptarg;			/* getsubopt(3) external variable */
11146625Sbostic int	 getsubopt __P((char **, char * const *, char **));
11250458Sbostic 
113*59426Sbostic char	*group_from_gid __P((unsigned long, int));
11449988Sbostic int	 heapsort __P((void *, size_t, size_t,
11549988Sbostic 	    int (*)(const void *, const void *)));
11646515Sdonn char	*initstate __P((unsigned, char *, int));
11756966Sbostic int	 mergesort __P((void *, size_t, size_t,
11856966Sbostic 	    int (*)(const void *, const void *)));
11956904Sbostic int	 radixsort __P((const unsigned char **, int, const unsigned char *,
12056904Sbostic 	    unsigned));
12156904Sbostic int	 sradixsort __P((const unsigned char **, int, const unsigned char *,
12256904Sbostic 	    unsigned));
12346515Sdonn long	 random __P((void));
12446515Sdonn char	*setstate __P((char *));
12546515Sdonn void	 srandom __P((unsigned));
126*59426Sbostic char	*user_from_uid __P((unsigned long, int));
12756904Sbostic #ifndef __STRICT_ANSI__
12854418Sbostic long long
12954418Sbostic 	 strtoq __P((const char *, char **, int));
13054418Sbostic unsigned long long
13154418Sbostic 	 strtouq __P((const char *, char **, int));
13256904Sbostic #endif
13346515Sdonn void	 unsetenv __P((const char *));
13450458Sbostic #endif
13546283Sbostic __END_DECLS
13642200Sbostic 
13742008Sbostic #endif /* _STDLIB_H_ */
138