stdlib.h revision 24152
1238104Sdes/*- 2238104Sdes * Copyright (c) 1990, 1993 3238104Sdes * The Regents of the University of California. All rights reserved. 4238104Sdes * 5238104Sdes * Redistribution and use in source and binary forms, with or without 6238104Sdes * modification, are permitted provided that the following conditions 7238104Sdes * are met: 8238104Sdes * 1. Redistributions of source code must retain the above copyright 9238104Sdes * notice, this list of conditions and the following disclaimer. 10238104Sdes * 2. Redistributions in binary form must reproduce the above copyright 11238104Sdes * notice, this list of conditions and the following disclaimer in the 12238104Sdes * documentation and/or other materials provided with the distribution. 13238104Sdes * 3. All advertising materials mentioning features or use of this software 14238104Sdes * must display the following acknowledgement: 15238104Sdes * This product includes software developed by the University of 16238104Sdes * California, Berkeley and its contributors. 17238104Sdes * 4. Neither the name of the University nor the names of its contributors 18238104Sdes * may be used to endorse or promote products derived from this software 19238104Sdes * without specific prior written permission. 20238104Sdes * 21238104Sdes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22238104Sdes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23238104Sdes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24238104Sdes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25238104Sdes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26238104Sdes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27238104Sdes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28238104Sdes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29238104Sdes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30238104Sdes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31238104Sdes * SUCH DAMAGE. 32238104Sdes * 33238104Sdes * @(#)stdlib.h 8.5 (Berkeley) 5/19/95 34238104Sdes */ 35238104Sdes 36238104Sdes#ifndef _STDLIB_H_ 37238104Sdes#define _STDLIB_H_ 38238104Sdes 39238104Sdes#include <machine/ansi.h> 40238104Sdes 41238104Sdes#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 42238104Sdes#ifdef _BSD_RUNE_T_ 43238104Sdestypedef _BSD_RUNE_T_ rune_t; 44238104Sdes#undef _BSD_RUNE_T_ 45238104Sdes#endif 46238104Sdes#endif 47238104Sdes 48238104Sdes#ifdef _BSD_SIZE_T_ 49238104Sdestypedef _BSD_SIZE_T_ size_t; 50238104Sdes#undef _BSD_SIZE_T_ 51238104Sdes#endif 52238104Sdes 53238104Sdes#ifdef _BSD_WCHAR_T_ 54238104Sdestypedef _BSD_WCHAR_T_ wchar_t; 55238104Sdes#undef _BSD_WCHAR_T_ 56238104Sdes#endif 57238104Sdes 58238104Sdestypedef struct { 59238104Sdes int quot; /* quotient */ 60238104Sdes int rem; /* remainder */ 61238104Sdes} div_t; 62238104Sdes 63238104Sdestypedef struct { 64238104Sdes long quot; /* quotient */ 65238104Sdes long rem; /* remainder */ 66238104Sdes} ldiv_t; 67238104Sdes 68238104Sdes#ifndef NULL 69238104Sdes#define NULL 0 70238104Sdes#endif 71238104Sdes 72238104Sdes#define EXIT_FAILURE 1 73238104Sdes#define EXIT_SUCCESS 0 74238104Sdes 75238104Sdes#define RAND_MAX 0x7fffffff 76238104Sdes 77238104Sdesextern int __mb_cur_max; 78238104Sdes#define MB_CUR_MAX __mb_cur_max 79238104Sdes 80238104Sdes#include <sys/cdefs.h> 81238104Sdes 82238104Sdes__BEGIN_DECLS 83238104Sdesvoid abort __P((void)) __dead2; 84238104Sdesint abs __P((int)) __pure2; 85238104Sdesint atexit __P((void (*)(void))); 86238104Sdesdouble atof __P((const char *)); 87238104Sdesint atoi __P((const char *)); 88238104Sdeslong atol __P((const char *)); 89238104Sdesvoid *bsearch __P((const void *, const void *, size_t, 90238104Sdes size_t, int (*)(const void *, const void *))); 91238104Sdesvoid *calloc __P((size_t, size_t)); 92238104Sdesdiv_t div __P((int, int)) __pure2; 93238104Sdesvoid exit __P((int)) __dead2; 94238104Sdesvoid free __P((void *)); 95238104Sdeschar *getenv __P((const char *)); 96238104Sdeslong labs __P((long)) __pure2; 97238104Sdesldiv_t ldiv __P((long, long)) __pure2; 98238104Sdesvoid *malloc __P((size_t)); 99238104Sdesvoid qsort __P((void *, size_t, size_t, 100238104Sdes int (*)(const void *, const void *))); 101238104Sdesint rand __P((void)); 102238104Sdesvoid *realloc __P((void *, size_t)); 103238104Sdesvoid srand __P((unsigned)); 104238104Sdesdouble strtod __P((const char *, char **)); 105238104Sdeslong strtol __P((const char *, char **, int)); 106238104Sdesunsigned long 107238104Sdes strtoul __P((const char *, char **, int)); 108238104Sdesint system __P((const char *)); 109238104Sdes 110238104Sdesint mblen __P((const char *, size_t)); 111238104Sdessize_t mbstowcs __P((wchar_t *, const char *, size_t)); 112238104Sdesint wctomb __P((char *, wchar_t)); 113238104Sdesint mbtowc __P((wchar_t *, const char *, size_t)); 114238104Sdessize_t wcstombs __P((char *, const wchar_t *, size_t)); 115238104Sdes 116238104Sdes#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 117238104Sdesint putenv __P((const char *)); 118238104Sdesint setenv __P((const char *, const char *, int)); 119238104Sdes 120238104Sdesdouble drand48 __P((void)); 121238104Sdesdouble erand48 __P((unsigned short[3])); 122238104Sdeslong jrand48 __P((unsigned short[3])); 123238104Sdesvoid lcong48 __P((unsigned short[7])); 124238104Sdeslong lrand48 __P((void)); 125238104Sdeslong mrand48 __P((void)); 126238104Sdeslong nrand48 __P((unsigned short[3])); 127238104Sdesunsigned short 128238104Sdes *seed48 __P((unsigned short[3])); 129238104Sdesvoid srand48 __P((long)); 130238104Sdes 131238104Sdesvoid *alloca __P((size_t)); /* built-in for gcc */ 132238104Sdes /* getcap(3) functions */ 133238104Sdeschar *getbsize __P((int *, long *)); 134238104Sdeschar *cgetcap __P((char *, char *, int)); 135238104Sdesint cgetclose __P((void)); 136238104Sdesint cgetent __P((char **, char **, char *)); 137238104Sdesint cgetfirst __P((char **, char **)); 138238104Sdesint cgetmatch __P((char *, char *)); 139238104Sdesint cgetnext __P((char **, char **)); 140238104Sdesint cgetnum __P((char *, char *, long *)); 141238104Sdesint cgetset __P((char *)); 142238104Sdesint cgetstr __P((char *, char *, char **)); 143238104Sdesint cgetustr __P((char *, char *, char **)); 144238104Sdes 145238104Sdesint daemon __P((int, int)); 146238104Sdeschar *devname __P((int, int)); 147238104Sdesint getloadavg __P((double [], int)); 148238104Sdes 149238104Sdeschar *group_from_gid __P((unsigned long, int)); 150238104Sdesint heapsort __P((void *, size_t, size_t, 151238104Sdes int (*)(const void *, const void *))); 152238104Sdeschar *initstate __P((unsigned long, char *, long)); 153238104Sdesint mergesort __P((void *, size_t, size_t, 154238104Sdes int (*)(const void *, const void *))); 155238104Sdesint radixsort __P((const unsigned char **, int, const unsigned char *, 156238104Sdes unsigned)); 157238104Sdesint sradixsort __P((const unsigned char **, int, const unsigned char *, 158238104Sdes unsigned)); 159238104Sdeslong random __P((void)); 160238104Sdeschar *realpath __P((const char *, char resolved_path[])); 161238104Sdeschar *setstate __P((char *)); 162238104Sdesvoid srandom __P((unsigned long)); 163238104Sdesint srandomdev __P((void)); 164238104Sdeschar *user_from_uid __P((unsigned long, int)); 165238104Sdes#ifndef __STRICT_ANSI__ 166238104Sdeslong long 167238104Sdes strtoq __P((const char *, char **, int)); 168238104Sdesunsigned long long 169238104Sdes strtouq __P((const char *, char **, int)); 170238104Sdes#endif 171238104Sdesvoid unsetenv __P((const char *)); 172238104Sdes#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ 173238104Sdes__END_DECLS 174238104Sdes 175238104Sdes#endif /* !_STDLIB_H_ */ 176238104Sdes