stdlib.h revision 35943
1280461Sdim/*- 2280461Sdim * Copyright (c) 1990, 1993 3280461Sdim * The Regents of the University of California. All rights reserved. 4280461Sdim * 5280461Sdim * Redistribution and use in source and binary forms, with or without 6317025Sdim * modification, are permitted provided that the following conditions 7317025Sdim * are met: 8317025Sdim * 1. Redistributions of source code must retain the above copyright 9280461Sdim * notice, this list of conditions and the following disclaimer. 10280461Sdim * 2. Redistributions in binary form must reproduce the above copyright 11280461Sdim * notice, this list of conditions and the following disclaimer in the 12280461Sdim * documentation and/or other materials provided with the distribution. 13280461Sdim * 3. All advertising materials mentioning features or use of this software 14280461Sdim * must display the following acknowledgement: 15280461Sdim * This product includes software developed by the University of 16280461Sdim * California, Berkeley and its contributors. 17280461Sdim * 4. Neither the name of the University nor the names of its contributors 18280461Sdim * may be used to endorse or promote products derived from this software 19280461Sdim * without specific prior written permission. 20280461Sdim * 21280461Sdim * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22280461Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23280461Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24280461Sdim * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25280461Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26280461Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27280461Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28280461Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29280461Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30280461Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31280461Sdim * SUCH DAMAGE. 32280461Sdim * 33280461Sdim * @(#)stdlib.h 8.5 (Berkeley) 5/19/95 34280461Sdim */ 35280461Sdim 36280461Sdim#ifndef _STDLIB_H_ 37280461Sdim#define _STDLIB_H_ 38280461Sdim 39280461Sdim#include <sys/cdefs.h> 40280461Sdim 41280461Sdim#include <machine/ansi.h> 42280461Sdim 43280461Sdim#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 44280461Sdim#include <machine/types.h> 45280461Sdim 46280461Sdim#ifdef _BSD_RUNE_T_ 47280461Sdimtypedef _BSD_RUNE_T_ rune_t; 48280461Sdim#undef _BSD_RUNE_T_ 49280461Sdim#endif 50280461Sdim#endif 51280461Sdim 52280461Sdim#ifdef _BSD_SIZE_T_ 53280461Sdimtypedef _BSD_SIZE_T_ size_t; 54280461Sdim#undef _BSD_SIZE_T_ 55280461Sdim#endif 56280461Sdim 57280461Sdim#ifdef _BSD_WCHAR_T_ 58292934Sdimtypedef _BSD_WCHAR_T_ wchar_t; 59292934Sdim#undef _BSD_WCHAR_T_ 60292934Sdim#endif 61280461Sdim 62280461Sdimtypedef struct { 63280461Sdim int quot; /* quotient */ 64280461Sdim int rem; /* remainder */ 65280461Sdim} div_t; 66280461Sdim 67280461Sdimtypedef struct { 68280461Sdim long quot; /* quotient */ 69280461Sdim long rem; /* remainder */ 70280461Sdim} ldiv_t; 71280461Sdim 72280461Sdim#ifndef NULL 73280461Sdim#define NULL 0 74280461Sdim#endif 75280461Sdim 76280461Sdim#define EXIT_FAILURE 1 77344779Sdim#define EXIT_SUCCESS 0 78280461Sdim 79280461Sdim#define RAND_MAX 0x7fffffff 80280461Sdim 81280461Sdimextern int __mb_cur_max; 82280461Sdim#define MB_CUR_MAX __mb_cur_max 83280461Sdim 84280461Sdim__BEGIN_DECLS 85280461Sdimvoid abort __P((void)) __dead2; 86280461Sdimint abs __P((int)) __pure2; 87280461Sdimint atexit __P((void (*)(void))); 88280461Sdimdouble atof __P((const char *)); 89280461Sdimint atoi __P((const char *)); 90280461Sdimlong atol __P((const char *)); 91280461Sdimvoid *bsearch __P((const void *, const void *, size_t, 92280461Sdim size_t, int (*)(const void *, const void *))); 93280461Sdimvoid *calloc __P((size_t, size_t)); 94280461Sdimdiv_t div __P((int, int)) __pure2; 95280461Sdimvoid exit __P((int)) __dead2; 96280461Sdimvoid free __P((void *)); 97280461Sdimchar *getenv __P((const char *)); 98280461Sdimlong labs __P((long)) __pure2; 99280461Sdimldiv_t ldiv __P((long, long)) __pure2; 100280461Sdimvoid *malloc __P((size_t)); 101280461Sdimvoid qsort __P((void *, size_t, size_t, 102280461Sdim int (*)(const void *, const void *))); 103280461Sdimint rand __P((void)); 104280461Sdimvoid *realloc __P((void *, size_t)); 105280461Sdimvoid srand __P((unsigned)); 106280461Sdimdouble strtod __P((const char *, char **)); 107280461Sdimlong strtol __P((const char *, char **, int)); 108280461Sdimunsigned long 109280461Sdim strtoul __P((const char *, char **, int)); 110280461Sdimint system __P((const char *)); 111280461Sdim 112280461Sdimint mblen __P((const char *, size_t)); 113280461Sdimsize_t mbstowcs __P((wchar_t *, const char *, size_t)); 114280461Sdimint wctomb __P((char *, wchar_t)); 115280461Sdimint mbtowc __P((wchar_t *, const char *, size_t)); 116280461Sdimsize_t wcstombs __P((char *, const wchar_t *, size_t)); 117280461Sdim 118280461Sdim#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 119280461Sdimint putenv __P((const char *)); 120280461Sdimint setenv __P((const char *, const char *, int)); 121280461Sdim 122280461Sdimdouble drand48 __P((void)); 123280461Sdimdouble erand48 __P((unsigned short[3])); 124280461Sdimlong jrand48 __P((unsigned short[3])); 125280461Sdimvoid lcong48 __P((unsigned short[7])); 126280461Sdimlong lrand48 __P((void)); 127280461Sdimlong mrand48 __P((void)); 128280461Sdimlong nrand48 __P((unsigned short[3])); 129280461Sdimunsigned short 130280461Sdim *seed48 __P((unsigned short[3])); 131280461Sdimvoid srand48 __P((long)); 132280461Sdim 133280461Sdimvoid *alloca __P((size_t)); /* built-in for gcc */ 134280461Sdim /* getcap(3) functions */ 135280461Sdimu_int32_t 136280461Sdim arc4random __P((void)); 137280461Sdimvoid arc4random_addrandom __P((unsigned char *dat, int datlen)); 138280461Sdimvoid arc4random_stir __P((void)); 139280461Sdimchar *getbsize __P((int *, long *)); 140280461Sdimchar *cgetcap __P((char *, char *, int)); 141280461Sdimint cgetclose __P((void)); 142280461Sdimint cgetent __P((char **, char **, char *)); 143280461Sdimint cgetfirst __P((char **, char **)); 144280461Sdimint cgetmatch __P((char *, char *)); 145280461Sdimint cgetnext __P((char **, char **)); 146280461Sdimint cgetnum __P((char *, char *, long *)); 147280461Sdimint cgetset __P((char *)); 148280461Sdimint cgetstr __P((char *, char *, char **)); 149280461Sdimint cgetustr __P((char *, char *, char **)); 150280461Sdim 151280461Sdimint daemon __P((int, int)); 152280461Sdimchar *devname __P((int, int)); 153280461Sdimint getloadavg __P((double [], int)); 154280461Sdim 155280461Sdimchar *group_from_gid __P((unsigned long, int)); 156280461Sdimint heapsort __P((void *, size_t, size_t, 157280461Sdim int (*)(const void *, const void *))); 158280461Sdimchar *initstate __P((unsigned long, char *, long)); 159280461Sdimint mergesort __P((void *, size_t, size_t, 160280461Sdim int (*)(const void *, const void *))); 161280461Sdimint radixsort __P((const unsigned char **, int, const unsigned char *, 162280461Sdim unsigned)); 163280461Sdimint sradixsort __P((const unsigned char **, int, const unsigned char *, 164280461Sdim unsigned)); 165280461Sdimlong random __P((void)); 166280461Sdimchar *realpath __P((const char *, char resolved_path[])); 167280461Sdimchar *setstate __P((char *)); 168280461Sdimvoid srandom __P((unsigned long)); 169280461Sdimvoid srandomdev __P((void)); 170280461Sdimchar *user_from_uid __P((unsigned long, int)); 171280461Sdim#ifndef __STRICT_ANSI__ 172280461Sdimint64_t strtoq __P((const char *, char **, int)); 173280461Sdimu_int64_t 174280461Sdim strtouq __P((const char *, char **, int)); 175#endif 176void unsetenv __P((const char *)); 177#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ 178__END_DECLS 179 180#endif /* !_STDLIB_H_ */ 181