stdlib.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #ifndef __STDLIB_H
  10. #define __STDLIB_H
  11. #pragma lib "/$M/lib/ape/libap.a"
  12. #include <stddef.h>
  13. #define EXIT_FAILURE 1
  14. #define EXIT_SUCCESS 0
  15. #define MB_CUR_MAX 4
  16. #define RAND_MAX 32767
  17. typedef struct { int quot, rem; } div_t;
  18. typedef struct { int32_t quot, rem; } ldiv_t;
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. extern double atof(const char *);
  23. extern int atoi(const char *);
  24. extern long int atol(const char *);
  25. extern long long atoll(const char *);
  26. extern double strtod(const char *, char **);
  27. extern long int strtol(const char *, char **, int);
  28. extern unsigned long int strtoul(const char *, char **, int);
  29. extern long long int strtoll(const char *, char **, int);
  30. extern unsigned long long int strtoull(const char *, char **, int);
  31. extern int rand(void);
  32. extern void srand(unsigned int seed);
  33. extern void *calloc(size_t, size_t);
  34. extern void free(void *);
  35. extern void *malloc(size_t);
  36. extern void *realloc(void *, size_t);
  37. extern void abort(void);
  38. extern int atexit(void (*func)(void));
  39. extern void exit(int);
  40. extern char *getenv(const char *);
  41. extern int system(const char *);
  42. extern void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
  43. extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
  44. extern int abs(int);
  45. extern div_t div(int, int);
  46. extern long int labs(long int);
  47. extern ldiv_t ldiv(long int, long int);
  48. extern int mblen(const char *, size_t);
  49. extern int mbtowc(wchar_t *, const char *, size_t);
  50. extern int wctomb(char *, wchar_t);
  51. extern size_t mbstowcs(wchar_t *, const char *, size_t);
  52. extern size_t wcstombs(char *, const wchar_t *, size_t);
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif /* __STDLIB_H */