home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJDEV201.ZIP / include / stdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-26  |  4.2 KB  |  138 lines

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