stdlib.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #pragma once
  2. #include <sys/cdefs.h>
  3. #include <sys/types.h>
  4. __BEGIN_DECLS
  5. #define EXIT_SUCCESS 0
  6. #define EXIT_FAILURE 1
  7. #define MB_CUR_MAX 1
  8. __attribute__((malloc)) __attribute__((alloc_size(1))) void* malloc(size_t);
  9. __attribute__((malloc)) __attribute__((alloc_size(1, 2))) void* calloc(size_t nmemb, size_t);
  10. void free(void*);
  11. void* realloc(void *ptr, size_t);
  12. char* getenv(const char* name);
  13. int putenv(char*);
  14. int atoi(const char*);
  15. long atol(const char*);
  16. double strtod(const char*, char** endptr);
  17. long strtol(const char*, char** endptr, int base);
  18. unsigned long strtoul(const char*, char** endptr, int base);
  19. void qsort(void* base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
  20. int atexit(void (*function)());
  21. __attribute__((noreturn)) void exit(int status);
  22. __attribute__((noreturn)) void abort();
  23. char* ptsname(int fd);
  24. int ptsname_r(int fd, char* buffer, size_t);
  25. int abs(int);
  26. long labs(long);
  27. double atof(const char*);
  28. int system(const char* command);
  29. char* mktemp(char*);
  30. void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
  31. #define RAND_MAX 32767
  32. int rand();
  33. void srand(unsigned seed);
  34. long int random();
  35. void srandom(unsigned seed);
  36. typedef struct { int quot; int rem; } div_t;
  37. div_t div(int, int);
  38. typedef struct { long quot; long rem; } ldiv_t;
  39. ldiv_t ldiv(long, long);
  40. __END_DECLS