Annotation of src/include/stdlib.h, Revision 1.12
1.12 ! millert 1: /* $OpenBSD: stdlib.h,v 1.11 1999/11/27 13:20:25 espie Exp $ */
1.2 deraadt 2: /* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */
1.1 deraadt 3:
4: /*-
5: * Copyright (c) 1990 The Regents of the University of California.
6: * All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. All advertising materials mentioning features or use of this software
17: * must display the following acknowledgement:
18: * This product includes software developed by the University of
19: * California, Berkeley and its contributors.
20: * 4. Neither the name of the University nor the names of its contributors
21: * may be used to endorse or promote products derived from this software
22: * without specific prior written permission.
23: *
24: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34: * SUCH DAMAGE.
35: *
36: * @(#)stdlib.h 5.13 (Berkeley) 6/4/91
37: */
38:
39: #ifndef _STDLIB_H_
40: #define _STDLIB_H_
41: #include <machine/ansi.h>
42:
43: #if !defined(_ANSI_SOURCE) /* for quad_t, etc. */
44: #include <sys/types.h>
45: #endif
46:
47: #ifdef _BSD_SIZE_T_
48: typedef _BSD_SIZE_T_ size_t;
49: #undef _BSD_SIZE_T_
50: #endif
51:
52: #ifdef _BSD_WCHAR_T_
1.11 espie 53: /* in C++, wchar_t is a built-in type */
54: #ifndef __cplusplus
1.1 deraadt 55: typedef _BSD_WCHAR_T_ wchar_t;
1.11 espie 56: #endif
1.1 deraadt 57: #undef _BSD_WCHAR_T_
58: #endif
59:
60: typedef struct {
61: int quot; /* quotient */
62: int rem; /* remainder */
63: } div_t;
64:
65: typedef struct {
66: long quot; /* quotient */
67: long rem; /* remainder */
68: } ldiv_t;
69:
70: #if !defined(_ANSI_SOURCE)
71: typedef struct {
72: quad_t quot; /* quotient */
73: quad_t rem; /* remainder */
74: } qdiv_t;
75: #endif
76:
77:
78: #ifndef NULL
1.10 espie 79: #ifdef __GNUG__
80: #define NULL __null
81: #else
1.1 deraadt 82: #define NULL 0
1.10 espie 83: #endif
1.1 deraadt 84: #endif
85:
86: #define EXIT_FAILURE 1
87: #define EXIT_SUCCESS 0
88:
89: #define RAND_MAX 0x7fffffff
90:
91: #define MB_CUR_MAX 1 /* XXX */
92:
93: #include <sys/cdefs.h>
94:
95: __BEGIN_DECLS
1.2 deraadt 96: __dead void abort __P((void));
1.1 deraadt 97: int abs __P((int));
98: int atexit __P((void (*)(void)));
99: double atof __P((const char *));
100: int atoi __P((const char *));
101: long atol __P((const char *));
102: void *bsearch __P((const void *, const void *, size_t,
103: size_t, int (*)(const void *, const void *)));
104: void *calloc __P((size_t, size_t));
105: div_t div __P((int, int));
1.2 deraadt 106: __dead void exit __P((int));
1.1 deraadt 107: void free __P((void *));
108: char *getenv __P((const char *));
109: long labs __P((long));
110: ldiv_t ldiv __P((long, long));
111: void *malloc __P((size_t));
112: void qsort __P((void *, size_t, size_t,
113: int (*)(const void *, const void *)));
114: int rand __P((void));
1.8 d 115: int rand_r __P((unsigned int *));
1.1 deraadt 116: void *realloc __P((void *, size_t));
117: void srand __P((unsigned));
118: double strtod __P((const char *, char **));
119: long strtol __P((const char *, char **, int));
120: unsigned long
121: strtoul __P((const char *, char **, int));
122: int system __P((const char *));
123:
124: /* these are currently just stubs */
125: int mblen __P((const char *, size_t));
126: size_t mbstowcs __P((wchar_t *, const char *, size_t));
127: int wctomb __P((char *, wchar_t));
128: int mbtowc __P((wchar_t *, const char *, size_t));
129: size_t wcstombs __P((char *, const wchar_t *, size_t));
130:
131: #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
132: #if defined(alloca) && (alloca == __builtin_alloca) && (__GNUC__ < 2)
133: void *alloca __P((int)); /* built-in for gcc */
134: #else
135: void *alloca __P((size_t));
136: #endif /* __GNUC__ */
137:
138: char *getbsize __P((int *, long *));
1.9 millert 139: char *cgetcap __P((char *, const char *, int));
1.1 deraadt 140: int cgetclose __P((void));
1.9 millert 141: int cgetent __P((char **, char **, const char *));
1.1 deraadt 142: int cgetfirst __P((char **, char **));
1.9 millert 143: int cgetmatch __P((char *, const char *));
1.1 deraadt 144: int cgetnext __P((char **, char **));
1.9 millert 145: int cgetnum __P((char *, const char *, long *));
146: int cgetset __P((const char *));
147: int cgetstr __P((char *, const char *, char **));
148: int cgetustr __P((char *, const char *, char **));
1.1 deraadt 149:
150: int daemon __P((int, int));
151: char *devname __P((int, int));
152: int getloadavg __P((double [], int));
153:
154: long a64l __P((const char *));
155: char *l64a __P((long));
156:
157: void cfree __P((void *));
158:
159: int getopt __P((int, char * const *, const char *));
160: extern char *optarg; /* getopt(3) external variables */
161: extern int opterr;
162: extern int optind;
163: extern int optopt;
164: extern int optreset;
165: int getsubopt __P((char **, char * const *, char **));
166: extern char *suboptarg; /* getsubopt(3) external variable */
167:
168: int heapsort __P((void *, size_t, size_t,
169: int (*)(const void *, const void *)));
170: int mergesort __P((void *, size_t, size_t,
171: int (*)(const void *, const void *)));
172: int radixsort __P((const unsigned char **, int, const unsigned char *,
173: unsigned));
174: int sradixsort __P((const unsigned char **, int, const unsigned char *,
175: unsigned));
176:
1.7 millert 177: char *initstate __P((unsigned int, char *, size_t));
1.1 deraadt 178: long random __P((void));
179: char *realpath __P((const char *, char *));
1.7 millert 180: char *setstate __P((const char *));
181: void srandom __P((unsigned int));
1.12 ! millert 182: void srandomdev __P((void));
1.1 deraadt 183:
184: int putenv __P((const char *));
185: int setenv __P((const char *, const char *, int));
186: void unsetenv __P((const char *));
187: void setproctitle __P((const char *, ...));
188:
189: quad_t qabs __P((quad_t));
190: qdiv_t qdiv __P((quad_t, quad_t));
191: quad_t strtoq __P((const char *, char **, int));
192: u_quad_t strtouq __P((const char *, char **, int));
193:
194: double drand48 __P((void));
195: double erand48 __P((unsigned short[3]));
196: long jrand48 __P((unsigned short[3]));
197: void lcong48 __P((unsigned short[7]));
198: long lrand48 __P((void));
199: long mrand48 __P((void));
200: long nrand48 __P((unsigned short[3]));
201: unsigned short *seed48 __P((unsigned short[3]));
202: void srand48 __P((long));
1.3 dm 203:
204: u_int32_t arc4random __P((void));
205: void arc4random_stir __P((void));
1.5 deraadt 206: void arc4random_addrandom __P((unsigned char *, int));
1.1 deraadt 207: #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
208:
209: __END_DECLS
210:
211: #endif /* _STDLIB_H_ */