1/*
2  Copyright (c) 1990-2005 Info-ZIP.  All rights reserved.
3
4  See the accompanying file LICENSE, version 2004-May-22 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/*
10 *  globals.c by Mark Adler
11 */
12#define __GLOBALS_C
13
14#define GLOBALS         /* include definition of errors[] in zip.h */
15#ifndef UTIL
16#define UTIL            /* do not declare the read_buf variable */
17#endif
18
19#include "zip.h"
20
21
22/* Handy place to build error messages */
23char errbuf[FNMAX+81];
24
25/* Argument processing globals */
26int recurse = 0;        /* 1=recurse into directories encountered */
27int dispose = 0;        /* 1=remove files after put in zip file */
28int pathput = 1;        /* 1=store path with name */
29#ifdef RISCOS
30int scanimage = 1;      /* 1=scan through image files */
31#endif
32int method = BEST;      /* one of BEST, DEFLATE (only), or STORE (only) */
33int dosify = 0;         /* 1=make new entries look like MSDOS */
34int verbose = 0;        /* 1=report oddities in zip file structure */
35int fix = 0;            /* 1=fix the zip file */
36int adjust = 0;         /* 1=adjust offsets for sfx'd file (keep preamble) */
37int level = 6;          /* 0=fastest compression, 9=best compression */
38int translate_eol = 0;  /* Translate end-of-line LF -> CR LF */
39#ifdef VMS
40   int vmsver = 0;      /* 1=append VMS version number to file names */
41   int vms_native = 0;  /* 1=store in VMS format */
42#endif /* VMS */
43#if defined(OS2) || defined(WIN32)
44   int use_longname_ea = 0; /* 1=use the .LONGNAME EA as the file's name */
45#endif
46int hidden_files = 0;   /* process hidden and system files */
47int volume_label = 0;   /* add volume label */
48int dirnames = 1;       /* include directory entries by default */
49int linkput = 0;        /* 1=store symbolic links as such */
50int noisy = 1;          /* 0=quiet operation */
51int extra_fields = 1;   /* 0=do not create extra fields */
52#ifdef NTSD_EAS
53    int use_privileges = 0; /* 1=use security privilege overrides */
54#endif
55#ifndef RISCOS
56#ifndef QDOS
57#ifndef TANDEM
58char *special = ".Z:.zip:.zoo:.arc:.lzh:.arj"; /* List of special suffixes */
59#else /* TANDEM */
60char *special = " Z: zip: zoo: arc: lzh: arj"; /* List of special suffixes */
61#endif
62#else /* QDOS */
63char *special = "_Z:_zip:_zoo:_arc:_lzh:_arj"; /* List of special suffixes */
64#endif
65#else /* RISCOS */
66char *special = "DDC:D96:68E";
67#endif /* ?RISCOS */
68char *key = NULL;       /* Scramble password if scrambling */
69char *tempath = NULL;   /* Path for temporary files */
70FILE *mesg;             /* stdout by default, stderr for piping */
71
72/* Zip file globals */
73char *zipfile;          /* New or existing zip archive (zip file) */
74ulg zipbeg;             /* Starting offset of zip structures */
75ulg cenbeg;             /* Starting offset of central directory */
76struct zlist far *zfiles = NULL;  /* Pointer to list of files in zip file */
77extent zcount;          /* Number of files in zip file */
78extent zcomlen;         /* Length of zip file comment */
79char *zcomment = NULL;  /* Zip file comment (not zero-terminated) */
80struct zlist far **zsort;       /* List of files sorted by name */
81ulg tempzn;             /* Count of bytes written to output zip file */
82
83/* Files to operate on that are not in zip file */
84struct flist far *found = NULL; /* List of names found */
85struct flist far * far *fnxt = &found;
86                        /* Where to put next name in found list */
87extent fcount;          /* Count of files in list */
88
89/* Patterns to be matched */
90struct plist *patterns = NULL;  /* List of patterns to be matched */
91unsigned pcount = 0;            /* number of patterns */
92unsigned icount = 0;            /* number of include only patterns */
93unsigned Rcount = 0;            /* number of -R include patterns */
94
95#ifdef IZ_CHECK_TZ
96int zp_tz_is_valid;     /* signals "timezone info is available" */
97#endif
98