compat.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * libcompat - system compatibility library
  3. * compat.h - system compatibility declarations
  4. *
  5. * Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
  6. * Copyright © 2008 Guillem Jover <guillem@debian.org>
  7. *
  8. * This is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2,
  11. * or (at your option) any later version.
  12. *
  13. * This is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public
  19. * License along with dpkg; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. */
  22. #ifndef COMPAT_H
  23. #define COMPAT_H
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #ifndef offsetof
  28. #define offsetof(st, m) ((size_t)&((st *)NULL)->m)
  29. #endif
  30. /*
  31. * Define WCOREDUMP if we don't have it already, coredumps won't be
  32. * detected, though.
  33. */
  34. #ifndef WCOREDUMP
  35. #define WCOREDUMP(x) 0
  36. #endif
  37. #ifndef HAVE_STRTOUL
  38. #define strtoul strtol
  39. #endif
  40. #ifndef HAVE_VA_COPY
  41. #define va_copy(dest, src) (dest) = (src)
  42. #endif
  43. #include <strnlen.h>
  44. #ifndef HAVE_STRERROR
  45. const char *strerror(int);
  46. #endif
  47. #ifndef HAVE_STRSIGNAL
  48. const char *strsignal(int);
  49. #endif
  50. #ifndef HAVE_SCANDIR
  51. struct dirent;
  52. int scandir(const char *dir, struct dirent ***namelist,
  53. int (*filter)(const struct dirent *),
  54. int (*cmp)(const void *, const void *));
  55. #endif
  56. #ifndef HAVE_ALPHASORT
  57. int alphasort(const void *a, const void *b);
  58. #endif
  59. #ifndef HAVE_UNSETENV
  60. int unsetenv(const char *x);
  61. #endif
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif /* COMPAT_H */