]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/stdlib.h
This commit was generated by cvs2svn to compensate for changes in r95978,
[FreeBSD/FreeBSD.git] / include / stdlib.h
1 /*-
2  * Copyright (c) 1990, 1993
3  *      The Regents of the University of California.  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    8.5 (Berkeley) 5/19/95
34  * $FreeBSD$
35  */
36
37 #ifndef _STDLIB_H_
38 #define _STDLIB_H_
39
40 #include <sys/cdefs.h>
41
42 #include <machine/ansi.h>
43
44 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
45 #ifdef  _BSD_RUNE_T_
46 typedef _BSD_RUNE_T_    rune_t;
47 #undef  _BSD_RUNE_T_
48 #endif
49 #endif
50
51 #ifdef  _BSD_SIZE_T_
52 typedef _BSD_SIZE_T_    size_t;
53 #undef  _BSD_SIZE_T_
54 #endif
55
56 #ifdef  _BSD_WCHAR_T_
57 typedef _BSD_WCHAR_T_   wchar_t;
58 #undef  _BSD_WCHAR_T_
59 #endif
60
61 typedef struct {
62         int quot;               /* quotient */
63         int rem;                /* remainder */
64 } div_t;
65
66 typedef struct {
67         long quot;              /* quotient */
68         long rem;               /* remainder */
69 } ldiv_t;
70
71 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
72 #ifdef __LONG_LONG_SUPPORTED
73 typedef struct {
74         long long quot;
75         long long rem;
76 } lldiv_t;
77 #endif
78 #endif
79
80 #ifndef NULL
81 #define NULL    0
82 #endif
83
84 #define EXIT_FAILURE    1
85 #define EXIT_SUCCESS    0
86
87 #define RAND_MAX        0x7fffffff
88
89 extern int __mb_cur_max;
90 #define MB_CUR_MAX      __mb_cur_max
91
92 __BEGIN_DECLS
93 void     abort(void) __dead2;
94 int      abs(int) __pure2;
95 int      atexit(void (*)(void));
96 double   atof(const char *);
97 int      atoi(const char *);
98 long     atol(const char *);
99 void    *bsearch(const void *, const void *, size_t,
100             size_t, int (*)(const void *, const void *));
101 void    *calloc(size_t, size_t);
102 div_t    div(int, int) __pure2;
103 void     exit(int) __dead2;
104 void     free(void *);
105 char    *getenv(const char *);
106 long     labs(long) __pure2;
107 ldiv_t   ldiv(long, long) __pure2;
108 void    *malloc(size_t);
109 void     qsort(void *, size_t, size_t,
110             int (*)(const void *, const void *));
111 int      rand(void);
112 void    *realloc(void *, size_t);
113 void     srand(unsigned);
114 double   strtod(const char *, char **);
115 long     strtol(const char *, char **, int);
116 unsigned long
117          strtoul(const char *, char **, int);
118 int      system(const char *);
119
120 int      mblen(const char *, size_t);
121 size_t   mbstowcs(wchar_t *, const char *, size_t);
122 int      wctomb(char *, wchar_t);
123 int      mbtowc(wchar_t *, const char *, size_t);
124 size_t   wcstombs(char *, const wchar_t *, size_t);
125
126 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
127 extern const char *_malloc_options;
128 extern void (*_malloc_message)(char *p1, char *p2, char *p3, char *p4);
129
130 int      putenv(const char *);
131 int      setenv(const char *, const char *, int);
132
133 double   drand48(void);
134 double   erand48(unsigned short[3]);
135 long     jrand48(unsigned short[3]);
136 void     lcong48(unsigned short[7]);
137 long     lrand48(void);
138 long     mrand48(void);
139 long     nrand48(unsigned short[3]);
140 unsigned short
141         *seed48(unsigned short[3]);
142 void     srand48(long);
143
144 void    *alloca(size_t);                /* built-in for gcc */
145                                         /* getcap(3) functions */
146 __uint32_t
147          arc4random(void);
148 void     arc4random_addrandom(unsigned char *dat, int datlen);
149 void     arc4random_stir(void);
150 #ifdef __LONG_LONG_SUPPORTED
151 long long
152          atoll(const char *);
153 #endif
154 char    *getbsize(int *, long *);
155 char    *cgetcap(char *, const char *, int);
156 int      cgetclose(void);
157 int      cgetent(char **, char **, const char *);
158 int      cgetfirst(char **, char **);
159 int      cgetmatch(const char *, const char *);
160 int      cgetnext(char **, char **);
161 int      cgetnum(char *, const char *, long *);
162 int      cgetset(const char *);
163 int      cgetstr(char *, const char *, char **);
164 int      cgetustr(char *, const char *, char **);
165
166 int      daemon(int, int);
167 char    *devname(int, int);
168 int      getloadavg(double [], int);
169 __const char *
170          getprogname(void);
171
172 int      heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
173 char    *initstate(unsigned long, char *, long);
174 #ifdef __LONG_LONG_SUPPORTED
175 long long
176          llabs(long long) __pure2;
177 lldiv_t  lldiv(long long, long long) __pure2;
178 #endif
179 int      mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
180 int      radixsort(const unsigned char **, int, const unsigned char *,
181             unsigned);
182 int      sradixsort(const unsigned char **, int, const unsigned char *,
183             unsigned);
184 int      rand_r(unsigned *);
185 long     random(void);
186 void    *reallocf(void *, size_t);
187 char    *realpath(const char *, char resolved_path[]);
188 void     setprogname(const char *);
189 char    *setstate(char *);
190 void     sranddev(void);
191 void     srandom(unsigned long);
192 void     srandomdev(void);
193 #ifdef __LONG_LONG_SUPPORTED
194 long long        
195          strtoll(const char *, char **, int);
196 #endif
197 __int64_t        strtoq(const char *, char **, int);
198 #ifdef __LONG_LONG_SUPPORTED
199 unsigned long long
200          strtoull(const char *, char **, int);
201 #endif
202 __uint64_t
203          strtouq(const char *, char **, int);
204 void     unsetenv(const char *);
205 #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
206 __END_DECLS
207
208 #endif /* !_STDLIB_H_ */