5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
8 Desc: ANSI-C header file stdlib.h
12 #include <sys/cdefs.h>
13 #include <sys/arosc.h>
15 /* It seems that also stdlib.h defines alloca() */
18 /* For wchar_t and size_t */
21 /* Types for div and ldiv */
22 typedef struct div_t {
27 typedef struct ldiv_t {
32 #if defined AROS_HAVE_LONG_LONG
33 typedef struct lldiv_t
{
43 #define EXIT_SUCCESS 0 /* Success exit status */
44 #define EXIT_FAILURE 20 /* Failing exit status */
46 /* Gives the largest size of a multibyte character for the current locale */
47 #define MB_CUR_MAX (__get_arosc_userdata()->acud_mb_cur_max)
51 /* String conversion functions */
52 double atof(const char *nptr
);
53 int atoi(const char *nptr
);
54 long int atol(const char *nptr
);
55 #if defined AROS_HAVE_LONG_LONG
56 long long int atoll(const char *nptr
);
59 double strtod(const char * restrict nptr
, char ** restrict endptr
);
60 float strtof(const char * restrict nptr
, char ** restrict endptr
);
61 long double strtold(const char * restrict nptr
, char ** restrict endptr
);
62 long int strtol(const char * restrict nptr
,
63 char ** restrict endptr
,
65 unsigned long int strtoul(const char * restrict nptr
,
66 char ** restrict endptr
,
69 #if defined AROS_HAVE_LONG_LONG
70 long long int strtoll(const char * restrict nptr
,
71 char ** restrict endptr
,
73 unsigned long long int strtoull(const char * restrict nptr
,
74 char ** restrict endptr
,
78 /* Pseudo-random number generation functions */
80 void srand (unsigned int seed
);
82 /* Max. number returned by rand() */
84 # define RAND_MAX 2147483647
87 /* Unix pseudo-random functions */
88 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
91 double erand48(unsigned short int xsubi
[3]);
94 void erand48(unsigned short int xsubi
[3]);
96 long int lrand48(void);
97 long int nrand48(unsigned short int xsubi
[3]);
98 long int mrand48(void);
99 long int jrand48(unsigned short int xsubi
[3]);
100 void srand48(long int seedval
);
101 unsigned short int *seed48(unsigned short int seed16v
[3]);
102 void lcong48(unsigned short int param
[7]);
104 /* Thread safe random */
105 int rand_r(unsigned int *);
108 void srandom(unsigned seed
);
109 char *initstate(unsigned seed
, char *state
, int n
);
110 char *setstate(char *state
);
111 #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
113 /* Memory management functions */
114 void *malloc(size_t size
);
115 void *calloc(size_t count
, size_t size
);
116 void *realloc(void *oldmem
, size_t newsize
);
117 void *realloc_nocopy(void *oldmem
, size_t newsize
); /* AROS specific */
118 void free(void *memory
);
120 /* Communication with the environment */
121 void abort (void) __noreturn
;
122 int atexit(void (*func
)(void));
123 int on_exit(void (*func
)(int, void *), void *);
124 void exit (int code
) __noreturn
;
125 int system(const char *string
);
126 char *getenv(const char *name
);
128 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
129 int putenv(const char *string
);
130 int setenv(const char *name
, const char *value
, int overwrite
);
131 void unsetenv(const char *name
);
134 /* Searching and sorting utilities */
135 void qsort(void * array
, size_t count
, size_t elementsize
,
136 int (*comparefunction
)(const void * element1
, const void * element2
));
137 void *bsearch(const void * key
, const void * base
, size_t count
,
138 size_t size
, int (*comparefunction
)(const void *, const void *));
140 /* Integer arithmetic functions */
143 #if defined AROS_HAVE_LONG_LONG
144 long long int llabs(long long int j
);
147 div_t div(int numer
, int denom
);
148 ldiv_t ldiv(long int numer
, long int denom
);
149 #if defined AROS_HAVE_LONG_LONG
150 lldiv_t
lldiv(long long int numer
, long long int denom
);
153 /* Multibyte character functions */
154 size_t mblen(const char *s
, size_t n
);
155 int mbtowc(wchar_t * restrict pwc
, const char * restrict s
, size_t n
);
156 int wctomb(char *s
, wchar_t wchar
);
158 /* Multibyte string functions */
159 size_t mbstowcs(wchar_t * restrict pwcs
, const char * restrict s
, size_t n
);
160 size_t wcstombs(char * restrict s
, const wchar_t * restrict pwcs
, size_t n
);
162 /* Miscellaneous BSD functions */
163 int getloadavg(double loadavg
[], int n
);
165 /* The following are POSIX/SUS additions */
166 #if !defined(_ANSI_SOURCE)
167 long a64l(const char *);
168 #if 0 /* FIXME: not implemented */
169 char *ecvt(double, int, int *, int *);
170 char *fcvt (double, int, int *, int *);
172 char *gcvt(double, int, char *);
173 int getsubopt(char **, char *const *, char **);
176 char *mktemp(char *);
179 char *realpath(const char *, char *);
180 void setkey(const char *);
182 #endif /* _ANSI_SOURCE */
186 #endif /* _STDLIB_H_ */