stdlib.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * stdlib.h - standard library
  3. *
  4. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  5. * See the copyright notice in the ACK home directory, in the file "Copyright".
  6. */
  7. /* $Header$ */
  8. #ifndef _STDLIB_HEADER_
  9. #define _STDLIB_HEADER_
  10. #ifndef NULL
  11. #define NULL 0
  12. #endif /* NULL */
  13. #define EXIT_FAILURE 1
  14. #define EXIT_SUCCESS 0
  15. #define RAND_MAX 32767
  16. #define MB_CUR_MAX 1
  17. typedef struct { int quot, rem; } div_t;
  18. typedef struct { long quot, rem; } ldiv_t;
  19. #ifndef _TYPE_SIZE_
  20. #define _TYPE_SIZE_
  21. typedef unsigned int size_t;
  22. #endif /* _TYPE_SIZE_ */
  23. #ifndef _TYPE_WCHAR_
  24. #define _TYPE_WCHAR_
  25. typedef int wchar_t;
  26. #endif /* _TYPE_WCHAR_ */
  27. #ifdef __STDC__
  28. double atof(const char *nptr);
  29. int atoi(const char *nptr);
  30. long atol(const char *nptr);
  31. double strtod(const char *nptr, char **endptr);
  32. long strtol(const char *nptr, char **endptr, int base);
  33. unsigned long int strtoul(const char *nptr, char **endptr, int base);
  34. int rand(void);
  35. void srand(unsigned int seed);
  36. void *calloc(size_t nmemb, size_t size);
  37. void free(void *ptr);
  38. void *malloc(size_t size);
  39. void *realloc(void *ptr, size_t size);
  40. void abort(void);
  41. int atexit(void (*func)(void));
  42. void exit(int status);
  43. char *getenv(const char *name);
  44. int system(const char *string);
  45. void *bsearch(const void *key, const void *base,
  46. size_t nmemb, size_t size,
  47. int (*compar)(const void *, const void *));
  48. void qsort(void *base, size_t nmemb, size_t size,
  49. int (*compar)(const void *, const void *));
  50. int abs(int j);
  51. div_t div(int numer, int denom);
  52. long labs(long j);
  53. ldiv_t ldiv(long numer, long denom);
  54. int mblen(const char *s, size_t n);
  55. int mbtowc(wchar_t *pwc, const char *s, size_t n);
  56. int wctomb(const char *s, wchar_t wchar);
  57. size_t mbstowcs(wchar_t *pwcs, const char *s, size_t n);
  58. size_t wcstombs(char *s, const wchar_t *pwcs, size_t n);
  59. #endif /* __STDC__ */
  60. #endif /* _STDLIB_HEADER_ */