stdlib.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 atoi(const char*);
  14. long atol(const char*);
  15. double strtod(const char*, char** endptr);
  16. long strtol(const char*, char** endptr, int base);
  17. unsigned long strtoul(const char*, char** endptr, int base);
  18. void qsort(void* base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
  19. int atexit(void (*function)());
  20. __attribute__((noreturn)) void exit(int status);
  21. __attribute__((noreturn)) void abort();
  22. char* ptsname(int fd);
  23. int ptsname_r(int fd, char* buffer, size_t);
  24. int abs(int);
  25. long labs(long);
  26. double atof(const char*);
  27. int system(const char* command);
  28. char* mktemp(char*);
  29. void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
  30. #define RAND_MAX 32767
  31. int rand();
  32. void srand(unsigned seed);
  33. long int random();
  34. void srandom(unsigned seed);
  35. typedef struct { int quot; int rem; } div_t;
  36. div_t div(int, int);
  37. typedef struct { long quot; long rem; } ldiv_t;
  38. ldiv_t ldiv(long, long);
  39. __END_DECLS