>From: Julian Elischer <julian@jules.dialix.oz.au>
[unix-history] / include / stdlib.h
CommitLineData
15637ed4
RG
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)stdlib.h 5.13 (Berkeley) 6/4/91
34 *
35 * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
36 * -------------------- ----- ----------------------
37 * CURRENT PATCH LEVEL: 1 00145
38 * -------------------- ----- ----------------------
39 *
40 * 20 Apr 93 Richard Murphey stddef.h patch for XFree86
41 */
42
43#ifndef _STDLIB_H_
44#define _STDLIB_H_
45#include <sys/types.h>
46
47#ifdef _WCHAR_T_
48typedef _WCHAR_T_ wchar_t;
49#undef _WCHAR_T_
50#endif
51
52typedef struct {
53 int quot; /* quotient */
54 int rem; /* remainder */
55} div_t;
56typedef struct {
57 long quot; /* quotient */
58 long rem; /* remainder */
59} ldiv_t;
60
61#define EXIT_FAILURE 1
62#define EXIT_SUCCESS 0
63
64#define RAND_MAX 0x7fffffff
65
66#define MB_CUR_MAX 1 /* XXX */
67
68#include <sys/cdefs.h>
69
70__BEGIN_DECLS
71void abort __P((void));
72int abs __P((int));
73int atexit __P((void (*)(void)));
74double atof __P((const char *));
75int atoi __P((const char *));
76long atol __P((const char *));
77void *bsearch __P((const void *, const void *, size_t,
78 size_t, int (*)(const void *, const void *)));
79void *calloc __P((size_t, size_t));
80div_t div __P((int, int));
81void exit __P((int));
82void free __P((void *));
83char *getenv __P((const char *));
84long labs __P((long));
85ldiv_t ldiv __P((long, long));
86void *malloc __P((size_t));
87void qsort __P((void *, size_t, size_t,
88 int (*)(const void *, const void *)));
89int rand __P((void));
90void *realloc __P((void *, size_t));
91void srand __P((unsigned));
92double strtod __P((const char *, char **));
93long strtol __P((const char *, char **, int));
94unsigned long
95 strtoul __P((const char *, char **, int));
96int system __P((const char *));
97
98/* these are currently just stubs */
99int mblen __P((const char *, size_t));
100size_t mbstowcs __P((wchar_t *, const char *, size_t));
101int wctomb __P((char *, wchar_t));
102int mbtowc __P((wchar_t *, const char *, size_t));
103size_t wcstombs __P((char *, const wchar_t *, size_t));
104
5f6c1647
PR
105/* don't ask me where to put these -- MB XXX */
106double drand48 __P((void));
107double erand48 __P((unsigned short[3]));
108long lrand48 __P((void));
109long nrand48 __P((unsigned short[3]));
110long mrand48 __P((void));
111long jrand48 __P((unsigned short[3]));
112void srand48 __P((long));
113unsigned short *seed48 __P((unsigned short[3]));
114void lcong48 __P((unsigned short[7]));
115
15637ed4
RG
116#ifndef _ANSI_SOURCE
117void cfree __P((void *));
118int putenv __P((const char *));
119int setenv __P((const char *, const char *, int));
120#endif /* not ANSI */
121
122#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
123#ifndef alloca
124void *alloca __P((size_t));
125#endif
126extern char *optarg; /* getopt(3) external variables */
127extern int optind;
128extern int opterr;
129int getopt __P((int, char * const *, const char *));
130extern char *suboptarg; /* getsubopt(3) external variable */
131int getsubopt __P((char **, char * const *, char **));
132int heapsort __P((void *, size_t, size_t,
133 int (*)(const void *, const void *)));
134char *initstate __P((unsigned, char *, int));
135int radixsort __P((const u_char **, int, const u_char *, u_char));
136long random __P((void));
137char *setstate __P((char *));
138void srandom __P((unsigned));
139void unsetenv __P((const char *));
140#endif /* neither ANSI nor POSIX */
141
142__END_DECLS
143
144#endif /* _STDLIB_H_ */