You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
2.5 KiB

  1. --- a/configure.ac
  2. +++ b/configure.ac
  3. @@ -42,7 +42,7 @@ DAV_CHECK_NEON
  4. # Checks for header files.
  5. AC_HEADER_DIRENT
  6. AC_HEADER_STDC
  7. -AC_CHECK_HEADERS([fcntl.h iconv.h libintl.h langinfo.h limits.h locale.h mntent.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/mount.h sys/time.h syslog.h termios.h unistd.h utime.h])
  8. +AC_CHECK_HEADERS([error.h fcntl.h iconv.h libintl.h langinfo.h limits.h locale.h mntent.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/mount.h sys/time.h syslog.h termios.h unistd.h utime.h])
  9. # Checks for typedefs, structures, and compiler characteristics.
  10. AC_C_CONST
  11. --- a/src/cache.c
  12. +++ b/src/cache.c
  13. @@ -19,12 +19,12 @@
  14. #include "config.h"
  15. +#include "compat.h"
  16. #ifdef HAVE_DIRENT_H
  17. #include <dirent.h>
  18. #endif
  19. #include <errno.h>
  20. -#include <error.h>
  21. #ifdef HAVE_FCNTL_H
  22. #include <fcntl.h>
  23. #endif
  24. --- /dev/null
  25. +++ b/src/compat.h
  26. @@ -0,0 +1,39 @@
  27. +#ifndef _COMPAT_H
  28. +#define _COMPAT_H
  29. +
  30. +#ifdef HAVE_ERROR_H
  31. +# include <error.h>
  32. +#else
  33. +# include <stdio.h>
  34. +# include <stdarg.h>
  35. +# include <stdlib.h>
  36. +# include <string.h>
  37. +static void error_at_line(int status, int errnum, const char *filename,
  38. + unsigned int linenum, const char *format, ...)
  39. +{
  40. + va_list ap;
  41. +
  42. + fflush(stdout);
  43. +
  44. + if (filename != NULL)
  45. + fprintf(stderr, "%s:%u: ", filename, linenum);
  46. +
  47. + va_start(ap, format);
  48. + vfprintf(stderr, format, ap);
  49. + va_end(ap);
  50. +
  51. + if (errnum != 0)
  52. + fprintf(stderr, ": %s", strerror(errnum));
  53. +
  54. + fprintf(stderr, "\n");
  55. +
  56. + if (status != 0)
  57. + exit(status);
  58. +}
  59. +
  60. +#define error(status, errnum, format...) \
  61. + error_at_line(status, errnum, NULL, 0, format)
  62. +
  63. +#endif /* HAVE_ERROR_H */
  64. +
  65. +#endif /* _COMPAT_H */
  66. --- a/src/kernel_interface.c
  67. +++ b/src/kernel_interface.c
  68. @@ -19,9 +19,9 @@
  69. #include "config.h"
  70. +#include "compat.h"
  71. #include <errno.h>
  72. -#include <error.h>
  73. #ifdef HAVE_FCNTL_H
  74. #include <fcntl.h>
  75. #endif
  76. --- a/src/mount_davfs.c
  77. +++ b/src/mount_davfs.c
  78. @@ -19,10 +19,10 @@
  79. #include "config.h"
  80. +#include "compat.h"
  81. #include <ctype.h>
  82. #include <errno.h>
  83. -#include <error.h>
  84. #ifdef HAVE_FCNTL_H
  85. #include <fcntl.h>
  86. #endif
  87. --- a/src/umount_davfs.c
  88. +++ b/src/umount_davfs.c
  89. @@ -19,8 +19,8 @@
  90. #include "config.h"
  91. +#include "compat.h"
  92. -#include <error.h>
  93. #include <errno.h>
  94. #include <getopt.h>
  95. #ifdef HAVE_LIBINTL_H
  96. --- a/src/webdav.c
  97. +++ b/src/webdav.c
  98. @@ -19,9 +19,9 @@
  99. #include "config.h"
  100. +#include "compat.h"
  101. #include <errno.h>
  102. -#include <error.h>
  103. #ifdef HAVE_FCNTL_H
  104. #include <fcntl.h>
  105. #endif