stdlib.h revision 55031
11539Srgrimes/*- 21539Srgrimes * Copyright (c) 1990, 1993 31539Srgrimes * The Regents of the University of California. All rights reserved. 41539Srgrimes * 51539Srgrimes * Redistribution and use in source and binary forms, with or without 61539Srgrimes * modification, are permitted provided that the following conditions 71539Srgrimes * are met: 81539Srgrimes * 1. Redistributions of source code must retain the above copyright 91539Srgrimes * notice, this list of conditions and the following disclaimer. 101539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111539Srgrimes * notice, this list of conditions and the following disclaimer in the 121539Srgrimes * documentation and/or other materials provided with the distribution. 131539Srgrimes * 3. All advertising materials mentioning features or use of this software 141539Srgrimes * must display the following acknowledgement: 151539Srgrimes * This product includes software developed by the University of 161539Srgrimes * California, Berkeley and its contributors. 171539Srgrimes * 4. Neither the name of the University nor the names of its contributors 181539Srgrimes * may be used to endorse or promote products derived from this software 191539Srgrimes * without specific prior written permission. 201539Srgrimes * 211539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241539Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311539Srgrimes * SUCH DAMAGE. 321539Srgrimes * 3323657Speter * @(#)stdlib.h 8.5 (Berkeley) 5/19/95 3455031Sbde * $FreeBSD: head/include/stdlib.h 55031 1999-12-23 15:58:20Z bde $ 351539Srgrimes */ 361539Srgrimes 371539Srgrimes#ifndef _STDLIB_H_ 387865Sbde#define _STDLIB_H_ 391539Srgrimes 4033861Sbde#include <sys/cdefs.h> 4133861Sbde 421539Srgrimes#include <machine/ansi.h> 4326636Sache 4426636Sache#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 4515483Sbde#ifdef _BSD_RUNE_T_ 4615483Sbdetypedef _BSD_RUNE_T_ rune_t; 4715483Sbde#undef _BSD_RUNE_T_ 4815483Sbde#endif 4915483Sbde#endif 5015483Sbde 511539Srgrimes#ifdef _BSD_SIZE_T_ 521539Srgrimestypedef _BSD_SIZE_T_ size_t; 531539Srgrimes#undef _BSD_SIZE_T_ 541539Srgrimes#endif 551539Srgrimes 561539Srgrimes#ifdef _BSD_WCHAR_T_ 571539Srgrimestypedef _BSD_WCHAR_T_ wchar_t; 581539Srgrimes#undef _BSD_WCHAR_T_ 591539Srgrimes#endif 601539Srgrimes 611539Srgrimestypedef struct { 621539Srgrimes int quot; /* quotient */ 631539Srgrimes int rem; /* remainder */ 641539Srgrimes} div_t; 651539Srgrimes 661539Srgrimestypedef struct { 671539Srgrimes long quot; /* quotient */ 681539Srgrimes long rem; /* remainder */ 691539Srgrimes} ldiv_t; 701539Srgrimes 711539Srgrimes#ifndef NULL 721539Srgrimes#define NULL 0 731539Srgrimes#endif 741539Srgrimes 751539Srgrimes#define EXIT_FAILURE 1 761539Srgrimes#define EXIT_SUCCESS 0 771539Srgrimes 781539Srgrimes#define RAND_MAX 0x7fffffff 791539Srgrimes 801539Srgrimesextern int __mb_cur_max; 811539Srgrimes#define MB_CUR_MAX __mb_cur_max 821539Srgrimes 831539Srgrimes__BEGIN_DECLS 8418286Sbdevoid abort __P((void)) __dead2; 8518286Sbdeint abs __P((int)) __pure2; 861539Srgrimesint atexit __P((void (*)(void))); 871539Srgrimesdouble atof __P((const char *)); 881539Srgrimesint atoi __P((const char *)); 891539Srgrimeslong atol __P((const char *)); 901539Srgrimesvoid *bsearch __P((const void *, const void *, size_t, 911539Srgrimes size_t, int (*)(const void *, const void *))); 921539Srgrimesvoid *calloc __P((size_t, size_t)); 9318286Sbdediv_t div __P((int, int)) __pure2; 9418286Sbdevoid exit __P((int)) __dead2; 951539Srgrimesvoid free __P((void *)); 961539Srgrimeschar *getenv __P((const char *)); 9718286Sbdelong labs __P((long)) __pure2; 9818286Sbdeldiv_t ldiv __P((long, long)) __pure2; 991539Srgrimesvoid *malloc __P((size_t)); 1001539Srgrimesvoid qsort __P((void *, size_t, size_t, 1011539Srgrimes int (*)(const void *, const void *))); 1021539Srgrimesint rand __P((void)); 1031539Srgrimesvoid *realloc __P((void *, size_t)); 1041539Srgrimesvoid srand __P((unsigned)); 1051539Srgrimesdouble strtod __P((const char *, char **)); 1061539Srgrimeslong strtol __P((const char *, char **, int)); 1071539Srgrimesunsigned long 1081539Srgrimes strtoul __P((const char *, char **, int)); 1091539Srgrimesint system __P((const char *)); 1101539Srgrimes 1111539Srgrimesint mblen __P((const char *, size_t)); 1121539Srgrimessize_t mbstowcs __P((wchar_t *, const char *, size_t)); 1131539Srgrimesint wctomb __P((char *, wchar_t)); 1141539Srgrimesint mbtowc __P((wchar_t *, const char *, size_t)); 1151539Srgrimessize_t wcstombs __P((char *, const wchar_t *, size_t)); 1161539Srgrimes 1177865Sbde#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 1181539Srgrimesint putenv __P((const char *)); 1191539Srgrimesint setenv __P((const char *, const char *, int)); 1201539Srgrimes 1217865Sbdedouble drand48 __P((void)); 1227865Sbdedouble erand48 __P((unsigned short[3])); 1237865Sbdelong jrand48 __P((unsigned short[3])); 1247865Sbdevoid lcong48 __P((unsigned short[7])); 1257865Sbdelong lrand48 __P((void)); 1267865Sbdelong mrand48 __P((void)); 1277865Sbdelong nrand48 __P((unsigned short[3])); 1287865Sbdeunsigned short 1297865Sbde *seed48 __P((unsigned short[3])); 1307865Sbdevoid srand48 __P((long)); 1314749Sats 1321539Srgrimesvoid *alloca __P((size_t)); /* built-in for gcc */ 1331539Srgrimes /* getcap(3) functions */ 13441927Sdt__uint32_t 13526630Sache arc4random __P((void)); 13626636Sachevoid arc4random_addrandom __P((unsigned char *dat, int datlen)); 13726630Sachevoid arc4random_stir __P((void)); 1381539Srgrimeschar *getbsize __P((int *, long *)); 1391539Srgrimeschar *cgetcap __P((char *, char *, int)); 1401539Srgrimesint cgetclose __P((void)); 1411539Srgrimesint cgetent __P((char **, char **, char *)); 1421539Srgrimesint cgetfirst __P((char **, char **)); 1431539Srgrimesint cgetmatch __P((char *, char *)); 1441539Srgrimesint cgetnext __P((char **, char **)); 1451539Srgrimesint cgetnum __P((char *, char *, long *)); 1461539Srgrimesint cgetset __P((char *)); 1471539Srgrimesint cgetstr __P((char *, char *, char **)); 1481539Srgrimesint cgetustr __P((char *, char *, char **)); 1491539Srgrimes 1501539Srgrimesint daemon __P((int, int)); 1511539Srgrimeschar *devname __P((int, int)); 1521539Srgrimesint getloadavg __P((double [], int)); 1531539Srgrimes 1541539Srgrimeschar *group_from_gid __P((unsigned long, int)); 1551539Srgrimesint heapsort __P((void *, size_t, size_t, 1561539Srgrimes int (*)(const void *, const void *))); 15723657Speterchar *initstate __P((unsigned long, char *, long)); 1581539Srgrimesint mergesort __P((void *, size_t, size_t, 1591539Srgrimes int (*)(const void *, const void *))); 1601539Srgrimesint radixsort __P((const unsigned char **, int, const unsigned char *, 1611539Srgrimes unsigned)); 1621539Srgrimesint sradixsort __P((const unsigned char **, int, const unsigned char *, 1631539Srgrimes unsigned)); 16455031Sbdeint rand_r __P((unsigned *)); 1651539Srgrimeslong random __P((void)); 16639191Simpvoid *reallocf __P((void *, size_t)); 1671539Srgrimeschar *realpath __P((const char *, char resolved_path[])); 1681539Srgrimeschar *setstate __P((char *)); 16923657Spetervoid srandom __P((unsigned long)); 17026624Sachevoid srandomdev __P((void)); 1711539Srgrimeschar *user_from_uid __P((unsigned long, int)); 1721539Srgrimes#ifndef __STRICT_ANSI__ 17341927Sdt__int64_t strtoq __P((const char *, char **, int)); 17441927Sdt__uint64_t 1751539Srgrimes strtouq __P((const char *, char **, int)); 1761539Srgrimes#endif 1771539Srgrimesvoid unsetenv __P((const char *)); 1787865Sbde#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ 1791539Srgrimes__END_DECLS 1801539Srgrimes 1817865Sbde#endif /* !_STDLIB_H_ */ 182