Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4973 | right-hear | 1 | /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */ |
2 | /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ |
||
3 | /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
||
4 | #ifndef __dj_include_stdlib_h_ |
||
5 | #define __dj_include_stdlib_h_ |
||
6 | |||
7 | #ifdef __cplusplus |
||
8 | extern "C" { |
||
9 | #endif |
||
10 | |||
11 | #ifndef __dj_ENFORCE_ANSI_FREESTANDING |
||
12 | |||
13 | #include |
||
14 | #include |
||
15 | |||
16 | /* Some programs think they know better... */ |
||
17 | #undef NULL |
||
18 | |||
19 | #define EXIT_FAILURE 1 |
||
20 | #define EXIT_SUCCESS 0 |
||
21 | #define MB_CUR_MAX __dj_mb_cur_max |
||
22 | #define NULL 0 |
||
23 | #define RAND_MAX 2147483647 |
||
24 | |||
25 | extern int __dj_mb_cur_max; |
||
26 | |||
27 | typedef struct { |
||
28 | int quot; |
||
29 | int rem; |
||
30 | } div_t; |
||
31 | |||
32 | typedef struct { |
||
33 | long quot; |
||
34 | long rem; |
||
35 | } ldiv_t; |
||
36 | |||
37 | __DJ_size_t |
||
38 | #undef __DJ_size_t |
||
39 | #define __DJ_size_t |
||
40 | __DJ_wchar_t |
||
41 | #undef __DJ_wchar_t |
||
42 | #define __DJ_wchar_t |
||
43 | |||
44 | #ifdef _MSC_VER |
||
45 | void __declspec(noreturn) abort(void); |
||
46 | void __declspec(noreturn) exit(int _status); |
||
47 | #else |
||
48 | void abort(void) __attribute__((noreturn)); |
||
49 | void exit(int _status) __attribute__((noreturn)); |
||
50 | #endif |
||
51 | int abs(int _i); |
||
52 | int atexit(void (*_func)(void)); |
||
53 | double atof(const char *_s); |
||
54 | int atoi(const char *_s); |
||
55 | long atol(const char *_s); |
||
56 | void * bsearch(const void *_key, const void *_base, size_t _nelem, |
||
57 | size_t _size, int (*_cmp)(const void *_ck, const void *_ce)); |
||
58 | void * calloc(size_t _nelem, size_t _size); |
||
59 | div_t div(int _numer, int _denom); |
||
60 | void free(void *_ptr); |
||
61 | char * getenv(const char *_name); |
||
62 | long labs(long _i); |
||
63 | ldiv_t ldiv(long _numer, long _denom); |
||
64 | void * malloc(size_t _size); |
||
65 | int mblen(const char *_s, size_t _n); |
||
66 | size_t mbstowcs(wchar_t *_wcs, const char *_s, size_t _n); |
||
67 | int mbtowc(wchar_t *_pwc, const char *_s, size_t _n); |
||
68 | void qsort(void *_base, size_t _nelem, size_t _size, |
||
69 | int (*_cmp)(const void *_e1, const void *_e2)); |
||
70 | int rand(void); |
||
71 | void * realloc(void *_ptr, size_t _size); |
||
72 | void srand(unsigned _seed); |
||
73 | double strtod(const char *_s, char **_endptr); |
||
74 | long strtol(const char *_s, char **_endptr, int _base); |
||
75 | unsigned long strtoul(const char *_s, char **_endptr, int _base); |
||
76 | int system(const char *_s); |
||
77 | size_t wcstombs(char *_s, const wchar_t *_wcs, size_t _n); |
||
78 | int wctomb(char *_s, wchar_t _wchar); |
||
79 | |||
80 | #ifndef __STRICT_ANSI__ |
||
81 | |||
82 | #ifndef _POSIX_SOURCE |
||
83 | |||
84 | typedef struct { |
||
85 | long long quot; |
||
86 | long long rem; |
||
87 | } lldiv_t; |
||
88 | |||
89 | void * alloca(size_t _size); |
||
90 | long double _atold(const char *_s); |
||
91 | long long atoll(const char *_s); |
||
92 | void cfree(void *_ptr); |
||
93 | double drand48(void); |
||
94 | char * ecvtbuf(double _val, int _nd, int *_dp, int *_sn, char *_bf); |
||
95 | char * ecvt(double _val, int _nd, int *_dp, int *_sn); |
||
96 | double erand48(unsigned short state[3]); |
||
97 | char * fcvtbuf(double _val, int _nd, int *_dp, int *_sn, char *_bf); |
||
98 | char * fcvt(double _val, int _nd, int *_dp, int *_sn); |
||
99 | char * gcvt(double _val, int _nd, char *_buf); |
||
100 | char * getpass(const char *_prompt); |
||
101 | int getlongpass(const char *_prompt, char *_buffer, int _max_len); |
||
102 | char * itoa(int value, char *buffer, int radix); |
||
103 | long jrand48(unsigned short state[3]); |
||
104 | long long llabs(long long _i); |
||
105 | lldiv_t lldiv(long long _numer, long long _denom); |
||
106 | void lcong48(unsigned short param[7]); |
||
107 | unsigned long lrand48(void); |
||
108 | long mrand48(void); |
||
109 | unsigned long nrand48(unsigned short state[3]); |
||
110 | int putenv(const char *_val); |
||
111 | unsigned short *seed48(unsigned short state_seed[3]); |
||
112 | int setenv(const char *_var, const char *_val, int _replace); |
||
113 | void srand48(long seedval); |
||
114 | int stackavail(void); |
||
115 | long double _strtold(const char *_s, char **_endptr); |
||
116 | long long strtoll(const char *_s, char **_endptr, int _base); |
||
117 | unsigned long long strtoull(const char *_s, char **_endptr, int _base); |
||
118 | void swab(const void *from, void *to, int nbytes); |
||
119 | |||
120 | #ifndef alloca |
||
121 | #define alloca __builtin_alloca |
||
122 | #endif |
||
123 | |||
124 | /* BSD Random Number Generator */ |
||
125 | char * initstate (unsigned _seed, char *_arg_state, int _n); |
||
126 | char * setstate(char *_arg_state); |
||
127 | long random(void); |
||
128 | int srandom(int _seed); |
||
129 | |||
130 | /* These vary in expected prototype, so we just don't prototype them. |
||
131 | void xfree(void *_ptr); |
||
132 | void * xmalloc(size_t _size); |
||
133 | void * xrealloc(void *ptr, size_t _size); |
||
134 | */ |
||
135 | |||
136 | #define __system_redirect 0x0001 /* redirect internally */ |
||
137 | #define __system_call_cmdproc 0x0002 /* always call COMMAND/$SHELL */ |
||
138 | #define __system_use_shell 0x0004 /* use $SHELL if set */ |
||
139 | #define __system_allow_multiple_cmds 0x0008 /* allow `cmd1; cmd2; ...' */ |
||
140 | #define __system_allow_long_cmds 0x0010 /* handle commands > 126 chars */ |
||
141 | #define __system_emulate_command 0x0020 /* try to emulate the shell */ |
||
142 | #define __system_handle_null_commands 0x1000 /* ignore cmds with no effect */ |
||
143 | #define __system_ignore_chdir 0x2000 /* make `cd' be a null command */ |
||
144 | #define __system_emulate_chdir 0x4000 /* handle `cd' internally */ |
||
145 | |||
146 | extern int __system_flags; |
||
147 | |||
148 | #endif /* !_POSIX_SOURCE */ |
||
149 | #endif /* !__STRICT_ANSI__ */ |
||
150 | #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ |
||
151 | |||
152 | #ifndef __dj_ENFORCE_FUNCTION_CALLS |
||
153 | #endif /* !__dj_ENFORCE_FUNCTION_CALLS */ |
||
154 | |||
155 | #ifdef __cplusplus |
||
156 | } |
||
157 | #endif |
||
158 | |||
159 | #endif /* !__dj_include_stdlib_h_ */ |