142008Sbostic /*- 261068Sbostic * Copyright (c) 1990, 1993 361068Sbostic * The Regents of the University of California. All rights reserved. 442008Sbostic * 542008Sbostic * %sccs.include.redist.c% 642008Sbostic * 7*64836Storek * @(#)stdlib.h 8.2 (Berkeley) 11/12/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_ 2160543Sbostic #ifndef _ANSI_SOURCE 2260461Selan typedef _BSD_WCHAR_T_ rune_t; 2360543Sbostic #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 38*64836Storek #ifndef NULL 39*64836Storek #define NULL 0 40*64836Storek #endif 41*64836Storek 4242008Sbostic #define EXIT_FAILURE 1 4342008Sbostic #define EXIT_SUCCESS 0 4442008Sbostic 4546622Sbostic #define RAND_MAX 0x7fffffff 4642008Sbostic 4760461Selan extern int __mb_cur_max; 4860461Selan #define MB_CUR_MAX __mb_cur_max 4942008Sbostic 5046283Sbostic #include <sys/cdefs.h> 5142008Sbostic 5246283Sbostic __BEGIN_DECLS 5352805Storek __dead void 5452805Storek abort __P((void)); 5552805Storek __pure int 5652805Storek abs __P((int)); 5746404Sdonn int atexit __P((void (*)(void))); 5846515Sdonn double atof __P((const char *)); 5946515Sdonn int atoi __P((const char *)); 6046515Sdonn long atol __P((const char *)); 6146515Sdonn void *bsearch __P((const void *, const void *, size_t, 6246515Sdonn size_t, int (*)(const void *, const void *))); 6346515Sdonn void *calloc __P((size_t, size_t)); 6452805Storek __pure div_t 6552805Storek div __P((int, int)); 6652805Storek __dead void 6752805Storek exit __P((int)); 6846515Sdonn void free __P((void *)); 6946515Sdonn char *getenv __P((const char *)); 7052805Storek __pure long 7152805Storek labs __P((long)); 7252805Storek __pure ldiv_t 7352805Storek ldiv __P((long, long)); 7446515Sdonn void *malloc __P((size_t)); 7546515Sdonn void qsort __P((void *, size_t, size_t, 7646515Sdonn int (*)(const void *, const void *))); 7746283Sbostic int rand __P((void)); 7846515Sdonn void *realloc __P((void *, size_t)); 7946515Sdonn void srand __P((unsigned)); 8046515Sdonn double strtod __P((const char *, char **)); 8146515Sdonn long strtol __P((const char *, char **, int)); 8242200Sbostic unsigned long 8346515Sdonn strtoul __P((const char *, char **, int)); 8446515Sdonn int system __P((const char *)); 8542008Sbostic 8650458Sbostic /* These are currently just stubs. */ 8746515Sdonn int mblen __P((const char *, size_t)); 8846515Sdonn size_t mbstowcs __P((wchar_t *, const char *, size_t)); 8946515Sdonn int wctomb __P((char *, wchar_t)); 9046515Sdonn int mbtowc __P((wchar_t *, const char *, size_t)); 9146515Sdonn size_t wcstombs __P((char *, const wchar_t *, size_t)); 9246446Sdonn 9342444Sbostic #ifndef _ANSI_SOURCE 9446515Sdonn int putenv __P((const char *)); 9546515Sdonn int setenv __P((const char *, const char *, int)); 9650458Sbostic #endif 9742200Sbostic 9846515Sdonn #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 9959426Sbostic void *alloca __P((size_t)); /* built-in for gcc */ 10055867Sbostic /* getcap(3) functions */ 10161038Smckusick char *getbsize __P((int *, long *)); 10255867Sbostic char *cgetcap __P((char *, char *, int)); 10355867Sbostic int cgetclose __P((void)); 10455867Sbostic int cgetent __P((char **, char **, char *)); 10555867Sbostic int cgetfirst __P((char **, char **)); 10655867Sbostic int cgetmatch __P((char *, char *)); 10755867Sbostic int cgetnext __P((char **, char **)); 10855867Sbostic int cgetnum __P((char *, char *, long *)); 10955867Sbostic int cgetset __P((char *)); 11055867Sbostic int cgetstr __P((char *, char *, char **)); 11155867Sbostic int cgetustr __P((char *, char *, char **)); 11255867Sbostic 11359426Sbostic int daemon __P((int, int)); 11461038Smckusick char *devname __P((int, int)); 11559339Sbostic int getloadavg __P((double [], int)); 11659426Sbostic 11750458Sbostic extern char *optarg; /* getopt(3) external variables */ 11851837Sbostic extern int opterr, optind, optopt; 11946556Sdonn int getopt __P((int, char * const *, const char *)); 12050458Sbostic 12150458Sbostic extern char *suboptarg; /* getsubopt(3) external variable */ 12246625Sbostic int getsubopt __P((char **, char * const *, char **)); 12350458Sbostic 12459426Sbostic char *group_from_gid __P((unsigned long, int)); 12549988Sbostic int heapsort __P((void *, size_t, size_t, 12649988Sbostic int (*)(const void *, const void *))); 12746515Sdonn char *initstate __P((unsigned, char *, int)); 12856966Sbostic int mergesort __P((void *, size_t, size_t, 12956966Sbostic int (*)(const void *, const void *))); 13056904Sbostic int radixsort __P((const unsigned char **, int, const unsigned char *, 13156904Sbostic unsigned)); 13256904Sbostic int sradixsort __P((const unsigned char **, int, const unsigned char *, 13356904Sbostic unsigned)); 13446515Sdonn long random __P((void)); 13546515Sdonn char *setstate __P((char *)); 13646515Sdonn void srandom __P((unsigned)); 13759426Sbostic char *user_from_uid __P((unsigned long, int)); 13856904Sbostic #ifndef __STRICT_ANSI__ 13954418Sbostic long long 14054418Sbostic strtoq __P((const char *, char **, int)); 14154418Sbostic unsigned long long 14254418Sbostic strtouq __P((const char *, char **, int)); 14356904Sbostic #endif 14446515Sdonn void unsetenv __P((const char *)); 14550458Sbostic #endif 14646283Sbostic __END_DECLS 14742200Sbostic 14842008Sbostic #endif /* _STDLIB_H_ */ 149