osdep.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. unix/osdep.h - Zip 3
  3. Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
  4. See the accompanying file LICENSE, version 2005-Feb-10 or later
  5. (the contents of which are also included in zip.h) for terms of use.
  6. If, for some reason, both of these files are missing, the Info-ZIP license
  7. also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
  8. */
  9. #ifdef NO_LARGE_FILE_SUPPORT
  10. # ifdef LARGE_FILE_SUPPORT
  11. # undef LARGE_FILE_SUPPORT
  12. # endif
  13. #endif
  14. #ifdef LARGE_FILE_SUPPORT
  15. /* 64-bit Large File Support */
  16. /* The following Large File Summit (LFS) defines turn on large file support on
  17. Linux (probably 2.4 or later kernel) and many other unixen */
  18. # define _LARGEFILE_SOURCE /* some OSes need this for fseeko */
  19. # define _LARGEFILE64_SOURCE
  20. # define _FILE_OFFSET_BITS 64 /* select default interface as 64 bit */
  21. # define _LARGE_FILES /* some OSes need this for 64-bit off_t */
  22. #endif
  23. #include <sys/types.h>
  24. #include <sys/stat.h>
  25. /* printf format size prefix for zoff_t values */
  26. #ifdef LARGE_FILE_SUPPORT
  27. # define ZOFF_T_FORMAT_SIZE_PREFIX "ll"
  28. #else
  29. # define ZOFF_T_FORMAT_SIZE_PREFIX "l"
  30. #endif
  31. #ifdef NO_OFF_T
  32. typedef long zoff_t;
  33. typedef unsigned long uzoff_t;
  34. #else
  35. typedef off_t zoff_t;
  36. # if defined(LARGE_FILE_SUPPORT) && !(defined(__alpha) && defined(__osf__))
  37. typedef unsigned long long uzoff_t;
  38. # else
  39. typedef unsigned long uzoff_t;
  40. # endif
  41. #endif
  42. typedef struct stat z_stat;
  43. /* Automatically set ZIP64_SUPPORT if LFS */
  44. #ifdef LARGE_FILE_SUPPORT
  45. # ifndef NO_ZIP64_SUPPORT
  46. # ifndef ZIP64_SUPPORT
  47. # define ZIP64_SUPPORT
  48. # endif
  49. # else
  50. # ifdef ZIP64_SUPPORT
  51. # undef ZIP64_SUPPORT
  52. # endif
  53. # endif
  54. #endif
  55. /* Process files in binary mode */
  56. #if defined(__DJGPP__) || defined(__CYGWIN__)
  57. # define FOPR "rb"
  58. # define FOPM "r+b"
  59. # define FOPW "wb"
  60. #endif
  61. /* Enable the "UT" extra field (time info) */
  62. #if !defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME)
  63. # define USE_EF_UT_TIME
  64. #endif