159deaec5SRodney W. Grimes /*- 259deaec5SRodney W. Grimes * Copyright (c) 1990, 1993 359deaec5SRodney W. Grimes * The Regents of the University of California. All rights reserved. 459deaec5SRodney W. Grimes * 559deaec5SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 659deaec5SRodney W. Grimes * modification, are permitted provided that the following conditions 759deaec5SRodney W. Grimes * are met: 859deaec5SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 959deaec5SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 1059deaec5SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 1159deaec5SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 1259deaec5SRodney W. Grimes * documentation and/or other materials provided with the distribution. 1359deaec5SRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 1459deaec5SRodney W. Grimes * must display the following acknowledgement: 1559deaec5SRodney W. Grimes * This product includes software developed by the University of 1659deaec5SRodney W. Grimes * California, Berkeley and its contributors. 1759deaec5SRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 1859deaec5SRodney W. Grimes * may be used to endorse or promote products derived from this software 1959deaec5SRodney W. Grimes * without specific prior written permission. 2059deaec5SRodney W. Grimes * 2159deaec5SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2259deaec5SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2359deaec5SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2459deaec5SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2559deaec5SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2659deaec5SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2759deaec5SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2859deaec5SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2959deaec5SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3059deaec5SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3159deaec5SRodney W. Grimes * SUCH DAMAGE. 3259deaec5SRodney W. Grimes * 3359deaec5SRodney W. Grimes * @(#)stdlib.h 8.3 (Berkeley) 2/16/94 3459deaec5SRodney W. Grimes */ 3559deaec5SRodney W. Grimes 3659deaec5SRodney W. Grimes #ifndef _STDLIB_H_ 3759deaec5SRodney W. Grimes #define _STDLIB_H_ 3859deaec5SRodney W. Grimes 3959deaec5SRodney W. Grimes #include <machine/ansi.h> 4059deaec5SRodney W. Grimes 4159deaec5SRodney W. Grimes #ifdef _BSD_SIZE_T_ 4259deaec5SRodney W. Grimes typedef _BSD_SIZE_T_ size_t; 4359deaec5SRodney W. Grimes #undef _BSD_SIZE_T_ 4459deaec5SRodney W. Grimes #endif 4559deaec5SRodney W. Grimes 4659deaec5SRodney W. Grimes #ifdef _BSD_WCHAR_T_ 4767c54240SBruce Evans #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 4859deaec5SRodney W. Grimes typedef _BSD_WCHAR_T_ rune_t; 4959deaec5SRodney W. Grimes #endif 5059deaec5SRodney W. Grimes typedef _BSD_WCHAR_T_ wchar_t; 5159deaec5SRodney W. Grimes #undef _BSD_WCHAR_T_ 5259deaec5SRodney W. Grimes #endif 5359deaec5SRodney W. Grimes 5459deaec5SRodney W. Grimes typedef struct { 5559deaec5SRodney W. Grimes int quot; /* quotient */ 5659deaec5SRodney W. Grimes int rem; /* remainder */ 5759deaec5SRodney W. Grimes } div_t; 5859deaec5SRodney W. Grimes 5959deaec5SRodney W. Grimes typedef struct { 6059deaec5SRodney W. Grimes long quot; /* quotient */ 6159deaec5SRodney W. Grimes long rem; /* remainder */ 6259deaec5SRodney W. Grimes } ldiv_t; 6359deaec5SRodney W. Grimes 6459deaec5SRodney W. Grimes #ifndef NULL 6559deaec5SRodney W. Grimes #define NULL 0 6659deaec5SRodney W. Grimes #endif 6759deaec5SRodney W. Grimes 6859deaec5SRodney W. Grimes #define EXIT_FAILURE 1 6959deaec5SRodney W. Grimes #define EXIT_SUCCESS 0 7059deaec5SRodney W. Grimes 7159deaec5SRodney W. Grimes #define RAND_MAX 0x7fffffff 7259deaec5SRodney W. Grimes 7359deaec5SRodney W. Grimes extern int __mb_cur_max; 7459deaec5SRodney W. Grimes #define MB_CUR_MAX __mb_cur_max 7559deaec5SRodney W. Grimes 7659deaec5SRodney W. Grimes #include <sys/cdefs.h> 7759deaec5SRodney W. Grimes 7859deaec5SRodney W. Grimes __BEGIN_DECLS 7959deaec5SRodney W. Grimes __dead void 802868e961SBruce Evans abort __P((void)) __dead2; 8159deaec5SRodney W. Grimes __pure int 8267c54240SBruce Evans abs __P((int)) __pure2; 8359deaec5SRodney W. Grimes int atexit __P((void (*)(void))); 8459deaec5SRodney W. Grimes double atof __P((const char *)); 8559deaec5SRodney W. Grimes int atoi __P((const char *)); 8659deaec5SRodney W. Grimes long atol __P((const char *)); 8759deaec5SRodney W. Grimes void *bsearch __P((const void *, const void *, size_t, 8859deaec5SRodney W. Grimes size_t, int (*)(const void *, const void *))); 8959deaec5SRodney W. Grimes void *calloc __P((size_t, size_t)); 9059deaec5SRodney W. Grimes __pure div_t 9167c54240SBruce Evans div __P((int, int)) __pure2; 9259deaec5SRodney W. Grimes __dead void 932868e961SBruce Evans exit __P((int)) __dead2; 9459deaec5SRodney W. Grimes void free __P((void *)); 9559deaec5SRodney W. Grimes char *getenv __P((const char *)); 9659deaec5SRodney W. Grimes __pure long 9767c54240SBruce Evans labs __P((long)) __pure2; 9859deaec5SRodney W. Grimes __pure ldiv_t 9967c54240SBruce Evans ldiv __P((long, long)) __pure2; 10059deaec5SRodney W. Grimes void *malloc __P((size_t)); 10159deaec5SRodney W. Grimes void qsort __P((void *, size_t, size_t, 10259deaec5SRodney W. Grimes int (*)(const void *, const void *))); 10359deaec5SRodney W. Grimes int rand __P((void)); 10459deaec5SRodney W. Grimes void *realloc __P((void *, size_t)); 10559deaec5SRodney W. Grimes void srand __P((unsigned)); 10659deaec5SRodney W. Grimes double strtod __P((const char *, char **)); 10759deaec5SRodney W. Grimes long strtol __P((const char *, char **, int)); 10859deaec5SRodney W. Grimes unsigned long 10959deaec5SRodney W. Grimes strtoul __P((const char *, char **, int)); 11059deaec5SRodney W. Grimes int system __P((const char *)); 11159deaec5SRodney W. Grimes 11259deaec5SRodney W. Grimes int mblen __P((const char *, size_t)); 11359deaec5SRodney W. Grimes size_t mbstowcs __P((wchar_t *, const char *, size_t)); 11459deaec5SRodney W. Grimes int wctomb __P((char *, wchar_t)); 11559deaec5SRodney W. Grimes int mbtowc __P((wchar_t *, const char *, size_t)); 11659deaec5SRodney W. Grimes size_t wcstombs __P((char *, const wchar_t *, size_t)); 11759deaec5SRodney W. Grimes 11867c54240SBruce Evans #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 11959deaec5SRodney W. Grimes int putenv __P((const char *)); 12059deaec5SRodney W. Grimes int setenv __P((const char *, const char *, int)); 12159deaec5SRodney W. Grimes 122f8f6d0dcSAndreas Schulz double drand48 __P((void)); 123f8f6d0dcSAndreas Schulz double erand48 __P((unsigned short[3])); 124f8f6d0dcSAndreas Schulz long jrand48 __P((unsigned short[3])); 125f8f6d0dcSAndreas Schulz void lcong48 __P((unsigned short[7])); 12667c54240SBruce Evans long lrand48 __P((void)); 12767c54240SBruce Evans long mrand48 __P((void)); 12867c54240SBruce Evans long nrand48 __P((unsigned short[3])); 12967c54240SBruce Evans unsigned short 13067c54240SBruce Evans *seed48 __P((unsigned short[3])); 13167c54240SBruce Evans void srand48 __P((long)); 132f8f6d0dcSAndreas Schulz 13359deaec5SRodney W. Grimes void *alloca __P((size_t)); /* built-in for gcc */ 13459deaec5SRodney W. Grimes /* getcap(3) functions */ 13559deaec5SRodney W. Grimes char *getbsize __P((int *, long *)); 13659deaec5SRodney W. Grimes char *cgetcap __P((char *, char *, int)); 13759deaec5SRodney W. Grimes int cgetclose __P((void)); 13859deaec5SRodney W. Grimes int cgetent __P((char **, char **, char *)); 13959deaec5SRodney W. Grimes int cgetfirst __P((char **, char **)); 14059deaec5SRodney W. Grimes int cgetmatch __P((char *, char *)); 14159deaec5SRodney W. Grimes int cgetnext __P((char **, char **)); 14259deaec5SRodney W. Grimes int cgetnum __P((char *, char *, long *)); 14359deaec5SRodney W. Grimes int cgetset __P((char *)); 14459deaec5SRodney W. Grimes int cgetstr __P((char *, char *, char **)); 14559deaec5SRodney W. Grimes int cgetustr __P((char *, char *, char **)); 14659deaec5SRodney W. Grimes 14759deaec5SRodney W. Grimes int daemon __P((int, int)); 14859deaec5SRodney W. Grimes char *devname __P((int, int)); 14959deaec5SRodney W. Grimes int getloadavg __P((double [], int)); 15059deaec5SRodney W. Grimes 15159deaec5SRodney W. Grimes extern char *optarg; /* getopt(3) external variables */ 15259deaec5SRodney W. Grimes extern int opterr, optind, optopt; 15359deaec5SRodney W. Grimes int getopt __P((int, char * const *, const char *)); 15459deaec5SRodney W. Grimes 15559deaec5SRodney W. Grimes extern char *suboptarg; /* getsubopt(3) external variable */ 15659deaec5SRodney W. Grimes int getsubopt __P((char **, char * const *, char **)); 15759deaec5SRodney W. Grimes 15859deaec5SRodney W. Grimes char *group_from_gid __P((unsigned long, int)); 15959deaec5SRodney W. Grimes int heapsort __P((void *, size_t, size_t, 16059deaec5SRodney W. Grimes int (*)(const void *, const void *))); 16159deaec5SRodney W. Grimes char *initstate __P((unsigned, char *, int)); 16259deaec5SRodney W. Grimes int mergesort __P((void *, size_t, size_t, 16359deaec5SRodney W. Grimes int (*)(const void *, const void *))); 16459deaec5SRodney W. Grimes int radixsort __P((const unsigned char **, int, const unsigned char *, 16559deaec5SRodney W. Grimes unsigned)); 16659deaec5SRodney W. Grimes int sradixsort __P((const unsigned char **, int, const unsigned char *, 16759deaec5SRodney W. Grimes unsigned)); 16859deaec5SRodney W. Grimes long random __P((void)); 16959deaec5SRodney W. Grimes char *realpath __P((const char *, char resolved_path[])); 17059deaec5SRodney W. Grimes char *setstate __P((char *)); 17159deaec5SRodney W. Grimes void srandom __P((unsigned)); 17259deaec5SRodney W. Grimes char *user_from_uid __P((unsigned long, int)); 17359deaec5SRodney W. Grimes #ifndef __STRICT_ANSI__ 17459deaec5SRodney W. Grimes long long 17559deaec5SRodney W. Grimes strtoq __P((const char *, char **, int)); 17659deaec5SRodney W. Grimes unsigned long long 17759deaec5SRodney W. Grimes strtouq __P((const char *, char **, int)); 17859deaec5SRodney W. Grimes #endif 17959deaec5SRodney W. Grimes void unsetenv __P((const char *)); 18067c54240SBruce Evans #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ 18159deaec5SRodney W. Grimes __END_DECLS 18259deaec5SRodney W. Grimes 18367c54240SBruce Evans #endif /* !_STDLIB_H_ */ 184