1 /* 2 * stdlib.h 3 * 4 * Definitions for common types, variables, and functions. 5 */ 6 7 #ifndef _STDLIB_H_ 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 #define _STDLIB_H_ 12 13 #include "_ansi.h" 14 15 #define __need_size_t 16 #define __need_wchar_t 17 #include <stddef.h> 18 19 #include <sys/reent.h> 20 21 typedef struct 22 { 23 int quot; /* quotient */ 24 int rem; /* remainder */ 25 } div_t; 26 27 typedef struct 28 { 29 long quot; /* quotient */ 30 long rem; /* remainder */ 31 } ldiv_t; 32 33 #ifndef NULL 34 #define NULL 0 35 #endif 36 37 #define EXIT_FAILURE 1 38 #define EXIT_SUCCESS 0 39 40 #define RAND_MAX __RAND_MAX 41 42 extern __IMPORT int __mb_cur_max; 43 44 #define MB_CUR_MAX __mb_cur_max 45 46 _VOID _EXFUN(abort,(_VOID) _ATTRIBUTE ((noreturn))); 47 int _EXFUN(abs,(int)); 48 int _EXFUN(atexit,(_VOID (*__func)(_VOID))); 49 double _EXFUN(atof,(const char *__nptr)); 50 #ifndef __STRICT_ANSI__ 51 float _EXFUN(atoff,(const char *__nptr)); 52 #endif 53 int _EXFUN(atoi,(const char *__nptr)); 54 long _EXFUN(atol,(const char *__nptr)); 55 _PTR _EXFUN(bsearch,(const _PTR __key, 56 const _PTR __base, 57 size_t __nmemb, 58 size_t __size, 59 int _EXPARM(_compar,(const _PTR, const _PTR)))); 60 _PTR _EXFUN(calloc,(size_t __nmemb, size_t __size)); 61 div_t _EXFUN(div,(int __numer, int __denom)); 62 _VOID _EXFUN(exit,(int __status) _ATTRIBUTE ((noreturn))); 63 _VOID _EXFUN(free,(_PTR)); 64 char * _EXFUN(getenv,(const char *__string)); 65 char * _EXFUN(_getenv_r,(struct _reent *, const char *__string)); 66 char * _EXFUN(_findenv,(_CONST char *, int *)); 67 char * _EXFUN(_findenv_r,(struct _reent *, _CONST char *, int *)); 68 long _EXFUN(labs,(long)); 69 ldiv_t _EXFUN(ldiv,(long __numer, long __denom)); 70 _PTR _EXFUN(malloc,(size_t __size)); 71 int _EXFUN(mblen,(const char *, size_t)); 72 int _EXFUN(_mblen_r,(struct _reent *, const char *, size_t, int *)); 73 int _EXFUN(mbtowc,(wchar_t *, const char *, size_t)); 74 int _EXFUN(_mbtowc_r,(struct _reent *, wchar_t *, const char *, size_t, int *)); 75 int _EXFUN(wctomb,(char *, wchar_t)); 76 int _EXFUN(_wctomb_r,(struct _reent *, char *, wchar_t, int *)); 77 size_t _EXFUN(mbstowcs,(wchar_t *, const char *, size_t)); 78 size_t _EXFUN(_mbstowcs_r,(struct _reent *, wchar_t *, const char *, size_t, int *)); 79 size_t _EXFUN(wcstombs,(char *, const wchar_t *, size_t)); 80 size_t _EXFUN(_wcstombs_r,(struct _reent *, char *, const wchar_t *, size_t, int *)); 81 #ifndef __STRICT_ANSI__ 82 #ifndef _REENT_ONLY 83 int _EXFUN(mkstemp,(char *)); 84 char * _EXFUN(mktemp,(char *)); 85 #endif 86 #endif 87 _VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR))); 88 int _EXFUN(rand,(_VOID)); 89 _PTR _EXFUN(realloc,(_PTR __r, size_t __size)); 90 _VOID _EXFUN(srand,(unsigned __seed)); 91 double _EXFUN(strtod,(const char *__n, char **_end_PTR)); 92 #ifndef __STRICT_ANSI__ 93 float _EXFUN(strtodf,(const char *__n, char **_end_PTR)); 94 #endif 95 long _EXFUN(strtol,(const char *__n, char **_end_PTR, int __base)); 96 unsigned long _EXFUN(strtoul,(const char *_n_PTR, char **_end_PTR, int __base)); 97 unsigned long _EXFUN(_strtoul_r,(struct _reent *,const char *_n_PTR, char **_end_PTR, int __base)); 98 int _EXFUN(system,(const char *__string)); 99 100 #ifndef __STRICT_ANSI__ 101 int _EXFUN(putenv,(const char *__string)); 102 int _EXFUN(_putenv_r,(struct _reent *, const char *__string)); 103 int _EXFUN(setenv,(const char *__string, const char *__value, int __overwrite)); 104 int _EXFUN(_setenv_r,(struct _reent *, const char *__string, const char *__value, int __overwrite)); 105 106 char * _EXFUN(gcvt,(double,int,char *)); 107 char * _EXFUN(gcvtf,(float,int,char *)); 108 char * _EXFUN(fcvt,(double,int,int *,int *)); 109 char * _EXFUN(fcvtf,(float,int,int *,int *)); 110 char * _EXFUN(ecvt,(double,int,int *,int *)); 111 char * _EXFUN(ecvtbuf,(double, int, int*, int*, char *)); 112 char * _EXFUN(fcvtbuf,(double, int, int*, int*, char *)); 113 char * _EXFUN(ecvtf,(float,int,int *,int *)); 114 char * _EXFUN(dtoa,(double, int, int, int *, int*, char**)); 115 int _EXFUN(rand_r,(unsigned *__seed)); 116 117 #ifndef __CYGWIN__ 118 _VOID _EXFUN(cfree,(_PTR)); 119 #else 120 char * _EXFUN(realpath,(const char *, char *)); 121 void _EXFUN(unsetenv,(const char *__string)); 122 void _EXFUN(_unsetenv_r,(struct _reent *, const char *__string)); 123 int _EXFUN(random,(_VOID)); 124 long _EXFUN(srandom,(unsigned __seed)); 125 char * _EXFUN(ptsname, (int)); 126 int _EXFUN(grantpt, (int)); 127 int _EXFUN(unlockpt,(int)); 128 #endif 129 130 #endif /* ! __STRICT_ANSI__ */ 131 132 char * _EXFUN(_dtoa_r,(struct _reent *, double, int, int, int *, int*, char**)); 133 _PTR _EXFUN(_malloc_r,(struct _reent *, size_t)); 134 _PTR _EXFUN(_calloc_r,(struct _reent *, size_t, size_t)); 135 _VOID _EXFUN(_free_r,(struct _reent *, _PTR)); 136 _PTR _EXFUN(_realloc_r,(struct _reent *, _PTR, size_t)); 137 _VOID _EXFUN(_mstats_r,(struct _reent *, char *)); 138 int _EXFUN(_system_r,(struct _reent *, const char *)); 139 140 _VOID _EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *)); 141 142 #ifdef __cplusplus 143 } 144 #endif 145 #endif /* _STDLIB_H_ */ |