initial check-in, version 0.5.0
[musl] / include / stdlib.h
1 #ifndef _STDLIB_H
2 #define _STDLIB_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #undef NULL
9 #ifdef __cplusplus
10 #define NULL 0
11 #else
12 #define NULL ((void*)0)
13 #endif
14
15 #define __NEED_size_t
16 #define __NEED_wchar_t
17
18 #include <bits/alltypes.h>
19
20 int atoi (const char *);
21 long atol (const char *);
22 long long atoll (const char *);
23 double atof (const char *);
24
25 float strtof (const char *, char **);
26 double strtod (const char *, char **);
27 long double strtold (const char *, char **);
28
29 long strtol (const char *, char **, int);
30 unsigned long strtoul (const char *, char **, int);
31
32 long long strtoll (const char *, char **, int);
33 unsigned long long strtoull (const char *, char **, int);
34
35 char *l64a (long);
36 long a64l (const char *);
37
38 long int random (void);
39 void srandom (unsigned int);
40 char *initstate (unsigned int, char *, size_t);
41 char *setstate (char *);
42
43 int rand (void);
44 void srand (unsigned);
45 int rand_r (unsigned *);
46
47 double drand48 (void);
48 double erand48 (unsigned short [3]);
49 long int lrand48 (void);
50 long int nrand48 (unsigned short [3]);
51 long mrand48 (void);
52 long jrand48 (unsigned short [3]);
53 void srand48 (long);
54 unsigned short *seed48 (unsigned short [3]);
55 void lcong48 (unsigned short [7]);
56
57 void *malloc (size_t);
58 void *calloc (size_t, size_t);
59 void *realloc (void *, size_t);
60 void free (void *);
61 void *valloc (size_t);
62 int posix_memalign (void **, size_t, size_t);
63
64 void abort (void);
65 int atexit (void (*) (void));
66 void exit (int);
67 void _Exit (int);
68
69
70 char *getenv (const char *);
71 int putenv (char *);
72 int setenv (const char *, const char *, int);
73 int unsetenv (const char *);
74
75
76 char *mktemp (char *);
77 int mkstemp (char *);
78
79 int system (const char *);
80
81
82 char *realpath (const char *, char *);
83
84 void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
85 void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
86
87 int abs (int);
88 long labs (long);
89 long long llabs (long long);
90
91 typedef struct { int quot, rem; } div_t;
92 extern div_t div (int, int);
93
94 typedef struct { long quot, rem; } ldiv_t;
95 ldiv_t ldiv (long, long);
96
97 typedef struct { long long quot, rem; } lldiv_t;
98 lldiv_t lldiv (long long, long long);
99
100
101 int mblen (const char *, size_t);
102 int mbtowc (wchar_t *, const char *, size_t);
103 int wctomb (char *, wchar_t);
104 size_t mbstowcs (wchar_t *, const char *, size_t);
105 size_t wcstombs (char *, const wchar_t *, size_t);
106
107 int getsubopt (char **, char *const *, char **);
108
109 void setkey (const char *);
110
111 int posix_openpt (int);
112 int grantpt (int);
113 int unlockpt (int);
114 char *ptsname (int);
115
116 #define MB_CUR_MAX 4
117
118 #define RAND_MAX (0x7fffffff)
119
120 #define EXIT_FAILURE 1
121 #define EXIT_SUCCESS 0
122
123 #include <bits/wexitstatus.h>
124
125 #ifdef __cplusplus
126 }
127 #endif
128
129 #endif