config.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright (C) 2014 Michael McMaster <michael@codesrc.com>
  2. //
  3. // This file is part of libzipper.
  4. //
  5. // libzipper is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // libzipper is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU General Public License
  16. // along with libzipper. If not, see <http://www.gnu.org/licenses/>.
  17. #ifndef zipper_config_h
  18. #define zipper_config_h
  19. #include "autoconfig.h"
  20. #include <sys/types.h>
  21. #include <sys/time.h>
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #ifndef HAVE_PREAD
  26. // Use port/pread.c
  27. extern ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset);
  28. #endif
  29. #ifndef HAVE_PWRITE
  30. // Use port/pwrite.c
  31. extern ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
  32. #endif
  33. #ifndef HAVE_UTIMES
  34. extern int utimes(const char *filename, const struct timeval times[2]);
  35. #endif
  36. // Thread un-safe alternative
  37. #ifndef HAVE_LOCALTIME_R
  38. #define localtime_r(timep, result) localtime( (timep) )
  39. #endif
  40. #ifdef _WIN32
  41. #define MKDIR(file,mode) mkdir(file)
  42. #else
  43. #define MKDIR(file,mode) mkdir(file,mode)
  44. // no automagic CR/LF conversion undr mingw
  45. #define O_BINARY 0
  46. #endif
  47. #ifdef __cplusplus
  48. // extern "C"
  49. }
  50. #endif
  51. #endif