142008Sbostic /*- 242008Sbostic * Copyright (c) 1990 The Regents of the University of California. 342008Sbostic * All rights reserved. 442008Sbostic * 542008Sbostic * %sccs.include.redist.c% 642008Sbostic * 7*55867Sbostic * @(#)stdlib.h 5.21 (Berkeley) 08/06/92 842008Sbostic */ 942008Sbostic 1042008Sbostic #ifndef _STDLIB_H_ 1142008Sbostic #define _STDLIB_H_ 1246622Sbostic #include <sys/types.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 void cfree __P((void *)); 8646515Sdonn int putenv __P((const char *)); 8746515Sdonn int setenv __P((const char *, const char *, int)); 8850458Sbostic #endif 8942200Sbostic 9046515Sdonn #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 91*55867Sbostic /* getcap(3) functions */ 92*55867Sbostic char *cgetcap __P((char *, char *, int)); 93*55867Sbostic int cgetclose __P((void)); 94*55867Sbostic int cgetent __P((char **, char **, char *)); 95*55867Sbostic int cgetfirst __P((char **, char **)); 96*55867Sbostic int cgetmatch __P((char *, char *)); 97*55867Sbostic int cgetnext __P((char **, char **)); 98*55867Sbostic int cgetnum __P((char *, char *, long *)); 99*55867Sbostic int cgetset __P((char *)); 100*55867Sbostic int cgetstr __P((char *, char *, char **)); 101*55867Sbostic int cgetustr __P((char *, char *, char **)); 102*55867Sbostic 10350458Sbostic extern char *optarg; /* getopt(3) external variables */ 10451837Sbostic extern int opterr, optind, optopt; 10546556Sdonn int getopt __P((int, char * const *, const char *)); 10650458Sbostic 10750458Sbostic extern char *suboptarg; /* getsubopt(3) external variable */ 10846625Sbostic int getsubopt __P((char **, char * const *, char **)); 10950458Sbostic 11050458Sbostic void *alloca __P((size_t)); /* built-in for gcc */ 11149988Sbostic int heapsort __P((void *, size_t, size_t, 11249988Sbostic int (*)(const void *, const void *))); 11346515Sdonn char *initstate __P((unsigned, char *, int)); 11450482Sbostic int radixsort __P((const u_char **, int, const u_char *, u_int)); 11554578Sbostic int sradixsort __P((const u_char **, int, const u_char *, u_int)); 11646515Sdonn long random __P((void)); 11746515Sdonn char *setstate __P((char *)); 11846515Sdonn void srandom __P((unsigned)); 11954418Sbostic long long 12054418Sbostic strtoq __P((const char *, char **, int)); 12154418Sbostic unsigned long long 12254418Sbostic strtouq __P((const char *, char **, int)); 12346515Sdonn void unsetenv __P((const char *)); 12450458Sbostic #endif 12546283Sbostic __END_DECLS 12642200Sbostic 12742008Sbostic #endif /* _STDLIB_H_ */ 128