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