Complete Citrus import. Import message catalog implement from
[dragonfly.git] / include / stdlib.h
CommitLineData
984263bc
MD
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: src/include/stdlib.h,v 1.16.2.5 2002/12/13 01:34:00 tjr Exp $
32a7b49a 35 * $DragonFly: src/include/stdlib.h,v 1.10 2005/04/21 16:36:34 joerg Exp $
984263bc
MD
36 */
37
38#ifndef _STDLIB_H_
39#define _STDLIB_H_
40
41#include <sys/cdefs.h>
42
e2565a42
MD
43#ifndef _SYS_STDINT_H_
44#include <sys/stdint.h>
45#endif
984263bc 46
e2565a42 47#ifndef __cplusplus
a81b3ef3
JR
48#ifndef _WCHAR_T_DECLARED
49#define _WCHAR_T_DECLARED
e2565a42 50typedef __wchar_t wchar_t;
984263bc 51#endif
984263bc 52#endif
e2565a42 53
a81b3ef3
JR
54#ifndef _SIZE_T_DECLARED
55#define _SIZE_T_DECLARED
e2565a42 56typedef __size_t size_t;
984263bc
MD
57#endif
58
59typedef struct {
60 int quot; /* quotient */
61 int rem; /* remainder */
62} div_t;
63
64typedef struct {
65 long quot; /* quotient */
66 long rem; /* remainder */
67} ldiv_t;
68
69#ifndef NULL
70#define NULL 0
71#endif
72
73#define EXIT_FAILURE 1
74#define EXIT_SUCCESS 0
75
76#define RAND_MAX 0x7fffffff
77
78extern int __mb_cur_max;
79#define MB_CUR_MAX __mb_cur_max
80
81__BEGIN_DECLS
f0a7d0bb 82void _Exit(int) __dead2;
5baeefc7
JS
83void abort(void) __dead2;
84int abs(int) __pure2;
85int atexit(void (*)(void));
86double atof(const char *);
87int atoi(const char *);
88long atol(const char *);
89void *bsearch(const void *, const void *, size_t,
90 size_t, int (*)(const void *, const void *));
91void *calloc(size_t, size_t);
92div_t div(int, int) __pure2;
93void exit(int) __dead2;
94void free(void *);
95char *getenv(const char *);
96long labs(long) __pure2;
97ldiv_t ldiv(long, long) __pure2;
98void *malloc(size_t);
99void qsort(void *, size_t, size_t, int(*)(const void *, const void *));
100int rand(void);
101void *realloc(void *, size_t);
102void srand(unsigned);
103double strtod(const char *, char **);
104long strtol(const char *, char **, int);
105unsigned long strtoul(const char *, char **, int);
984263bc 106#ifdef __LONG_LONG_SUPPORTED
5baeefc7
JS
107long long strtoll(const char *, char **, int);
108unsigned long long strtoull(const char *, char **, int);
984263bc 109#endif
5baeefc7 110int system(const char *);
984263bc 111
5baeefc7
JS
112int mblen(const char *, size_t);
113size_t mbstowcs(wchar_t *, const char *, size_t);
114int wctomb(char *, wchar_t);
115int mbtowc(wchar_t *, const char *, size_t);
116size_t wcstombs(char *, const wchar_t *, size_t);
984263bc
MD
117
118#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
5baeefc7
JS
119int putenv(const char *);
120int setenv(const char *, const char *, int);
121
122double drand48(void);
123double erand48(unsigned short[3]);
124long jrand48(unsigned short[3]);
125void lcong48(unsigned short[7]);
126long lrand48(void);
127long mrand48(void);
128long nrand48(unsigned short[3]);
129unsigned short *seed48(unsigned short[3]);
130void srand48(long);
131
132void *alloca(size_t); /* built-in for gcc */
984263bc 133 /* getcap(3) functions */
5baeefc7
JS
134__uint32_t arc4random(void);
135void arc4random_addrandom(unsigned char *, int);
136void arc4random_stir(void);
137char *getbsize(int *, long *);
138char *cgetcap(char *, char *, int);
139int cgetclose(void);
140int cgetent(char **, char **, char *);
141int cgetfirst(char **, char **);
142int cgetmatch(char *, char *);
143int cgetnext(char **, char **);
144int cgetnum(char *, char *, long *);
145int cgetset(char *);
146int cgetstr(char *, char *, char **);
147int cgetustr(char *, char *, char **);
148
149int daemon(int, int);
150char *devname(int, int);
151char *devname_r(int, int, char *, size_t);
152int getloadavg(double [], int);
153const char *getprogname(void);
154
155char *group_from_gid(unsigned long, int);
156int heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
157char *initstate(unsigned long, char *, long);
158int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
159int radixsort(const unsigned char **, int, const unsigned char *,
160 unsigned int);
161int sradixsort(const unsigned char **, int, const unsigned char *,
162 unsigned int);
163int rand_r(unsigned *);
164long random(void);
165void *reallocf(void *, size_t);
166char *realpath(const char *, char []);
167void setprogname(const char *);
168char *setstate(char *);
169void srandom(unsigned long);
170void srandomdev(void);
171char *user_from_uid(unsigned long, int);
984263bc 172#ifndef __STRICT_ANSI__
5baeefc7
JS
173__int64_t strtoq(const char *, char **, int);
174__uint64_t strtouq(const char *, char **, int);
70e9d14e
JS
175
176#ifdef __LONG_LONG_SUPPORTED
177unsigned long long strtonum(const char *, long long, unsigned long long,
178 const char **);
179#endif
984263bc 180#endif
5baeefc7 181void unsetenv(const char *);
984263bc
MD
182#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
183__END_DECLS
184
185#endif /* !_STDLIB_H_ */