common.h 840 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef AVM_COMMON_H
  2. #define AVM_COMMON_H 1
  3. /* adapted from the autobook reference */
  4. #ifdef __cplusplus
  5. extern "C"
  6. {
  7. #endif
  8. #if HAVE_CONFIG_H
  9. #include <config.h>
  10. #endif
  11. #include <stdio.h>
  12. #include <sys/types.h>
  13. #include <sys/stat.h>
  14. #include <stdint.h>
  15. #define _GNU_SOURCE
  16. #define _REENTRANT
  17. #if STDC_HEADERS
  18. # include <stdlib.h>
  19. #include <string.h>
  20. #elif HAVE_STRINGS_H
  21. #include <strings.h>
  22. #endif /*STDC_HEADERS */
  23. #if HAVE_UNISTD_H
  24. #include <unistd.h>
  25. #endif
  26. #if HAVE_ERRNO_H
  27. #include <errno.h>
  28. #endif /*HAVE_ERRNO_H */
  29. typedef uintmax_t counter;
  30. #ifndef errno
  31. /* Some systems #define this! */
  32. #include <errno.h>
  33. extern int errno;
  34. #endif
  35. #ifndef EXIT_SUCCESS
  36. #define EXIT_SUCCESS 0
  37. #define EXIT_FAILURE 1
  38. #endif
  39. extern char *xstrerror (int errnum);
  40. #ifdef __cplusplus
  41. }
  42. #endif
  43. #endif /* AVM_COMMON_H */