stdlib.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #ifndef _STDLIB_H
  2. #define _STDLIB_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #undef NULL
  7. #ifdef __cplusplus
  8. #define NULL 0
  9. #else
  10. #define NULL ((void*)0)
  11. #endif
  12. #define __NEED_size_t
  13. #define __NEED_wchar_t
  14. #include <bits/alltypes.h>
  15. int atoi (const char *);
  16. long atol (const char *);
  17. long long atoll (const char *);
  18. double atof (const char *);
  19. float strtof (const char *, char **);
  20. double strtod (const char *, char **);
  21. long double strtold (const char *, char **);
  22. long strtol (const char *, char **, int);
  23. unsigned long strtoul (const char *, char **, int);
  24. long long strtoll (const char *, char **, int);
  25. unsigned long long strtoull (const char *, char **, int);
  26. int rand (void);
  27. void srand (unsigned);
  28. void *malloc (size_t);
  29. void *calloc (size_t, size_t);
  30. void *realloc (void *, size_t);
  31. void free (void *);
  32. void abort (void);
  33. int atexit (void (*) (void));
  34. void exit (int);
  35. void _Exit (int);
  36. char *getenv (const char *);
  37. int system (const char *);
  38. void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
  39. void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
  40. int abs (int);
  41. long labs (long);
  42. long long llabs (long long);
  43. typedef struct { int quot, rem; } div_t;
  44. typedef struct { long quot, rem; } ldiv_t;
  45. typedef struct { long long quot, rem; } lldiv_t;
  46. div_t div (int, int);
  47. ldiv_t ldiv (long, long);
  48. lldiv_t lldiv (long long, long long);
  49. int mblen (const char *, size_t);
  50. int mbtowc (wchar_t *, const char *, size_t);
  51. int wctomb (char *, wchar_t);
  52. size_t mbstowcs (wchar_t *, const char *, size_t);
  53. size_t wcstombs (char *, const wchar_t *, size_t);
  54. #define EXIT_FAILURE 1
  55. #define EXIT_SUCCESS 0
  56. #define MB_CUR_MAX ((size_t)+4)
  57. #define RAND_MAX (0x7fffffff)
  58. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  59. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
  60. #ifndef WEXITSTATUS
  61. #define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
  62. #define WTERMSIG(s) ((s) & 0x7f)
  63. #define WSTOPSIG(s) WEXITSTATUS(s)
  64. #define WCOREDUMP(s) ((s) & 0x80)
  65. #define WIFEXITED(s) (!WTERMSIG(s))
  66. #define WIFSTOPPED(s) (((s) & 0xff) == 0x7f)
  67. #define WIFSIGNALED(s) (((signed char) (((s) & 0x7f) + 1) >> 1) > 0)
  68. #define WIFCONTINUED(s) ((s) == 0xffff)
  69. #endif
  70. int posix_memalign (void **, size_t, size_t);
  71. int setenv (const char *, const char *, int);
  72. int unsetenv (const char *);
  73. int mkstemp (char *);
  74. char *mkdtemp (char *);
  75. int getsubopt (char **, char *const *, char **);
  76. int rand_r (unsigned *);
  77. #endif
  78. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
  79. int putenv (char *);
  80. int posix_openpt (int);
  81. int grantpt (int);
  82. int unlockpt (int);
  83. char *ptsname (int);
  84. char *realpath (const char *, char *);
  85. char *l64a (long);
  86. long a64l (const char *);
  87. void setkey (const char *);
  88. long int random (void);
  89. void srandom (unsigned int);
  90. char *initstate (unsigned int, char *, size_t);
  91. char *setstate (char *);
  92. double drand48 (void);
  93. double erand48 (unsigned short [3]);
  94. long int lrand48 (void);
  95. long int nrand48 (unsigned short [3]);
  96. long mrand48 (void);
  97. long jrand48 (unsigned short [3]);
  98. void srand48 (long);
  99. unsigned short *seed48 (unsigned short [3]);
  100. void lcong48 (unsigned short [7]);
  101. #endif
  102. #if defined(_GNU_SOURCE)
  103. void *alloca(size_t);
  104. char *mktemp (char *);
  105. void *valloc (size_t);
  106. void *memalign(size_t, size_t);
  107. int clearenv(void);
  108. int ptsname_r(int, char *, size_t);
  109. #endif
  110. #ifdef __cplusplus
  111. }
  112. #endif
  113. #endif