142008Sbostic /*- 242008Sbostic * Copyright (c) 1990 The Regents of the University of California. 342008Sbostic * All rights reserved. 442008Sbostic * 542008Sbostic * %sccs.include.redist.c% 642008Sbostic * 7*61038Smckusick * @(#)stdlib.h 5.29 (Berkeley) 06/02/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 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 */ 97*61038Smckusick char *getbsize __P((int *, long *)); 9855867Sbostic char *cgetcap __P((char *, char *, int)); 9955867Sbostic int cgetclose __P((void)); 10055867Sbostic int cgetent __P((char **, char **, char *)); 10155867Sbostic int cgetfirst __P((char **, char **)); 10255867Sbostic int cgetmatch __P((char *, char *)); 10355867Sbostic int cgetnext __P((char **, char **)); 10455867Sbostic int cgetnum __P((char *, char *, long *)); 10555867Sbostic int cgetset __P((char *)); 10655867Sbostic int cgetstr __P((char *, char *, char **)); 10755867Sbostic int cgetustr __P((char *, char *, char **)); 10855867Sbostic 10959426Sbostic int daemon __P((int, int)); 110*61038Smckusick char *devname __P((int, int)); 11159339Sbostic int getloadavg __P((double [], int)); 11259426Sbostic 11350458Sbostic extern char *optarg; /* getopt(3) external variables */ 11451837Sbostic extern int opterr, optind, optopt; 11546556Sdonn int getopt __P((int, char * const *, const char *)); 11650458Sbostic 11750458Sbostic extern char *suboptarg; /* getsubopt(3) external variable */ 11846625Sbostic int getsubopt __P((char **, char * const *, char **)); 11950458Sbostic 12059426Sbostic char *group_from_gid __P((unsigned long, int)); 12149988Sbostic int heapsort __P((void *, size_t, size_t, 12249988Sbostic int (*)(const void *, const void *))); 12346515Sdonn char *initstate __P((unsigned, char *, int)); 12456966Sbostic int mergesort __P((void *, size_t, size_t, 12556966Sbostic int (*)(const void *, const void *))); 12656904Sbostic int radixsort __P((const unsigned char **, int, const unsigned char *, 12756904Sbostic unsigned)); 12856904Sbostic int sradixsort __P((const unsigned char **, int, const unsigned char *, 12956904Sbostic unsigned)); 13046515Sdonn long random __P((void)); 13146515Sdonn char *setstate __P((char *)); 13246515Sdonn void srandom __P((unsigned)); 13359426Sbostic char *user_from_uid __P((unsigned long, int)); 13456904Sbostic #ifndef __STRICT_ANSI__ 13554418Sbostic long long 13654418Sbostic strtoq __P((const char *, char **, int)); 13754418Sbostic unsigned long long 13854418Sbostic strtouq __P((const char *, char **, int)); 13956904Sbostic #endif 14046515Sdonn void unsetenv __P((const char *)); 14150458Sbostic #endif 14246283Sbostic __END_DECLS 14342200Sbostic 14442008Sbostic #endif /* _STDLIB_H_ */ 145