osdep.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*
  2. Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
  3. See the accompanying file LICENSE, version 2007-Mar-4 or later
  4. (the contents of which are also included in zip.h) for terms of use.
  5. If, for some reason, all these files are missing, the Info-ZIP license
  6. also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
  7. */
  8. #ifndef VMS
  9. # define VMS 1
  10. #endif
  11. #if (defined(__VMS_VER) && !defined(__CRTL_VER))
  12. # define __CRTL_VER __VMS_VER
  13. #endif
  14. #if (defined(__VMS_VERSION) && !defined(VMS_VERSION))
  15. # define VMS_VERSION __VMS_VERSION
  16. #endif
  17. #if !(defined(__DECC) || defined(__DECCXX) || defined(__GNUC__))
  18. /* VAX C does not properly support the void keyword. (Only functions
  19. are allowed to have the type "void".) */
  20. # ifndef NO_TYPEDEF_VOID
  21. # define NO_TYPEDEF_VOID
  22. # endif
  23. # define NO_FCNTL_H /* VAXC does not supply fcntl.h. */
  24. #endif /* VAX C */
  25. #define USE_CASE_MAP
  26. #define PROCNAME(n) \
  27. (((action == ADD) || (action == UPDATE) || (action == FRESHEN)) ? \
  28. wild(n) : procname(n, filter_match_case))
  29. /* 2004-11-09 SMS.
  30. Large file support.
  31. */
  32. #ifdef LARGE_FILE_SUPPORT
  33. # define _LARGEFILE /* Define the pertinent macro. */
  34. /* LARGE_FILE_SUPPORT implies ZIP64_SUPPORT,
  35. unless explicitly disabled by NO_ZIP64_SUPPORT.
  36. */
  37. # ifdef NO_ZIP64_SUPPORT
  38. # ifdef ZIP64_SUPPORT
  39. # undef ZIP64_SUPPORT
  40. # endif /* def ZIP64_SUPPORT */
  41. # else /* def NO_ZIP64_SUPPORT */
  42. # ifndef ZIP64_SUPPORT
  43. # define ZIP64_SUPPORT
  44. # endif /* ndef ZIP64_SUPPORT */
  45. # endif /* def NO_ZIP64_SUPPORT */
  46. # define ZOFF_T_FORMAT_SIZE_PREFIX "ll"
  47. #else /* def LARGE_FILE_SUPPORT */
  48. # define ZOFF_T_FORMAT_SIZE_PREFIX "l"
  49. #endif /* def LARGE_FILE_SUPPORT */
  50. /* Need _LARGEFILE for types.h. */
  51. #include <types.h>
  52. #ifdef __GNUC__
  53. #include <sys/types.h>
  54. #endif /* def __GNUC__ */
  55. /* Need types.h for off_t. */
  56. #ifdef LARGE_FILE_SUPPORT
  57. typedef off_t zoff_t;
  58. typedef unsigned long long uzoff_t;
  59. #else /* def LARGE_FILE_SUPPORT */
  60. typedef long zoff_t;
  61. typedef unsigned long uzoff_t;
  62. #endif /* def LARGE_FILE_SUPPORT */
  63. #include <stat.h>
  64. typedef struct stat z_stat;
  65. #include <unixio.h>
  66. #if defined(__GNUC__) && !defined(ZCRYPT_INTERNAL)
  67. # include <unixlib.h> /* ctermid() declaration needed in ttyio.c */
  68. #endif
  69. #ifdef ZCRYPT_INTERNAL
  70. # include <unixlib.h> /* getpid() declaration for srand seed */
  71. #endif
  72. #if defined(_MBCS)
  73. # undef _MBCS /* Zip on VMS does not support MBCS */
  74. #endif
  75. /* VMS is run on little-endian processors with 4-byte ints:
  76. * enable the optimized CRC-32 code */
  77. #ifdef IZ_CRC_BE_OPTIMIZ
  78. # undef IZ_CRC_BE_OPTIMIZ
  79. #endif
  80. #if !defined(IZ_CRC_LE_OPTIMIZ) && !defined(NO_CRC_OPTIMIZ)
  81. # define IZ_CRC_LE_OPTIMIZ
  82. #endif
  83. #if !defined(IZ_CRCOPTIM_UNFOLDTBL) && !defined(NO_CRC_OPTIMIZ)
  84. # define IZ_CRCOPTIM_UNFOLDTBL
  85. #endif
  86. #if !defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME)
  87. # if (defined(__CRTL_VER) && (__CRTL_VER >= 70000000))
  88. # define USE_EF_UT_TIME
  89. # endif
  90. #endif
  91. #if defined(VMS_PK_EXTRA) && defined(VMS_IM_EXTRA)
  92. # undef VMS_IM_EXTRA /* PK style takes precedence */
  93. #endif
  94. #if !defined(VMS_PK_EXTRA) && !defined(VMS_IM_EXTRA)
  95. # define VMS_PK_EXTRA 1 /* PK style VMS support is default */
  96. #endif
  97. /* 2007-02-22 SMS.
  98. * <unistd.h> is needed for symbolic link functions, so use it when the
  99. * symbolic link criteria are met.
  100. */
  101. #if defined(__VAX) || __CRTL_VER < 70301000
  102. # define NO_UNISTD_H
  103. # define NO_SYMLINKS
  104. #endif /* defined(__VAX) || __CRTL_VER < 70301000 */
  105. /* 2007-02-22 SMS. Use delete() when unlink() is not available. */
  106. #if defined(NO_UNISTD_H) || (__CRTL_VER < 70000000)
  107. # define unlink delete
  108. #endif /* defined(NO_UNISTD_H) || __CRTL_VER < 70000000) */
  109. #define SSTAT vms_stat
  110. #define EXIT(exit_code) vms_exit(exit_code)
  111. #define RETURN(exit_code) return (vms_exit(exit_code), 1)
  112. #ifdef __DECC
  113. /* File open callback ID values. */
  114. # define FOPM_ID 1
  115. # define FOPR_ID 2
  116. # define FOPW_ID 3
  117. /* File open callback ID storage. */
  118. extern int fopm_id;
  119. extern int fopr_id;
  120. extern int fopw_id;
  121. /* File open callback ID function. */
  122. extern int acc_cb();
  123. /* Option macros for zfopen().
  124. * General: Stream access
  125. * Output: fixed-length, 512-byte records.
  126. *
  127. * Callback function (DEC C only) sets deq, mbc, mbf, rah, wbh, ...
  128. */
  129. # define FOPM "r+b", "ctx=stm", "rfm=fix", "mrs=512", "acc", acc_cb, &fopm_id
  130. # define FOPR "rb", "ctx=stm", "acc", acc_cb, &fopr_id
  131. # define FOPW "wb", "ctx=stm", "rfm=fix", "mrs=512", "acc", acc_cb, &fopw_id
  132. #else /* def __DECC */ /* (So, GNU C, VAX C, ...)*/
  133. # define FOPM "r+b", "ctx=stm", "rfm=fix", "mrs=512"
  134. # define FOPR "rb", "ctx=stm"
  135. # define FOPW "wb", "ctx=stm", "rfm=fix", "mrs=512"
  136. #endif /* def __DECC */