mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-15 05:16:30 +00:00
Fix issues with InfoZip build
Artifacts weren't being invalidated because THIRD_PARTY_ZIP_SRCS_C needed to be renamed THIRD_PARTY_ZIP_SRCS. This caused a build break.
This commit is contained in:
parent
a81192e0b9
commit
ab64c746cc
23 changed files with 40 additions and 3414 deletions
17
third_party/infozip/infozip.mk
vendored
17
third_party/infozip/infozip.mk
vendored
|
@ -4,14 +4,14 @@
|
|||
PKGS += THIRD_PARTY_ZIP
|
||||
|
||||
THIRD_PARTY_ZIP_FILES = $(wildcard third_party/infozip/zip/*) third_party/infozip/zip/unix/unix.c
|
||||
THIRD_PARTY_ZIP_SRCS_C = $(filter %.c,$(THIRD_PARTY_ZIP_FILES))
|
||||
THIRD_PARTY_ZIP_SRCS = $(filter %.c,$(THIRD_PARTY_ZIP_FILES))
|
||||
THIRD_PARTY_ZIP = $(THIRD_PARTY_ZIP_COMS) $(THIRD_PARTY_ZIP_COMS:%=%.dbg)
|
||||
|
||||
THIRD_PARTY_ZIP_COMS = \
|
||||
o/$(MODE)/third_party/infozip/zip.com \
|
||||
o/$(MODE)/third_party/infozip/zipsplit.com \
|
||||
o/$(MODE)/third_party/infozip/zipnote.com \
|
||||
o/$(MODE)/third_party/infozip/zipcloak.com
|
||||
o/$(MODE)/third_party/infozip/zipcloak.com
|
||||
|
||||
THIRD_PARTY_ZIP_OBJS = $(sort \
|
||||
$(THIRD_PARTY_ZIP_COM_OBJS) \
|
||||
|
@ -25,7 +25,7 @@ THIRD_PARTY_ZIP_UTIL_OBJS1 = \
|
|||
o/$(MODE)/third_party/infozip/zip/unix/unix_.o \
|
||||
o/$(MODE)/third_party/infozip/zip/zipfile_.o \
|
||||
o/$(MODE)/third_party/infozip/zip/fileio_.o \
|
||||
o/$(MODE)/third_party/infozip/zip/util_.o
|
||||
o/$(MODE)/third_party/infozip/zip/util_.o
|
||||
|
||||
THIRD_PARTY_ZIP_UTIL_OBJS2 = \
|
||||
o/$(MODE)/third_party/infozip/zip/crypt_.o \
|
||||
|
@ -48,7 +48,7 @@ THIRD_PARTY_ZIP_COM_OBJS = \
|
|||
o/$(MODE)/third_party/infozip/zip/crc32.o \
|
||||
o/$(MODE)/third_party/infozip/zip/zbz2err.o \
|
||||
o/$(MODE)/third_party/infozip/zip/deflate.o \
|
||||
o/$(MODE)/third_party/infozip/zip/trees.o
|
||||
o/$(MODE)/third_party/infozip/zip/trees.o
|
||||
|
||||
THIRD_PARTY_ZIPSPLIT_OBJS = \
|
||||
o/$(MODE)/third_party/infozip/zip/zipsplit.o \
|
||||
|
@ -68,13 +68,13 @@ THIRD_PARTY_ZIP_LARGE_OBJS = \
|
|||
o/$(MODE)/third_party/infozip/zip/zip.o \
|
||||
o/$(MODE)/third_party/infozip/zip/zipsplit.o \
|
||||
o/$(MODE)/third_party/infozip/zip/fileio.o \
|
||||
o/$(MODE)/third_party/infozip/zip/fileio_.o
|
||||
o/$(MODE)/third_party/infozip/zip/fileio_.o
|
||||
|
||||
o/$(MODE)/third_party/infozip/zip/%_.o: third_party/infozip/zip/%.c
|
||||
@$(COMPILE) -AOBJECTIFY.c $(OBJECTIFY.c) $(OUTPUT_OPTION) -DUTIL $<
|
||||
|
||||
$(THIRD_PARTY_ZIP_OBJS): \
|
||||
OVERRIDE_CFLAGS += \
|
||||
OVERRIDE_CPPFLAGS += \
|
||||
-DUNIX \
|
||||
-DMMAP \
|
||||
-DUNICODE_SUPPORT \
|
||||
|
@ -82,10 +82,11 @@ $(THIRD_PARTY_ZIP_OBJS): \
|
|||
-DLARGE_FILE_SUPPORT \
|
||||
-DHAVE_DIRENT_H \
|
||||
-DHAVE_TERMIOS_H \
|
||||
-DNO_BZIP2_SUPPORT
|
||||
-DNO_BZIP2_SUPPORT \
|
||||
-DZIP64_SUPPORT
|
||||
|
||||
$(THIRD_PARTY_ZIP_LARGE_OBJS): \
|
||||
OVERRIDE_CFLAGS += -DSTACK_FRAME_UNLIMITED
|
||||
OVERRIDE_CPPFLAGS += -DSTACK_FRAME_UNLIMITED
|
||||
|
||||
THIRD_PARTY_ZIP_DIRECTDEPS = \
|
||||
LIBC_ERRNO \
|
||||
|
|
368
third_party/infozip/zip/INSTALL
vendored
368
third_party/infozip/zip/INSTALL
vendored
|
@ -1,368 +0,0 @@
|
|||
HOW TO INSTALL ZIP
|
||||
|
||||
Zip is distributed as C source code that can be compiled on a
|
||||
wide range of systems: Unix, VMS, MSDOS, OS/2, NT, Amiga, Atari,
|
||||
BeOS, VM/CMS, ... You will need Unzip 5.0p1 or later (under any
|
||||
system) or PKUNZIP 2.04g or later (under MSDOS) to unpack the
|
||||
distribution file, in this case zip30.zip. But since you read this,
|
||||
you have unpacked it already, or you cheated and got a tar.Z file...
|
||||
|
||||
Note: Zip 3.0 distribution kits (unlike previously distributed
|
||||
Zip 2.x kits) are created with a top-level directory ("zip30") in
|
||||
the archive, making the creating of the zipsrc directory optional.
|
||||
|
||||
Installation on Unix (see below for installation on other systems)
|
||||
|
||||
Let's assume that you start from scratch and have not yet unpacked
|
||||
the sources. First step, then, is to unpack Zip. The following
|
||||
assumes that you have zip30.zip in the current directory.
|
||||
|
||||
For example, to extract to a new zipsrc directory (assuming
|
||||
zip30.zip is in the current directory):
|
||||
|
||||
mkdir zipsrc
|
||||
cd zipsrc
|
||||
cp ../zip30.zip .
|
||||
unzip zip30.zip
|
||||
cd zip30
|
||||
|
||||
To extract in an existing directory, such as /usr/local/src/zip:
|
||||
|
||||
cd /usr/local/src/zip
|
||||
(copy zip30.zip here)
|
||||
unzip zip30.zip
|
||||
cd zip30
|
||||
|
||||
The first extracts all source files and documentation to the
|
||||
directory "zipsrc/zip30". The second places the zip30 directory
|
||||
in the "/usr/local/src/zip" directory. Both then cd in to the
|
||||
zip30 directory where Zip will be built.
|
||||
|
||||
Note: This release now includes the standard encryption code
|
||||
previously in the separate package zcrypt29.zip, but you still
|
||||
can decide whether to activate the crypt code or not. Crypt is
|
||||
enabled by default, but you may disable it by specifying the
|
||||
option -DNO_CRYPT in the LOCAL_ZIP environment variable (or by
|
||||
adding this option to the compilation options in the appropiate
|
||||
makefile). See README.CR for more on crypt.
|
||||
|
||||
You then do:
|
||||
|
||||
make -f unix/Makefile system
|
||||
|
||||
where "system" is one of: generic, generic_gcc,
|
||||
att6300, coherent, cray_v3, minix, sco_x286, xenix, zilog.
|
||||
|
||||
For Unix systems where "cc" is the preferred C compiler command,
|
||||
try
|
||||
|
||||
make -f unix/Makefile generic
|
||||
|
||||
first. If "gcc" is preferred, specify "generic_gcc" instead of
|
||||
"generic". This should work on most systems and automatically
|
||||
selects compilation options based on a set of tests (in
|
||||
unix/configure), including detection of large file support
|
||||
sufficient to enable Zip64 large archive features. If "generic"
|
||||
(or "generic_gcc" if that is used) fail, then one of the special
|
||||
targets given above may work.
|
||||
|
||||
Among other special systems are Cray Unicos, Zilog Zeus and MINIX.
|
||||
|
||||
The optimization settings for many systems should be close, but
|
||||
if you see optimization for your system is not ideal, send in
|
||||
the changes so we can improve it.
|
||||
|
||||
By default, Zip uses the "deflate" compression method. To add
|
||||
the additional optional "bzip2" compression method, see the file
|
||||
bzip2/install.txt. Note that bzip2 support is provided by
|
||||
compiling or linking in the bzip2 library. See the bzip2 site
|
||||
(http://www.bzip.org/) for more on bzip2.
|
||||
|
||||
If you get error messages such as "constant expected" in
|
||||
deflate.c, add -DDYN_ALLOC to CFLAGS in your makefile entry.
|
||||
|
||||
If you have lots of memory, try compiling with -DBIG_MEM. If your
|
||||
system supports mmap(), try compiling with -DMMAP. This generally
|
||||
gives faster compression but uses more memory. See the unix/Makefile
|
||||
entry mmap_gcc for an example.
|
||||
|
||||
If none of these compiles, links, and functions properly on
|
||||
your Unix system, then your system apparently has specific
|
||||
requirements we did not account for. See the file README for how
|
||||
to get help.
|
||||
|
||||
If the appropriate system was selected, then the executables zip,
|
||||
zipnote, zipcloak, and zipsplit will be created. You can copy
|
||||
them to an appropriate directory in the search path using:
|
||||
|
||||
make -f unix/Makefile install
|
||||
|
||||
The defaults are /usr/local/bin for the executables and
|
||||
/usr/local/man/man1 for the manual pages. Change the macros
|
||||
BINDIR and MANDIR in makefile to change these if needed.
|
||||
|
||||
If necessary, add the directory with the Zip executables to your
|
||||
shell's PATH (or "path") variable. (C-shell users may need to
|
||||
use the "rehash" command so csh can find the new command in the
|
||||
path.) You should now be ready to use Zip.
|
||||
|
||||
You can get rid of the now unnecessary source and object files
|
||||
with:
|
||||
|
||||
cd ..
|
||||
rm -r zip30
|
||||
|
||||
This will remove the directory zip30 and its contents created
|
||||
by unzip. You should keep the zip30.zip file around though,
|
||||
in case you need to build it again or want to give it to a
|
||||
colleague.
|
||||
|
||||
You can add the following lines to the file /etc/magic for
|
||||
usage by the 'file' command:
|
||||
|
||||
0 string PK Zip archive
|
||||
>4 byte 011 (at least v0.9 to extract)
|
||||
>4 byte 012 (at least v1.0 to extract)
|
||||
>4 byte 013 (at least v1.1 to extract)
|
||||
>4 byte 024 (at least v2.0 to extract)
|
||||
>4 byte 025 (at least v2.1 to extract)
|
||||
|
||||
|
||||
Installation on other systems
|
||||
|
||||
The steps for installation under VMS, MSDOS, OS/2, NT, Amiga and
|
||||
Atari are similar to the above: first unzip the distribution
|
||||
files into their own directory. The system-dependent files are
|
||||
stored in special subdirectories.
|
||||
|
||||
For all the non-Unix ports which support the creation of "UT" extra
|
||||
fields (these ports contain USE_EF_UT_TIME in the list of optional
|
||||
features displayed with "zip -v"), the timezone environment variable TZ
|
||||
should be set according to the local timezone in order for the -f, -u,
|
||||
-o, and similar options to work correctly. This is not needed for the
|
||||
WIN32 and WinDLL ports, since they get the timezone information from
|
||||
the OS by other means.
|
||||
|
||||
|
||||
MSDOS:
|
||||
|
||||
Do one of:
|
||||
|
||||
make msdos\makefile.msc (Microsoft C 5.1)
|
||||
nmake -f msdos\makefile.msc (Microsoft C 6.0 and newer)
|
||||
make -fmsdos\makefile.bor -DCC_REV=1 (Borland Turbo C++ 1.0)
|
||||
make -fmsdos\makefile.bor (Borland C++ 2.0 and newer)
|
||||
make -fmsdos\makefile.tc (Borland Turbo C 2.0x)
|
||||
make -f msdos/makefile.dj1 (DJGPP v1.12m4)
|
||||
make -f msdos/makefile.dj2 (DJGPP v2.01 and newer)
|
||||
make -f msdos/makefile.emx (gcc/emx 0.9b and newer)
|
||||
make -f os2/makefile.os2 gccdos (gcc/emx 0.9b and newer)
|
||||
wmake -f msdos\makefile.wat (Watcom C 11.x 16-bit)
|
||||
wmake -f msdos\makefile.wat PM=1 (Watcom C 11.x 32-bit, PMODE/W)
|
||||
|
||||
for Microsoft, Borland C++ and Turbo C, Watcom C/C++ and the various
|
||||
free GNU C implementations, respectively. More detailed instructions
|
||||
can be found in the respective makefiles.
|
||||
|
||||
|
||||
WIN32 (Windows NT/2K/XP/2K3 and Windows 95/98/ME):
|
||||
|
||||
Supported compilers are Microsoft Visual C++, Borland C++, Watcom C/C++,
|
||||
and miscellaneous free GNU C implementations (gcc/mingw, CygWin, ...).
|
||||
The makefiles supplied in the win32/ subdirectory contain further
|
||||
information.
|
||||
|
||||
|
||||
Windows DLL (WIN32):
|
||||
|
||||
Supported environments are Visual C++ (32-bit only, 5.x and newer).
|
||||
For instructions how to build the DLLs and where find the makefiles,
|
||||
look into windll/contents.
|
||||
|
||||
|
||||
OS/2:
|
||||
|
||||
Type
|
||||
|
||||
{make} -f os2/makefile.os2
|
||||
|
||||
to get a list of supported targets/compiling environments.
|
||||
(replace "{make}" with the name of your OS/2 make utility.)
|
||||
|
||||
To initiate the actual compiling process, you have to specify
|
||||
a system target:
|
||||
|
||||
{make} -f os2/makefile.os2 {system}
|
||||
|
||||
An example: type
|
||||
|
||||
nmake -f os2/makefile.os2 msc
|
||||
|
||||
for Microsoft C 6.00.
|
||||
|
||||
|
||||
VMS (OpenVMS):
|
||||
|
||||
The most complete information on building and installing Zip on VMS
|
||||
is in [.vms]install_vms.txt. Optimists in a hurry may wish to try
|
||||
commands like these:
|
||||
|
||||
@ [.VMS]BUILD_ZIP.COM
|
||||
or:
|
||||
MMS /DESCRIP = [.VMS]DESCRIP.MMS CLEAN ! Or MMK ...
|
||||
MMS /DESCRIP = [.VMS]DESCRIP.MMS ! Or MMK ...
|
||||
|
||||
When the executables have been created (or located if already installed),
|
||||
most users define foreign command symbols for the Zip executables, like
|
||||
this:
|
||||
|
||||
ZIP :== $ dev:[dir]ZIP.EXE ! UNIX-like command line.
|
||||
or:
|
||||
ZIP :== $ dev:[dir]ZIP_CLI.EXE ! VMS-like command line.
|
||||
|
||||
Such symbol definitions are often added to a user's
|
||||
SYS$LOGIN:LOGIN.COM procedure, or to a common, site-specific
|
||||
procedure, like SYS$MANAGER:SYLOGIN.COM.
|
||||
|
||||
Additional installation options are described in install_vms.txt.
|
||||
|
||||
The builders create help text files, ZIP.HLP and ZIP_CLI.HLP. Also
|
||||
see install_vms.txt for how to create the help libraries.
|
||||
|
||||
|
||||
Mac OS:
|
||||
|
||||
Mac OS X is part of the Unix port, so use the Unix installation above.
|
||||
|
||||
Mac OS before Mac OS X use the Mac OS port, though little testing has
|
||||
been done for that port recently. See macos/README.TXT for more on
|
||||
this port.
|
||||
|
||||
|
||||
Compiler Flags
|
||||
|
||||
Zip should compile fine out of the box for your port. In particular,
|
||||
for Unix the command
|
||||
make -f unix/Makefile generic
|
||||
should automatically detect the features available on your system and
|
||||
set the flags appropriately. In some cases, however, you may need to
|
||||
set one or more compiler flags yourself to get Zip to compile or to
|
||||
add features you want or remove features that cause trouble for your
|
||||
port. Below are the more common compiler macros you can set.
|
||||
|
||||
LARGE_FILE_SUPPORT
|
||||
Tell Zip that the OS supports large files (generally files larger
|
||||
than 4 GB). Zip will try to compile in the large file calls
|
||||
(typically 64-bit) for the OS instead of using the standard
|
||||
(typically 32-bit) file calls. On Unix Zip tries to switch over to
|
||||
the 64-bit file environment. If setting this flag causes errors
|
||||
or Zip still can't handle large files on that port, then probably
|
||||
either Zip doesn't have the code to support large files on your OS
|
||||
(write a patch and send it in to us) or your OS doesn't support large
|
||||
files.
|
||||
|
||||
Note that the flag ZIP64_SUPPORT must also be set to create archives
|
||||
with large files.
|
||||
|
||||
This flag should be set automatically on Unix, Win32, and some
|
||||
other ports. Setting NO_LARGE_FILE_SUPPORT turns this flag off.
|
||||
|
||||
ZIP64_SUPPORT
|
||||
Enable the Zip64 code in Zip that supports the Zip64 extensions noted
|
||||
in the PKWare AppNote. These extensions allow storing files larger
|
||||
than 4 GB in archives and the creating of archives larger than 4 GB.
|
||||
They also allow storing more than 64K files in an archive. Currently
|
||||
Zip does not handle archives of PKZip version 4.5 or later unless
|
||||
this flag is set.
|
||||
|
||||
To enable large file support in Zip, you generally need to set both
|
||||
LARGE_FILE_SUPPORT (to read and write large files) and ZIP64_SUPPORT
|
||||
(to store them in and read them from archives). Files larger than
|
||||
4 GB may be invisible to Zip (directory scans don't see them) if
|
||||
LARGE_FILE_SUPPORT is not enabled.
|
||||
|
||||
Keeping LARGE_FILE_SUPPORT and ZIP64_SUPPORT separate allows easier
|
||||
debugging of these features. When testing large file support on an
|
||||
OS, first set just LARGE_FILE_SUPPORT to test the file calls (all
|
||||
should compile and work as before with small files), then turn on
|
||||
ZIP64_SUPPORT to let Zip recognize and handle large files.
|
||||
|
||||
This flag should be set automatically on most ports if
|
||||
LARGE_FILE_SUPPORT is set. Setting NO_ZIP64_SUPPORT turns this flag
|
||||
off.
|
||||
|
||||
UNICODE_SUPPORT
|
||||
Enable storing and using UTF-8 paths. These paths are stored in
|
||||
a backward-compatible way so that archives with UTF-8 paths still
|
||||
work on zips and unzips that don't support Unicode. This support
|
||||
follows the recent additions to the PKWare AppNote for Unicode
|
||||
support, except that Unicode comments on systems where UTF-8 is
|
||||
not the current character set is not implemented in this release.
|
||||
|
||||
On some ports UNICODE_SUPPORT is set automatically if wide characters
|
||||
are supported. Setting NO_UNICODE_SUPPORT turns off this flag.
|
||||
|
||||
USE_EF_UT_TIME
|
||||
Enables storing UT time in an extra field. This becomes useful
|
||||
for ports that normally store file times as local time, resulting
|
||||
in problems when files are moved across time zones and when
|
||||
there are daylight savings time changes. Zip and UnZip will
|
||||
automatically correct for time zone changes when UT time is stored.
|
||||
|
||||
This is usually set by default. Use NO_EF_UT_TIME to turn this off.
|
||||
|
||||
NTSD_EAS (Win32 only)
|
||||
Enable storing Windows NT file security descriptors. This allows
|
||||
restoring the descriptors (file ACL's, etc.).
|
||||
|
||||
This is on by default for Win32. Use NO_NTSD_EAS to turn this off.
|
||||
|
||||
BZIP2_SUPPORT
|
||||
Enable compressing zip entries using the bzip2 library. You must get
|
||||
the bzip2 library from somewhere else as we only provide a way to
|
||||
compile or link the library in and compress files using bzip2. Enables
|
||||
a new compression method, bzip2, that can be used instead of the default
|
||||
Zip compression method deflate.
|
||||
|
||||
This flag is set on Unix, including Mac OS X, when compiling using
|
||||
generic if the bzip2 library is found. Set on Win32 if the bzip2
|
||||
projects are used. See the VMS documentation for when VMS sets this
|
||||
flag. Setting NO_BZIP2_SUPPORT turns this off.
|
||||
|
||||
See bzip2/install.txt for more on installing bzip2 support.
|
||||
|
||||
WIN32_OEM (Win32 only)
|
||||
Enable saving paths on Win32 in the OEM character set. Zip has stored
|
||||
paths using the standard ANSI local character set, but other zips have
|
||||
used the OEM character set on MSDOS and Win32. This flag should make
|
||||
Zip more compatible with other DOS and Win32 zips and unzips. It also
|
||||
enables the translation of OEM paths in DOS archives to ANSI and should
|
||||
eliminate some problems with funny characters showing up in path names.
|
||||
|
||||
If Unicode is enabled and used, Unicode paths generally override
|
||||
local paths using OEM character sets.
|
||||
|
||||
This flag is on by default on most Win32 ports. Some ports apparently
|
||||
have problems with OEM conversions. If your port or compiler does
|
||||
funny things with file names, you may want to turn this off. Defining
|
||||
NO_WIN32_OEM turns this flag off.
|
||||
|
||||
NO_STREAMING_STORE
|
||||
Because storing zip archives inside a zip entry adds "false" signatures
|
||||
and this causes problems when using data descriptors if the archive
|
||||
needs fixing, this option is provided to force deflating when streaming.
|
||||
This version of Zip includes an advanced algorithm for correctly finding
|
||||
these signatures, but if an archive is "broke", there is no telling
|
||||
what's where. This is only a problem if an archive becomes broke for
|
||||
some reason, but to be safe define this.
|
||||
|
||||
ALLOW_REGEX
|
||||
For MSDOS and Windows, now "[list]" wildcard matching (where any
|
||||
character between [ and ] can be used to match the character at that
|
||||
position) is turned off unless the new -RE option is used. Defining
|
||||
this flag forces "[list]" matching to be always on as in previous
|
||||
releases.
|
||||
|
||||
|
||||
For command help on any of the zip* utilities, simply enter
|
||||
the name with no arguments.
|
719
third_party/infozip/zip/api.c
vendored
719
third_party/infozip/zip/api.c
vendored
|
@ -1,719 +0,0 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
api.c - Zip 3
|
||||
|
||||
Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2007-Mar-4 or later
|
||||
(the contents of which are also included in zip.h) for terms of use.
|
||||
If, for some reason, all these files are missing, the Info-ZIP license
|
||||
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
|
||||
*/
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
api.c
|
||||
|
||||
This module supplies a Zip dll engine for use directly from C/C++
|
||||
programs.
|
||||
|
||||
The entry points are:
|
||||
|
||||
ZpVer *ZpVersion(void);
|
||||
int EXPENTRY ZpInit(LPZIPUSERFUNCTIONS lpZipUserFunc);
|
||||
int EXPENTRY ZpArchive(ZCL C, LPZPOPT Opts);
|
||||
|
||||
This module is currently only used by the Windows dll, and is not used at
|
||||
all by any of the other platforms, although it should be easy enough to
|
||||
implement this on most platforms.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
#define __API_C
|
||||
|
||||
#include <malloc.h>
|
||||
#ifdef WINDLL
|
||||
# include <windows.h>
|
||||
# include "windll/windll.h"
|
||||
#endif
|
||||
|
||||
#ifdef OS2
|
||||
# define INCL_DOSMEMMGR
|
||||
# include <os2.h>
|
||||
#endif
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#include <dir.h>
|
||||
#endif
|
||||
#include <direct.h>
|
||||
#include <ctype.h>
|
||||
#include "api.h" /* this includes zip.h */
|
||||
#include "crypt.h"
|
||||
#include "revision.h"
|
||||
#ifdef USE_ZLIB
|
||||
# include "zlib.h"
|
||||
#endif
|
||||
|
||||
|
||||
DLLPRNT *lpZipPrint;
|
||||
DLLPASSWORD *lpZipPassword;
|
||||
extern DLLCOMMENT *lpComment;
|
||||
ZIPUSERFUNCTIONS ZipUserFunctions, far * lpZipUserFunctions;
|
||||
|
||||
int ZipRet;
|
||||
char szOrigDir[PATH_MAX];
|
||||
BOOL fNo_int64 = FALSE; /* flag for DLLSERVICE_NO_INT64 */
|
||||
|
||||
/* Local forward declarations */
|
||||
extern int zipmain OF((int, char **));
|
||||
int AllocMemory(unsigned int, char *, char *, BOOL);
|
||||
int ParseString(LPSTR, unsigned int);
|
||||
void FreeArgVee(void);
|
||||
|
||||
ZPOPT Options;
|
||||
char **argVee;
|
||||
unsigned int argCee;
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Local functions
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
char szRootDir[PATH_MAX], szExcludeList[PATH_MAX], szIncludeList[PATH_MAX], szTempDir[PATH_MAX];
|
||||
|
||||
int ParseString(LPSTR s, unsigned int ArgC)
|
||||
{
|
||||
unsigned int i;
|
||||
int root_flag, m, j;
|
||||
char *str1, *str2, *str3;
|
||||
size_t size;
|
||||
|
||||
i = ArgC;
|
||||
str1 = (char *) malloc(lstrlen(s)+4);
|
||||
lstrcpy(str1, s);
|
||||
lstrcat(str1, " @");
|
||||
|
||||
if ((szRootDir != NULL) && (szRootDir[0] != '\0'))
|
||||
{
|
||||
root_flag = TRUE;
|
||||
if (szRootDir[lstrlen(szRootDir)-1] != '\\')
|
||||
lstrcat(szRootDir, "\\");
|
||||
}
|
||||
else
|
||||
root_flag = FALSE;
|
||||
|
||||
str2 = strchr(str1, '\"'); /* get first occurance of double quote */
|
||||
|
||||
while ((str3 = strchr(str1, '\t')) != NULL)
|
||||
{
|
||||
str3[0] = ' '; /* Change tabs into a single space */
|
||||
}
|
||||
|
||||
/* Note that if a quoted string contains multiple adjacent spaces, they
|
||||
will not be removed, because they could well point to a valid
|
||||
folder/file name.
|
||||
*/
|
||||
while ((str2 = strchr(str1, '\"')) != NULL)
|
||||
/* Found a double quote if not NULL */
|
||||
{
|
||||
str3 = strchr(str2+1, '\"'); /* Get the second quote */
|
||||
if (str3 == NULL)
|
||||
{
|
||||
free(str1);
|
||||
return ZE_PARMS; /* Something is screwy with the
|
||||
string, bail out */
|
||||
}
|
||||
str3[0] = '\0'; /* terminate str2 with a NULL */
|
||||
|
||||
/* strip unwanted fully qualified path from entry */
|
||||
if (root_flag)
|
||||
if ((_strnicmp(szRootDir, str2+1, lstrlen(szRootDir))) == 0)
|
||||
{
|
||||
m = 0;
|
||||
str2++;
|
||||
for (j = lstrlen(szRootDir); j < lstrlen(str2); j++)
|
||||
str2[m++] = str2[j];
|
||||
str2[m] = '\0';
|
||||
str2--;
|
||||
}
|
||||
size = _msize(argVee);
|
||||
if ((argVee = (char **)realloc(argVee, size + sizeof(char *))) == NULL)
|
||||
{
|
||||
fprintf(stdout, "Unable to allocate memory in zip dll\n");
|
||||
return ZE_MEM;
|
||||
}
|
||||
/* argCee is incremented in AllocMemory */
|
||||
if (AllocMemory(i, str2+1, "Creating file list from string", TRUE) != ZE_OK)
|
||||
{
|
||||
free(str1);
|
||||
return ZE_MEM;
|
||||
}
|
||||
i++;
|
||||
str3+=2; /* Point past the whitespace character */
|
||||
str2[0] = '\0'; /* Terminate str1 */
|
||||
lstrcat(str1, str3);
|
||||
} /* end while */
|
||||
|
||||
/* points to first occurance of a space */
|
||||
str2 = strchr(str1, ' ');
|
||||
|
||||
/* Go through the string character by character, looking for instances
|
||||
of two spaces together. Terminate when you find the trailing @
|
||||
*/
|
||||
while ((str2[0] != '\0') && (str2[0] != '@'))
|
||||
{
|
||||
while ((str2[0] == ' ') && (str2[1] == ' '))
|
||||
{
|
||||
str3 = &str2[1];
|
||||
str2[0] = '\0';
|
||||
lstrcat(str1, str3);
|
||||
}
|
||||
str2++;
|
||||
}
|
||||
|
||||
/* Do we still have a leading space? */
|
||||
if (str1[0] == ' ')
|
||||
{
|
||||
str3 = &str1[1];
|
||||
lstrcpy(str1, str3); /* Dump the leading space */
|
||||
}
|
||||
|
||||
|
||||
/* Okay, now we have gotten rid of any tabs and replaced them with
|
||||
spaces, and have replaced multiple spaces with a single space. We
|
||||
couldn't do this before because the folder names could have actually
|
||||
contained these characters.
|
||||
*/
|
||||
|
||||
str2 = str3 = str1;
|
||||
|
||||
while ((str2[0] != '\0') && (str3[0] != '@'))
|
||||
{
|
||||
str3 = strchr(str2+1, ' ');
|
||||
str3[0] = '\0';
|
||||
/* strip unwanted fully qualified path from entry */
|
||||
if (root_flag)
|
||||
if ((_strnicmp(szRootDir, str2, lstrlen(szRootDir))) == 0)
|
||||
{
|
||||
m = 0;
|
||||
for (j = lstrlen(Options.szRootDir); j < lstrlen(str2); j++)
|
||||
str2[m++] = str2[j];
|
||||
str2[m] = '\0';
|
||||
}
|
||||
size = _msize(argVee);
|
||||
if ((argVee = (char **)realloc(argVee, size + sizeof(char *))) == NULL)
|
||||
{
|
||||
fprintf(stdout, "Unable to allocate memory in zip dll\n");
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (AllocMemory(i, str2, "Creating file list from string", TRUE) != ZE_OK)
|
||||
{
|
||||
free(str1);
|
||||
return ZE_MEM;
|
||||
}
|
||||
i++;
|
||||
str3++;
|
||||
str2 = str3;
|
||||
}
|
||||
free(str1);
|
||||
return ZE_OK;
|
||||
}
|
||||
|
||||
int AllocMemory(unsigned int i, char *cmd, char *str, BOOL IncrementArgCee)
|
||||
{
|
||||
if ((argVee[i] = (char *) malloc( sizeof(char) * strlen(cmd)+1 )) == NULL)
|
||||
{
|
||||
if (IncrementArgCee)
|
||||
argCee++;
|
||||
FreeArgVee();
|
||||
fprintf(stdout, "Unable to allocate memory in zip library at %s\n", str);
|
||||
return ZE_MEM;
|
||||
}
|
||||
strcpy( argVee[i], cmd );
|
||||
argCee++;
|
||||
return ZE_OK;
|
||||
}
|
||||
|
||||
void FreeArgVee(void)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
/* Free the arguments in the array */
|
||||
for (i = 0; i < argCee; i++)
|
||||
{
|
||||
free (argVee[i]);
|
||||
argVee[i] = NULL;
|
||||
}
|
||||
/* Then free the array itself */
|
||||
free(argVee);
|
||||
|
||||
/* Restore the original working directory */
|
||||
chdir(szOrigDir);
|
||||
#ifdef __BORLANDC__
|
||||
setdisk(toupper(szOrigDir[0]) - 'A');
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Documented API entry points
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
int EXPENTRY ZpInit(LPZIPUSERFUNCTIONS lpZipUserFunc)
|
||||
{
|
||||
ZipUserFunctions = *lpZipUserFunc;
|
||||
lpZipUserFunctions = &ZipUserFunctions;
|
||||
|
||||
if (!lpZipUserFunctions->print ||
|
||||
!lpZipUserFunctions->comment)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int EXPENTRY ZpArchive(ZCL C, LPZPOPT Opts)
|
||||
/* Add, update, freshen, or delete zip entries in a zip file. See the
|
||||
command help in help() zip.c */
|
||||
{
|
||||
int k, j, m;
|
||||
size_t size;
|
||||
|
||||
Options = *Opts; /* Save off options, and make them available locally */
|
||||
szRootDir[0] = '\0';
|
||||
szExcludeList[0] = '\0';
|
||||
szIncludeList[0] = '\0';
|
||||
szTempDir[0] = '\0';
|
||||
if (Options.szRootDir) lstrcpy(szRootDir, Options.szRootDir);
|
||||
if (Options.szExcludeList) lstrcpy(szExcludeList, Options.szExcludeList);
|
||||
if (Options.szIncludeList) lstrcpy(szIncludeList, Options.szIncludeList);
|
||||
if (Options.szTempDir) lstrcpy(szTempDir, Options.szTempDir);
|
||||
|
||||
getcwd(szOrigDir, PATH_MAX); /* Save current drive and directory */
|
||||
|
||||
if ((szRootDir != NULL) && (szRootDir[0] != '\0'))
|
||||
{
|
||||
/* Make sure there isn't a trailing slash */
|
||||
if (szRootDir[lstrlen(szRootDir)-1] == '\\')
|
||||
szRootDir[lstrlen(szRootDir)-1] = '\0';
|
||||
|
||||
chdir(szRootDir);
|
||||
#ifdef __BORLANDC__
|
||||
setdisk(toupper(szRootDir[0]) - 'A');
|
||||
#endif
|
||||
}
|
||||
|
||||
argCee = 0;
|
||||
|
||||
/* malloc additional 40 to allow for additional command line arguments. Note
|
||||
that we are also adding in the count for the include lists as well as the
|
||||
exclude list. */
|
||||
if ((argVee = (char **)malloc((C.argc+40)*sizeof(char *))) == NULL)
|
||||
{
|
||||
fprintf(stdout, "Unable to allocate memory in zip dll\n");
|
||||
return ZE_MEM;
|
||||
}
|
||||
if ((argVee[argCee] = (char *) malloc( sizeof(char) * strlen("wiz.exe")+1 )) == NULL)
|
||||
{
|
||||
free(argVee);
|
||||
fprintf(stdout, "Unable to allocate memory in zip dll\n");
|
||||
return ZE_MEM;
|
||||
}
|
||||
strcpy( argVee[argCee], "wiz.exe" );
|
||||
argCee++;
|
||||
|
||||
|
||||
/* Set compression level efficacy -0...-9 */
|
||||
if (AllocMemory(argCee, "-0", "Compression", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
|
||||
/* Check to see if the compression level is set to a valid value. If
|
||||
not, then set it to the default.
|
||||
*/
|
||||
if ((Options.fLevel < '0') || (Options.fLevel > '9'))
|
||||
{
|
||||
Options.fLevel = '6';
|
||||
if (!Options.fDeleteEntries)
|
||||
fprintf(stdout, "Compression level set to invalid value. Setting to default\n");
|
||||
}
|
||||
|
||||
argVee[argCee-1][1] = Options.fLevel;
|
||||
|
||||
if (Options.fOffsets) /* Update offsets for SFX prefix */
|
||||
{
|
||||
if (AllocMemory(argCee, "-A", "Offsets", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.fDeleteEntries) /* Delete files from zip file -d */
|
||||
{
|
||||
if (AllocMemory(argCee, "-d", "Delete", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.fNoDirEntries) /* Do not add directory entries -D */
|
||||
{
|
||||
if (AllocMemory(argCee, "-D", "No Dir Entries", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.fFreshen) /* Freshen zip file--overwrite only -f */
|
||||
{
|
||||
if (AllocMemory(argCee, "-f", "Freshen", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.fRepair) /* Fix archive -F or -FF */
|
||||
{
|
||||
if (Options.fRepair == 1)
|
||||
{
|
||||
if (AllocMemory(argCee, "-F", "Repair", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AllocMemory(argCee, "-FF", "Repair", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
}
|
||||
if (Options.fGrow) /* Allow appending to a zip file -g */
|
||||
{
|
||||
if (AllocMemory(argCee, "-g", "Appending", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.fJunkDir) /* Junk directory names -j */
|
||||
{
|
||||
if (AllocMemory(argCee, "-j", "Junk Dir Names", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.fEncrypt) /* encrypt -e */
|
||||
{
|
||||
if (AllocMemory(argCee, "-e", "Encrypt", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.fJunkSFX) /* Junk sfx prefix */
|
||||
{
|
||||
if (AllocMemory(argCee, "-J", "Junk SFX", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
|
||||
if (Options.fForce) /* Make entries using DOS names (k for Katz) -k */
|
||||
{
|
||||
if (AllocMemory(argCee, "-k", "Force DOS", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
|
||||
if (Options.fLF_CRLF) /* Translate LF_CRLF -l */
|
||||
{
|
||||
if (AllocMemory(argCee, "-l", "LF-CRLF", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.fCRLF_LF) /* Translate CR/LF to LF -ll */
|
||||
{
|
||||
if (AllocMemory(argCee, "-ll", "CRLF-LF", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.fMove) /* Delete files added to or updated in zip file -m */
|
||||
{
|
||||
if (AllocMemory(argCee, "-m", "Move", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
|
||||
if (Options.fLatestTime) /* Set zip file time to time of latest file in it -o */
|
||||
{
|
||||
if (AllocMemory(argCee, "-o", "Time", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
|
||||
if (Options.fComment) /* Add archive comment "-z" */
|
||||
{
|
||||
if (AllocMemory(argCee, "-z", "Comment", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
|
||||
if (Options.fQuiet) /* quiet operation -q */
|
||||
{
|
||||
if (AllocMemory(argCee, "-q", "Quiet", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.fRecurse == 1) /* recurse into subdirectories -r */
|
||||
{
|
||||
if (AllocMemory(argCee, "-r", "Recurse -r", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
else if (Options.fRecurse == 2) /* recurse into subdirectories -R */
|
||||
{
|
||||
if (AllocMemory(argCee, "-R", "Recurse -R", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.fSystem) /* include system and hidden files -S */
|
||||
{
|
||||
if (AllocMemory(argCee, "-S", "System", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.fExcludeDate) /* Exclude files newer than specified date -tt */
|
||||
{
|
||||
if ((Options.Date != NULL) && (Options.Date[0] != '\0'))
|
||||
{
|
||||
if (AllocMemory(argCee, "-tt", "Date", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
if (AllocMemory(argCee, Options.Date, "Date", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
}
|
||||
|
||||
if (Options.fIncludeDate) /* include files newer than specified date -t */
|
||||
{
|
||||
if ((Options.Date != NULL) && (Options.Date[0] != '\0'))
|
||||
{
|
||||
if (AllocMemory(argCee, "-t", "Date", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
if (AllocMemory(argCee, Options.Date, "Date", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
}
|
||||
|
||||
if (Options.fUpdate) /* Update zip file--overwrite only if newer -u */
|
||||
{
|
||||
if (AllocMemory(argCee, "-u", "Update", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.fVerbose) /* Mention oddities in zip file structure -v */
|
||||
{
|
||||
if (AllocMemory(argCee, "-v", "Verbose", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.fVolume) /* Include volume label -$ */
|
||||
{
|
||||
if (AllocMemory(argCee, "-$", "Volume", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.szSplitSize != NULL) /* Turn on archive splitting */
|
||||
{
|
||||
if (AllocMemory(argCee, "-s", "Splitting", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
if (AllocMemory(argCee, Options.szSplitSize, "Split size", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (lpZipUserFunctions->split != NULL) /* Turn on archive split destinations select */
|
||||
{
|
||||
if (AllocMemory(argCee, "-sp", "Split Pause Select Destination", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
#ifdef WIN32
|
||||
if (Options.fPrivilege) /* Use privileges -! */
|
||||
{
|
||||
if (AllocMemory(argCee, "-!", "Privileges", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
#endif
|
||||
if (Options.fExtra) /* Exclude extra attributes -X */
|
||||
{
|
||||
if (AllocMemory(argCee, "-X", "Extra", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.IncludeList != NULL) /* Include file list -i */
|
||||
{
|
||||
if (AllocMemory(argCee, "-i", "Include file list", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
k = 0;
|
||||
if (Options.IncludeListCount > 0)
|
||||
while ((Options.IncludeList[k] != NULL) && (Options.IncludeListCount != k+1))
|
||||
{
|
||||
size = _msize(argVee);
|
||||
if ((argVee = (char **)realloc(argVee, size + sizeof(char *))) == NULL)
|
||||
{
|
||||
fprintf(stdout, "Unable to allocate memory in zip dll\n");
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (AllocMemory(argCee, Options.IncludeList[k], "Include file list array", TRUE) != ZE_OK)
|
||||
{
|
||||
return ZE_MEM;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
else
|
||||
while (Options.IncludeList[k] != NULL)
|
||||
{
|
||||
size = _msize(argVee);
|
||||
if ((argVee = (char **)realloc(argVee, size + sizeof(char *))) == NULL)
|
||||
{
|
||||
FreeArgVee();
|
||||
fprintf(stdout, "Unable to allocate memory in zip dll\n");
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (AllocMemory(argCee, Options.IncludeList[k], "Include file list array", TRUE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
k++;
|
||||
}
|
||||
|
||||
if (AllocMemory(argCee, "@", "End of Include List", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (Options.ExcludeList != NULL) /* Exclude file list -x */
|
||||
{
|
||||
if (AllocMemory(argCee, "-x", "Exclude file list", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
k = 0;
|
||||
if (Options.ExcludeListCount > 0)
|
||||
while ((Options.ExcludeList[k] != NULL) && (Options.ExcludeListCount != k+1))
|
||||
{
|
||||
size = _msize(argVee);
|
||||
if ((argVee = (char **)realloc(argVee, size + sizeof(char *))) == NULL)
|
||||
{
|
||||
fprintf(stdout, "Unable to allocate memory in zip dll\n");
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (AllocMemory(argCee, Options.ExcludeList[k], "Exclude file list array", TRUE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
k++;
|
||||
}
|
||||
else
|
||||
while (Options.ExcludeList[k] != NULL)
|
||||
{
|
||||
size = _msize(argVee);
|
||||
if ((argVee = (char **)realloc(argVee, size + sizeof(char *))) == NULL)
|
||||
{
|
||||
FreeArgVee();
|
||||
fprintf(stdout, "Unable to allocate memory in zip dll\n");
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (AllocMemory(argCee, Options.ExcludeList[k], "Exclude file list array", TRUE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
k++;
|
||||
}
|
||||
if (AllocMemory(argCee, "@", "End of Exclude List", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
|
||||
if (szIncludeList != NULL && szIncludeList[0] != '\0') /* Include file list -i */
|
||||
{
|
||||
if (AllocMemory(argCee, "-i", "Include file list", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
if ((k = ParseString(szIncludeList, argCee)) != ZE_OK)
|
||||
return k; /* Something was screwy with the parsed string
|
||||
bail out */
|
||||
if (AllocMemory(argCee, "@", "End of Include List", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
if (szExcludeList != NULL && szExcludeList[0] != '\0') /* Exclude file list -x */
|
||||
{
|
||||
if (AllocMemory(argCee, "-x", "Exclude file list", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
|
||||
if ((k = ParseString(szExcludeList, argCee)) != ZE_OK)
|
||||
return k; /* Something was screwy with the parsed string
|
||||
bail out */
|
||||
|
||||
if (AllocMemory(argCee, "@", "End of Exclude List", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
|
||||
if ((szTempDir != NULL) && (szTempDir[0] != '\0')
|
||||
&& Options.fTemp) /* Use temporary directory -b */
|
||||
{
|
||||
if (AllocMemory(argCee, "-b", "Temp dir switch command", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
if (AllocMemory(argCee, szTempDir, "Temporary directory", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
|
||||
if (AllocMemory(argCee, C.lpszZipFN, "Zip file name", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
|
||||
if ((szRootDir != NULL) && (szRootDir[0] != '\0'))
|
||||
{
|
||||
if (szRootDir[lstrlen(szRootDir)-1] != '\\')
|
||||
lstrcat(szRootDir, "\\"); /* append trailing \\ */
|
||||
if (C.FNV != NULL)
|
||||
{
|
||||
for (k = 0; k < C.argc; k++)
|
||||
{
|
||||
if (AllocMemory(argCee, C.FNV[k], "Making argv", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
if ((_strnicmp(szRootDir, C.FNV[k], lstrlen(szRootDir))) == 0)
|
||||
{
|
||||
m = 0;
|
||||
for (j = lstrlen(szRootDir); j < lstrlen(C.FNV[k]); j++)
|
||||
argVee[argCee-1][m++] = C.FNV[k][j];
|
||||
argVee[argCee-1][m] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
if (C.FNV != NULL)
|
||||
for (k = 0; k < C.argc; k++)
|
||||
{
|
||||
if (AllocMemory(argCee, C.FNV[k], "Making argv", FALSE) != ZE_OK)
|
||||
return ZE_MEM;
|
||||
}
|
||||
|
||||
if (C.lpszAltFNL != NULL)
|
||||
{
|
||||
if ((k = ParseString(C.lpszAltFNL, argCee)) != ZE_OK)
|
||||
return k; /* Something was screwy with the parsed string
|
||||
bail out
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
argVee[argCee] = NULL;
|
||||
|
||||
ZipRet = zipmain(argCee, argVee);
|
||||
|
||||
/* Free the arguments in the array. Note this also restores the
|
||||
current directory
|
||||
*/
|
||||
FreeArgVee();
|
||||
|
||||
return ZipRet;
|
||||
}
|
||||
|
||||
#if CRYPT
|
||||
int encr_passwd(int modeflag, char *pwbuf, int size, const char *zfn)
|
||||
{
|
||||
return (*lpZipUserFunctions->password)(pwbuf, size, ((modeflag == ZP_PW_VERIFY) ?
|
||||
"Verify password: " : "Enter password: "),
|
||||
(char *)zfn);
|
||||
}
|
||||
#endif /* CRYPT */
|
||||
|
||||
void EXPENTRY ZpVersion(ZpVer far * p) /* should be pointer to const struct */
|
||||
{
|
||||
p->structlen = ZPVER_LEN;
|
||||
|
||||
#ifdef BETA
|
||||
p->flag = 1;
|
||||
#else
|
||||
p->flag = 0;
|
||||
#endif
|
||||
#ifdef CRYPT
|
||||
p->fEncryption = TRUE;
|
||||
#else
|
||||
p->fEncryption = FALSE;
|
||||
#endif
|
||||
lstrcpy(p->betalevel, Z_BETALEVEL);
|
||||
lstrcpy(p->date, REVDATE);
|
||||
|
||||
#ifdef ZLIB_VERSION
|
||||
lstrcpy(p->zlib_version, ZLIB_VERSION);
|
||||
p->flag |= 2;
|
||||
#else
|
||||
p->zlib_version[0] = '\0';
|
||||
#endif
|
||||
|
||||
#ifdef ZIP64_SUPPORT
|
||||
p->flag |= 4; /* Flag that ZIP64 was compiled in. */
|
||||
#endif
|
||||
|
||||
p->zip.major = Z_MAJORVER;
|
||||
p->zip.minor = Z_MINORVER;
|
||||
p->zip.patchlevel = Z_PATCHLEVEL;
|
||||
|
||||
#ifdef OS2
|
||||
p->os2dll.major = D2_MAJORVER;
|
||||
p->os2dll.minor = D2_MINORVER;
|
||||
p->os2dll.patchlevel = D2_PATCHLEVEL;
|
||||
#endif
|
||||
#ifdef WINDLL
|
||||
p->windll.major = DW_MAJORVER;
|
||||
p->windll.minor = DW_MINORVER;
|
||||
p->windll.patchlevel = DW_PATCHLEVEL;
|
||||
#endif
|
||||
}
|
3
third_party/infozip/zip/crc32.c
vendored
3
third_party/infozip/zip/crc32.c
vendored
|
@ -22,6 +22,7 @@
|
|||
|
||||
#define __CRC32_C /* identifies this source module */
|
||||
|
||||
#include "libc/nexgen32e/crc32.h"
|
||||
#include "third_party/infozip/zip/zip.h"
|
||||
|
||||
#if (!defined(USE_ZLIB) || defined(USE_OWN_CRCTAB))
|
||||
|
@ -686,6 +687,8 @@ ulg crc32(crc, buf, len)
|
|||
pointer, then initialize the crc shift register contents instead.
|
||||
Return the current crc in either case. */
|
||||
{
|
||||
return crc32_z(crc,buf,len);
|
||||
|
||||
register z_uint4 c;
|
||||
register ZCONST ulg near *crc_32_tab;
|
||||
|
||||
|
|
304
third_party/infozip/zip/crc_i386.S
vendored
304
third_party/infozip/zip/crc_i386.S
vendored
|
@ -1,304 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in zip.h) for terms of use.
|
||||
If, for some reason, all these files are missing, the Info-ZIP license
|
||||
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
|
||||
*/
|
||||
/*
|
||||
* crc_i386.S, optimized CRC calculation function for Zip and UnZip,
|
||||
* created by Paul Kienitz and Christian Spieler. Last revised 07 Jan 2007.
|
||||
*
|
||||
* GRR 961110: incorporated Scott Field optimizations from win32/crc_i386.asm
|
||||
* => overall 6% speedup in "unzip -tq" on 9MB zipfile (486-66)
|
||||
*
|
||||
* SPC 970402: revised for Rodney Brown's optimizations (32-bit-wide
|
||||
* aligned reads for most of the data from buffer), can be
|
||||
* disabled by defining the macro NO_32_BIT_LOADS
|
||||
*
|
||||
* SPC 971012: added Rodney Brown's additional tweaks for 32-bit-optimized
|
||||
* CPUs (like the Pentium Pro, Pentium II, and probably some
|
||||
* Pentium clones). This optimization is controlled by the
|
||||
* preprocessor switch "__686" and is disabled by default.
|
||||
* (This default is based on the assumption that most users
|
||||
* do not yet work on a Pentium Pro or Pentium II machine ...)
|
||||
*
|
||||
* COS 050116: Enabled the 686 build by default, because there are hardly any
|
||||
* pre-686 CPUs in serious use nowadays. (See SPC 970402 above.)
|
||||
*
|
||||
* SPC 060103: Updated code to incorporate newer optimizations found in zlib.
|
||||
*
|
||||
* SPC 070107: Added conditional switch to deactivate crc32() compilation.
|
||||
*
|
||||
* FLAT memory model assumed. Calling interface:
|
||||
* - args are pushed onto the stack from right to left,
|
||||
* - return value is given in the EAX register,
|
||||
* - all other registers (with exception of EFLAGS) are preserved. (With
|
||||
* GNU C 2.7.x, %edx and %ecx are `scratch' registers, but preserving
|
||||
* them nevertheless adds only 4 single byte instructions.)
|
||||
*
|
||||
* This source generates the function
|
||||
* ulg crc32(ulg crc, ZCONST uch *buf, extent len).
|
||||
*
|
||||
* Loop unrolling can be disabled by defining the macro NO_UNROLLED_LOOPS.
|
||||
* This results in shorter code at the expense of reduced performance.
|
||||
*/
|
||||
|
||||
/* This file is NOT used in conjunction with zlib, or when only creation of
|
||||
* the basic CRC_32_Table (for other purpose) is requested.
|
||||
*/
|
||||
#if !defined(USE_ZLIB) && !defined(CRC_TABLE_ONLY)
|
||||
|
||||
/* Preprocess with -DNO_UNDERLINE if your C compiler does not prefix
|
||||
* external symbols with an underline character '_'.
|
||||
*/
|
||||
#if defined(NO_UNDERLINE) || defined(__ELF__)
|
||||
# define _crc32 crc32
|
||||
# define _get_crc_table get_crc_table
|
||||
#endif
|
||||
/* Use 16-byte alignment if your assembler supports it. Warning: gas
|
||||
* uses a log(x) parameter (.align 4 means 16-byte alignment). On SVR4
|
||||
* the parameter is a number of bytes.
|
||||
*/
|
||||
#ifndef ALIGNMENT
|
||||
# define ALIGNMENT .align 4,0x90
|
||||
#endif
|
||||
|
||||
#if defined(i386) || defined(_i386) || defined(_I386) || defined(__i386)
|
||||
|
||||
/* This version is for 386 Unix, OS/2, MSDOS in 32 bit mode (gcc & gas).
|
||||
* Warning: it uses the AT&T syntax: mov source,dest
|
||||
* This file is only optional. If you want to use the C version,
|
||||
* remove -DASM_CRC from CFLAGS in Makefile and set OBJA to an empty string.
|
||||
*/
|
||||
|
||||
.file "crc_i386.S"
|
||||
|
||||
#if !defined(PRE_686) && !defined(__686)
|
||||
/* Optimize for Pentium Pro and compatible CPUs by default. */
|
||||
# define __686
|
||||
#endif
|
||||
|
||||
#if defined(NO_STD_STACKFRAME) && defined(USE_STD_STACKFRAME)
|
||||
# undef USE_STACKFRAME
|
||||
#else
|
||||
/* The default is to use standard stack frame entry, because it
|
||||
* results in smaller code!
|
||||
*/
|
||||
# ifndef USE_STD_STACKFRAME
|
||||
# define USE_STD_STACKFRAME
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_STD_STACKFRAME
|
||||
# define _STD_ENTRY pushl %ebp ; movl %esp,%ebp
|
||||
# define arg1 8(%ebp)
|
||||
# define arg2 12(%ebp)
|
||||
# define arg3 16(%ebp)
|
||||
# define _STD_LEAVE popl %ebp
|
||||
#else /* !USE_STD_STACKFRAME */
|
||||
# define _STD_ENTRY
|
||||
# define arg1 24(%esp)
|
||||
# define arg2 28(%esp)
|
||||
# define arg3 32(%esp)
|
||||
# define _STD_LEAVE
|
||||
#endif /* ?USE_STD_STACKFRAME */
|
||||
|
||||
/*
|
||||
* These two (three) macros make up the loop body of the CRC32 cruncher.
|
||||
* registers modified:
|
||||
* eax : crc value "c"
|
||||
* esi : pointer to next data byte (or lword) "buf++"
|
||||
* registers read:
|
||||
* edi : pointer to base of crc_table array
|
||||
* scratch registers:
|
||||
* ebx : index into crc_table array
|
||||
* (requires upper three bytes = 0 when __686 is undefined)
|
||||
*/
|
||||
#ifndef __686 /* optimize for 386, 486, Pentium */
|
||||
#define Do_CRC /* c = (c >> 8) ^ table[c & 0xFF] */\
|
||||
movb %al, %bl ;/* tmp = c & 0xFF */\
|
||||
shrl $8, %eax ;/* c = (c >> 8) */\
|
||||
xorl (%edi, %ebx, 4), %eax ;/* c ^= table[tmp] */
|
||||
#else /* __686 : optimize for Pentium Pro and compatible CPUs */
|
||||
#define Do_CRC /* c = (c >> 8) ^ table[c & 0xFF] */\
|
||||
movzbl %al, %ebx ;/* tmp = c & 0xFF */\
|
||||
shrl $8, %eax ;/* c = (c >> 8) */\
|
||||
xorl (%edi, %ebx, 4), %eax ;/* c ^=table[tmp] */
|
||||
#endif /* ?__686 */
|
||||
|
||||
#define Do_CRC_byte /* c = (c >> 8) ^ table[(c^*buf++)&0xFF] */\
|
||||
xorb (%esi), %al ;/* c ^= *buf */\
|
||||
incl %esi ;/* buf++ */\
|
||||
Do_CRC
|
||||
|
||||
#define Do_CRC_byteof(ofs) /* c = (c >> 8) ^ table[(c^*buf++)&0xFF] */\
|
||||
xorb ofs(%esi), %al ;/* c ^= *buf */\
|
||||
incl %esi ;/* buf++ */\
|
||||
Do_CRC
|
||||
|
||||
#ifndef NO_32_BIT_LOADS
|
||||
# ifdef IZ_CRCOPTIM_UNFOLDTBL
|
||||
/* the edx register is needed in crc calculation */
|
||||
# define SavLen arg3
|
||||
# define UpdCRC_lword \
|
||||
movzbl %al, %ebx ; \
|
||||
movl 3072(%edi,%ebx,4), %edx ; \
|
||||
movzbl %ah, %ebx ; \
|
||||
shrl $16, %eax ; \
|
||||
xor 2048(%edi,%ebx,4), %edx ; \
|
||||
movzbl %al, %ebx ; \
|
||||
shrl $8,%eax ; \
|
||||
xorl 1024(%edi,%ebx,4), %edx ; \
|
||||
movl (%edi,%eax,4), %eax ; \
|
||||
xorl %edx,%eax ;
|
||||
# define UpdCRC_lword_sh(dwPtrIncr) \
|
||||
movzbl %al, %ebx ; \
|
||||
movl 3072(%edi,%ebx,4), %edx ; \
|
||||
movzbl %ah, %ebx ; \
|
||||
shrl $16, %eax ; \
|
||||
xor 2048(%edi,%ebx,4), %edx ; \
|
||||
movzbl %al, %ebx ; \
|
||||
addl $4*(dwPtrIncr), %esi ;/* ((ulg *)buf)+=dwPtrIncr */\
|
||||
shrl $8,%eax ; \
|
||||
xorl 1024(%edi,%ebx,4), %edx ; \
|
||||
movl (%edi,%eax,4),%eax ; \
|
||||
xorl %edx,%eax ;
|
||||
# else /* !IZ_CRCOPTIM_UNFOLDTBL */
|
||||
/* the edx register is not needed anywhere else */
|
||||
# define SavLen %edx
|
||||
# define UpdCRC_lword \
|
||||
Do_CRC \
|
||||
Do_CRC \
|
||||
Do_CRC \
|
||||
Do_CRC
|
||||
# define UpdCRC_lword_sh(dwPtrIncr) \
|
||||
Do_CRC \
|
||||
Do_CRC \
|
||||
addl $4*(dwPtrIncr), %esi ;/* ((ulg *)buf)++ */\
|
||||
Do_CRC \
|
||||
Do_CRC
|
||||
# endif /* ?IZ_CRCOPTIM_UNFOLDTBL */
|
||||
#define Do_CRC_lword \
|
||||
xorl (%esi), %eax ;/* c ^= *(ulg *)buf */\
|
||||
UpdCRC_lword_sh(1) /* ... ((ulg *)buf)++ */
|
||||
#define Do_CRC_4lword \
|
||||
xorl (%esi), %eax ;/* c ^= *(ulg *)buf */\
|
||||
UpdCRC_lword \
|
||||
xorl 4(%esi), %eax ;/* c ^= *((ulg *)buf+1) */\
|
||||
UpdCRC_lword \
|
||||
xorl 8(%esi), %eax ;/* c ^= *((ulg *)buf+2) */\
|
||||
UpdCRC_lword \
|
||||
xorl 12(%esi), %eax ;/* c ^= *((ulg *)buf]+3 */\
|
||||
UpdCRC_lword_sh(4) /* ... ((ulg *)buf)+=4 */
|
||||
#endif /* !NO_32_BIT_LOADS */
|
||||
|
||||
|
||||
.text
|
||||
|
||||
.globl _crc32
|
||||
|
||||
_crc32: /* ulg crc32(ulg crc, uch *buf, extent len) */
|
||||
_STD_ENTRY
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
pushl %edx
|
||||
pushl %ecx
|
||||
|
||||
movl arg2, %esi /* 2nd arg: uch *buf */
|
||||
subl %eax, %eax /* > if (!buf) */
|
||||
testl %esi, %esi /* > return 0; */
|
||||
jz .L_fine /* > else { */
|
||||
call _get_crc_table
|
||||
movl %eax, %edi
|
||||
movl arg1, %eax /* 1st arg: ulg crc */
|
||||
#ifndef __686
|
||||
subl %ebx, %ebx /* ebx=0; bl usable as dword */
|
||||
#endif
|
||||
movl arg3, %ecx /* 3rd arg: extent len */
|
||||
notl %eax /* > c = ~crc; */
|
||||
|
||||
testl %ecx, %ecx
|
||||
#ifndef NO_UNROLLED_LOOPS
|
||||
jz .L_bail
|
||||
# ifndef NO_32_BIT_LOADS
|
||||
/* Assert now have positive length */
|
||||
.L_align_loop:
|
||||
testl $3, %esi /* Align buf on lword boundary */
|
||||
jz .L_aligned_now
|
||||
Do_CRC_byte
|
||||
decl %ecx
|
||||
jnz .L_align_loop
|
||||
.L_aligned_now:
|
||||
# endif /* !NO_32_BIT_LOADS */
|
||||
movl %ecx, SavLen /* save current value of len */
|
||||
shrl $4, %ecx /* ecx = len / 16 */
|
||||
jz .L_No_Sixteens
|
||||
/* align loop head at start of 486 internal cache line !! */
|
||||
ALIGNMENT
|
||||
.L_Next_Sixteen:
|
||||
# ifndef NO_32_BIT_LOADS
|
||||
Do_CRC_4lword
|
||||
# else /* NO_32_BIT_LOADS */
|
||||
Do_CRC_byteof(0)
|
||||
Do_CRC_byteof(1)
|
||||
Do_CRC_byteof(2)
|
||||
Do_CRC_byteof(3)
|
||||
Do_CRC_byteof(4)
|
||||
Do_CRC_byteof(5)
|
||||
Do_CRC_byteof(6)
|
||||
Do_CRC_byteof(7)
|
||||
Do_CRC_byteof(8)
|
||||
Do_CRC_byteof(9)
|
||||
Do_CRC_byteof(10)
|
||||
Do_CRC_byteof(11)
|
||||
Do_CRC_byteof(12)
|
||||
Do_CRC_byteof(13)
|
||||
Do_CRC_byteof(14)
|
||||
Do_CRC_byteof(15)
|
||||
addl $16,%esi ;/* buf += 16 */
|
||||
# endif /* ?NO_32_BIT_LOADS */
|
||||
decl %ecx
|
||||
jnz .L_Next_Sixteen
|
||||
|
||||
.L_No_Sixteens:
|
||||
movl SavLen, %ecx
|
||||
andl $15, %ecx /* ecx = len % 16 */
|
||||
# ifndef NO_32_BIT_LOADS
|
||||
shrl $2,%ecx /* ecx = len / 4 */
|
||||
jz .L_No_Fours
|
||||
.L_Next_Four:
|
||||
Do_CRC_lword
|
||||
decl %ecx
|
||||
jnz .L_Next_Four
|
||||
.L_No_Fours:
|
||||
movl SavLen,%ecx
|
||||
andl $3,%ecx /* ecx = len % 4 */
|
||||
# endif /* !NO_32_BIT_LOADS */
|
||||
#endif /* !NO_UNROLLED_LOOPS */
|
||||
jz .L_bail /* > if (len) */
|
||||
/* align loop head at start of 486 internal cache line !! */
|
||||
ALIGNMENT
|
||||
.L_loupe: /* > do { */
|
||||
Do_CRC_byte /* c = CRC32(c,*buf++,crctab);*/
|
||||
decl %ecx /* > } while (--len); */
|
||||
jnz .L_loupe
|
||||
|
||||
.L_bail: /* > } */
|
||||
notl %eax /* > return ~c; */
|
||||
.L_fine:
|
||||
popl %ecx
|
||||
popl %edx
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
_STD_LEAVE
|
||||
ret
|
||||
|
||||
#else
|
||||
error: this asm version is for 386 only
|
||||
#endif /* i386 || _i386 || _I386 || __i386 */
|
||||
|
||||
#endif /* !USE_ZLIB && !CRC_TABLE_ONLY */
|
329
third_party/infozip/zip/ebcdic.h
vendored
329
third_party/infozip/zip/ebcdic.h
vendored
|
@ -1,329 +0,0 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
ebcdic.h
|
||||
|
||||
Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2005-Feb-10 or later
|
||||
(the contents of which are also included in zip.h) for terms of use.
|
||||
If, for some reason, both of these files are missing, the Info-ZIP license
|
||||
also may be found at: ftp://ftp.info-zip.org/pub/infozip/licen
|
||||
*/
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
ebcdic.h
|
||||
|
||||
The CECP 1047 (Extended de-facto EBCDIC) <-> ISO 8859-1 conversion tables,
|
||||
from ftp://aix1.segi.ulg.ac.be/pub/docs/iso8859/iso8859.networking
|
||||
|
||||
NOTES:
|
||||
<Paul_von_Behren@stortek.com> (OS/390 port 12/97)
|
||||
These table no longer represent the standard mappings (for example in the
|
||||
OS/390 iconv utility). In order to follow current standards I remapped
|
||||
ebcdic x0a to ascii x15 and
|
||||
ebcdic x85 to ascii x25 (and vice-versa)
|
||||
Without these changes, newlines in auto-convert text files appeared
|
||||
as literal \045.
|
||||
I'm not sure what effect this remap would have on the MVS and CMS ports, so
|
||||
I ifdef'd these changes. Hopefully these ifdef's can be removed when the
|
||||
MVS/CMS folks test the new mappings.
|
||||
|
||||
Christian Spieler <spieler@ikp.tu-darmstadt.de>, 27-Apr-1998
|
||||
The problem mentioned by Paul von Behren was already observed previously
|
||||
on VM/CMS, during the preparation of the CMS&MVS port of UnZip 5.20 in
|
||||
1996. At that point, the ebcdic tables were not changed since they seemed
|
||||
to be an adopted standard (to my knowledge, these tables are still used
|
||||
as presented in mainfraime KERMIT). Instead, the "end-of-line" conversion
|
||||
feature of Zip's and UnZip's "text-translation" mode was used to force
|
||||
correct mappings between ASCII and EBCDIC newline markers.
|
||||
Before interchanging the ASCII mappings of the EBCDIC control characters
|
||||
"NL" 0x25 and "LF" 0x15 according to the OS/390 setting, we have to
|
||||
make sure that EBCDIC 0x15 is never used as line termination.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __ebcdic_h /* prevent multiple inclusions */
|
||||
#define __ebcdic_h
|
||||
|
||||
|
||||
#ifndef ZCONST
|
||||
# define ZCONST const
|
||||
#endif
|
||||
|
||||
#ifdef EBCDIC
|
||||
#ifndef MTS /* MTS uses a slightly "special" EBCDIC code page */
|
||||
|
||||
ZCONST uch ebcdic[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, /* 00 - 07 */
|
||||
#ifdef OS390
|
||||
0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */
|
||||
#else
|
||||
0x16, 0x05, 0x25, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */
|
||||
#endif
|
||||
0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, /* 10 - 17 */
|
||||
0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, /* 18 - 1F */
|
||||
0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, /* 20 - 27 */
|
||||
0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, /* 28 - 2F */
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, /* 30 - 37 */
|
||||
0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F, /* 38 - 3F */
|
||||
0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, /* 40 - 47 */
|
||||
0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, /* 48 - 4F */
|
||||
0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, /* 50 - 57 */
|
||||
0xE7, 0xE8, 0xE9, 0xAD, 0xE0, 0xBD, 0x5F, 0x6D, /* 58 - 5F */
|
||||
0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60 - 67 */
|
||||
0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* 68 - 6F */
|
||||
0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, /* 70 - 77 */
|
||||
0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07, /* 78 - 7F */
|
||||
#ifdef OS390
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x06, 0x17, /* 80 - 87 */
|
||||
#else
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x15, 0x06, 0x17, /* 80 - 87 */
|
||||
#endif
|
||||
0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x09, 0x0A, 0x1B, /* 88 - 8F */
|
||||
0x30, 0x31, 0x1A, 0x33, 0x34, 0x35, 0x36, 0x08, /* 90 - 97 */
|
||||
0x38, 0x39, 0x3A, 0x3B, 0x04, 0x14, 0x3E, 0xFF, /* 98 - 9F */
|
||||
0x41, 0xAA, 0x4A, 0xB1, 0x9F, 0xB2, 0x6A, 0xB5, /* A0 - A7 */
|
||||
0xBB, 0xB4, 0x9A, 0x8A, 0xB0, 0xCA, 0xAF, 0xBC, /* A8 - AF */
|
||||
0x90, 0x8F, 0xEA, 0xFA, 0xBE, 0xA0, 0xB6, 0xB3, /* B0 - B7 */
|
||||
0x9D, 0xDA, 0x9B, 0x8B, 0xB7, 0xB8, 0xB9, 0xAB, /* B8 - BF */
|
||||
0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9E, 0x68, /* C0 - C7 */
|
||||
0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* C8 - CF */
|
||||
0xAC, 0x69, 0xED, 0xEE, 0xEB, 0xEF, 0xEC, 0xBF, /* D0 - D7 */
|
||||
0x80, 0xFD, 0xFE, 0xFB, 0xFC, 0xBA, 0xAE, 0x59, /* D8 - DF */
|
||||
0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9C, 0x48, /* E0 - E7 */
|
||||
0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* E8 - EF */
|
||||
0x8C, 0x49, 0xCD, 0xCE, 0xCB, 0xCF, 0xCC, 0xE1, /* F0 - F7 */
|
||||
0x70, 0xDD, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF /* F8 - FF */
|
||||
};
|
||||
|
||||
#if (defined(ZIP) || CRYPT)
|
||||
ZCONST uch ascii[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, /* 00 - 07 */
|
||||
0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */
|
||||
#ifdef OS390
|
||||
0x10, 0x11, 0x12, 0x13, 0x9D, 0x0A, 0x08, 0x87, /* 10 - 17 */
|
||||
#else
|
||||
0x10, 0x11, 0x12, 0x13, 0x9D, 0x85, 0x08, 0x87, /* 10 - 17 */
|
||||
#endif
|
||||
0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F, /* 18 - 1F */
|
||||
#ifdef OS390
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1B, /* 20 - 27 */
|
||||
#else
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x0A, 0x17, 0x1B, /* 20 - 27 */
|
||||
#endif
|
||||
0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07, /* 28 - 2F */
|
||||
0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30 - 37 */
|
||||
0x98, 0x99, 0x9A, 0x9B, 0x14, 0x15, 0x9E, 0x1A, /* 38 - 3F */
|
||||
0x20, 0xA0, 0xE2, 0xE4, 0xE0, 0xE1, 0xE3, 0xE5, /* 40 - 47 */
|
||||
0xE7, 0xF1, 0xA2, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, /* 48 - 4F */
|
||||
0x26, 0xE9, 0xEA, 0xEB, 0xE8, 0xED, 0xEE, 0xEF, /* 50 - 57 */
|
||||
0xEC, 0xDF, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0x5E, /* 58 - 5F */
|
||||
0x2D, 0x2F, 0xC2, 0xC4, 0xC0, 0xC1, 0xC3, 0xC5, /* 60 - 67 */
|
||||
0xC7, 0xD1, 0xA6, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, /* 68 - 6F */
|
||||
0xF8, 0xC9, 0xCA, 0xCB, 0xC8, 0xCD, 0xCE, 0xCF, /* 70 - 77 */
|
||||
0xCC, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, /* 78 - 7F */
|
||||
0xD8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80 - 87 */
|
||||
0x68, 0x69, 0xAB, 0xBB, 0xF0, 0xFD, 0xFE, 0xB1, /* 88 - 8F */
|
||||
0xB0, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, /* 90 - 97 */
|
||||
0x71, 0x72, 0xAA, 0xBA, 0xE6, 0xB8, 0xC6, 0xA4, /* 98 - 9F */
|
||||
0xB5, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* A0 - A7 */
|
||||
0x79, 0x7A, 0xA1, 0xBF, 0xD0, 0x5B, 0xDE, 0xAE, /* A8 - AF */
|
||||
0xAC, 0xA3, 0xA5, 0xB7, 0xA9, 0xA7, 0xB6, 0xBC, /* B0 - B7 */
|
||||
0xBD, 0xBE, 0xDD, 0xA8, 0xAF, 0x5D, 0xB4, 0xD7, /* B8 - BF */
|
||||
0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* C0 - C7 */
|
||||
0x48, 0x49, 0xAD, 0xF4, 0xF6, 0xF2, 0xF3, 0xF5, /* C8 - CF */
|
||||
0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, /* D0 - D7 */
|
||||
0x51, 0x52, 0xB9, 0xFB, 0xFC, 0xF9, 0xFA, 0xFF, /* D8 - DF */
|
||||
0x5C, 0xF7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* E0 - E7 */
|
||||
0x59, 0x5A, 0xB2, 0xD4, 0xD6, 0xD2, 0xD3, 0xD5, /* E8 - EF */
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* F0 - F7 */
|
||||
0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, 0x9F /* F8 - FF */
|
||||
};
|
||||
#endif /* ZIP || CRYPT */
|
||||
|
||||
#else /* MTS */
|
||||
|
||||
/*
|
||||
* This is the MTS ASCII->EBCDIC translation table. It provides a 1-1
|
||||
* translation from ISO 8859/1 8-bit ASCII to IBM Code Page 37 EBCDIC.
|
||||
*/
|
||||
|
||||
ZCONST uch ebcdic[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, /* 00 - 07 */
|
||||
0x16, 0x05, 0x25, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */
|
||||
0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, /* 10 - 17 */
|
||||
0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, /* 18 - 1F */
|
||||
0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, /* 20 - 27 */
|
||||
0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, /* 28 - 2F */
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, /* 30 - 37 */
|
||||
0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F, /* 38 - 3F */
|
||||
0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, /* 40 - 47 */
|
||||
0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, /* 48 - 4F */
|
||||
0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, /* 50 - 57 */
|
||||
0xE7, 0xE8, 0xE9, 0xBA, 0xE0, 0xBB, 0xB0, 0x6D, /* 58 - 5F */
|
||||
0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60 - 67 */
|
||||
0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* 68 - 6F */
|
||||
0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, /* 70 - 77 */
|
||||
0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07, /* 78 - 7F */
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x15, 0x06, 0x17, /* 80 - 87 */
|
||||
0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x09, 0x0A, 0x1B, /* 88 - 8F */
|
||||
0x30, 0x31, 0x1A, 0x33, 0x34, 0x35, 0x36, 0x08, /* 90 - 97 */
|
||||
0x38, 0x39, 0x3A, 0x3B, 0x04, 0x14, 0x3E, 0xFF, /* 98 - 9F */
|
||||
0x41, 0xAA, 0x4A, 0xB1, 0x9F, 0xB2, 0x6A, 0xB5, /* A0 - A7 */
|
||||
0xBD, 0xB4, 0x9A, 0x8A, 0x5F, 0xCA, 0xAF, 0xBC, /* A8 - AF */
|
||||
0x90, 0x8F, 0xEA, 0xFA, 0xBE, 0xA0, 0xB6, 0xB3, /* B0 - B7 */
|
||||
0x9D, 0xDA, 0x9B, 0x8B, 0xB7, 0xB8, 0xB9, 0xAB, /* B8 - BF */
|
||||
0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9E, 0x68, /* C0 - C7 */
|
||||
0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* C8 - CF */
|
||||
0xAC, 0x69, 0xED, 0xEE, 0xEB, 0xEF, 0xEC, 0xBF, /* D0 - D7 */
|
||||
0x80, 0xFD, 0xFE, 0xFB, 0xFC, 0xAD, 0xAE, 0x59, /* D8 - DF */
|
||||
0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9C, 0x48, /* E0 - E7 */
|
||||
0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* E8 - EF */
|
||||
0x8C, 0x49, 0xCD, 0xCE, 0xCB, 0xCF, 0xCC, 0xE1, /* F0 - F7 */
|
||||
0x70, 0xDD, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF /* F8 - FF */
|
||||
};
|
||||
|
||||
#if (defined(ZIP) || CRYPT)
|
||||
ZCONST uch ascii[] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, /* 00 - 07 */
|
||||
0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, /* 08 - 0F */
|
||||
0x10, 0x11, 0x12, 0x13, 0x9D, 0x85, 0x08, 0x87, /* 10 - 17 */
|
||||
0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F, /* 18 - 1F */
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x0A, 0x17, 0x1B, /* 20 - 27 */
|
||||
0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07, /* 28 - 2F */
|
||||
0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30 - 37 */
|
||||
0x98, 0x99, 0x9A, 0x9B, 0x14, 0x15, 0x9E, 0x1A, /* 38 - 3F */
|
||||
0x20, 0xA0, 0xE2, 0xE4, 0xE0, 0xE1, 0xE3, 0xE5, /* 40 - 47 */
|
||||
0xE7, 0xF1, 0xA2, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, /* 48 - 4F */
|
||||
0x26, 0xE9, 0xEA, 0xEB, 0xE8, 0xED, 0xEE, 0xEF, /* 50 - 57 */
|
||||
0xEC, 0xDF, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0xAC, /* 58 - 5F */
|
||||
0x2D, 0x2F, 0xC2, 0xC4, 0xC0, 0xC1, 0xC3, 0xC5, /* 60 - 67 */
|
||||
0xC7, 0xD1, 0xA6, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, /* 68 - 6F */
|
||||
0xF8, 0xC9, 0xCA, 0xCB, 0xC8, 0xCD, 0xCE, 0xCF, /* 70 - 77 */
|
||||
0xCC, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, /* 78 - 7F */
|
||||
0xD8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80 - 87 */
|
||||
0x68, 0x69, 0xAB, 0xBB, 0xF0, 0xFD, 0xFE, 0xB1, /* 88 - 8F */
|
||||
0xB0, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, /* 90 - 97 */
|
||||
0x71, 0x72, 0xAA, 0xBA, 0xE6, 0xB8, 0xC6, 0xA4, /* 98 - 9F */
|
||||
0xB5, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* A0 - A7 */
|
||||
0x79, 0x7A, 0xA1, 0xBF, 0xD0, 0xDD, 0xDE, 0xAE, /* A8 - AF */
|
||||
0x5E, 0xA3, 0xA5, 0xB7, 0xA9, 0xA7, 0xB6, 0xBC, /* B0 - B7 */
|
||||
0xBD, 0xBE, 0x5B, 0x5D, 0xAF, 0xA8, 0xB4, 0xD7, /* B8 - BF */
|
||||
0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* C0 - C7 */
|
||||
0x48, 0x49, 0xAD, 0xF4, 0xF6, 0xF2, 0xF3, 0xF5, /* C8 - CF */
|
||||
0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, /* D0 - D7 */
|
||||
0x51, 0x52, 0xB9, 0xFB, 0xFC, 0xF9, 0xFA, 0xFF, /* D8 - DF */
|
||||
0x5C, 0xF7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* E0 - E7 */
|
||||
0x59, 0x5A, 0xB2, 0xD4, 0xD6, 0xD2, 0xD3, 0xD5, /* E8 - EF */
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* F0 - F7 */
|
||||
0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, 0x9F /* F8 - FF */
|
||||
};
|
||||
#endif /* ZIP || CRYPT */
|
||||
|
||||
#endif /* ?MTS */
|
||||
#endif /* EBCDIC */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
The following conversion tables translate between IBM PC CP 850
|
||||
(OEM codepage) and the "Western Europe & America" Windows codepage 1252.
|
||||
The Windows codepage 1252 contains the ISO 8859-1 "Latin 1" codepage,
|
||||
with some additional printable characters in the range (0x80 - 0x9F),
|
||||
that is reserved to control codes in the ISO 8859-1 character table.
|
||||
|
||||
The ISO <--> OEM conversion tables were constructed with the help
|
||||
of the WIN32 (Win16?) API's OemToAnsi() and AnsiToOem() conversion
|
||||
functions and have been checked against the CP850 and LATIN1 tables
|
||||
provided in the MS-Kermit 3.14 distribution.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef IZ_ISO2OEM_ARRAY
|
||||
#ifdef OEM_RUSS
|
||||
ZCONST uch Far iso2oem[] = {
|
||||
0x3F, 0x3F, 0x27, 0x9F, 0x22, 0x2E, 0xC5, 0xCE, /* 80 - 87 */
|
||||
0xFD, 0x25, 0x53, 0x3C, 0x4F, 0x3F, 0x3F, 0x3F, /* 88 - 8F */
|
||||
0x3F, 0x27, 0x27, 0x22, 0x22, 0xF9, 0x2D, 0x2D, /* 90 - 97 */
|
||||
0x7E, 0x54, 0x73, 0x3E, 0x6F, 0x3F, 0x3F, 0x59, /* 98 - 9F */
|
||||
0xFF, 0xF6, 0xF7, 0x9C, 0xCF, 0xBE, 0xFE, 0xF5, /* A0 - A7 */
|
||||
0xF0, 0xB8, 0xF2, 0xAE, 0xAA, 0xF0, 0xA9, 0xEE, /* A8 - AF */
|
||||
0xF8, 0xFB, 0xF4, 0xF5, 0xEF, 0xE6, 0xF4, 0xFA, /* B0 - B7 */
|
||||
0xF1, 0xFC, 0xF3, 0xAF, 0xAC, 0xAB, 0xF3, 0xA8, /* B8 - BF */
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x86, 0x86, 0x87, /* C0 - C7 */
|
||||
0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, /* C8 - CF */
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* D0 - D7 */
|
||||
0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, /* D8 - DF */
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, /* E0 - E7 */
|
||||
0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, /* E8 - EF */
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, /* F0 - F7 */
|
||||
0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF /* F8 - FF */
|
||||
};
|
||||
#else /* OEM_RUS */
|
||||
ZCONST uch Far iso2oem[] = {
|
||||
0x3F, 0x3F, 0x27, 0x9F, 0x22, 0x2E, 0xC5, 0xCE, /* 80 - 87 */
|
||||
0x5E, 0x25, 0x53, 0x3C, 0x4F, 0x3F, 0x3F, 0x3F, /* 88 - 8F */
|
||||
0x3F, 0x27, 0x27, 0x22, 0x22, 0x07, 0x2D, 0x2D, /* 90 - 97 */
|
||||
0x7E, 0x54, 0x73, 0x3E, 0x6F, 0x3F, 0x3F, 0x59, /* 98 - 9F */
|
||||
0xFF, 0xAD, 0xBD, 0x9C, 0xCF, 0xBE, 0xDD, 0xF5, /* A0 - A7 */
|
||||
0xF9, 0xB8, 0xA6, 0xAE, 0xAA, 0xF0, 0xA9, 0xEE, /* A8 - AF */
|
||||
0xF8, 0xF1, 0xFD, 0xFC, 0xEF, 0xE6, 0xF4, 0xFA, /* B0 - B7 */
|
||||
0xF7, 0xFB, 0xA7, 0xAF, 0xAC, 0xAB, 0xF3, 0xA8, /* B8 - BF */
|
||||
0xB7, 0xB5, 0xB6, 0xC7, 0x8E, 0x8F, 0x92, 0x80, /* C0 - C7 */
|
||||
0xD4, 0x90, 0xD2, 0xD3, 0xDE, 0xD6, 0xD7, 0xD8, /* C8 - CF */
|
||||
0xD1, 0xA5, 0xE3, 0xE0, 0xE2, 0xE5, 0x99, 0x9E, /* D0 - D7 */
|
||||
0x9D, 0xEB, 0xE9, 0xEA, 0x9A, 0xED, 0xE8, 0xE1, /* D8 - DF */
|
||||
0x85, 0xA0, 0x83, 0xC6, 0x84, 0x86, 0x91, 0x87, /* E0 - E7 */
|
||||
0x8A, 0x82, 0x88, 0x89, 0x8D, 0xA1, 0x8C, 0x8B, /* E8 - EF */
|
||||
0xD0, 0xA4, 0x95, 0xA2, 0x93, 0xE4, 0x94, 0xF6, /* F0 - F7 */
|
||||
0x9B, 0x97, 0xA3, 0x96, 0x81, 0xEC, 0xE7, 0x98 /* F8 - FF */
|
||||
};
|
||||
#endif /* OEM_RUS */
|
||||
#endif /* IZ_ISO2OEM_ARRAY */
|
||||
|
||||
#ifdef IZ_OEM2ISO_ARRAY
|
||||
#ifdef OEM_RUSS
|
||||
ZCONST uch Far oem2iso[] = {
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, /* 80 - 87 */
|
||||
0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, /* 88 - 8F */
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, /* 90 - 97 */
|
||||
0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, /* 98 - 9F */
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, /* A0 - A7 */
|
||||
0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, /* A8 - AF */
|
||||
0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xC1, 0xC2, 0xC0, /* B0 - B7 */
|
||||
0xA9, 0xA6, 0xA6, 0x2B, 0x2B, 0xA2, 0xA5, 0x2B, /* B8 - BF */
|
||||
0x2B, 0x2D, 0x2D, 0x2B, 0x2D, 0x2B, 0xE3, 0xC3, /* C0 - C7 */
|
||||
0x2B, 0x2B, 0x2D, 0x2D, 0xA6, 0x2D, 0x2B, 0xA4, /* C8 - CF */
|
||||
0xF0, 0xD0, 0xCA, 0xCB, 0xC8, 0x69, 0xCD, 0xCE, /* D0 - D7 */
|
||||
0xCF, 0x2B, 0x2B, 0xA6, 0x5F, 0xA6, 0xCC, 0xAF, /* D8 - DF */
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, /* E0 - E7 */
|
||||
0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, /* E8 - EF */
|
||||
0xA8, 0xB8, 0xAA, 0xBA, 0xB2, 0xB3, 0xA1, 0xA2, /* F0 - F7 */
|
||||
0xB0, 0x95, 0xB7, 0xB1, 0xB9, 0x88, 0xA6, 0xA0 /* F8 - FF */
|
||||
};
|
||||
#else /* OEM_RUS */
|
||||
ZCONST uch Far oem2iso[] = {
|
||||
0xC7, 0xFC, 0xE9, 0xE2, 0xE4, 0xE0, 0xE5, 0xE7, /* 80 - 87 */
|
||||
0xEA, 0xEB, 0xE8, 0xEF, 0xEE, 0xEC, 0xC4, 0xC5, /* 88 - 8F */
|
||||
0xC9, 0xE6, 0xC6, 0xF4, 0xF6, 0xF2, 0xFB, 0xF9, /* 90 - 97 */
|
||||
0xFF, 0xD6, 0xDC, 0xF8, 0xA3, 0xD8, 0xD7, 0x83, /* 98 - 9F */
|
||||
0xE1, 0xED, 0xF3, 0xFA, 0xF1, 0xD1, 0xAA, 0xBA, /* A0 - A7 */
|
||||
0xBF, 0xAE, 0xAC, 0xBD, 0xBC, 0xA1, 0xAB, 0xBB, /* A8 - AF */
|
||||
0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xC1, 0xC2, 0xC0, /* B0 - B7 */
|
||||
0xA9, 0xA6, 0xA6, 0x2B, 0x2B, 0xA2, 0xA5, 0x2B, /* B8 - BF */
|
||||
0x2B, 0x2D, 0x2D, 0x2B, 0x2D, 0x2B, 0xE3, 0xC3, /* C0 - C7 */
|
||||
0x2B, 0x2B, 0x2D, 0x2D, 0xA6, 0x2D, 0x2B, 0xA4, /* C8 - CF */
|
||||
0xF0, 0xD0, 0xCA, 0xCB, 0xC8, 0x69, 0xCD, 0xCE, /* D0 - D7 */
|
||||
0xCF, 0x2B, 0x2B, 0xA6, 0x5F, 0xA6, 0xCC, 0xAF, /* D8 - DF */
|
||||
0xD3, 0xDF, 0xD4, 0xD2, 0xF5, 0xD5, 0xB5, 0xFE, /* E0 - E7 */
|
||||
0xDE, 0xDA, 0xDB, 0xD9, 0xFD, 0xDD, 0xAF, 0xB4, /* E8 - EF */
|
||||
0xAD, 0xB1, 0x3D, 0xBE, 0xB6, 0xA7, 0xF7, 0xB8, /* F0 - F7 */
|
||||
0xB0, 0xA8, 0xB7, 0xB9, 0xB3, 0xB2, 0xA6, 0xA0 /* F8 - FF */
|
||||
};
|
||||
#endif /* OEM_RUS */
|
||||
#endif /* IZ_OEM2ISO_ARRAY */
|
||||
|
||||
#if defined(THEOS) || defined(THEOS_SUPPORT)
|
||||
# include "theos/charconv.h"
|
||||
#endif
|
||||
|
||||
#endif /* __ebcdic_h */
|
1
third_party/infozip/zip/fileio.c
vendored
1
third_party/infozip/zip/fileio.c
vendored
|
@ -15,6 +15,7 @@
|
|||
#define __FILEIO_C
|
||||
|
||||
#include "third_party/infozip/zip/zip.h"
|
||||
#include "libc/calls/struct/stat.macros.h"
|
||||
#include "third_party/infozip/zip/crc32.h"
|
||||
|
||||
#ifdef MACOS
|
||||
|
|
407
third_party/infozip/zip/match.S
vendored
407
third_party/infozip/zip/match.S
vendored
|
@ -1,407 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2004-May-22 or later
|
||||
(the contents of which are also included in zip.h) for terms of use.
|
||||
If, for some reason, both of these files are missing, the Info-ZIP license
|
||||
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* match.s by Jean-loup Gailly. Translated to 32 bit code by Kai Uwe Rommel.
|
||||
* The 68020 version has been written by Francesco Potorti` <pot@cnuce.cnr.it>
|
||||
* with adaptations by Carsten Steger <stegerc@informatik.tu-muenchen.de>,
|
||||
* Andreas Schwab <schwab@lamothe.informatik.uni-dortmund.de> and
|
||||
* Kristoffer Eriksson <ske@pkmab.se>
|
||||
*/
|
||||
|
||||
/* This file is NOT used in conjunction with zlib. */
|
||||
#ifndef USE_ZLIB
|
||||
|
||||
/* Preprocess with -DNO_UNDERLINE if your C compiler does not prefix
|
||||
* external symbols with an underline character '_'.
|
||||
*/
|
||||
#if defined(NO_UNDERLINE) || defined(__ELF__)
|
||||
# define _prev prev
|
||||
# define _window window
|
||||
# define _match_start match_start
|
||||
# define _prev_length prev_length
|
||||
# define _good_match good_match
|
||||
# define _nice_match nice_match
|
||||
# define _strstart strstart
|
||||
# define _max_chain_length max_chain_length
|
||||
|
||||
# define _match_init match_init
|
||||
# define _longest_match longest_match
|
||||
#endif
|
||||
|
||||
#ifdef DYN_ALLOC
|
||||
error: DYN_ALLOC not yet supported in match.s
|
||||
#endif
|
||||
|
||||
/* Use 16-bytes alignment if your assembler supports it. Warning: gas
|
||||
* uses a log(x) parameter (.align 4 means 16-bytes alignment). On SVR4
|
||||
* the parameter is a number of bytes.
|
||||
*/
|
||||
#ifndef ALIGNMENT
|
||||
# define ALIGNMENT 4
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef WSIZE
|
||||
# define WSIZE 32768
|
||||
#endif
|
||||
#define MIN_MATCH 3
|
||||
#define MAX_MATCH 258
|
||||
#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1)
|
||||
#define MAX_DIST (WSIZE - MIN_LOOKAHEAD)
|
||||
|
||||
#if defined(i386) || defined(_I386) || defined(_i386) || defined(__i386)
|
||||
|
||||
/* This version is for 386 Unix or OS/2 in 32 bit mode.
|
||||
* Warning: it uses the AT&T syntax: mov source,dest
|
||||
* This file is only optional. If you want to force the C version,
|
||||
* add -DNO_ASM to CFLAGS in Makefile and set OBJA to an empty string.
|
||||
* If you have reduced WSIZE in (g)zip.h, then make sure this is
|
||||
* assembled with an equivalent -DWSIZE=<whatever>.
|
||||
* This version assumes static allocation of the arrays (-DDYN_ALLOC not used).
|
||||
*/
|
||||
|
||||
.file "match.S"
|
||||
|
||||
.globl _match_init
|
||||
.globl _longest_match
|
||||
|
||||
.text
|
||||
|
||||
_match_init:
|
||||
ret
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Set match_start to the longest match starting at the given string and
|
||||
* return its length. Matches shorter or equal to prev_length are discarded,
|
||||
* in which case the result is equal to prev_length and match_start is
|
||||
* garbage.
|
||||
* IN assertions: cur_match is the head of the hash chain for the current
|
||||
* string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
|
||||
*/
|
||||
|
||||
.align ALIGNMENT
|
||||
|
||||
_longest_match: /* int longest_match(cur_match) */
|
||||
|
||||
#define cur_match 20(%esp)
|
||||
/* return address */ /* esp+16 */
|
||||
push %ebp /* esp+12 */
|
||||
push %edi /* esp+8 */
|
||||
push %esi /* esp+4 */
|
||||
push %ebx /* esp */
|
||||
|
||||
/*
|
||||
* match equ esi
|
||||
* scan equ edi
|
||||
* chain_length equ ebp
|
||||
* best_len equ ebx
|
||||
* limit equ edx
|
||||
*/
|
||||
mov cur_match,%esi
|
||||
mov _strstart,%edx
|
||||
mov _max_chain_length,%ebp /* chain_length = max_chain_length */
|
||||
mov %edx,%edi
|
||||
sub $(MAX_DIST),%edx /* limit = strstart-MAX_DIST */
|
||||
cld /* string ops increment si and di */
|
||||
jae limit_ok
|
||||
sub %edx,%edx /* limit = NIL */
|
||||
limit_ok:
|
||||
add $2+_window,%edi /* edi = offset(window+strstart+2) */
|
||||
mov _prev_length,%ebx /* best_len = prev_length */
|
||||
movw -2(%edi),%cx /* cx = scan[0..1] */
|
||||
movw -3(%ebx,%edi),%ax /* ax = scan[best_len-1..best_len] */
|
||||
cmp _good_match,%ebx /* do we have a good match already? */
|
||||
jb do_scan
|
||||
shr $2,%ebp /* chain_length >>= 2 */
|
||||
jmp do_scan
|
||||
|
||||
.align ALIGNMENT
|
||||
long_loop:
|
||||
/* at this point, edi == scan+2, esi == cur_match */
|
||||
movw -3(%ebx,%edi),%ax /* ax = scan[best_len-1..best_len] */
|
||||
movw -2(%edi),%cx /* cx = scan[0..1] */
|
||||
short_loop:
|
||||
/*
|
||||
* at this point, di == scan+2, si == cur_match,
|
||||
* ax = scan[best_len-1..best_len] and cx = scan[0..1]
|
||||
*/
|
||||
and $(WSIZE-1), %esi
|
||||
dec %ebp /* --chain_length */
|
||||
movw _prev(,%esi,2),%si /* cur_match = prev[cur_match] */
|
||||
/* top word of esi is still 0 */
|
||||
jz the_end
|
||||
cmp %edx,%esi /* cur_match <= limit ? */
|
||||
jbe the_end
|
||||
do_scan:
|
||||
cmpw _window-1(%ebx,%esi),%ax/* check match at best_len-1 */
|
||||
jne short_loop
|
||||
cmpw _window(%esi),%cx /* check min_match_length match */
|
||||
jne short_loop
|
||||
|
||||
add $2+_window,%esi /* si = match */
|
||||
mov $((MAX_MATCH>>1)-1),%ecx/* scan for at most MAX_MATCH bytes */
|
||||
mov %edi,%eax /* ax = scan+2 */
|
||||
repe; cmpsw /* loop until mismatch */
|
||||
je maxmatch /* match of length MAX_MATCH? */
|
||||
mismatch:
|
||||
movb -2(%edi),%cl /* mismatch on first or second byte? */
|
||||
xchg %edi,%eax /* edi = scan+2, eax = end of scan */
|
||||
subb -2(%esi),%cl /* cl = 0 if first bytes equal */
|
||||
sub %edi,%eax /* eax = len */
|
||||
sub $2+_window,%esi /* esi = cur_match + len */
|
||||
sub %eax,%esi /* esi = cur_match */
|
||||
subb $1,%cl /* set carry if cl == 0 (cannot use DEC) */
|
||||
adc $0,%eax /* eax = carry ? len+1 : len */
|
||||
cmp %ebx,%eax /* len > best_len ? */
|
||||
jle long_loop
|
||||
mov %esi,_match_start /* match_start = cur_match */
|
||||
mov %eax,%ebx /* ebx = best_len = len */
|
||||
#ifdef FULL_SEARCH
|
||||
cmp $(MAX_MATCH),%eax /* len >= MAX_MATCH ? */
|
||||
#else
|
||||
cmp _nice_match,%eax /* len >= nice_match ? */
|
||||
#endif
|
||||
jl long_loop
|
||||
the_end:
|
||||
mov %ebx,%eax /* result = eax = best_len */
|
||||
pop %ebx
|
||||
pop %esi
|
||||
pop %edi
|
||||
pop %ebp
|
||||
ret
|
||||
.align ALIGNMENT
|
||||
maxmatch:
|
||||
cmpsb
|
||||
jmp mismatch
|
||||
|
||||
#else /* !(i386 || _I386 || _i386 || __i386) */
|
||||
|
||||
/* ======================== 680x0 version ================================= */
|
||||
|
||||
#if defined(m68k)||defined(mc68k)||defined(__mc68000__)||defined(__MC68000__)
|
||||
# ifndef mc68000
|
||||
# define mc68000
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__mc68020__) || defined(__MC68020__) || defined(sysV68)
|
||||
# ifndef mc68020
|
||||
# define mc68020
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(mc68020) || defined(mc68000)
|
||||
|
||||
#if (defined(mc68020) || defined(NeXT)) && !defined(UNALIGNED_OK)
|
||||
# define UNALIGNED_OK
|
||||
#endif
|
||||
|
||||
#ifdef sysV68 /* Try Motorola Delta style */
|
||||
|
||||
# define GLOBAL(symbol) global symbol
|
||||
# define TEXT text
|
||||
# define FILE(filename) file filename
|
||||
# define invert_maybe(src,dst) dst,src
|
||||
# define imm(data) &data
|
||||
# define reg(register) %register
|
||||
|
||||
# define addl add.l
|
||||
# define addql addq.l
|
||||
# define blos blo.b
|
||||
# define bhis bhi.b
|
||||
# define bras bra.b
|
||||
# define clrl clr.l
|
||||
# define cmpmb cmpm.b
|
||||
# define cmpw cmp.w
|
||||
# define cmpl cmp.l
|
||||
# define lslw lsl.w
|
||||
# define lsrl lsr.l
|
||||
# define movel move.l
|
||||
# define movew move.w
|
||||
# define moveb move.b
|
||||
# define moveml movem.l
|
||||
# define subl sub.l
|
||||
# define subw sub.w
|
||||
# define subql subq.l
|
||||
|
||||
# define IndBase(bd,An) (bd,An)
|
||||
# define IndBaseNdxl(bd,An,Xn) (bd,An,Xn.l)
|
||||
# define IndBaseNdxw(bd,An,Xn) (bd,An,Xn.w)
|
||||
# define predec(An) -(An)
|
||||
# define postinc(An) (An)+
|
||||
|
||||
#else /* default style (Sun 3, NeXT, Amiga, Atari) */
|
||||
|
||||
# define GLOBAL(symbol) .globl symbol
|
||||
# define TEXT .text
|
||||
# define FILE(filename) .even
|
||||
# define invert_maybe(src,dst) src,dst
|
||||
# if defined(sun) || defined(mc68k)
|
||||
# define imm(data) #data
|
||||
# else
|
||||
# define imm(data) \#data
|
||||
# endif
|
||||
# define reg(register) register
|
||||
|
||||
# define blos bcss
|
||||
# if defined(sun) || defined(mc68k)
|
||||
# define movel movl
|
||||
# define movew movw
|
||||
# define moveb movb
|
||||
# endif
|
||||
# define IndBase(bd,An) An@(bd)
|
||||
# define IndBaseNdxl(bd,An,Xn) An@(bd,Xn:l)
|
||||
# define IndBaseNdxw(bd,An,Xn) An@(bd,Xn:w)
|
||||
# define predec(An) An@-
|
||||
# define postinc(An) An@+
|
||||
|
||||
#endif /* styles */
|
||||
|
||||
#define Best_Len reg(d0) /* unsigned */
|
||||
#define Cur_Match reg(d1) /* Ipos */
|
||||
#define Loop_Counter reg(d2) /* int */
|
||||
#define Scan_Start reg(d3) /* unsigned short */
|
||||
#define Scan_End reg(d4) /* unsigned short */
|
||||
#define Limit reg(d5) /* IPos */
|
||||
#define Chain_Length reg(d6) /* unsigned */
|
||||
#define Scan_Test reg(d7)
|
||||
#define Scan reg(a0) /* *uch */
|
||||
#define Match reg(a1) /* *uch */
|
||||
#define Prev_Address reg(a2) /* *Pos */
|
||||
#define Scan_Ini reg(a3) /* *uch */
|
||||
#define Match_Ini reg(a4) /* *uch */
|
||||
#define Stack_Pointer reg(sp)
|
||||
|
||||
GLOBAL (_match_init)
|
||||
GLOBAL (_longest_match)
|
||||
|
||||
TEXT
|
||||
|
||||
FILE ("match.S")
|
||||
|
||||
_match_init:
|
||||
rts
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Set match_start to the longest match starting at the given string and
|
||||
* return its length. Matches shorter or equal to prev_length are discarded,
|
||||
* in which case the result is equal to prev_length and match_start is
|
||||
* garbage.
|
||||
* IN assertions: cur_match is the head of the hash chain for the current
|
||||
* string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
|
||||
*/
|
||||
|
||||
/* int longest_match (cur_match) */
|
||||
|
||||
#ifdef UNALIGNED_OK
|
||||
# define pushreg 15928 /* d2-d6/a2-a4 */
|
||||
# define popreg 7292
|
||||
#else
|
||||
# define pushreg 16184 /* d2-d7/a2-a4 */
|
||||
# define popreg 7420
|
||||
#endif
|
||||
|
||||
_longest_match:
|
||||
movel IndBase(4,Stack_Pointer),Cur_Match
|
||||
moveml imm(pushreg),predec(Stack_Pointer)
|
||||
movel _max_chain_length,Chain_Length
|
||||
movel _prev_length,Best_Len
|
||||
movel imm(_prev),Prev_Address
|
||||
movel imm(_window+MIN_MATCH),Match_Ini
|
||||
movel _strstart,Limit
|
||||
movel Match_Ini,Scan_Ini
|
||||
addl Limit,Scan_Ini
|
||||
subw imm(MAX_DIST),Limit
|
||||
bhis L__limit_ok
|
||||
clrl Limit
|
||||
L__limit_ok:
|
||||
cmpl invert_maybe(_good_match,Best_Len)
|
||||
blos L__length_ok
|
||||
lsrl imm(2),Chain_Length
|
||||
L__length_ok:
|
||||
subql imm(1),Chain_Length
|
||||
#ifdef UNALIGNED_OK
|
||||
movew IndBase(-MIN_MATCH,Scan_Ini),Scan_Start
|
||||
movew IndBaseNdxw(-MIN_MATCH-1,Scan_Ini,Best_Len),Scan_End
|
||||
#else
|
||||
moveb IndBase(-MIN_MATCH,Scan_Ini),Scan_Start
|
||||
lslw imm(8),Scan_Start
|
||||
moveb IndBase(-MIN_MATCH+1,Scan_Ini),Scan_Start
|
||||
moveb IndBaseNdxw(-MIN_MATCH-1,Scan_Ini,Best_Len),Scan_End
|
||||
lslw imm(8),Scan_End
|
||||
moveb IndBaseNdxw(-MIN_MATCH,Scan_Ini,Best_Len),Scan_End
|
||||
#endif
|
||||
bras L__do_scan
|
||||
|
||||
L__long_loop:
|
||||
#ifdef UNALIGNED_OK
|
||||
movew IndBaseNdxw(-MIN_MATCH-1,Scan_Ini,Best_Len),Scan_End
|
||||
#else
|
||||
moveb IndBaseNdxw(-MIN_MATCH-1,Scan_Ini,Best_Len),Scan_End
|
||||
lslw imm(8),Scan_End
|
||||
moveb IndBaseNdxw(-MIN_MATCH,Scan_Ini,Best_Len),Scan_End
|
||||
#endif
|
||||
|
||||
L__short_loop:
|
||||
lslw imm(1),Cur_Match
|
||||
movew IndBaseNdxl(0,Prev_Address,Cur_Match),Cur_Match
|
||||
cmpw invert_maybe(Limit,Cur_Match)
|
||||
dbls Chain_Length,L__do_scan
|
||||
bras L__return
|
||||
|
||||
L__do_scan:
|
||||
movel Match_Ini,Match
|
||||
addl Cur_Match,Match
|
||||
#ifdef UNALIGNED_OK
|
||||
cmpw invert_maybe(IndBaseNdxw(-MIN_MATCH-1,Match,Best_Len),Scan_End)
|
||||
bne L__short_loop
|
||||
cmpw invert_maybe(IndBase(-MIN_MATCH,Match),Scan_Start)
|
||||
bne L__short_loop
|
||||
#else
|
||||
moveb IndBaseNdxw(-MIN_MATCH-1,Match,Best_Len),Scan_Test
|
||||
lslw imm(8),Scan_Test
|
||||
moveb IndBaseNdxw(-MIN_MATCH,Match,Best_Len),Scan_Test
|
||||
cmpw invert_maybe(Scan_Test,Scan_End)
|
||||
bne L__short_loop
|
||||
moveb IndBase(-MIN_MATCH,Match),Scan_Test
|
||||
lslw imm(8),Scan_Test
|
||||
moveb IndBase(-MIN_MATCH+1,Match),Scan_Test
|
||||
cmpw invert_maybe(Scan_Test,Scan_Start)
|
||||
bne L__short_loop
|
||||
#endif
|
||||
|
||||
movew imm((MAX_MATCH-MIN_MATCH+1)-1),Loop_Counter
|
||||
movel Scan_Ini,Scan
|
||||
L__scan_loop:
|
||||
cmpmb postinc(Match),postinc(Scan)
|
||||
dbne Loop_Counter,L__scan_loop
|
||||
|
||||
subl Scan_Ini,Scan
|
||||
addql imm(MIN_MATCH-1),Scan
|
||||
cmpl invert_maybe(Best_Len,Scan)
|
||||
bls L__short_loop
|
||||
movel Scan,Best_Len
|
||||
movel Cur_Match,_match_start
|
||||
#ifdef FULL_SEARCH
|
||||
cmpl invert_maybe(imm(MAX_MATCH),Best_Len)
|
||||
#else
|
||||
cmpl invert_maybe(_nice_match,Best_Len)
|
||||
#endif
|
||||
blos L__long_loop
|
||||
L__return:
|
||||
moveml postinc(Stack_Pointer),imm(popreg)
|
||||
rts
|
||||
|
||||
#else
|
||||
error: this asm version is for 386 or 680x0 only
|
||||
#endif /* mc68000 || mc68020 */
|
||||
#endif /* i386 || _I386 || _i386 || __i386 */
|
||||
|
||||
#endif /* !USE_ZLIB */
|
329
third_party/infozip/zip/unix/Makefile
vendored
329
third_party/infozip/zip/unix/Makefile
vendored
|
@ -1,329 +0,0 @@
|
|||
# Makefile for Zip, ZipNote, ZipCloak and ZipSplit
|
||||
|
||||
# what you can make ...
|
||||
all:
|
||||
@echo ''
|
||||
@echo 'Make what? You must say what system to make Zip for--e.g.'
|
||||
@echo '"make generic".'
|
||||
@echo 'Choices: generic, generic_gcc, att6300nodir,'
|
||||
@echo 'coherent, cray_v3, cygwin, lynx, minix, os390,'
|
||||
@echo 'qnx, qnxnto, solaris, solaris_gcc'
|
||||
@echo 'Try first "make -f unix/Makefile generic" as'
|
||||
@echo 'it should autodetect and set the proper flags.'
|
||||
@echo 'To make the manuals use "make zipsman" after Zip is made.'
|
||||
@echo 'See the files INSTALL and zip.txt for more information.'
|
||||
@echo ''
|
||||
|
||||
list: all
|
||||
|
||||
#MAKE = make -f unix/Makefile
|
||||
MAKEF = -f unix/Makefile
|
||||
SHELL = /bin/sh
|
||||
LN = ln -s
|
||||
|
||||
# (to use the GNU compiler, change cc to gcc in CC)
|
||||
CC = cc
|
||||
BIND = $(CC)
|
||||
AS = $(CC) -c
|
||||
CPP = /lib/cpp
|
||||
E =
|
||||
|
||||
# probably can change this to 'install' if you have it
|
||||
INSTALL_PROGRAM = cp
|
||||
# probably can change this to 'install -d' if you have it
|
||||
# XXX NextStep 3.3 and Openstep 4.x don't know about -p !
|
||||
INSTALL_D = mkdir -p
|
||||
CHMOD = chmod
|
||||
BINFLAGS = 755
|
||||
MANFLAGS = 644
|
||||
|
||||
# target directories - where to install executables and man pages to
|
||||
prefix = /usr/local
|
||||
BINDIR = $(prefix)/bin
|
||||
MANEXT=1
|
||||
MANDIR = $(prefix)/man/man$(MANEXT)
|
||||
ZIPMANUAL = zip.txt
|
||||
ZIPMANUALcloak = zipcloak.txt
|
||||
ZIPMANUALnote = zipnote.txt
|
||||
ZIPMANUALsplit = zipsplit.txt
|
||||
ZIPMANUALs = zip.txt zipcloak.txt zipnote.txt zipsplit.txt
|
||||
PKGDIR = IZzip
|
||||
VERSION = Version 3.0
|
||||
|
||||
# Our bzip2 directory
|
||||
IZ_OUR_BZIP2_DIR = bzip2
|
||||
|
||||
# flags
|
||||
# CFLAGS flags for C compile
|
||||
# LFLAGS1 flags after output file spec, before obj file list
|
||||
# LFLAGS2 flags after obj file list (libraries, etc)
|
||||
CFLAGS_NOOPT = -I. -DUNIX $(LOCAL_ZIP)
|
||||
CFLAGS = -O2 $(CFLAGS_NOOPT)
|
||||
LFLAGS1 =
|
||||
LFLAGS2 = -s
|
||||
|
||||
# object file lists
|
||||
OBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o crypt.o ttyio.o \
|
||||
unix.o crc32.o zbz2err.o
|
||||
OBJI = deflate.o trees.o
|
||||
OBJA =
|
||||
OCRCU8 =
|
||||
OCRCTB = crc32_.o
|
||||
OBJU = zipfile_.o fileio_.o util_.o globals.o unix_.o $(OCRCU8)
|
||||
OBJN = zipnote.o $(OBJU)
|
||||
OBJC = zipcloak.o $(OBJU) $(OCRCTB) crypt_.o ttyio.o
|
||||
OBJS = zipsplit.o $(OBJU)
|
||||
|
||||
ZIP_H = zip.h ziperr.h tailor.h unix/osdep.h
|
||||
|
||||
# suffix rules
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: _.o .o .c .doc .1
|
||||
.c_.o:
|
||||
$(CC) -c $(CFLAGS) -DUTIL -o $@ $<
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
.1.doc:
|
||||
nroff -man $< | col -bx | uniq > $@
|
||||
|
||||
# rules for zip, zipnote, zipcloak, zipsplit, and the Zip MANUALs.
|
||||
$(OBJZ): $(ZIP_H)
|
||||
$(OBJI): $(ZIP_H)
|
||||
$(OBJN): $(ZIP_H)
|
||||
$(OBJS): $(ZIP_H)
|
||||
$(OBJC): $(ZIP_H)
|
||||
zip.o zipup.o zipfile.o fileio.o crc32.o crypt.o: crc32.h
|
||||
zipcloak.o zipfile_.o fileio_.o crc32_.o crypt_.o: crc32.h
|
||||
zip.o zipup.o crypt.o ttyio.o zipcloak.o crypt_.o: crypt.h
|
||||
zip.o zipup.o zipnote.o zipcloak.o zipsplit.o: revision.h
|
||||
zip.o crypt.o ttyio.o zipcloak.o crypt_.o: ttyio.h
|
||||
zipup.o: unix/zipup.h
|
||||
|
||||
match.o: match.S
|
||||
$(CPP) match.S > _match.s
|
||||
$(AS) _match.s
|
||||
mv _match.o match.o
|
||||
rm -f _match.s
|
||||
|
||||
crc_i386.o: crc_i386.S
|
||||
$(CPP) crc_i386.S > _crc_i386.s
|
||||
$(AS) _crc_i386.s
|
||||
mv _crc_i386.o crc_i386.o
|
||||
rm -f _crc_i386.s
|
||||
|
||||
unix.o: unix/unix.c
|
||||
$(CC) -c $(CFLAGS) unix/unix.c
|
||||
|
||||
unix_.o: unix/unix.c
|
||||
$(CC) -c $(CFLAGS) -DUTIL -o $@ unix/unix.c
|
||||
|
||||
ZIPS = zip$E zipcloak$E zipnote$E zipsplit$E
|
||||
|
||||
zips: $(ZIPS)
|
||||
zipsman: $(ZIPS) $(ZIPMANUALs)
|
||||
|
||||
zip$E: $(OBJZ) $(OBJI) $(OBJA) $(LIB_BZ)
|
||||
$(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2)
|
||||
zipnote$E: $(OBJN)
|
||||
$(BIND) -o zipnote$E $(LFLAGS1) $(OBJN) $(LFLAGS2)
|
||||
zipcloak$E: $(OBJC) $(OCRCTB)
|
||||
$(BIND) -o zipcloak$E $(LFLAGS1) $(OBJC) $(LFLAGS2)
|
||||
zipsplit$E: $(OBJS)
|
||||
$(BIND) -o zipsplit$E $(LFLAGS1) $(OBJS) $(LFLAGS2)
|
||||
|
||||
$(ZIPMANUAL): man/zip.1
|
||||
nroff -man man/zip.1 | col -bx | uniq > $(ZIPMANUAL)
|
||||
|
||||
$(ZIPMANUALcloak): man/zipcloak.1
|
||||
nroff -man man/zipcloak.1 | col -bx | uniq > $(ZIPMANUALcloak)
|
||||
|
||||
$(ZIPMANUALnote): man/zipnote.1
|
||||
nroff -man man/zipnote.1 | col -bx | uniq > $(ZIPMANUALnote)
|
||||
|
||||
$(ZIPMANUALsplit): man/zipsplit.1
|
||||
nroff -man man/zipsplit.1 | col -bx | uniq > $(ZIPMANUALsplit)
|
||||
|
||||
|
||||
# bzip2 object library
|
||||
|
||||
$(IZ_OUR_BZIP2_DIR)/libbz2.a : $(IZ_OUR_BZIP2_DIR)/Makefile
|
||||
@echo "Building bzip2 object library..."
|
||||
( cd $(IZ_OUR_BZIP2_DIR); \
|
||||
$(MAKE) CC="$(CC_BZ)" CFLAGS="$(CFLAGS_BZ)" libbz2.a )
|
||||
@echo " bzip2 object library created."
|
||||
|
||||
|
||||
# install
|
||||
install: $(ZIPS)
|
||||
-$(INSTALL_D) $(BINDIR)
|
||||
$(INSTALL_PROGRAM) $(ZIPS) $(BINDIR)
|
||||
-cd $(BINDIR); $(CHMOD) $(BINFLAGS) $(ZIPS)
|
||||
-$(INSTALL_D) $(MANDIR)
|
||||
$(INSTALL_PROGRAM) man/zip.1 $(MANDIR)/zip.$(MANEXT)
|
||||
$(CHMOD) $(MANFLAGS) $(MANDIR)/zip.$(MANEXT)
|
||||
$(INSTALL_PROGRAM) man/zipcloak.1 $(MANDIR)/zipcloak.$(MANEXT)
|
||||
$(CHMOD) $(MANFLAGS) $(MANDIR)/zipcloak.$(MANEXT)
|
||||
$(INSTALL_PROGRAM) man/zipnote.1 $(MANDIR)/zipnote.$(MANEXT)
|
||||
$(CHMOD) $(MANFLAGS) $(MANDIR)/zipnote.$(MANEXT)
|
||||
$(INSTALL_PROGRAM) man/zipsplit.1 $(MANDIR)/zipsplit.$(MANEXT)
|
||||
$(CHMOD) $(MANFLAGS) $(MANDIR)/zipsplit.$(MANEXT)
|
||||
|
||||
uninstall:
|
||||
-cd $(BINDIR); rm -f $(ZIPS)
|
||||
-cd $(MANDIR); rm -f \
|
||||
zip.$(MANEXT) zipcloak.$(MANEXT) zipnote.$(MANEXT) zipsplit.$(MANEXT)
|
||||
|
||||
|
||||
flags: unix/configure
|
||||
sh unix/configure "${CC}" "${CFLAGS_NOOPT}" "${IZ_BZIP2}"
|
||||
|
||||
# These symbols, when #defined using -D have these effects on compilation:
|
||||
# ZMEM - includes C language versions of memset(), memcpy(),
|
||||
# and memcmp() (util.c).
|
||||
# HAVE_DIRENT_H - use <dirent.h> instead of <sys/dir.h>
|
||||
# NODIR - for 3B1, which has neither getdents() nor opendir().
|
||||
# HAVE_NDIR_H - use <ndir.h> (unix/unix.c).
|
||||
# HAVE_SYS_DIR_H - use <sys/dir.h>
|
||||
# HAVE_SYS_NDIR_H - use <sys/ndir.h>
|
||||
# UTIL - select routines for utilities (note, cloak, split)
|
||||
# NO_RMDIR - remove directories using a system("rmdir ...") call.
|
||||
# NO_PROTO - cannot handle ANSI prototypes
|
||||
# NO_CONST - cannot handle ANSI const
|
||||
# NO_LARGE_FILE_SUPPORT - do not enable Large File support even if available.
|
||||
# NO_ZIP64_SUPPORT - do not enable Zip64 archive support even if available.
|
||||
# NO_UNICODE_SUPPORT - do not enable Unicode support even if available.
|
||||
# NO_BZIP2_SUPPORT - do not compile in bzip2 code even if available.
|
||||
|
||||
# Generic targets:
|
||||
|
||||
generic: flags
|
||||
eval $(MAKE) $(MAKEF) zips `cat flags`
|
||||
|
||||
generic_gcc:
|
||||
$(MAKE) $(MAKEF) generic CC=gcc CPP="gcc -E"
|
||||
|
||||
# AT&T 6300 PLUS (don't know yet how to allocate 64K bytes):
|
||||
att6300nodir:
|
||||
$(MAKE) $(MAKEF) zips LFLAGS1="-Ml -s" \
|
||||
CFLAGS="-DUNIX -I. -O -Ml -DNO_RMDIR -DDYN_ALLOC -DMEDIUM_MEM \
|
||||
-DWSIZE=16384 -DNO_STDLIB_H -DNO_STDDEF_H -DNO_RENAME \
|
||||
-DNO_MKTIME -DNO_SIZE_T -DNO_VOID -DNO_PROTO -DNO_DIR \
|
||||
-DNO_CONST -DHAVE_TERMIO_H" \
|
||||
"LFLAGS2="
|
||||
|
||||
# Coherent (AS definition not needed for gcc)
|
||||
coherent:
|
||||
$(MAKE) $(MAKEF) zips CFLAGS="-DUNIX -I. -O -DDIRENT -DASMV" \
|
||||
AS="as -gx" OBJA=match.o
|
||||
|
||||
# Cray Unicos 6.1, Standard C compiler 3.0 (all routines except trees.c
|
||||
# may be compiled with vector3; internal compiler bug in 3.0.2.3 and
|
||||
# earlier requires vector2 for trees.c)
|
||||
cray_v3:
|
||||
$(MAKE) $(MAKEF) zips CC="scc" \
|
||||
CFLAGS="-DUNIX -I. -O -h vector2 -h scalar3 -DHAVE_DIRENT_H"
|
||||
|
||||
# Cygwin
|
||||
cygwin:
|
||||
$(MAKE) $(MAKEF) generic CC="gcc" CPP="gcc -E" EXE=".exe"
|
||||
|
||||
# LynxOS
|
||||
lynx:
|
||||
$(MAKE) $(MAKEF) generic CC=gcc CPP="gcc -E" CFLAGS="$(CFLAGS) \
|
||||
-DNO_UNDERLINE -DLynx -DLYNX LFLAGS2="$LFLAGS2 -lc_p"
|
||||
|
||||
# MINIX 1.5.10 with Bruce Evans 386 patches and gcc/GNU make
|
||||
minix:
|
||||
$(MAKE) $(MAKEF) zips CFLAGS="-DUNIX -I. -O -DDIRENT -DMINIX" CC=gcc
|
||||
chmem =262144 zip
|
||||
|
||||
# IBM OS/390 (formerly MVS) compiled under "OpenEdition" shell
|
||||
# You can make the zip executable with IBM's make, but you will
|
||||
# get errors dealing with the _.o targets for the other executables
|
||||
# (zipcloak, etc). GNU make will build all the executables.
|
||||
# If you have GNU make in your path as gmake, you can uncomment
|
||||
# the following, but it shouldn't be needed:
|
||||
#MAKE = gmake
|
||||
|
||||
os390:
|
||||
$(MAKE) $(MAKEF) zips CFLAGS="$(CF) -I. -DUNIX -DOS390 -DEBCDIC \
|
||||
-DSYSV -DNO_PARAM_H" LFLAGS2=""
|
||||
|
||||
# QNX is "special" because out /bin/sh is ksh and it doesn't grok the
|
||||
# configure script properly, generating a bad flags file. D'oh! [cjh]
|
||||
#
|
||||
# QNX/Neutrino is "special" because you don't have any native development
|
||||
# tools yet. Set ARCH to "x86", "ppcbe", "ppcle", "mipsbe", or "mipsle"
|
||||
# to produce x86, PowerPC (big- or little-endian) and MIPS (big-
|
||||
# or little-endian) using gcc. [cjh]
|
||||
qnx:
|
||||
$(MAKE) $(MAKEF) zips LN=ln CC=cc CFLAGS="-DUNIX -I. -O \
|
||||
-DHAVE_DIRENT_H -DHAVE_TERMIOS_H -DNO_MKTEMP"
|
||||
|
||||
qnxnto:
|
||||
@if [ "$(ARCH)" = "" ] ; then \
|
||||
echo "You didn't set ARCH; I'll assume you meant ARCH=x86..." ; \
|
||||
echo "" ; \
|
||||
$(MAKE) $(MAKEF) zips LN=ln CC="qcc -Vgcc_ntox86" \
|
||||
CFLAGS="-g -DUNIX -I. -O -DHAVE_DIRENT_H -DHAVE_TERMIOS_H -DNO_MKTEMP" \
|
||||
LFLAGS2=-g ; \
|
||||
else \
|
||||
echo "Making zip for $(ARCH)..." ; \
|
||||
echo "" ; \
|
||||
$(MAKE) $(MAKEF) zips LN=ln CC="qcc -Vgcc_nto$(ARCH)" \
|
||||
CFLAGS="-g -DUNIX -I. -O -DHAVE_DIRENT_H -DHAVE_TERMIOS_H -DNO_MKTEMP" \
|
||||
LFLAGS2=-g ; \
|
||||
fi
|
||||
|
||||
# Solaris: Generic, plus generation of installable package.
|
||||
solaris: generic svr4package
|
||||
|
||||
# Solaris with GCC: generic_gcc, plus generation of installable package
|
||||
solaris_gcc: generic_gcc svr4package
|
||||
|
||||
# Package generation interface (by JBush). Originally tested under Sun Solaris.
|
||||
# Other SVr4s may be very similar, and could possibly use this.
|
||||
# Note: Expects version info to be stored in VERSION macro variable.
|
||||
# See "README" under ./unix/Packaging
|
||||
svr4package:
|
||||
@echo "Creating SVR4 package for Unix ..."
|
||||
-@rm -rf ./$(PKGDIR) ./$(PKGDIR)_`uname -p`.pkg
|
||||
-@sed -e "s/.VERSION./$(VERSION)/g" \
|
||||
-e "s/.PSTAMP./$(LOGNAME)_`date | tr ' ' '_'`/g" \
|
||||
-e "s/.ARCH./Solaris_`uname -rp | tr ' ' ','`/g" \
|
||||
./unix/Packaging/pkginfo.in > ./unix/Packaging/pkginfo
|
||||
-@sed -e "s/.ARCH./`uname -p`/g" \
|
||||
./unix/Packaging/preinstall.in > ./unix/Packaging/preinstall
|
||||
/usr/bin/pkgmk -d . -b . -r . -f ./unix/Packaging/prototype $(PKGDIR)
|
||||
/usr/bin/pkgtrans -o -s . $(PKGDIR)_`uname -p`.pkg $(PKGDIR)
|
||||
@echo " "
|
||||
@echo "To install, copy $(PKGDIR)_`uname -p`.pkg to the target system, and"
|
||||
@echo "issue the command (as root): pkgadd -d $(PKGDIR)_`uname -p`.pkg"
|
||||
@echo " "
|
||||
|
||||
# make a distribution
|
||||
dist: $(ZIPMANUAL)
|
||||
eval zip -r9 zip`sed -e '/VERSION/!d' -e 's/.*"\(.*\)".*/\1/' \
|
||||
-e 's/[.]//g' -e 's/ .*//g' -e q revision.h` *
|
||||
|
||||
# clean up after making stuff and installing it
|
||||
clean:
|
||||
rm -f *.o $(ZIPS) flags
|
||||
rm -rf $(PKGDIR)
|
||||
|
||||
clean_bzip2 :
|
||||
@if test -f "$(IZ_OUR_BZIP2_DIR)/Makefile"; then \
|
||||
( cd $(IZ_OUR_BZIP2_DIR); make clean ); \
|
||||
else \
|
||||
if test -z "$(IZ_OUR_BZIP2_DIR)"; then \
|
||||
echo "No bzip2 directory (\"IZ_OUR_BZIP2_DIR\") specified."; \
|
||||
else \
|
||||
echo "No bzip2 make file found: $(IZ_OUR_BZIP2_DIR)/Makefile."; \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
clean_exe :
|
||||
rm -f $(ZIPS)
|
||||
#
|
44
third_party/infozip/zip/unix/Packaging/README
vendored
44
third_party/infozip/zip/unix/Packaging/README
vendored
|
@ -1,44 +0,0 @@
|
|||
Solaris packaging
|
||||
-----------------
|
||||
|
||||
To generate a Solaris package for Info-ZIP zip utilities,
|
||||
first see the top level INSTALL and README files. Do a
|
||||
"make solaris", which will automatically build two Solaris
|
||||
installable package files for the package, IZzip.
|
||||
|
||||
IZzip -- Solaris installable package in directory format.
|
||||
IZzip_$(arch).pkg -- Solaris installable package in "stream" format.
|
||||
|
||||
Where: $(arch) := system architecture, currently i386, sparc, or ppc.
|
||||
(use "uname -p" to determine)
|
||||
|
||||
The ".pkg" file is a single file datastream that can be compressed
|
||||
and/or ftp'd. This is the recommended form, because all required
|
||||
files are resident in the archive, and it is easily distributed.
|
||||
|
||||
To install, simply:
|
||||
|
||||
1) copy the package to the target system's /tmp directory.
|
||||
2) login or su to root
|
||||
3) pkgadd -d /tmp/IZzip_$(arch).pkg
|
||||
4) add /opt/Info-ZIP/IZzip/bin to PATH
|
||||
5) add /opt/Info-ZIP/IZzip/man to MANPATH
|
||||
|
||||
This works for both SPARC and x86.
|
||||
|
||||
Ongoing maintenance:
|
||||
|
||||
Keep the files, "prototype" and "pkginfo.in" up to date.
|
||||
Observe variable substitutions made by "Makefile".
|
||||
See manpages for pkginfo(1), pkginfo(4), pkgmk(1), pkgproto(1)
|
||||
|
||||
Variations:
|
||||
|
||||
If you wish the base directory to be set to something other than
|
||||
/opt/Info-ZIP, change the setting BASEDIR in pkginfo.in and
|
||||
re-run the make.
|
||||
|
||||
|
||||
-John Bush (John.Bush@East.Sun.COM)
|
||||
July 20, 1996
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
PKG=IZzip
|
||||
NAME=Info-ZIP Zip Utilities
|
||||
CATEGORY=application
|
||||
VENDOR=Info-ZIP
|
||||
EMAIL=http://info-zip.org/zip-bug.html
|
||||
HOTLINE=http://info-zip.org/zip-bug.html
|
||||
DESC=Copyrighted FREEWARE. See README, WHERE, and docs in pkg's doc dir.
|
||||
CLASSES=none
|
||||
BASEDIR=/opt/Info-ZIP
|
||||
#BASEDIR=/usr/local
|
||||
VERSION=".VERSION."
|
||||
PSTAMP=".PSTAMP."
|
||||
ARCH=".ARCH."
|
|
@ -1,29 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Info-ZIP Zip post-installation script.
|
||||
#
|
||||
# Last revised: 2007-09-29 SMS. Zip 3.0.
|
||||
#
|
||||
# Post installation script (simply inform installer about PATH etc)
|
||||
#
|
||||
echo ''
|
||||
echo 'Installation is complete. Users should adjust their environment'
|
||||
echo 'variables to include these directories:'
|
||||
echo " PATH: ${BASEDIR}/${PKG}/bin"
|
||||
echo " MANPATH: ${BASEDIR}/${PKG}/man"
|
||||
echo ''
|
||||
echo "Commands like the following may be added to a user's shell start-up"
|
||||
echo 'file (.cshrc, .login, .profile, ...) to do this:'
|
||||
echo ''
|
||||
echo ' For a Bourne-like shell:'
|
||||
echo " PATH=\"\${PATH}:${BASEDIR}/${PKG}/bin\""
|
||||
echo " MANPATH=\"\${MANPATH}:${BASEDIR}/${PKG}/man\""
|
||||
echo ' export PATH MANPATH'
|
||||
echo ''
|
||||
echo ' For a C shell:'
|
||||
echo " setenv PATH \"\${PATH}:${BASEDIR}/${PKG}/bin\""
|
||||
echo " setenv MANPATH \"\${MANPATH}:${BASEDIR}/${PKG}/man\""
|
||||
echo ''
|
||||
echo "See the files under ${BASEDIR}/${PKG}/doc for more information."
|
||||
echo ''
|
||||
exit 0
|
|
@ -1,29 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Info-ZIP Zip pre-installation script.
|
||||
#
|
||||
# Last revised: 2007-09-29 SMS. Zip 3.0.
|
||||
#
|
||||
# pkgadd should set a good PATH, but just in case, ...
|
||||
PATH="/sbin:/usr/bin:${PATH}"
|
||||
export PATH
|
||||
echo ''
|
||||
echo 'Please report problems to Info-ZIP using:'
|
||||
echo ''
|
||||
echo ' http://info-zip.org/zip-bug.html'
|
||||
echo ''
|
||||
arch=`uname -p`
|
||||
if [ "arch_${arch}" != "arch_.ARCH." ]; then
|
||||
echo "This product MUST be installed on a Solaris \".ARCH.\" system."
|
||||
echo "This system appears to have \"${arch}\" architecture, not \".ARCH.\"."
|
||||
echo "Please install the version for the \".ARCH.\" architecture."
|
||||
echo 'Aborting installation...'
|
||||
returncode=1
|
||||
else
|
||||
echo "Installing on \".ARCH.\" architecture..."
|
||||
returncode=0
|
||||
fi
|
||||
echo ''
|
||||
sleep 4
|
||||
exit ${returncode:-1}
|
||||
#
|
29
third_party/infozip/zip/unix/Packaging/prototype
vendored
29
third_party/infozip/zip/unix/Packaging/prototype
vendored
|
@ -1,29 +0,0 @@
|
|||
d none $BASEDIR 0755 root bin
|
||||
d none $PKG 0755 root bin
|
||||
d none $PKG/doc 0755 root bin
|
||||
f none $PKG/doc/BUGS=BUGS 0644 root bin
|
||||
f none $PKG/doc/CHANGES=CHANGES 0644 root bin
|
||||
f none $PKG/doc/INSTALL=INSTALL 0644 root bin
|
||||
f none $PKG/doc/LICENSE=LICENSE 0644 root bin
|
||||
f none $PKG/doc/README=README 0644 root bin
|
||||
f none $PKG/doc/TODO=TODO 0644 root bin
|
||||
f none $PKG/doc/USexport.msg=USexport.msg 0644 root bin
|
||||
f none $PKG/doc/WHATSNEW=WHATSNEW 0644 root bin
|
||||
f none $PKG/doc/WHERE=WHERE 0644 root bin
|
||||
f none $PKG/doc/zip.txt=zip.txt 0644 root bin
|
||||
d none $PKG/man 0755 root bin
|
||||
d none $PKG/man/man1 0755 root bin
|
||||
f none $PKG/man/man1/zip.1=man/zip.1 0644 root bin
|
||||
f none $PKG/man/man1/zipcloak.1=man/zipcloak.1 0644 root bin
|
||||
f none $PKG/man/man1/zipnote.1=man/zipnote.1 0644 root bin
|
||||
f none $PKG/man/man1/zipsplit.1=man/zipsplit.1 0644 root bin
|
||||
d none $PKG/bin 0755 root bin
|
||||
f none $PKG/bin/zip=zip 0755 root bin
|
||||
f none $PKG/bin/zipcloak=zipcloak 0755 root bin
|
||||
f none $PKG/bin/zipnote=zipnote 0755 root bin
|
||||
f none $PKG/bin/zipsplit=zipsplit 0755 root bin
|
||||
i README
|
||||
i pkginfo
|
||||
i prototype
|
||||
i preinstall
|
||||
i postinstall
|
85
third_party/infozip/zip/unix/README.OS390
vendored
85
third_party/infozip/zip/unix/README.OS390
vendored
|
@ -1,85 +0,0 @@
|
|||
|
||||
OS/390 is IBM's follow-on to MVS and includes a POSIX, XOPEN,
|
||||
XPG4, build environment, a Unix-style filesystem (called HFS), and
|
||||
a POSIX (Born) shell. This port uses this environment and is a fairly
|
||||
straight-forward port of ZIP's Unix port - but uses the existing EBCDIC
|
||||
code. This port does not work with non-HFS (traditional MVS)
|
||||
filesystems.
|
||||
|
||||
I believe all my changes are isolated with #ifdef's.
|
||||
|
||||
Here's some text which might be useful for an OS390 README or
|
||||
the manual.
|
||||
|
||||
ZIP for OS390 HFS datasets
|
||||
--------------------------
|
||||
Allows you to create ZIP archives from the OS/390 OpenEdition
|
||||
command prompt. This port uses standard Unix-style I/O routines
|
||||
and only works with HFS files.
|
||||
|
||||
Usage
|
||||
-----
|
||||
By default, ZIP does not perform character-set translation, but has
|
||||
options to make it easy to convert text files to be compatible with
|
||||
other systems
|
||||
zip zipfile list # add the files in 'list' to archive 'zipfile'
|
||||
zip -a zipfile list # same as above, but translate files to ASCII
|
||||
zip -al zipfile list # same as above, translate linefeeds to DOS style
|
||||
zip -all zipfile list # same as '-a', translate linefeeds to UNIX style
|
||||
|
||||
Build process
|
||||
-------------
|
||||
Assuming GNU make is available in your path and is called "gmake" (See
|
||||
the notes on Makefile changes below) and a C compiler is available as
|
||||
"cc", then type
|
||||
gmake -f unix/Makefile MAKE=gmake os390
|
||||
|
||||
If GNU make is not available, the existing makefile can create zip, but will
|
||||
error on the other executable (zipsplit, zipcloak, zipnote) if you type
|
||||
make -f unix/Makefile os390
|
||||
|
||||
Overview of Changes
|
||||
-------------------
|
||||
The OS/390 port is treated as a variant of the Unix port. EBCDIC support
|
||||
was already implemented for CMS/MVS-batch ports. The specific changes I
|
||||
made are summarized below.
|
||||
|
||||
unix/Makefile - zip uses a unusual _.o target which IBM's make can't handle.
|
||||
Since the Makefile has a macro called MAKE that is used for a recursive
|
||||
call to make, I changed the MACRO to call "gmake" - GNU's make - which
|
||||
can handle the _.o target. If you don't have GNU make, you can
|
||||
workaround by manually applying symlinks from whatever.c to whatever_.c.
|
||||
Alternatively, the whatever_.o files could be explicitely added for os390.
|
||||
|
||||
I added an os390 target with appropriate defines.
|
||||
|
||||
zipup.c - added code (#ifdef OS390) to convert test to ASCII if -a flag
|
||||
was set.
|
||||
|
||||
zip.c - changed logic which always used DOS-style newlines when -a was
|
||||
set to be consistent with other port (DOS newlines if -l option)
|
||||
|
||||
zipfile.c - miscellaneous changes to force storing file names and
|
||||
descriptions in ASCII in the zip directory. This makes zip files
|
||||
portable across all platforms. This in turn meant names did not
|
||||
need to be translated when displaying messages.
|
||||
|
||||
zip.h - strtoasc was missing a closing parenthesis.
|
||||
|
||||
ebcdic.h - changed translation table to be consistent with current IBM
|
||||
recommendations - exact same changes to ebcdic.h as in my unzip port.
|
||||
|
||||
tailor.h - define huge/far/near to be empty
|
||||
|
||||
unix/unix.c - substantial changes to deal with mode flags. Under
|
||||
the current XOPEN standards, some of the traditional unix file mode
|
||||
bits need not be in fixed locations, but standard access macros must be
|
||||
available to access the values. The old unix.c code just picked up these
|
||||
values and saved them as-is where unzip interpreted them. Existing
|
||||
Unix system provided the macros for XOPEN compliance, but left the flags
|
||||
in their traditional locations. OS/390 has a brand new filesystem which
|
||||
is XOPEN compliant without revealing the positions of these flags.
|
||||
To create the bitmask in the same format unzip expects, the macros are
|
||||
tested one-by-one to set the appropriate bits. This same logic should
|
||||
work on any XOPEN system, but takes more instructions (I did test this
|
||||
logic on Linux).
|
695
third_party/infozip/zip/unix/configure
vendored
695
third_party/infozip/zip/unix/configure
vendored
|
@ -1,695 +0,0 @@
|
|||
:
|
||||
#!/bin/sh -x
|
||||
# The above : is necessary on some buggy systems.
|
||||
|
||||
# configure: Guess values for system-dependent variables
|
||||
# Output the flag definitions to the file "flags".
|
||||
#
|
||||
# Parameters: $1 = $CC, $2 = $CFLAGS, $3 = $IZ_BZIP2
|
||||
#
|
||||
# This file is typically called from Makefile rather than executed
|
||||
# from the command line.
|
||||
#
|
||||
# To construct zip automatically using this file, type
|
||||
# "make -f unix/Makefile generic".
|
||||
# If this fails, then type "make list" to get a list of special targets.
|
||||
|
||||
trap "rm -f conftest* core a.out; exit 1" 1 2 3 15
|
||||
|
||||
CC=${1-cc}
|
||||
CFLAGS=${2-"-I. -DUNIX"}
|
||||
LFLAGS1=''
|
||||
LFLAGS2=''
|
||||
LN="ln -s"
|
||||
|
||||
CFLAGS_OPT=''
|
||||
|
||||
# bzip2
|
||||
IZ_BZIP2=${3-}
|
||||
CFLAGS_BZ=''
|
||||
|
||||
|
||||
echo 'Check C compiler type (optimization options)'
|
||||
# Sun C?
|
||||
cat > conftest.c << _EOF_
|
||||
int main()
|
||||
{
|
||||
#ifndef __SUNPRO_C
|
||||
bad code
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
_EOF_
|
||||
$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
|
||||
if test $? -eq 0; then
|
||||
CFLAGS_OPT='-xO3'
|
||||
echo " Sun C ($CFLAGS_OPT)"
|
||||
else
|
||||
# Tru64 DEC/Compaq/HP C?
|
||||
cat > conftest.c << _EOF_
|
||||
int main()
|
||||
{
|
||||
#ifndef __DECC
|
||||
bad code
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
_EOF_
|
||||
$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
|
||||
if test $? -eq 0; then
|
||||
CFLAGS_OPT='-O3'
|
||||
echo " DEC C ($CFLAGS_OPT)"
|
||||
else
|
||||
# HP-UX HP C?
|
||||
cat > conftest.c << _EOF_
|
||||
int main()
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
bad code
|
||||
#endif
|
||||
#ifndef __hpux
|
||||
bad code
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
_EOF_
|
||||
$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
|
||||
if test $? -eq 0; then
|
||||
# HP-UX, not GCC. Lame bundled or real ANSI compiler?
|
||||
CFLAGS_OPT_TRY="+O3 +Onolimit"
|
||||
$CC $CFLAGS $CFLAGS_OPT_TRY -c conftest.c 2>&1 | \
|
||||
grep '(Bundled)' > /dev/null
|
||||
if test $? -ne 0; then
|
||||
CFLAGS_OPT="$CFLAGS_OPT_TRY"
|
||||
echo " HP-UX ANSI C ($CFLAGS_OPT)"
|
||||
else
|
||||
echo ' HP-UX Bundled C (no opt)'
|
||||
fi
|
||||
else
|
||||
# GNU C?
|
||||
cat > conftest.c << _EOF_
|
||||
int main()
|
||||
{
|
||||
#ifndef __GNUC__
|
||||
bad code
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
_EOF_
|
||||
$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
|
||||
if test $? -eq 0; then
|
||||
CFLAGS_OPT='-O3'
|
||||
echo " GNU C ($CFLAGS_OPT)"
|
||||
# Special Mac OS X shared library "ld" option?
|
||||
if test ` uname -s 2> /dev/null ` = 'Darwin'; then
|
||||
lf='-Wl,-search_paths_first'
|
||||
$CC $CFLAGS $lf conftest.c > /dev/null 2>/dev/null
|
||||
if test $? -eq 0; then
|
||||
LFLAGS2="${LFLAGS2} ${lf}"
|
||||
fi
|
||||
rm -f conftest
|
||||
fi
|
||||
else
|
||||
CFLAGS_OPT='-O'
|
||||
echo " Other-unknown C ($CFLAGS_OPT)"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# optimization flags
|
||||
if test -n "${CFLAGS_OPT}"; then
|
||||
CFLAGS="${CFLAGS} ${CFLAGS_OPT}"
|
||||
CFLAGS_BZ="${CFLAGS_BZ} ${CFLAGS_OPT}"
|
||||
fi
|
||||
|
||||
|
||||
# bzip2
|
||||
|
||||
echo "Check bzip2 support"
|
||||
CC_BZ="${CC}"
|
||||
LIB_BZ=''
|
||||
if test -n "${IZ_BZIP2}"; then
|
||||
echo " Check for bzip2 compiled library in IZ_BZIP2 (${IZ_BZIP2})"
|
||||
if test -f "${IZ_BZIP2}/libbz2.a"; then
|
||||
#
|
||||
# A bzip2 library built with BZ_NO_STDIO should have an
|
||||
# unresolved external, "bz_internal_error". The default,
|
||||
# full-function library will not mention it.
|
||||
#
|
||||
nm ${IZ_BZIP2}/libbz2.a | grep bz_internal_error > /dev/null
|
||||
if test $? -eq 0; then
|
||||
echo " Found bzip2 BZ_NO_STDIO library, ${IZ_BZIP2}/libbz2.a"
|
||||
else
|
||||
echo " Found bzip2 library, ${IZ_BZIP2}/libbz2.a,"
|
||||
echo " but library not compiled with BZ_NO_STDIO"
|
||||
echo " WARNING: We recommend using a bzip2 library compiled"
|
||||
echo " with BZ_NO_STDIO defined for proper error handling"
|
||||
echo " Please see the Zip installation instructions in bzip2/install.txt"
|
||||
echo " Continuing anyway with standard bzip2 library..."
|
||||
fi
|
||||
if test -f "${IZ_BZIP2}/bzlib.h"; then
|
||||
CFLAGS="${CFLAGS} -I${IZ_BZIP2} -DBZIP2_SUPPORT"
|
||||
LFLAGS2="${LFLAGS2} -L${IZ_BZIP2} -lbz2"
|
||||
echo "-- Found bzip2 library - linking in bzip2"
|
||||
else
|
||||
echo " ${IZ_BZIP2}/bzlib.h not found"
|
||||
echo "-- Since IZ_BZIP2 defined, skipping OS and bzip2 dir checks - no bzip2"
|
||||
fi
|
||||
else
|
||||
echo " ${IZ_BZIP2}/libbz2.a not found"
|
||||
echo "-- Since IZ_BZIP2 defined, skipping OS and bzip2 checks - no bzip2"
|
||||
fi
|
||||
else
|
||||
echo " Check for bzip2 in bzip2 directory"
|
||||
IZ_BZIP2=bzip2
|
||||
if test -f "${IZ_BZIP2}/libbz2.a"; then
|
||||
nm ${IZ_BZIP2}/libbz2.a | grep bz_internal_error > /dev/null
|
||||
if test $? -eq 0; then
|
||||
echo " Found bzip2 BZ_NO_STDIO library in bzip2 directory"
|
||||
else
|
||||
echo " Found bzip2 library in bzip2 directory,"
|
||||
echo " but not built with the BZ_NO_STDIO option"
|
||||
echo " WARNING: We recommend using a bzip2 library compiled"
|
||||
echo " with BZ_NO_STDIO defined for proper error handling"
|
||||
echo " Please see the Zip installation instructions"
|
||||
echo " Continuing anyway with standard bzip2 library..."
|
||||
fi
|
||||
fi
|
||||
if test -f "bzip2/bzlib.h" -a -f "bzip2/libbz2.a"; then
|
||||
CFLAGS="${CFLAGS} -I${IZ_BZIP2} -DBZIP2_SUPPORT"
|
||||
LFLAGS2="${LFLAGS2} -Lbzip2 -lbz2"
|
||||
echo "-- Found bzip2 library - linking in bzip2"
|
||||
else
|
||||
if test -f "bzip2/bzlib.c" -a -f "bzip2/bzlib.h"; then
|
||||
echo "-- No library, but found bzip2 source in bzip2 directory"
|
||||
echo "-- Will try to build bzip2 library from source and link in"
|
||||
#
|
||||
# Arrange to build a BZ_NO_STDIO bzip2 object library using the
|
||||
# same compiler and optimization options as used for Zip, and
|
||||
# to compile and link Zip with bzip2.
|
||||
#
|
||||
CFLAGS_BZ="${CFLAGS_BZ} -DBZ_NO_STDIO"
|
||||
LIB_BZ="bzip2/libbz2.a"
|
||||
CFLAGS="${CFLAGS} -Ibzip2 -DBZIP2_SUPPORT"
|
||||
LFLAGS2="${LFLAGS2} -Lbzip2 -lbz2"
|
||||
else
|
||||
echo " Check if OS already has bzip2 library installed"
|
||||
cat > conftest.c << _EOF_
|
||||
#include "bzlib.h"
|
||||
int main()
|
||||
{
|
||||
bz_stream strm;
|
||||
BZ2_bzCompressEnd(&strm);
|
||||
return 0;
|
||||
}
|
||||
_EOF_
|
||||
$CC $CFLAGS -o conftest conftest.c -lbz2 > /dev/null 2>/dev/null
|
||||
if test $? -eq 0; then
|
||||
echo "-- OS supports bzip2 - linking in bzip2"
|
||||
CFLAGS="${CFLAGS} -DBZIP2_SUPPORT"
|
||||
LFLAGS2="${LFLAGS2} -lbz2"
|
||||
else
|
||||
echo "-- Either bzlib.h or libbz2.a not found - no bzip2"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
echo Check for the C preprocessor
|
||||
# on SVR4, cc -E does not produce correct assembler files. Need /lib/cpp.
|
||||
CPP="${CC} -E"
|
||||
# solaris as(1) needs -P, maybe others as well ?
|
||||
[ -f /usr/ccs/lib/cpp ] && CPP="/usr/ccs/lib/cpp -P"
|
||||
[ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp
|
||||
[ -f /lib/cpp ] && CPP=/lib/cpp
|
||||
[ -f /usr/bin/cpp ] && CPP=/usr/bin/cpp
|
||||
[ -f /xenix ] && CPP="${CC} -E"
|
||||
[ -f /lynx.os ] && CPP="${CC} -E"
|
||||
|
||||
echo "#include <stdio.h>" > conftest.c
|
||||
$CPP conftest.c >/dev/null 2>/dev/null || CPP="${CC} -E"
|
||||
|
||||
|
||||
echo Check if we can use asm code
|
||||
OBJA=""
|
||||
OCRCU8=""
|
||||
if eval "$CPP match.S > _match.s 2>/dev/null"; then
|
||||
if test ! -s _match.s || grep error < _match.s > /dev/null; then
|
||||
:
|
||||
elif eval "$CC -c _match.s >/dev/null 2>/dev/null" && [ -f _match.o ]; then
|
||||
CFLAGS="${CFLAGS} -DASMV"
|
||||
OBJA="match.o"
|
||||
echo "int foo() { return 0;}" > conftest.c
|
||||
$CC -c conftest.c >/dev/null 2>/dev/null
|
||||
echo Check if compiler generates underlines
|
||||
nm conftest.o | grep "(^|[^_])foo" >/dev/null 2>/dev/null
|
||||
[ $? -eq 0 ] && CPP="${CPP} -DNO_UNDERLINE"
|
||||
if eval "$CPP crc_i386.S > _crc_i386.s 2>/dev/null"; then
|
||||
if eval "$CC -c _crc_i386.s >/dev/null 2>/dev/null" && [ -f _crc_i386.o ]
|
||||
then
|
||||
OBJA="$OBJA crc_i386.o"
|
||||
OCRCU8="crc_i386.o"
|
||||
CFLAGS="${CFLAGS} -DASM_CRC"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
rm -f _match.s _match.o _crc_i386.s _crc_i386.o
|
||||
|
||||
|
||||
# ANSI options for compilers that don't have __STDC__ defined by default
|
||||
# Currently HPUX, pyramid, Dynix, AIX, OSF/1 and ultrix
|
||||
|
||||
echo Check for ANSI options
|
||||
cat > conftest.c << _EOF_
|
||||
int main()
|
||||
{
|
||||
#ifndef __STDC__
|
||||
forget it
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
_EOF_
|
||||
$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
for OPT in -Ae -Xa -qlanglvl=ansi -std1 -std
|
||||
do
|
||||
$CC $CFLAGS $OPT -c conftest.c > /dev/null 2>/dev/null
|
||||
[ $? -eq 0 ] && CFLAGS="${CFLAGS} ${OPT}" && break
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
echo Check for prototypes
|
||||
echo "int main(int argc, char *argv[]) { return 0; }" > conftest.c
|
||||
$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
|
||||
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_PROTO"
|
||||
|
||||
# const check currently handles mips cc and non ANSI compilers.
|
||||
# does it need more ?
|
||||
echo Check the handling of const
|
||||
cat > conftest.c << _EOF_
|
||||
typedef int charset[2];
|
||||
int main()
|
||||
{
|
||||
const charset x;
|
||||
const char *foo;
|
||||
return 0;
|
||||
}
|
||||
_EOF_
|
||||
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
|
||||
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_CONST"
|
||||
|
||||
|
||||
echo Check for time_t
|
||||
cat > conftest.c << _EOF_
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
int main()
|
||||
{
|
||||
time_t t;
|
||||
return 0;
|
||||
}
|
||||
_EOF_
|
||||
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
|
||||
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_TIME_T"
|
||||
|
||||
|
||||
echo Check for size_t
|
||||
cat > conftest.c << _EOF_
|
||||
#include <sys/types.h>
|
||||
int main()
|
||||
{
|
||||
size_t s;
|
||||
return 0;
|
||||
}
|
||||
_EOF_
|
||||
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
|
||||
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_SIZE_T"
|
||||
|
||||
|
||||
echo Check for off_t
|
||||
cat > conftest.c << _EOF_
|
||||
#include <sys/types.h>
|
||||
int main()
|
||||
{
|
||||
off_t s;
|
||||
return 0;
|
||||
}
|
||||
_EOF_
|
||||
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
|
||||
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_OFF_T"
|
||||
|
||||
|
||||
echo Check size of UIDs and GIDs
|
||||
echo "(Now zip stores variable size UIDs/GIDs using a new extra field. This"
|
||||
echo " tests if this OS uses 16-bit UIDs/GIDs and so if the old 16-bit storage"
|
||||
echo " should also be used for backward compatibility.)"
|
||||
# Added 2008-04-15 CS
|
||||
cat > conftest.c << _EOF_
|
||||
# define _LARGEFILE_SOURCE /* some OSes need this for fseeko */
|
||||
# define _LARGEFILE64_SOURCE
|
||||
# define _FILE_OFFSET_BITS 64 /* select default interface as 64 bit */
|
||||
# define _LARGE_FILES /* some OSes need this for 64-bit off_t */
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
struct stat s;
|
||||
|
||||
printf(" s.st_uid is %u bytes\n", sizeof(s.st_uid));
|
||||
printf(" s.st_gid is %u bytes\n", sizeof(s.st_gid));
|
||||
|
||||
/* see if have 16-bit UID */
|
||||
if (sizeof(s.st_uid) != 2) {
|
||||
return 1;
|
||||
}
|
||||
/* see if have 16-bit GID */
|
||||
if (sizeof(s.st_gid) != 2) {
|
||||
return 2;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
_EOF_
|
||||
# compile it
|
||||
$CC -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -- UID/GID test failed on compile - disabling old 16-bit UID/GID support
|
||||
CFLAGS="${CFLAGS} -DUIDGID_NOT_16BIT"
|
||||
else
|
||||
# run it
|
||||
./conftest
|
||||
r=$?
|
||||
if [ $r -eq 1 ]; then
|
||||
echo -- UID not 2 bytes - disabling old 16-bit UID/GID support
|
||||
CFLAGS="${CFLAGS} -DUIDGID_NOT_16BIT"
|
||||
elif [ $r -eq 2 ]; then
|
||||
echo -- GID not 2 bytes - disabling old 16-bit UID/GID support
|
||||
CFLAGS="${CFLAGS} -DUIDGID_NOT_16BIT"
|
||||
elif [ $r -eq 3 ]; then
|
||||
echo -- 16-bit UIDs and GIDs - keeping old 16-bit UID/GID support
|
||||
else
|
||||
echo -- test failed - conftest returned $r - disabling old 16-bit UID/GID support
|
||||
CFLAGS="${CFLAGS} -DUIDGID_NOT_16BIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Now we set the 64-bit file environment and check the size of off_t
|
||||
# Added 11/4/2003 EG
|
||||
# Revised 8/12/2004 EG
|
||||
|
||||
echo Check for Large File Support
|
||||
cat > conftest.c << _EOF_
|
||||
# define _LARGEFILE_SOURCE /* some OSes need this for fseeko */
|
||||
# define _LARGEFILE64_SOURCE
|
||||
# define _FILE_OFFSET_BITS 64 /* select default interface as 64 bit */
|
||||
# define _LARGE_FILES /* some OSes need this for 64-bit off_t */
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
off_t offset;
|
||||
struct stat s;
|
||||
/* see if have 64-bit off_t */
|
||||
if (sizeof(offset) < 8)
|
||||
return 1;
|
||||
printf(" off_t is %d bytes\n", sizeof(off_t));
|
||||
/* see if have 64-bit stat */
|
||||
if (sizeof(s.st_size) < 8) {
|
||||
printf(" s.st_size is %d bytes\n", sizeof(s.st_size));
|
||||
return 2;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
_EOF_
|
||||
# compile it
|
||||
$CC -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -- no Large File Support
|
||||
else
|
||||
# run it
|
||||
./conftest
|
||||
r=$?
|
||||
if [ $r -eq 1 ]; then
|
||||
echo -- no Large File Support - no 64-bit off_t
|
||||
elif [ $r -eq 2 ]; then
|
||||
echo -- no Large File Support - no 64-bit stat
|
||||
elif [ $r -eq 3 ]; then
|
||||
echo -- yes we have Large File Support!
|
||||
CFLAGS="${CFLAGS} -DLARGE_FILE_SUPPORT"
|
||||
else
|
||||
echo -- no Large File Support - conftest returned $r
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Check for wide char for Unicode support
|
||||
# Added 11/24/2005 EG
|
||||
|
||||
echo Check for wide char support
|
||||
cat > conftest.c << _EOF_
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
int wsize;
|
||||
wchar_t *wide_string;
|
||||
|
||||
if ((wide_string = (wchar_t *)malloc(4 * sizeof(wchar_t))) == NULL) {
|
||||
return 0;
|
||||
}
|
||||
/* get wide string */
|
||||
wsize = mbstowcs(wide_string, "foo", 3);
|
||||
wide_string[wsize] = (wchar_t) NULL;
|
||||
return 1;
|
||||
}
|
||||
_EOF_
|
||||
# compile it
|
||||
$CC -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
# OCRCU8 is used by all utilities if Unicode is enabled
|
||||
# OCRCTB is only used by zipcloak
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -- no Unicode support
|
||||
OCRCU8=""
|
||||
OCRCTB="crc32_.o"
|
||||
else
|
||||
# have wide char support
|
||||
echo -- have wchar_t - enabling Unicode support
|
||||
CFLAGS="${CFLAGS} -DUNICODE_SUPPORT"
|
||||
OCRCU8="crc32_.o ${OCRCU8}"
|
||||
OCRCTB=""
|
||||
fi
|
||||
|
||||
|
||||
# from configure 2.4i (Onno) 12/5/04
|
||||
|
||||
echo Check for gcc no-builtin flag
|
||||
# -fno-builtin since version 2
|
||||
cat > conftest.c << _EOF_
|
||||
int main()
|
||||
{
|
||||
#if __GNUC__ >= 2
|
||||
return 0;
|
||||
#else
|
||||
forget it
|
||||
#endif
|
||||
}
|
||||
_EOF_
|
||||
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
|
||||
[ $? -eq 0 ] && BFLAG="-fno-builtin"
|
||||
|
||||
|
||||
# Check for missing functions
|
||||
# add NO_'function_name' to flags if missing
|
||||
|
||||
for func in rmdir strchr strrchr rename mktemp mktime mkstemp
|
||||
do
|
||||
echo Check for $func
|
||||
echo "int main(){ $func(); return 0; }" > conftest.c
|
||||
$CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
|
||||
done
|
||||
|
||||
|
||||
echo Check for memset
|
||||
echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
|
||||
$CC -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DZMEM"
|
||||
|
||||
|
||||
echo Check for memmove
|
||||
cat > conftest.c << _EOF_
|
||||
#include <string.h>
|
||||
int main() { int a; int b = 0; memmove( &a, &b, sizeof( a)); return a; }
|
||||
_EOF_
|
||||
$CC -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNEED_MEMMOVE"
|
||||
|
||||
|
||||
echo Check for strerror
|
||||
cat > conftest.c << _EOF_
|
||||
#include <string.h>
|
||||
int main() { strerror( 0); return 0; }
|
||||
_EOF_
|
||||
$CC -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNEED_STRERROR"
|
||||
|
||||
echo Check for errno declaration
|
||||
cat > conftest.c << _EOF_
|
||||
#include <errno.h>
|
||||
main()
|
||||
{
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
_EOF_
|
||||
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
|
||||
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_ERRNO"
|
||||
|
||||
|
||||
echo Check for directory libraries
|
||||
cat > conftest.c << _EOF_
|
||||
int main() { return closedir(opendir(".")); }
|
||||
_EOF_
|
||||
|
||||
$CC -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
OPT=""
|
||||
for lib in ndir dir ucb bsd BSD PW x dirent
|
||||
do
|
||||
$CC -o conftest conftest.c -l$lib >/dev/null 2>/dev/null
|
||||
[ $? -eq 0 ] && OPT=-l$lib && break
|
||||
done
|
||||
if [ ${OPT} ]; then
|
||||
LFLAGS2="${LFLAGS2} ${OPT}"
|
||||
else
|
||||
CFLAGS="${CFLAGS} -DNO_DIR"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Dynix/ptx 1.3 needed this
|
||||
|
||||
echo Check for readlink
|
||||
echo "int main(){ return readlink(); }" > conftest.c
|
||||
$CC -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
$CC -o conftest conftest.c -lseq >/dev/null 2>/dev/null
|
||||
[ $? -eq 0 ] && LFLAGS2="${LFLAGS2} -lseq"
|
||||
fi
|
||||
|
||||
|
||||
echo Check for directory include file
|
||||
OPT=""
|
||||
for inc in dirent.h sys/ndir.h ndir.h sys/dir.h
|
||||
do
|
||||
echo "#include <$inc>" > conftest.c
|
||||
$CPP conftest.c > /dev/null 2>/dev/null
|
||||
[ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break
|
||||
done
|
||||
CFLAGS="${CFLAGS} ${OPT}"
|
||||
|
||||
|
||||
echo Check for nonexistent include files
|
||||
for inc in stdlib.h stddef.h unistd.h fcntl.h string.h
|
||||
do
|
||||
echo "#include <$inc>" > conftest.c
|
||||
$CPP conftest.c >/dev/null 2>/dev/null
|
||||
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $inc | tr '[a-z]./' '[A-Z]__'`"
|
||||
done
|
||||
|
||||
|
||||
echo Check for term I/O include file
|
||||
OPT=""
|
||||
for inc in termios.h termio.h sgtty.h
|
||||
do
|
||||
echo "#include <$inc>" > conftest.c
|
||||
$CPP conftest.c > /dev/null 2>/dev/null
|
||||
[ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break
|
||||
done
|
||||
CFLAGS="${CFLAGS} ${OPT}"
|
||||
|
||||
|
||||
# needed for AIX (and others ?) when mmap is used
|
||||
|
||||
echo Check for valloc
|
||||
cat > conftest.c << _EOF_
|
||||
main()
|
||||
{
|
||||
#ifdef MMAP
|
||||
valloc();
|
||||
#endif
|
||||
}
|
||||
_EOF_
|
||||
$CC ${CFLAGS} -c conftest.c > /dev/null 2>/dev/null
|
||||
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_VALLOC"
|
||||
|
||||
|
||||
echo Check for /usr/local/bin and /usr/local/man
|
||||
BINDIR=$HOME/bin
|
||||
[ -d /usr/local/bin ] && BINDIR=/usr/local/bin
|
||||
|
||||
MANDIR=manl
|
||||
[ -d /usr/man/manl ] && MANDIR=/usr/man/manl
|
||||
[ -d /usr/local/man/manl ] && MANDIR=/usr/local/man/manl
|
||||
[ -d /usr/local/man/man1 ] && MANDIR=/usr/local/man/man1
|
||||
|
||||
|
||||
echo Check for OS-specific flags
|
||||
if [ -f /usr/bin/hostinfo ]; then
|
||||
if /usr/bin/hostinfo | grep NeXT > /dev/null; then
|
||||
CFLAGS="${CFLAGS} -posix"
|
||||
LFLAGS1="${LFLAGS1} -posix -object"
|
||||
fi
|
||||
# XXX ATT6300, Cray
|
||||
elif [ -f /xenix ]; then
|
||||
if uname -p | grep 286 > /dev/null; then
|
||||
CFLAGS="${CFLAGS} -LARGE -Mel2 -DMEDIUM_MEM -DWSIZE=16384 -DNO_VOID"
|
||||
LFLAGS1="${LFLAGS1} -LARGE -Mel2"
|
||||
fi
|
||||
elif uname -X >/dev/null 2>/dev/null; then
|
||||
# SCO shared library check
|
||||
echo "int main() { return 0;}" > conftest.c
|
||||
$CC -o conftest conftest.c -lc_s -nointl >/dev/null 2> /dev/null
|
||||
[ $? -eq 0 ] && LFLAGS2="-lc_s -nointl"
|
||||
else
|
||||
SYSTEM=`uname -s 2>/dev/null` || SYSTEM="unknown"
|
||||
echo "int main() { return 0;}" > conftest.c
|
||||
case $SYSTEM in
|
||||
OSF1|ULTRIX)
|
||||
echo Check for -Olimit option
|
||||
$CC ${CFLAGS} -Olimit 1000 -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
[ $? -eq 0 ] && CFLAGS="${CFLAGS} -Olimit 1000"
|
||||
;;
|
||||
### HP-UX)
|
||||
### echo Check for +Onolimit option
|
||||
### $CC ${CFLAGS} +Onolimit -o conftest conftest.c >/dev/null 2>/dev/null
|
||||
### [ $? -eq 0 ] && CFLAGS="${CFLAGS} +Onolimit"
|
||||
### ;;
|
||||
### SunOS)
|
||||
### CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
|
||||
### ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
echo Check for symbolic links
|
||||
ln -s /dev/null null > /dev/null 2>/dev/null || LN=ln
|
||||
|
||||
|
||||
rm -f a.out conftest.c conftest.o conftest null
|
||||
|
||||
echo CC=\"${CC}\" CFLAGS=\"${CFLAGS}\" CPP=\"${CPP}\" OBJA=\"${OBJA}\" \
|
||||
OCRCU8=\"${OCRCU8}\" OCRCTB=\"${OCRCTB}\" \
|
||||
BINDIR=${BINDIR} MANDIR=${MANDIR} LFLAGS1=\"${LFLAGS1}\" \
|
||||
LFLAGS2=\"${LFLAGS2}\" LN=\"${LN}\" \
|
||||
CC_BZ=\"${CC_BZ}\" CFLAGS_BZ=\"${CFLAGS_BZ}\" \
|
||||
IZ_BZIP2=\"${IZ_BZIP2}\" LIB_BZ=\"${LIB_BZ}\" > flags
|
||||
|
1
third_party/infozip/zip/unix/unix.c
vendored
1
third_party/infozip/zip/unix/unix.c
vendored
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/sysv/consts/_posix.h"
|
||||
#include "libc/calls/struct/stat.macros.h"
|
||||
|
||||
#if defined(MINIX) || defined(__mpexl)
|
||||
# ifdef S_IWRITE
|
||||
|
|
39
third_party/infozip/zip/unix/zipup.h
vendored
39
third_party/infozip/zip/unix/zipup.h
vendored
|
@ -1,25 +1,20 @@
|
|||
/* clang-format off */
|
||||
/*
|
||||
unix/zipup.h - Zip 3
|
||||
#ifndef COSMOPOLITAN_THIRD_PARTY_INFOZIP_ZIP_UNIX_ZIPUP_H_
|
||||
#define COSMOPOLITAN_THIRD_PARTY_INFOZIP_ZIP_UNIX_ZIPUP_H_
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
|
||||
#define fhow O_RDONLY
|
||||
#define fbad (-1)
|
||||
#define zopen(n, p) open(n, p)
|
||||
#define zread(f, b, n) read(f, b, n)
|
||||
#define zclose(f) close(f)
|
||||
#define zerr(f) (k == (extent)(-1L))
|
||||
#define zstdin 0
|
||||
|
||||
See the accompanying file LICENSE, version 2005-Feb-10 or later
|
||||
(the contents of which are also included in zip.h) for terms of use.
|
||||
If, for some reason, both of these files are missing, the Info-ZIP license
|
||||
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
|
||||
*/
|
||||
#ifndef O_RDONLY
|
||||
# define O_RDONLY 0
|
||||
#endif
|
||||
#ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
#endif
|
||||
#define fhow (O_RDONLY|O_BINARY)
|
||||
#define fbad (-1)
|
||||
typedef int ftype;
|
||||
#define zopen(n,p) open(n,p)
|
||||
#define zread(f,b,n) read(f,b,n)
|
||||
#define zclose(f) close(f)
|
||||
#define zerr(f) (k == (extent)(-1L))
|
||||
#define zstdin 0
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_THIRD_PARTY_INFOZIP_ZIP_UNIX_ZIPUP_H_ */
|
||||
|
|
1
third_party/infozip/zip/util.c
vendored
1
third_party/infozip/zip/util.c
vendored
|
@ -15,7 +15,6 @@
|
|||
#define __UTIL_C
|
||||
|
||||
#include "third_party/infozip/zip/zip.h"
|
||||
#include "third_party/infozip/zip/ebcdic.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
|
|
2
third_party/infozip/zip/zbz2err.c
vendored
2
third_party/infozip/zip/zbz2err.c
vendored
|
@ -30,7 +30,7 @@
|
|||
|
||||
#define __ZBZ2ERR_C /* identifies this source module */
|
||||
|
||||
#include "zip.h"
|
||||
#include "third_party/infozip/zip/zip.h"
|
||||
|
||||
#ifdef BZIP2_SUPPORT
|
||||
# ifdef BZIP2_USEBZIP2DIR
|
||||
|
|
2
third_party/infozip/zip/zip.c
vendored
2
third_party/infozip/zip/zip.c
vendored
|
@ -4750,7 +4750,9 @@ char **argv; /* command line tokens */
|
|||
#if CRYPT
|
||||
/* Initialize the crc_32_tab pointer, when encryption was requested. */
|
||||
if (key != NULL) {
|
||||
#ifndef USE_ZLIB
|
||||
crc_32_tab = get_crc_table();
|
||||
#endif
|
||||
#ifdef EBCDIC
|
||||
/* convert encryption key to ASCII (ISO variant for 8-bit ASCII chars) */
|
||||
strtoasc(key, key);
|
||||
|
|
2
third_party/infozip/zip/zipcloak.c
vendored
2
third_party/infozip/zip/zipcloak.c
vendored
|
@ -388,8 +388,10 @@ int main(argc, argv)
|
|||
|
||||
init_upper(); /* build case map table */
|
||||
|
||||
#ifndef USE_ZLIB
|
||||
crc_32_tab = get_crc_table();
|
||||
/* initialize crc table for crypt */
|
||||
#endif
|
||||
|
||||
/* Go through args */
|
||||
zipfile = tempzip = NULL;
|
||||
|
|
6
third_party/infozip/zip/zipup.c
vendored
6
third_party/infozip/zip/zipup.c
vendored
|
@ -24,6 +24,8 @@
|
|||
#include "libc/str/str.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/sysv/consts/prot.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
|
||||
#ifndef UTIL /* This module contains no code for Zip Utilities */
|
||||
|
@ -1543,8 +1545,8 @@ local zoff_t filecompress(z_entry, cmpr_method)
|
|||
do {
|
||||
err = deflate(&zstrm, Z_FINISH);
|
||||
if (maybe_stored) {
|
||||
if (err == Z_STREAM_END && zstrm.total_out >= zstrm.total_in &&
|
||||
fseekable(zipfile)) {
|
||||
if (err == Z_STREAM_END && zstrm.total_out >= zstrm.total_in/* && */
|
||||
/* fseekable(y) */) {
|
||||
/* deflation does not reduce size, switch to STORE method */
|
||||
unsigned len_out = (unsigned)zstrm.total_in;
|
||||
if (zfwrite(f_ibuf, 1, len_out) != len_out) {
|
||||
|
|
Loading…
Add table
Reference in a new issue