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
);
119 int posix_memalign(void **memptr
, size_t alignment
, size_t size
);
121 /* Communication with the environment */
122 void abort (void) __noreturn
;
123 int atexit(void (*func
)(void));
124 int on_exit(void (*func
)(int, void *), void *);
125 void exit (int code
) __noreturn
;
126 int system(const char *string
);
127 char *getenv(const char *name
);
129 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
130 int putenv(const char *string
);
131 int setenv(const char *name
, const char *value
, int overwrite
);
132 void unsetenv(const char *name
);
135 /* Searching and sorting utilities */
136 void qsort(void * array
, size_t count
, size_t elementsize
,
137 int (*comparefunction
)(const void * element1
, const void * element2
));
138 void *bsearch(const void * key
, const void * base
, size_t count
,
139 size_t size
, int (*comparefunction
)(const void *, const void *));
141 /* Integer arithmetic functions */
144 #if defined AROS_HAVE_LONG_LONG
145 long long int llabs(long long int j
);
148 div_t div(int numer
, int denom
);
149 ldiv_t ldiv(long int numer
, long int denom
);
150 #if defined AROS_HAVE_LONG_LONG
151 lldiv_t
lldiv(long long int numer
, long long int denom
);
154 /* Multibyte character functions */
155 size_t mblen(const char *s
, size_t n
);
156 int mbtowc(wchar_t * restrict pwc
, const char * restrict s
, size_t n
);
157 int wctomb(char *s
, wchar_t wchar
);
159 /* Multibyte string functions */
160 size_t mbstowcs(wchar_t * restrict pwcs
, const char * restrict s
, size_t n
);
161 size_t wcstombs(char * restrict s
, const wchar_t * restrict pwcs
, size_t n
);
163 /* Miscellaneous BSD functions */
164 int getloadavg(double loadavg
[], int n
);
166 /* The following are POSIX/SUS additions */
167 #if !defined(_ANSI_SOURCE)
168 long a64l(const char *);
169 #if 0 /* FIXME: not implemented */
170 char *ecvt(double, int, int *, int *);
171 char *fcvt (double, int, int *, int *);
173 char *gcvt(double, int, char *);
174 int getsubopt(char **, char *const *, char **);
177 char *mktemp(char *);
180 char *realpath(const char *, char *);
181 void setkey(const char *);
183 #endif /* _ANSI_SOURCE */
187 #endif /* _STDLIB_H_ */