386BSD 0.1 development
[unix-history] / usr / src / include / stdlib.h
CommitLineData
b2592ddb
WJ
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
36#ifndef _STDLIB_H_
37#define _STDLIB_H_
38#include <sys/types.h>
39
40#ifdef _WCHAR_T_
41typedef _WCHAR_T_ wchar_t;
42#undef _WCHAR_T_
43#endif
44
45typedef struct {
46 int quot; /* quotient */
47 int rem; /* remainder */
48} div_t;
49typedef struct {
50 long quot; /* quotient */
51 long rem; /* remainder */
52} ldiv_t;
53
54#define EXIT_FAILURE 1
55#define EXIT_SUCCESS 0
56
57#define RAND_MAX 0x7fffffff
58
59#define MB_CUR_MAX 1 /* XXX */
60
61#include <sys/cdefs.h>
62
63__BEGIN_DECLS
64void abort __P((void));
65int abs __P((int));
66int atexit __P((void (*)(void)));
67double atof __P((const char *));
68int atoi __P((const char *));
69long atol __P((const char *));
70void *bsearch __P((const void *, const void *, size_t,
71 size_t, int (*)(const void *, const void *)));
72void *calloc __P((size_t, size_t));
73div_t div __P((int, int));
74void exit __P((int));
75void free __P((void *));
76char *getenv __P((const char *));
77long labs __P((long));
78ldiv_t ldiv __P((long, long));
79void *malloc __P((size_t));
80void qsort __P((void *, size_t, size_t,
81 int (*)(const void *, const void *)));
82int rand __P((void));
83void *realloc __P((void *, size_t));
84void srand __P((unsigned));
85double strtod __P((const char *, char **));
86long strtol __P((const char *, char **, int));
87unsigned long
88 strtoul __P((const char *, char **, int));
89int system __P((const char *));
90
91/* these are currently just stubs */
92int mblen __P((const char *, size_t));
93size_t mbstowcs __P((wchar_t *, const char *, size_t));
94int wctomb __P((char *, wchar_t));
95int mbtowc __P((wchar_t *, const char *, size_t));
96size_t wcstombs __P((char *, const wchar_t *, size_t));
97
98#ifndef _ANSI_SOURCE
99void cfree __P((void *));
100int putenv __P((const char *));
101int setenv __P((const char *, const char *, int));
102#endif /* not ANSI */
103
104#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
105void *alloca __P((size_t)); /* built-in for gcc */
106extern char *optarg; /* getopt(3) external variables */
107extern int optind;
108extern int opterr;
109int getopt __P((int, char * const *, const char *));
110extern char *suboptarg; /* getsubopt(3) external variable */
111int getsubopt __P((char **, char * const *, char **));
112int heapsort __P((void *, size_t, size_t,
113 int (*)(const void *, const void *)));
114char *initstate __P((unsigned, char *, int));
115int radixsort __P((const u_char **, int, const u_char *, u_char));
116long random __P((void));
117char *setstate __P((char *));
118void srandom __P((unsigned));
119void unsetenv __P((const char *));
120#endif /* neither ANSI nor POSIX */
121
122__END_DECLS
123
124#endif /* _STDLIB_H_ */