stdlib.h revision 90644
1290001Sglebius/*- 2181834Sroberto * Copyright (c) 1990, 1993 3290001Sglebius * The Regents of the University of California. All rights reserved. 4310419Sdelphij * 5181834Sroberto * Redistribution and use in source and binary forms, with or without 6181834Sroberto * modification, are permitted provided that the following conditions 7181834Sroberto * are met: 8290001Sglebius * 1. Redistributions of source code must retain the above copyright 9181834Sroberto * notice, this list of conditions and the following disclaimer. 10290001Sglebius * 2. Redistributions in binary form must reproduce the above copyright 11290001Sglebius * notice, this list of conditions and the following disclaimer in the 12290001Sglebius * documentation and/or other materials provided with the distribution. 13290001Sglebius * 3. All advertising materials mentioning features or use of this software 14290001Sglebius * must display the following acknowledgement: 15290001Sglebius * This product includes software developed by the University of 16290001Sglebius * California, Berkeley and its contributors. 17181834Sroberto * 4. Neither the name of the University nor the names of its contributors 18290001Sglebius * may be used to endorse or promote products derived from this software 19290001Sglebius * without specific prior written permission. 20181834Sroberto * 21294905Sdelphij * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22290001Sglebius * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23290001Sglebius * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24290001Sglebius * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25290001Sglebius * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26290001Sglebius * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27290001Sglebius * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28290001Sglebius * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29290001Sglebius * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30290001Sglebius * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31290001Sglebius * SUCH DAMAGE. 32290001Sglebius * 33290001Sglebius * @(#)stdlib.h 8.5 (Berkeley) 5/19/95 34290001Sglebius * $FreeBSD: head/include/stdlib.h 90644 2002-02-14 01:59:47Z imp $ 35290001Sglebius */ 36290001Sglebius 37181834Sroberto#ifndef _STDLIB_H_ 38290001Sglebius#define _STDLIB_H_ 39181834Sroberto 40181834Sroberto#include <sys/cdefs.h> 41181834Sroberto 42181834Sroberto#include <machine/ansi.h> 43181834Sroberto 44181834Sroberto#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 45290001Sglebius#ifdef _BSD_RUNE_T_ 46181834Srobertotypedef _BSD_RUNE_T_ rune_t; 47181834Sroberto#undef _BSD_RUNE_T_ 48181834Sroberto#endif 49290001Sglebius#endif 50181834Sroberto 51181834Sroberto#ifdef _BSD_SIZE_T_ 52181834Srobertotypedef _BSD_SIZE_T_ size_t; 53181834Sroberto#undef _BSD_SIZE_T_ 54181834Sroberto#endif 55181834Sroberto 56290001Sglebius#ifdef _BSD_WCHAR_T_ 57181834Srobertotypedef _BSD_WCHAR_T_ wchar_t; 58181834Sroberto#undef _BSD_WCHAR_T_ 59181834Sroberto#endif 60181834Sroberto 61181834Srobertotypedef struct { 62181834Sroberto int quot; /* quotient */ 63290001Sglebius int rem; /* remainder */ 64290001Sglebius} div_t; 65181834Sroberto 66181834Srobertotypedef struct { 67290001Sglebius long quot; /* quotient */ 68290001Sglebius long rem; /* remainder */ 69290001Sglebius} ldiv_t; 70290001Sglebius 71290001Sglebius#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 72290001Sglebius#ifdef __LONG_LONG_SUPPORTED 73290001Sglebiustypedef struct { 74290001Sglebius long long quot; 75290001Sglebius long long rem; 76298770Sdelphij} lldiv_t; 77298770Sdelphij#endif 78298770Sdelphij#endif 79298770Sdelphij 80298770Sdelphij#ifndef NULL 81298770Sdelphij#define NULL 0 82298770Sdelphij#endif 83181834Sroberto 84290001Sglebius#define EXIT_FAILURE 1 85298770Sdelphij#define EXIT_SUCCESS 0 86290001Sglebius 87310419Sdelphij#define RAND_MAX 0x7fffffff 88290001Sglebius 89310419Sdelphijextern int __mb_cur_max; 90181834Sroberto#define MB_CUR_MAX __mb_cur_max 91290001Sglebius 92181834Sroberto__BEGIN_DECLS 93181834Srobertovoid abort __P((void)) __dead2; 94290001Sglebiusint abs __P((int)) __pure2; 95181834Srobertoint atexit __P((void (*)(void))); 96181834Srobertodouble atof __P((const char *)); 97290001Sglebiusint atoi __P((const char *)); 98181834Srobertolong atol __P((const char *)); 99290001Sglebiusvoid *bsearch __P((const void *, const void *, size_t, 100181834Sroberto size_t, int (*)(const void *, const void *))); 101290001Sglebiusvoid *calloc __P((size_t, size_t)); 102290001Sglebiusdiv_t div __P((int, int)) __pure2; 103290001Sglebiusvoid exit __P((int)) __dead2; 104290001Sglebiusvoid free __P((void *)); 105181834Srobertochar *getenv __P((const char *)); 106290001Sglebiuslong labs __P((long)) __pure2; 107181834Srobertoldiv_t ldiv __P((long, long)) __pure2; 108290001Sglebiusvoid *malloc __P((size_t)); 109181834Srobertovoid qsort __P((void *, size_t, size_t, 110290001Sglebius int (*)(const void *, const void *))); 111181834Srobertoint rand __P((void)); 112290001Sglebiusvoid *realloc __P((void *, size_t)); 113181834Srobertovoid srand __P((unsigned)); 114290001Sglebiusdouble strtod __P((const char *, char **)); 115290001Sglebiuslong strtol __P((const char *, char **, int)); 116181834Srobertounsigned long 117290001Sglebius strtoul __P((const char *, char **, int)); 118290001Sglebiusint system __P((const char *)); 119181834Sroberto 120290001Sglebiusint mblen __P((const char *, size_t)); 121181834Srobertosize_t mbstowcs __P((wchar_t *, const char *, size_t)); 122181834Srobertoint wctomb __P((char *, wchar_t)); 123290001Sglebiusint mbtowc __P((wchar_t *, const char *, size_t)); 124181834Srobertosize_t wcstombs __P((char *, const wchar_t *, size_t)); 125181834Sroberto 126290001Sglebius#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 127290001Sglebiusextern char *_malloc_options; 128290001Sglebiusextern void (*_malloc_message)__P((char *p1, char *p2, char *p3, char *p4)); 129290001Sglebius 130290001Sglebiusint putenv __P((const char *)); 131290001Sglebiusint setenv __P((const char *, const char *, int)); 132290001Sglebius 133290001Sglebiusdouble drand48 __P((void)); 134290001Sglebiusdouble erand48 __P((unsigned short[3])); 135290001Sglebiuslong jrand48 __P((unsigned short[3])); 136290001Sglebiusvoid lcong48 __P((unsigned short[7])); 137290001Sglebiuslong lrand48 __P((void)); 138290001Sglebiuslong mrand48 __P((void)); 139181834Srobertolong nrand48 __P((unsigned short[3])); 140181834Srobertounsigned short 141181834Sroberto *seed48 __P((unsigned short[3])); 142181834Srobertovoid srand48 __P((long)); 143181834Sroberto 144181834Srobertovoid *alloca __P((size_t)); /* built-in for gcc */ 145181834Sroberto /* getcap(3) functions */ 146181834Sroberto__uint32_t 147181834Sroberto arc4random __P((void)); 148181834Srobertovoid arc4random_addrandom __P((unsigned char *dat, int datlen)); 149181834Srobertovoid arc4random_stir __P((void)); 150181834Sroberto#ifdef __LONG_LONG_SUPPORTED 151181834Srobertolong long 152181834Sroberto atoll __P((const char *)); 153181834Sroberto#endif 154181834Srobertochar *getbsize __P((int *, long *)); 155181834Srobertochar *cgetcap __P((char *, char *, int)); 156181834Srobertoint cgetclose __P((void)); 157181834Srobertoint cgetent __P((char **, char **, char *)); 158181834Srobertoint cgetfirst __P((char **, char **)); 159181834Srobertoint cgetmatch __P((char *, char *)); 160181834Srobertoint cgetnext __P((char **, char **)); 161181834Srobertoint cgetnum __P((char *, char *, long *)); 162181834Srobertoint cgetset __P((char *)); 163181834Srobertoint cgetstr __P((char *, char *, char **)); 164181834Srobertoint cgetustr __P((char *, char *, char **)); 165181834Sroberto 166181834Srobertoint daemon __P((int, int)); 167181834Srobertochar *devname __P((int, int)); 168181834Srobertoint getloadavg __P((double [], int)); 169181834Sroberto__const char * 170290001Sglebius getprogname __P((void)); 171290001Sglebius 172290001Sglebiusint heapsort __P((void *, size_t, size_t, 173290001Sglebius int (*)(const void *, const void *))); 174290001Sglebiuschar *initstate __P((unsigned long, char *, long)); 175290001Sglebius#ifdef __LONG_LONG_SUPPORTED 176290001Sglebiuslong long 177290001Sglebius llabs __P((long long)) __pure2; 178298770Sdelphijlldiv_t lldiv __P((long long, long long)) __pure2; 179298770Sdelphij#endif 180298770Sdelphijint mergesort __P((void *, size_t, size_t, 181298770Sdelphij int (*)(const void *, const void *))); 182290001Sglebiusint radixsort __P((const unsigned char **, int, const unsigned char *, 183290001Sglebius unsigned)); 184290001Sglebiusint sradixsort __P((const unsigned char **, int, const unsigned char *, 185290001Sglebius unsigned)); 186181834Srobertoint rand_r __P((unsigned *)); 187181834Srobertolong random __P((void)); 188181834Srobertovoid *reallocf __P((void *, size_t)); 189181834Srobertochar *realpath __P((const char *, char resolved_path[])); 190181834Srobertovoid setprogname __P((const char *)); 191181834Srobertochar *setstate __P((char *)); 192181834Srobertovoid sranddev __P((void)); 193181834Srobertovoid srandom __P((unsigned long)); 194290001Sglebiusvoid srandomdev __P((void)); 195290001Sglebius#ifdef __LONG_LONG_SUPPORTED 196298770Sdelphijlong long 197290001Sglebius strtoll __P((const char *, char **, int)); 198181834Sroberto#endif 199181834Sroberto__int64_t strtoq __P((const char *, char **, int)); 200290001Sglebius#ifdef __LONG_LONG_SUPPORTED 201181834Srobertounsigned long long 202290001Sglebius strtoull __P((const char *, char **, int)); 203181834Sroberto#endif 204181834Sroberto__uint64_t 205181834Sroberto strtouq __P((const char *, char **, int)); 206181834Srobertovoid unsetenv __P((const char *)); 207181834Sroberto#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ 208181834Sroberto__END_DECLS 209290001Sglebius 210290001Sglebius#endif /* !_STDLIB_H_ */ 211181834Sroberto