unzip initial commit
git-svn-id: svn://kolibrios.org@6725 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e4b55f0dfb
commit
e9b1c1bac6
82
programs/fs/unzip60/BUGS
Normal file
82
programs/fs/unzip60/BUGS
Normal file
@ -0,0 +1,82 @@
|
||||
Bogus bugs (not our fault!):
|
||||
---------------------------
|
||||
|
||||
By far THE BIGGEST source of bug reports to Info-ZIP/zip-bugs is the
|
||||
incorrect transfer of zipfiles (or of the UnZip executable itself).
|
||||
ALWAYS TRANSFER IN BINARY MODE! This includes ftp transfers and *both*
|
||||
ends of a Kermit connection ("set file type binary"). If your copy
|
||||
isn't exactly the same size as the original, you made a mistake.
|
||||
|
||||
Another common source of errors such as "compression method 8 not sup-
|
||||
ported" is the existence of an old version of UnZip somewhere in your
|
||||
path. Make sure you're using the version you think you're using; give
|
||||
the full path explicitly if necessary. Executing "unzip" without any
|
||||
options will print a help screen, at the top of which is the UnZip
|
||||
version number and release date; and executing "unzip -v" without any
|
||||
zipfile or other options will give information about what compiler was
|
||||
used, the target operating system, any special UnZip options, and the
|
||||
date of compilation--only for version 5.11 and later, though! (Also,
|
||||
under Unix C shell and some Bourne shells, "which unzip" will print
|
||||
the path of the unzip you're actually using. Under OS/2 and MS-DOS,
|
||||
whch21gr.zip [on Simtel mirror sites] will do the same thing; in addi-
|
||||
tion, "which -a unzip" will show *all* copies of "unzip" in your path.)
|
||||
|
||||
|
||||
Bugs (real and/or imagined):
|
||||
---------------------------
|
||||
|
||||
- [OS/2 DLL] when trying to use the REXX function UzUnZipToStem to extract a
|
||||
file with `&' in its name, the DLL crashes (but UzUnZipToVar still works)
|
||||
[Daniel H, 961215]
|
||||
- UnZip has problems with archives bigger than 2GB; it may print "note: didn't
|
||||
find end-of-central-dir signature at end of central dir" (harmless) or
|
||||
may not be able to seek to member files [James Lemley 970107, Iris Spaniol
|
||||
970206, ...]
|
||||
|
||||
Fixed with Zip64 support in UnZip 6.0
|
||||
|
||||
- fix overwrite behavior: hidden/system problems?; etc.
|
||||
- 32-bit DOS UnZip still unable to set volume labels?
|
||||
- 32-bit DOS UnZip under OS/2 doesn't extract all wildcard zipfiles?
|
||||
[DOS box: unzip386 (ver 5.12) x:\32bit\unix\emx09a\*.zip, Hobbes 3/95]
|
||||
- 32-bit DOS UnZip under OS/2 doesn't set timestamp when overwriting files
|
||||
on HPFS partition? (go32 and pmode/w both; emx/rsx OK) [Eberhard Mattes
|
||||
950726]
|
||||
- USE_FWRITE still causes occasional CRC errors when extracting on Pyramid?
|
||||
[Kevin Fritz 931102]
|
||||
- still NT/W95 bug with "unzip -v d:*.zip" not matching properly? [Steve S
|
||||
940527]
|
||||
980427: bug no longer exists, Opendir() must have been corrected by someone
|
||||
|
||||
- when ^Z received in no-echo mode, echo is not restored (works OK if
|
||||
resume, however)
|
||||
- signal() handler disabled after first use with one of BSD/SysV?
|
||||
- MKS Korn shell: unzip assumes the MKS-style command-line environment
|
||||
options are relevant to it, but this is not the case if unzip was called
|
||||
by another program (e.g., from a .BAT file). A fix for this exists for
|
||||
Borland compilers but not for MSC, Watcom, djgpp, etc.
|
||||
- OS/2: for paths with one long component, the .LONGNAME EA may be saved for
|
||||
all components (waste of disk space): how to check??
|
||||
- VMS: for extracting to other directories, only the VMS-style "-d [.foo]"
|
||||
format is accepted; "-d foo" should also be allowed. Long filenames are
|
||||
not automatically truncated to 39.39.
|
||||
- Novell Netware: Netware drives may clear the archive bit on extracted
|
||||
files under OS/2 and/or MS-DOS. UnZip always *tries* to set the archive
|
||||
bit, however. [pynq@uchicago, 940527]
|
||||
- DEC Ultrix: on long zipfiles, unzip will sometimes fail (bad CRC, not always
|
||||
reproducible); this is apparently due either to a hardware bug (cache mem)
|
||||
or OS bug (page faults?) [Igor, Jean-loup, bottom of BUGS.long]
|
||||
- funzip/more/decryption/no-echo bug: race condition(?) causes terminal to
|
||||
be "reset" to no-echo state
|
||||
- Macintosh (100200), Atari (020000) external file attributes not interpreted
|
||||
correctly (both unzip and zipinfo)
|
||||
- pkbug error: zipfile with incorrect csize and/or ucsize--check for end of
|
||||
compressed (csize) data in uncompression routines:
|
||||
unreduce.c: while (((outpos + outcnt) < ucsize) && (!zipeof)) {
|
||||
[James Birdsall, Mark, bottom of BUGS.long]
|
||||
- OS/2: directory EAs not restored if directory exists [Kai Uwe, KG27515@uark]
|
||||
(subsequent note: no way to determine which EAs are newer ==> cannot
|
||||
restore without user input)
|
||||
(update: as of UnZip 5.30, option -o forces restoring of directory EAs)
|
||||
- MS-DOS: Borland executables don't allow other than 80-column, 25/43/50-line
|
||||
screen modes (Borland bug) [Michael Stillwell]
|
212
programs/fs/unzip60/COPYING.OLD
Normal file
212
programs/fs/unzip60/COPYING.OLD
Normal file
@ -0,0 +1,212 @@
|
||||
__________________________________________________________________________
|
||||
|
||||
This is the Info-ZIP file COPYING (for UnZip), last updated 17 Jul 2000.
|
||||
__________________________________________________________________________
|
||||
|
||||
FIRST NOTE:
|
||||
This file contains some details about the copyright history of
|
||||
contributions to the UnZip project.
|
||||
Additionally, it summarises some exceptions to the general BSD-like
|
||||
copyright found in LICENSE that covers our generic code and most of
|
||||
the system specific ports.
|
||||
Please read LICENSE first to find out what is allowed to do with
|
||||
Info-ZIP's UnZip code.
|
||||
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
There are currently two explicit copyrights on portions of UnZip
|
||||
code (at least, of which Info-ZIP is aware):
|
||||
Jim Luther's Mac OS File Manager interface code; and Christopher Evans'
|
||||
MacBinaryIII coding code (for the MacOS port).. These copyrights
|
||||
are discussed in more detail below.
|
||||
|
||||
All remaining code is now (starting with UnZip version 5.41) covered
|
||||
by the new Info-ZIP license. For details, please read the acompaning
|
||||
file LICENSE. The terms and conditions in this license supersede the
|
||||
copyright conditions of the contributions by Igor Mandrichenko
|
||||
(vms/vms.c), Greg Roelofs (zipinfo.c, new version of unshrink.c),
|
||||
Mike White (Windows DLL code in "windll/*"), Steve P. Miller (Pocket
|
||||
UnZip GUI "wince/*"), and Mark Adler (inflate/explode decompresseion
|
||||
core routines, previously put into the public domain). All these
|
||||
Info-ZIP contributors (or "primary" authors) have permitted us to
|
||||
replace their copyright notes by the Info-ZIP License.
|
||||
|
||||
Frequently Asked Questions regarding (re)distribution of Zip and UnZip
|
||||
are near the end of this file.
|
||||
|
||||
There are no known patents on any of the code in UnZip. Unisys
|
||||
claims a patent on LZW encoding and on LZW decoding _in an apparatus
|
||||
that performs LZW encoding_, but the patent appears to exempt a stand-
|
||||
alone decoder (as in UnZip's unshrink.c). Unisys has publicly claimed
|
||||
otherwise, but the issue has never been tested in court. Since this
|
||||
point is unclear, unshrinking is not enabled by default. It is the
|
||||
responsibility of the user to make his or her peace with Unisys and
|
||||
its licensing requirements. (unshrink.c may be removed from future
|
||||
releases altogether.)
|
||||
__________________________________________________________________________
|
||||
|
||||
The original unzip source code has been extensively modified and
|
||||
almost entirely rewritten (changes include random zipfile access
|
||||
rather than sequential; replacement of unimplode() with explode();
|
||||
replacement of old unshrink() with new (unrelated) unshrink(); re-
|
||||
placement of output routines; addition of inflate(), wildcards,
|
||||
filename-mapping, text translation, ...; etc.). As far as we can
|
||||
tell, only the core code of the unreduce method remained substantially
|
||||
similar to Mr. Smith's original source. As of UnZip 5.42, the complete
|
||||
core code is now covered by the Info-ZIP Licence. Therefore, support
|
||||
for the reduce method has been removed.
|
||||
The drop of the reduce method should only affect some test archives,
|
||||
reducing was never used in any publically distributed Zip program.
|
||||
For pathologic cases where support for reduced archive entries is
|
||||
needed, the unreduce code copyrighted by Samuel H. Smith is available
|
||||
as a separate distribution (the restricted copyright of this code is
|
||||
cited below in the "historical" section).
|
||||
|
||||
The following copyright applies to the Mac OS File Manager interface code
|
||||
(macos/source/macstuff.[ch]), distributed with UnZip 5.4 and later:
|
||||
|
||||
* MoreFiles
|
||||
*
|
||||
* A collection of File Manager and related routines
|
||||
*
|
||||
* by Jim Luther (Apple Macintosh Developer Technical Support Emeritus)
|
||||
* with significant code contributions by Nitin Ganatra
|
||||
* (Apple Macintosh Developer Technical Support Emeritus)
|
||||
* Copyright 1992-1998 Apple Computer, Inc.
|
||||
* Portions copyright 1995 Jim Luther
|
||||
* All rights reserved.
|
||||
* The Package "More Files" is distributed under the following
|
||||
* license terms:
|
||||
*
|
||||
* "You may incorporate this sample code into your
|
||||
* applications without restriction, though the
|
||||
* sample code has been provided "AS IS" and the
|
||||
* responsibility for its operation is 100% yours.
|
||||
* However, what you are not permitted to do is to
|
||||
* redistribute the source as "DSC Sample Code" after
|
||||
* having made changes. If you're going to
|
||||
* redistribute the source, we require that you make
|
||||
* it clear in the source that the code was descended
|
||||
* from Apple Sample Code, but that you've made
|
||||
* changes."
|
||||
|
||||
The usage terms of this copyright note are compatible with the
|
||||
Info-ZIP license, they do not add further restrictions.
|
||||
|
||||
|
||||
The following copyright applies to the Mac OS "macbin3" decoding code
|
||||
(extra field compatibility with ZipIt):
|
||||
|
||||
* MacBinaryIII.h
|
||||
*
|
||||
* Copyright 1997 Christopher Evans (cevans@poppybank.com)
|
||||
*
|
||||
* Basic encoding and decoding of Macintosh files to the
|
||||
* MacBinary III spec.
|
||||
* ----------------------------------------------------------------------
|
||||
* This source is copyrighted by Christopher Evans (cevans@poppybank.com)
|
||||
* (available at ftp://ftp.lazerware.com/MacBinaryIII_src_C.sit
|
||||
* homepage of Leonard Rosenthol leonardr@netcom.com)
|
||||
|
||||
This copyright note does not contain any usage terms. So, we assume
|
||||
that this code is freely reusable until we are proved wrong...
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
The remaining copyright notes have been superseeded by the new
|
||||
Info-ZIP license, with explicit permission from the respective
|
||||
original authors. They are cited here for historical reasons,
|
||||
only:
|
||||
|
||||
The following copyright applies to the full-featured unreduce.c
|
||||
(now distributed separately):
|
||||
|
||||
* Copyright 1989 Samuel H. Smith; All rights reserved
|
||||
*
|
||||
* Do not distribute modified versions without my permission.
|
||||
* Do not remove or alter this notice or any other copyright notice.
|
||||
* If you use this in your own program you must distribute source code.
|
||||
* Do not use any of this in a commercial product.
|
||||
|
||||
Regarding the first stipulation, Mr. Smith was tracked down in southern
|
||||
California some years back [Samuel H. Smith, The Tool Shop; as of mid-
|
||||
May 1994, (213) 851-9969 (voice), (213) 887-2127(?) (subscription BBS),
|
||||
71150.2731@compuserve.com]:
|
||||
|
||||
"He says that he thought that whoever contacted him understood that
|
||||
he has no objection to the Info-ZIP group's inclusion of his code.
|
||||
His primary concern is that it remain freely distributable, he said."
|
||||
|
||||
Despite the fact that our "normal" code has been entirely rewritten
|
||||
and by default no longer contains any of Mr. Smith's code, Info-ZIP
|
||||
remains indebted and grateful to him. We hope he finds our contribu-
|
||||
tions as useful as we have his.
|
||||
|
||||
Note that the third and fourth stipulations still apply to any com-
|
||||
pany that wishes to incorporate the unreduce code into its products;
|
||||
if you wish to do so, you must contact Mr. Smith directly regarding
|
||||
licensing.
|
||||
|
||||
-----
|
||||
|
||||
The following copyright applied to most of the VMS code in vms.c,
|
||||
distributed with UnZip version 4.2 and later:
|
||||
|
||||
* Copyright (c) 1992-93 Igor Mandrichenko.
|
||||
* Permission is granted to any individual or institution to use, copy,
|
||||
* or redistribute this software so long as all of the original files
|
||||
* are included unmodified and that this copyright notice is retained.
|
||||
|
||||
-----
|
||||
|
||||
The following copyright applied to the new version of unshrink.c,
|
||||
distributed with UnZip version 5.2 and later:
|
||||
|
||||
* Copyright (c) 1994 Greg Roelofs.
|
||||
* Permission is granted to any individual/institution/corporate
|
||||
* entity to use, copy, redistribute or modify this software for
|
||||
* any purpose whatsoever, subject to the conditions noted in the
|
||||
* Frequently Asked Questions section below, plus one additional
|
||||
* condition: namely, that my name not be removed from the source
|
||||
* code. (Other names may, of course, be added as modifications
|
||||
* are made.) Corporate legal staff (like at IBM :-) ) who have
|
||||
* problems understanding this can contact me through Zip-Bugs...
|
||||
|
||||
-----
|
||||
|
||||
The following copyright applied to the Windows DLL code (windll/*),
|
||||
distributed with UnZip version 5.2 and later:
|
||||
|
||||
* Copyright (c) 1996 Mike White.
|
||||
* Permission is granted to any individual or institution to use,
|
||||
* copy, or redistribute this software so long as all of the original
|
||||
* files are included, that it is not sold for profit, and that this
|
||||
* copyright notice is retained.
|
||||
|
||||
-----
|
||||
|
||||
The following copyright applied to the Windows CE GUI port, ``Pocket
|
||||
UnZip,'' distributed with UnZip version 5.3 and later:
|
||||
|
||||
* All the source files for Pocket UnZip, except for components
|
||||
* written by the Info-ZIP group, are copyrighted 1997 by Steve P.
|
||||
* Miller. The product "Pocket UnZip" itself is property of the
|
||||
* author and cannot be altered in any way without written consent
|
||||
* from Steve P. Miller.
|
||||
|
||||
-----
|
||||
|
||||
The remaining code was written by many people associated with the
|
||||
Info-ZIP group, with large contributions from (but not limited to):
|
||||
Greg Roelofs (overall program logic, ZipInfo, unshrink, filename
|
||||
mapping/portability, etc.), Mark Adler (inflate, explode, funzip),
|
||||
Kai Uwe Rommel (OS/2), John Bush and Paul Kienitz (Amiga), Antoine
|
||||
Verheijen (Macintosh), Hunter Goatley (more VMS), Mike White (Windows
|
||||
DLLs), Christian Spieler (overall logic, optimization, VMS, etc.) and
|
||||
others. See the file CONTRIBS in the source distribution for a much
|
||||
more complete list of contributors.
|
||||
The decompression core code for the deflate method (inflate.[ch],
|
||||
explode.c) was originally written by Mark Adler who submitted it
|
||||
as public domain code.
|
||||
|
||||
--------------------------------------------------------------------------
|
84
programs/fs/unzip60/Contents
Normal file
84
programs/fs/unzip60/Contents
Normal file
@ -0,0 +1,84 @@
|
||||
Contents of the UnZip 6.00 source archive. The OS-specific subdirectories
|
||||
at the end contain their own Contents listings:
|
||||
|
||||
Contents this file
|
||||
README what UnZip is; general information
|
||||
LICENSE Info-ZIP license; terms for using and distributing UnZip
|
||||
COPYING.OLD historic copyrights and distribution policy (obsolete)
|
||||
INSTALL how to compile and install UnZip and related utilities
|
||||
WHERE where Zip/UnZip and encryption/decryption support can be found
|
||||
History.600 new features and fixes of the last major release
|
||||
ToDo rough priority list of new features to be added in next release
|
||||
BUGS known bugs, problems, and (possible) other features to be added
|
||||
unzip.txt UnZip manual page, human-readable format
|
||||
unzipsfx.txt UnZipSFX manual page, human-readable format
|
||||
zipinfo.txt ZipInfo manual page, human-readable format
|
||||
zipgrep.txt ZipGrep manual page, human-readable format
|
||||
funzip.txt fUnZip manual page, human-readable format
|
||||
file_id.diz BBS-oriented file describing this archive
|
||||
testmake.zip test archive for checking whether newly compiled UnZip works
|
||||
api.c generic DLL entry points, support functions (required for DLLs)
|
||||
apihelp.c API help text for DLL versions (currently OS/2 only)
|
||||
consts.h global, initialized variables that never change (required)
|
||||
crc32.c code for calculation 32bit CRC of a string buffer (required*)
|
||||
crc32.h declarations for the crc-32 code (required*)
|
||||
crc_i386.S fast assembler replacement for crc32() (Intel 386 and newer)
|
||||
crypt.c de-/encryption routines (required*)
|
||||
crypt.h de-/encryption header file (required*)
|
||||
ebcdic.h static lookup table for ASCII <-> EBCDIC translation (required)
|
||||
envargs.c code to read options from environment variables (required)
|
||||
explode.c code for exploding (required)
|
||||
extract.c high-level extraction and decryption code (required)
|
||||
fileio.c file manipulation and password code (required)
|
||||
funzip.c filter unzip: extracts in a pipe from stdin to stdout
|
||||
gbloffs.c helper program to retrieve offsets of globals struct members
|
||||
globals.c code to support global variables with reentrancy (required)
|
||||
globals.h definition of global structure G (required)
|
||||
inflate.c code for inflating (required*)
|
||||
inflate.h header file for inflating (required*)
|
||||
list.c UnZip listing routines, non-ZipInfo mode (required)
|
||||
match.c pattern-matching code for filename wildcards (required)
|
||||
process.c zipfile headers code (required)
|
||||
timezone.c timezone and timestamp functions (required)
|
||||
timezone.h header file for interface to "internal" tz functions (required)
|
||||
ttyio.c code for handling nonecho tty input: password, pager (required)
|
||||
ttyio.h header file for nonecho tty input: password, pager (required)
|
||||
ubz2err.c callback handler for fatal bzip2 errors (bzip2 support only)
|
||||
unreduce.c code for unreducing (required)
|
||||
unshrink.c code for unshrinking (required)
|
||||
unzip.c UnZip main(), usage and options code (required)
|
||||
unzip.h public half of main UnZip header file (required*)
|
||||
unzipstb.c minimal UnZip "stub" file demonstrating use of DLL versions
|
||||
unzpriv.h private (internal) half of main UnZip header file (required*)
|
||||
unzvers.h header with UnZip/UnZipSFX and ZipInfo version info (required)
|
||||
zip.h dummy header for use with crypt.c (required*)
|
||||
zipinfo.c UnZip listing routines, ZipInfo mode (required)
|
||||
acorn/ support files for compiling under Acorn RISC OS
|
||||
amiga/ support files for compiling under AmigaDOS
|
||||
aosvs/ support files for compiling under Data General AOS/VS
|
||||
atari/ support files for compiling under Atari TOS
|
||||
atheos/ support files for compiling under AtheOS/Syllable
|
||||
beos/ support files for compiling under BeOS
|
||||
cmsmvs/ support files for compiling under VM/CMS and MVS
|
||||
flexos/ support files for compiling under FlexOS
|
||||
human68k/ support files for compiling under X68000/Human68K
|
||||
macos/ support files for compiling under Macintosh OS
|
||||
msdos/ support files for compiling under MS-DOS
|
||||
netware/ support files for compiling for Novell Netware NLM
|
||||
os2/ support files for compiling under OS/2 (includes DLL stuff)
|
||||
qdos/ support files for compiling under SMS/QDOS
|
||||
tandem/ support files for compiling under Tandem NSK
|
||||
theos/ support files for compiling under Theos
|
||||
tops20/ support files for compiling under TOPS-20
|
||||
unix/ support files for compiling under Unix
|
||||
vms/ support files for compiling under VMS
|
||||
win32/ support files for compiling under Windows 9x and Windows NT
|
||||
wince/ support files for compiling under Windows CE (GUI version)
|
||||
windll/ support files for compiling Windows 3.x/9x/NT DLLs
|
||||
bzip2/ subfolder for source of externally supplied bzip2 extension
|
||||
man/ nroff man-page sources for the main user documentation
|
||||
proginfo/ programming docs, additional technical info, contributor list
|
||||
|
||||
Files marked "required*" are also needed to compile fUnZip. The normal
|
||||
UnZip makefile targets now make both UnZipSFX and fUnZip, except in a few
|
||||
cases; ZipInfo is now incorporated into UnZip (see zipinfo.txt for usage).
|
1117
programs/fs/unzip60/History.600
Normal file
1117
programs/fs/unzip60/History.600
Normal file
File diff suppressed because it is too large
Load Diff
861
programs/fs/unzip60/INSTALL
Normal file
861
programs/fs/unzip60/INSTALL
Normal file
@ -0,0 +1,861 @@
|
||||
__________________________________________________________________________
|
||||
|
||||
This is the Info-ZIP file INSTALL (for UnZip), last updated 16 Apr 2009.
|
||||
__________________________________________________________________________
|
||||
|
||||
Yes, this is a rather long file, but don't be intimidated: much of its
|
||||
length is due to coverage of multiple operating systems and of optional
|
||||
customization features, large portions of which may be skipped.
|
||||
__________________________________________________________________________
|
||||
|
||||
|
||||
|
||||
To compile UnZip, UnZipSFX and/or fUnZip (quick-start instructions):
|
||||
========================================
|
||||
|
||||
(1) Unpack everything into a work directory somewhere, and make sure you're
|
||||
in the main UnZip directory (the one with this file in it).
|
||||
* (See note below concerning line termination format used in the source
|
||||
distribution)
|
||||
|
||||
(2) Copy the appropriate makefile into the current directory, except under
|
||||
OS/2.
|
||||
|
||||
(3) Run your "make" utility on the makefile (e.g., "nmake -f makefile.msc").
|
||||
|
||||
(4) Try out your new UnZip the way you would any new utility: read the
|
||||
docs first.
|
||||
|
||||
Ah ha ha ha!! Oh, that kills me. But seriously... For VMS, see the
|
||||
Install section below or [.vms]README. for details.
|
||||
|
||||
For DOS and other OSes without explicit timezone support (i.e., everybody
|
||||
but Unix, Windows 95 and NT), make sure the "TZ" environment variable is
|
||||
set to a valid and reasonable value; see your compiler docs for details.
|
||||
|
||||
(*) The unzip sources as well as other Info-ZIP source archives are packaged
|
||||
in Unix format. All text files use single LF (Ascii 0x0a) characters as
|
||||
line terminators. On systems that use different conventions for plain text
|
||||
files (e.g.:DOS,Win9x,WinNT,OS/2 -> combined CR+LF; MacOS -> single CR),
|
||||
some utilities (editors, compilers, etc.) may not accept source files
|
||||
with LF line terminators.
|
||||
For these systems, we recommend to use Info-ZIP's UnZip utility for
|
||||
extraction of our distribution archives, applying the command option
|
||||
"-a" (= translate text files to native format) in the extraction command.
|
||||
In case this procedure is not applicable, an appropiate third-party
|
||||
conversion utility may be used to achieve the desired line termination
|
||||
style (examples: "flip", available for Unix, DOS, OS/2; or "tr" on Unix).
|
||||
|
||||
|
||||
To compile UnZip, UnZipSFX and/or fUnZip (detailed instructions):
|
||||
========================================
|
||||
|
||||
(1) Unpack *.c and *.h (the actual source files), preserving the directory
|
||||
structure (e.g., ./unix/unix.c). The sole exception is TOPS-20, where
|
||||
tops20/* should be unpacked into the current directory, but TOPS-20
|
||||
is no longer fully supported anyway.
|
||||
|
||||
As of UnZip 5.41, full decryption support has been integrated in the
|
||||
UnZip source distribution. If you wish to compile binaries without
|
||||
decryption support, you must define the preprocessor flag NO_CRYPT.
|
||||
For many environments, you may add this flag to the custom compilation
|
||||
flags supplied by the environment variable LOCAL_UNZIP. For more
|
||||
details, see the make procedures and accompanied documentation for your
|
||||
particular target OS.
|
||||
|
||||
As of UnZip 5.53, support for the bzip2 compression algorithm has been
|
||||
added to UnZip. However, this support requires the original sources of
|
||||
the bzip2 compression library which have to be aquired separately;
|
||||
see "http://www.bzip.org/" for further reference.
|
||||
|
||||
|
||||
(2) Choose the appropriate makefile based on the description in the Con-
|
||||
tents file for your OS (that is, there's only one for Unix or OS/2, but
|
||||
MS-DOS and several other OSes have several, depending on the compiler).
|
||||
Copy it into the current directory and rename if necessary or desired.
|
||||
(Some makefiles can be invoked in place; see (5) below.)
|
||||
|
||||
Don't be afraid to read the makefile! Many options will be explained only
|
||||
in the comments contained therein. The defaults may not quite suit your
|
||||
system. When making changes, remember that some "make" utilities expect
|
||||
tabs as part of the makefile syntax. Failure with cryptic error messages
|
||||
will result if your editor quietly replaces those tabs with spaces.
|
||||
|
||||
Special point of confusion: some non-MSDOS makefiles contain MS-DOS
|
||||
targets (useful for cross-compilations). An example is the OS/2 makefile
|
||||
os2/makefile.os2 that contains the gccdos target for DOS emx+gcc and
|
||||
some more DOS related targets for Watcom C and MSC. But since version 5.3,
|
||||
the msdos subdirectory contains makefiles for all supported DOS compilers.
|
||||
[The old djgpp, djgpp1 and gcc_dos targets in unix/Makefile have been
|
||||
removed in 5.3; use msdos/makefile.dj* instead.]
|
||||
|
||||
Extra-special point of confusion: makefile.os2 expects to remain in
|
||||
the os2 subdirectory. Invoke it via "nmake -f os2/makefile.os2 gcc",
|
||||
for example.
|
||||
|
||||
|
||||
(3) If you want a non-standard version of UnZip, define one or more of the
|
||||
following optional macros, either by adding them to the LOCAL_UNZIP
|
||||
environment variable or by editing your makefile as appropriate. The
|
||||
syntax differs from compiler to compiler, but macros are often defined
|
||||
via "-DMACRO_NAME" or similar (for one called MACRO_NAME). Note that
|
||||
some of these may not be fully supported in future releases (or even
|
||||
in the current release). Note also that very short command lines in
|
||||
MS-DOS (128 characters) may place severe limits on how many of these
|
||||
can be used; if need be, the definitions can be placed at the top of
|
||||
unzip.h instead (it is included in all source files)--for example,
|
||||
"#define MACRO_NAME", one macro per line.
|
||||
|
||||
DOSWILD (MS-DOS only)
|
||||
Treat trailing "*.*" like Unix "*" (i.e., matches anything); treat
|
||||
trailing "*." as match for files without a dot (i.e., matches any-
|
||||
thing, as long as no dots in name). Special treatment only occurs
|
||||
if patterns are at end of arguments; i.e., "a*.*" matches all files
|
||||
starting with "a", but "*.*c" matches all files ending in "c" *only*
|
||||
if they have a dot somewhere before the "c". [The default method of
|
||||
specifying files without a dot would be "* -x *.*", making use of
|
||||
UnZip's exclude-files option.] The matching is actually the same as
|
||||
Unix, if you assume that undotted filenames really have an invisible
|
||||
dot at the end, which is how DOS and related systems treat filenames
|
||||
in general. All other regular expressions (including "?" and
|
||||
"[range_of_chars]") retain their Unix-like behavior.
|
||||
|
||||
WILD_STOP_AT_DIR (incompatible with WINDLL!)
|
||||
Enables an additional option "-W". When this qualifier is specified,
|
||||
the pattern matching routine is modified so that both '?' (single-char
|
||||
wildcard) and '*' (multi-char wildcard) do not match the directory
|
||||
separator character '/'. Examples:
|
||||
"*.c" matches "foo.c" but not "mydir/foo.c"
|
||||
"*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
|
||||
"??*/*" matches "ab/foo" and "abc/foo" but not "a/foo" or "a/b/foo"
|
||||
To enable matching across directory separator chars, two consecutive
|
||||
multi-char wildcards "**" should be specified.
|
||||
This modified behaviour is equivalent to the pattern matching style
|
||||
used by the shells of some of UnZip's supported target OSs (one
|
||||
example is Acorn RISC OS).
|
||||
|
||||
VMSWILD (VMS only)
|
||||
Use parentheses rather than brackets to delimit sets (ranges), and
|
||||
use '%' instead of '?' as the single-character wildcard for internal
|
||||
filename matching. (External matching of zipfile names always uses
|
||||
the standard VMS wildcard facilities; character sets are disallowed.)
|
||||
|
||||
VMSCLI (VMS only)
|
||||
Use VMS-style "slash options" (/FOOBAR) instead of the default Unix-
|
||||
style hyphenated options (-f). This capability does not affect options
|
||||
stored in environment variables (UNZIP_OPTS or ZIPINFO_OPTS); those use
|
||||
the Unix style regardless. Beginning with UnZip 5.32, the supplied
|
||||
VMS build methods generate both VMS-style and default "UNIX-style"
|
||||
executables; you should NOT add VMSCLI to the custom options.
|
||||
|
||||
CHECK_VERSIONS (VMS only)
|
||||
UnZip "extra fields" are used to store VMS (RMS) filesystem info,
|
||||
and the format of this information may differ in various versions
|
||||
of VMS. Defining this option will enable UnZip warnings when the
|
||||
stored extra-field VMS version(s) do(es) not match the version of
|
||||
VMS currently being used. This is a common occurrence in zipfiles
|
||||
received from other sites, but since the format of the filesystem
|
||||
does not seem to have changed in years (including on Alpha and
|
||||
IA64 systems), the warnings are not enabled by default.
|
||||
|
||||
RETURN_CODES (VMS only)
|
||||
VMS interprets return codes according to a rigid set of guidelines,
|
||||
which means it misinterprets normal UnZip return codes as all sorts
|
||||
of really nasty errors. Therefore VMS UnZip returns an alternate set
|
||||
of return codes; since these may be difficult to interpret, define
|
||||
RETURN_CODES for human-readable explanations.
|
||||
|
||||
VMS_TEXT_CONV (everybody except VMS)
|
||||
VMS Stream_LF-format text files archived with the "-V" option
|
||||
(/VMS), but NOT with -VV (/VMS=ALL), should be fine when extracted
|
||||
on other systems. Stream_LF-files archived with -VV should be
|
||||
readable as well, but they may get some junk appended.
|
||||
Text files with other formats (like the default VFC, with its
|
||||
embedded byte counts) may be only semi-readable at best when
|
||||
extracted on other systems. Defining this option enables UnZip's
|
||||
-aa option to detect and convert VMS VFC-record text files into
|
||||
native text format. Non-VMS UnZips now use a rudimentary VMS extra
|
||||
field analyser to relyably determine such text files. (Earlier
|
||||
versions of UnZip applied some heuristics instead.)
|
||||
Therefore this option is now enabled by default for the main program
|
||||
(but not the SFX stub), because it can be extremely useful on those
|
||||
rare occasions when a VMS text file must be extracted as normal text.
|
||||
|
||||
USE_DJGPP_ENV (MS-DOS DJGPP 2.0x only)
|
||||
Regular DJGPP v2.0x compiled programs which use ENVIRONMENT are
|
||||
able to read from the file "djgpp.env" as well as those set in the
|
||||
environment. This adds about 1KB to the size of the executable.
|
||||
This option is disabled by default in Info-ZIP source. If you are
|
||||
able to use "djgpp.env" and don't like to clutter the environment
|
||||
with many special purpose variables, you may want to compile with
|
||||
this option set.
|
||||
|
||||
USE_DJGPP_GLOB (MS-DOS DJGPP 2.0x only)
|
||||
If you like to get UnZip binaries that handle command line arguments
|
||||
similar to Unix tools which are run in an Unix shell, you might want
|
||||
to set this compilation option. This option enables the support for
|
||||
globbing command line arguments containing wildcards that is built
|
||||
into the DJGPP startup code. When using a binary compiled with this
|
||||
option, you may have to enclose wildcard arguments in double quotes
|
||||
to get them passed to the program unmodified. Enabling this option
|
||||
is not recommended, because it results in Info-Zip binaries that do
|
||||
not behave as expected for MS-DOS programs.
|
||||
|
||||
USE_VFAT (MS-DOS only, for using same executable under DOS and Win95/NT)
|
||||
djgpp 2.x and emx/gcc+RSX 5.1 can detect when they are running under a
|
||||
Win32 DOS box and will accordingly enable long-filename support. For
|
||||
now only djgpp 2.x and emx/gcc with RSX 5.1 or later have this feature
|
||||
(and it is defined by default in msdos/makefile.dj2 and makefile.emx),
|
||||
but if/when other compilers build in similar support, define this
|
||||
macro to enable its use. See also msdos/doscfg.h. [Note that djgpp
|
||||
2.0's LFN support is flaky; users should upgrade to 2.01 or later.]
|
||||
|
||||
NO_W32TIMES_IZFIX (Win32 including WinDLL, and WinCE)
|
||||
By specifying this option, you can disable Info-ZIP's special timestamp
|
||||
adjustment to get stable time stamps on NTFS disks that do not change
|
||||
depending on the current time being normal vs. daylight saving time.
|
||||
When this option is set, UnZip behaves exactly like other programs;
|
||||
file timestamps on NTFS partitions are created so that their >current<
|
||||
local time representation displayed by directory listings (cmd.exe
|
||||
"dir" command or Windows Explorer listings) is the same as shown by
|
||||
UnZip's listing. But the actual UTC timestamp values stored in the
|
||||
NTFS file attributes vary depending on whether extraction is done
|
||||
at summer or winter time.
|
||||
This option is not recommended because it sacrifies the timestamp
|
||||
comparison checks when extracting or modifying archives in "update
|
||||
only newer" mode.
|
||||
However, for environments where consistency of >displayed< dates
|
||||
of files extracted to NTFS vs. FAT disks is considered more important
|
||||
than correctly working update/freshen tasks of Zip&UnZip, this
|
||||
option may be used.
|
||||
>> DO NOT DISTRIBUTE OR PUBLISH executables that were compiled with
|
||||
this option! <<
|
||||
|
||||
NOTIMESTAMP
|
||||
This option disables the -T option, which basically does exactly what
|
||||
Zip's -go options do (i.e., set the timestamp of the zipfile to that of
|
||||
the newest file in the archive without rewriting the archive). Unlike
|
||||
Zip, however, UnZip supports wildcard specifications for the archive
|
||||
name; for example, "unzip -T *.zip" will set the dates of all zipfiles
|
||||
in the current directory. (UnZip's option is also much faster.)
|
||||
|
||||
DATE_FORMAT=DF_DMY or DF_MDY or DF_YMD
|
||||
This option controls the order in which date components are printed
|
||||
in non-ZipInfo-mode listings: day-month-year or month-day-year or
|
||||
year-month-day.
|
||||
For DOS, FlexOS, OS2, Theos and Win32, the format is automatically
|
||||
obtained from the operating system; most others default to DF_MDY.
|
||||
|
||||
DATE_SEPCHAR='-' or '.' or '/' etc.
|
||||
This option controls the character that separates the date components
|
||||
shown in (non-ZipInfo-mode) listings. The Win32 port obtains the
|
||||
separator automatically from the operating system's locale settings;
|
||||
all others default to '-'.
|
||||
|
||||
ACORN_FTYPE_NFS (needs support for long filenames with embedded commas)
|
||||
This option enables a -F option that instructs UnZip to interpret the
|
||||
filetype information extracted from Acorn RiscOS extra field blocks.
|
||||
The filetype IDs are translated into "NFS filetype extensions" and
|
||||
appended to the names of the extracted files. This feature facilitates
|
||||
maintenance of Unix-based NFS volumes that are exported to Acorn RiscOS
|
||||
systems.
|
||||
|
||||
QLZIP (Unix only)
|
||||
Add some support for QDOS extra fields. This option enables Unix
|
||||
UnZip to append "datalen info" to QDOS exec type files in the same
|
||||
format as used by QDOS cross-compilers on Unix or the qltools v2.2(+).
|
||||
|
||||
UNIXBACKUP (default on OS/2, Unix, Win32)
|
||||
This option enables a -B option that instructs UnZip to rename files
|
||||
that would normally be overwritten. The renamed files are given a
|
||||
tilde suffix and a unique sequence number (`~#####'). Note that
|
||||
previously renamed files may be overwritten without notice, even
|
||||
if the -n option is given.
|
||||
On target ports where UNIXBACKUP is enabled by default, the negated
|
||||
option NO_UNIXBACKUP may be used to disable this feature.
|
||||
|
||||
OS2_EAS
|
||||
List the sizes of OS/2 EAs and ACLs for each file as two extra columns
|
||||
in "unzip -l" output. This is primarily useful for OS/2 systems, but
|
||||
because zipfiles are portable, OS2_EAS can be defined for any system.
|
||||
(May be extended someday to show sizes of Mac resource forks, RISCOS
|
||||
and VMS file info, etc.)
|
||||
|
||||
DELETE_IF_FULL (anybody with unlink() function)
|
||||
If a write error is encountered (most likely due to a full disk),
|
||||
enabling this option will cause the incomplete file to be deleted
|
||||
instead of closed normally. This is particularly useful for the
|
||||
Windows CE port, which must generally contend with extremely limited
|
||||
resources.
|
||||
|
||||
ASM_CRC (Amiga/Aztec C; many x86 systems: DOS, OS/2, Win32, Unix)
|
||||
Use an assembler routine to calculate the CRC for each file (speed).
|
||||
|
||||
ASM_INFLATECODES (Amiga/Aztec C only, for now)
|
||||
Use an assembler version of inflate_codes() for speed.
|
||||
|
||||
OLD_EXDIR
|
||||
No longer supported.
|
||||
|
||||
SFX_EXDIR
|
||||
Enable the "-d <extract_dir>" option for UnZipSFX. This is now
|
||||
enabled by default (since UnZip 5.5) to facilitate use with
|
||||
automated installation scripts and the like. For disabling
|
||||
this feature, see the NO_SFX_EXDIR option.
|
||||
|
||||
NO_SFX_EXDIR
|
||||
Disables the "-d <extract_dir>" option for UnZipSFX to generate the
|
||||
smallest possible executable stub. (Prior to the UnZip 5.5 release,
|
||||
this was the default.)
|
||||
|
||||
CHEAP_SFX_AUTORUN
|
||||
Enable a simple "run command after extraction" feature for
|
||||
the (command line) UnZipSFX stub. This feature is currently
|
||||
incompatible with the "-d <extract_dir>" command line option,
|
||||
therefore CHEAP_SFX_AUTORUN implicitely sets the NO_SFX_EXDIR
|
||||
option.
|
||||
|
||||
NO_ZIPINFO
|
||||
Compile without ZipInfo mode (-Z) enabled; makes a smaller executable
|
||||
because many text strings are left out. Automatically enabled for
|
||||
some small-model compiles under MS-DOS and OS/2, so ordinarily there
|
||||
is no need to specify this explicitly. (Note that even with this
|
||||
defined, the resulting executable may still be too big to extract
|
||||
some zipfiles correctly, if compiled with the small memory model.)
|
||||
|
||||
USE_DEFLATE64 (default for UnZip and fUnZip)
|
||||
NO_DEFLATE64 (default for UnZipSFX stub)
|
||||
The "deflate64" algorithm from PKZIP 4.0 (or newer) is an enhanced
|
||||
variant of the deflate algorithm that achieves slightly better
|
||||
compression ratios on highly redundant data. Normally, UnZip should
|
||||
be compiled with support for this compression algorithm enabled.
|
||||
However, this results in significantly larger memory requirements
|
||||
to run the program. For 16-bit executables (DOS and OS/2), the
|
||||
special memory management to support the 64k history buffer results
|
||||
in a slight performance (= speed) penalty. And for the SFX stub,
|
||||
"deflate64" support might be unnessessary as long as the Info-ZIP
|
||||
Zip utility does not support it (quite likely, this will never
|
||||
get implemented). So, the NO_DEFLATE64 option is provided to allow
|
||||
exclusion of the deflate64 support.
|
||||
|
||||
USE_BZIP2 (requires additional external code distribution)
|
||||
UnZip can optionally support the "bzip2" compression algorithm for
|
||||
most ports on 32-bit (or higher) platforms. Currently, this support
|
||||
is integrated in the Make procedures of MSDOS 32-bit (DJGPP), VMS,
|
||||
Win32, and many Unix systems.
|
||||
Prerequisites:
|
||||
You have to obtain the bzip2 source distribution (version 1.03 or
|
||||
higher) and extract it into the "bzip2" subdirectory.
|
||||
Compilation:
|
||||
- MSDOS, Win32: You have to supply the symbol definition
|
||||
"USEBZ2=1" on the command line when you invoke the make program.
|
||||
- Unix: The target "generic" automatically activates bzip2 support
|
||||
when its configure script detects the presence of the bzip2 sources.
|
||||
For other targets, there are two options:
|
||||
a) Use the command
|
||||
"make -f unix/Makefile D_USE_BZ2=-DUSE_BZIP2 L_BZ2=-lbz2 \
|
||||
LIBBZ2=bzip2/libbz2.a YourTarget"
|
||||
(Do not use the continuation line and replace YourTarget with
|
||||
the appropiate target name.)
|
||||
b) Edit the Makefile and remove the comment signs from the lines
|
||||
that define the macros D_USE_BZ2, L_BZ2, and LIBBZ2 (at about
|
||||
line 84 ff.).
|
||||
- VMS: The MMS/MMK build program should automatically activate the
|
||||
bzip2 support when it detects the presence of the bzip2 sources.
|
||||
|
||||
MULT_VOLUME (experimental for 5.5x, do NOT use in production versions!)
|
||||
NO_MULT_VOLUME (default)
|
||||
The symbol MULT_VOLUME is used to flag code portions needed for
|
||||
support of multi-volume archives. For now, this flag MUST NOT be
|
||||
used to compile a production versions of UnZip. This flag has been
|
||||
introduced to allow integration of experimental code for multi-volume
|
||||
support in the master source tree. This feature will become a default
|
||||
option in the future 6.1 release of UnZip.
|
||||
|
||||
LZW_CLEAN
|
||||
USE_UNSHRINK (now default, as of January 2005)
|
||||
The "shrinking" algorithm from PKZIP 1.0 is an LZW variant. Unisys
|
||||
patented the Lempel-Ziv-Welch algorithm in 1985 and has publicly
|
||||
claimed that decompression is covered by it. (IBM also patented the
|
||||
same thing in a filing 3 weeks prior to Unisys's.) In 2004, the
|
||||
Unisys and IBM patents expired worldwide, so unshrinking is now
|
||||
enabled again by default. If you do not wish to include the LZW
|
||||
method, you may still disable it by defining LZW_CLEAN.
|
||||
(Unshrinking was used by PKZIP 1.0 and 1.1, and Zip 1.0 and 1.1.
|
||||
All newer archives use only the deflation method.)
|
||||
|
||||
COPYRIGHT_CLEAN (now default)
|
||||
USE_SMITH_CODE
|
||||
The last chunk of code in UnZip that was blatantly derived from Sam
|
||||
Smith's unzip 2.0 (as in, "substantially similar") is in unreduce.c.
|
||||
Since reducing was only used by very early PKZIP beta versions (0.9x),
|
||||
support for it is now omitted by default (COPYRIGHT_CLEAN). To in-
|
||||
clude unreducing capability, define USE_SMITH_CODE and replace the
|
||||
stub unreduce.c source file by the separatly distributed full source
|
||||
code module. Note that this subjects UnZip to any and all restrictions
|
||||
in Smith's copyright; see the UnZip COPYING.OLD file for details.
|
||||
|
||||
USE_CRYPT
|
||||
Enable decryption support for all binaries. The default setting
|
||||
is to disable decryption support for the SFX stub to keep its size
|
||||
as small as possible. For other binaries of the UnZip distribution,
|
||||
decryption support is enabled by default.
|
||||
|
||||
NO_CRYPT
|
||||
Disable decryption support for all binaries.
|
||||
|
||||
PASSWD_FROM_STDIN (with full crypt sources only; Unix, VMS only)
|
||||
Used to allow the password on encrypted files to be read from stdin
|
||||
rather than the default stderr. This was useful for those who wished
|
||||
to automate the testing or decoding of encrypted archives (say, in a
|
||||
shell script via ``echo "password" | unzip -tq archive''), but as of
|
||||
version 5.3, UnZip has a -P option for passing a password directly to
|
||||
the program. PASSWD_FROM_STDIN will therefore probably be phased out
|
||||
in future versions. Note that the same security warnings given in the
|
||||
description of the -P option apply here as well.
|
||||
|
||||
UNICODE_SUPPORT
|
||||
Enable restoring from UTF-8 encoded paths. These paths are stored
|
||||
in extra fields 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.
|
||||
|
||||
Internally, Unicode support can be achieved by three methods:
|
||||
a) The charset encoding used by the system is already UTF-8, so
|
||||
the program just has to select the UTF-8 versions of the stored
|
||||
filenames for file name handling.
|
||||
This method is enabled by setting the symbol UTF8_MAYBE_NATIVE;
|
||||
this activates code to check for native UTF-8 encoding in the
|
||||
locale settings.
|
||||
b) The operating system and the compilation environment support
|
||||
"wide character" data in Unicode encoding (UCS-2/UTF-16 or UCS-4),
|
||||
which are used to translate between UTF-8 and the native
|
||||
extended-ASCII character encoding.
|
||||
The code for this method is activated by setting the preprocessor
|
||||
symbol UNICODE_WCHAR.
|
||||
It may be activated together with UTF8_MAYBE_NATIVE to provide
|
||||
more versatile Unicode support and additional "debugging" options
|
||||
for checking the correct recognition of non-ASCII Unicode
|
||||
characters.
|
||||
c) The operating system and the compilation environment allow to use
|
||||
unicode-encoded "wide character" data for native text strings
|
||||
support.
|
||||
Complete support for this method requires a throughout revision
|
||||
of the UnZip code. All internal string handling and text output
|
||||
needs to be ported to use wchar_t character storage.
|
||||
This porting is still in an experimental stage and not ready
|
||||
for general distribution.
|
||||
|
||||
On some ports UNICODE_SUPPORT is set automatically:
|
||||
- WIN32 (and WinCE) use method b) by defining UNICODE_SUPPORT and
|
||||
UNICODE_WCHAR.
|
||||
- On Unix, the automatic configuration script enables UNICODE_WCHAR
|
||||
if ISO-10646 compatible wide characters are supported and
|
||||
UTF8_MAYBE_NATIVE if the locale detection call is available.
|
||||
For these ports, setting NO_UNICODE_SUPPORT forces deactivation of
|
||||
the Unicode support.
|
||||
|
||||
NO_SETLOCALE (for Unix)
|
||||
On Unix, it is now assumed that <locale.h> and the setlocale function
|
||||
are available, to setup locale-aware filtering of displayed filenames.
|
||||
The option NO_SETLOCALE allows to disable the dependency on <locale.h>
|
||||
and setlocale() on systems where this assumption is invalid (and the
|
||||
auto-configuring make target "generic" cannot be used for capabilities
|
||||
detection).
|
||||
|
||||
_MBCS
|
||||
NO_MBCS
|
||||
Enable multi-byte character set support. This is the default for the
|
||||
Human68k system (originated from Japan) and for Win32 (here only DBCS
|
||||
"double-byte character set" support). The MBCS support should also be
|
||||
enabled on systems which are capable of using UTF-8 as native charset.
|
||||
For MBCS support, the C runtime library must supply implementations
|
||||
for the mblen() function and the MB_CUR_MAX runtime macro/function.
|
||||
The NO_MBCS symbol allows to explicitely disable MBCS support for
|
||||
testing purpose, or when MBCS support does not work as expected.
|
||||
|
||||
HAVE_WORKING_ISPRINT
|
||||
NO_WORKING_ISPRINT
|
||||
The symbol HAVE_WORKING_ISPRINT enables enhanced non-printable chars
|
||||
filtering for filenames in the fnfilter() function. On some systems
|
||||
(Unix, VMS, some Win32 compilers), this setting is enabled by default.
|
||||
In cases where isprint() flags printable extended characters as
|
||||
unprintable, defining NO_WORKING_ISPRINT allows to disable the enhanced
|
||||
filtering capability in fnfilter(). (The ASCII control codes 0x01 to
|
||||
0x1f are always escaped on ASCII systems.)
|
||||
|
||||
DEBUG
|
||||
Used for debugging purposes; enables Trace() statements. Generally
|
||||
it's best to compile only one or two modules this way.
|
||||
|
||||
DEBUG_TIME
|
||||
Used for debugging the timezone code in fileio.c; enables TTrace()
|
||||
statements. This code is only used for the freshen/update options
|
||||
(-f and -u), and non-Unix compilers often get it wrong.
|
||||
|
||||
|
||||
(4) If you regularly compile new versions of UnZip and always want the same
|
||||
non-standard option(s), you may wish to add it (them) to the LOCAL_UNZIP
|
||||
environment variable (assuming it's supported in your makefile). Under
|
||||
MS-DOS, for example, add this to AUTOEXEC.BAT:
|
||||
|
||||
set LOCAL_UNZIP=-DDOSWILD -DDATE_FORMAT=DF_DMY
|
||||
|
||||
You can also use the variable to hold special compiler options (e.g.,
|
||||
-FPi87 for Microsoft C, if the x87 libraries are the only ones on your
|
||||
disk and they follow Microsoft's default naming conventions; MSC also
|
||||
supports the CL environment variable, however).
|
||||
|
||||
|
||||
(5) Run the make utility on your chosen makefile:
|
||||
|
||||
Unix
|
||||
For most systems it's possible to invoke the makefile in place, at
|
||||
the possible cost of an ignorable warning; do "make -f unix/Makefile
|
||||
list" to get a list of possible system targets, and then "make -f
|
||||
unix/Makefile target" for your chosen target. The "generic" target
|
||||
works for most systems, but if it fails with a message about ftime()
|
||||
unresolved or timezone redefined, do "make clean", "make help", and
|
||||
then either "make generic2" or "make generic3" as instructed. If all
|
||||
else fails, read the makefile itself; it contains numerous comments.
|
||||
(One of these days we'll make a configure script that automates this
|
||||
procedure better.)
|
||||
|
||||
VMS (OpenVMS):
|
||||
On VMS, two build methods are provided: a command procedure, and
|
||||
description files for MMS or MMK. Both methods must be run from
|
||||
the main directory, not the [.VMS] subdirectory.
|
||||
|
||||
A simple build using the command procedure looks like this:
|
||||
@ [.VMS]BUILD_UNZIP.COM
|
||||
|
||||
A simple build using MMS or MMK looks like this:
|
||||
MMS /DESCRIP = [.VMS]DESCRIP.MMS ! Or, with MMK, ...
|
||||
MMK /DESCRIP = [.VMS]DESCRIP.MMS
|
||||
|
||||
Various options for each build method are explained in comments in
|
||||
the main builder file, either BUILD_UNZIP.COM or DESCRIP.MMS.
|
||||
|
||||
Here are some more complex build examples:
|
||||
|
||||
o Build with the large-file option enabled (non-VAX only):
|
||||
|
||||
@ [.VMS]BUILD_UNZIP LARGE
|
||||
or:
|
||||
MMS /DESC = [.VMS] /MACRO = LARGE=1
|
||||
|
||||
o Re-link the executables (small-file and large-file):
|
||||
|
||||
@ [.VMS]BUILD_UNZIP LINK
|
||||
@ [.VMS]BUILD_UNZIP LARGE LINK
|
||||
or
|
||||
MMK /DESC = [.VMS] CLEAN_EXE ! Deletes existing executables.
|
||||
MMK /DESC = [.VMS] ! Builds new executables.
|
||||
MMK /DESC = [.VMS] /MACRO = LARGE=1 CLEAN_EXE
|
||||
MMK /DESC = [.VMS] /MACRO = LARGE=1
|
||||
|
||||
o Build a large-file product from scratch, for debug, getting
|
||||
compiler listings and link maps:
|
||||
|
||||
mms /desc = [.vms] clean
|
||||
mms /desc = [.vms] /macro = (DBG=1, LARGE=1. LIST=1)
|
||||
|
||||
On VAX, the builders attempt to cope with the various available C
|
||||
compilers: DEC/Compaq/HP C, VAX C, or GNU C. If DEC/Compaq/HP C is
|
||||
not available or not desired, comments in the relevant builder file
|
||||
explain the command-line options used to select a different
|
||||
compiler.
|
||||
|
||||
System-architecture-specific files (like objects and executables)
|
||||
are placed in separate directories, such as [.ALPHA], [.IA64], or
|
||||
[.VAX]. Large-file products get their own directories, [.ALPHAL]
|
||||
or [.IA64L]. On VAX, VAX C products are placed in [.VAXV], GNU C
|
||||
products in [.VAXG]. Each product builder announces what the
|
||||
destination directory will be when it is run.
|
||||
|
||||
Common files, such as the help libraries (UNZIP.HLP for the
|
||||
default UNIX-like command-line interface, UNZIP_CLI.HLP for the
|
||||
VMS-like command-line interface), are placed in the main
|
||||
directory. With a mixed-architecture VMS cluster, the same main
|
||||
directory on a shared disk may may be used by all system types.
|
||||
(Using the NOHELP option with BUILD_UNZIP.COM can keep it from
|
||||
making the same help files repeatedly.)
|
||||
|
||||
Some further information may be found in the files
|
||||
[.VMS]README. and [.VMS]00BINARY.VMS, though much of what's
|
||||
there is now obsolete.
|
||||
|
||||
MS-DOS
|
||||
See the msdos\Contents file for notes regarding which makefile(s) to
|
||||
use with which compiler. In summary: pick one of msdos\makefile.*
|
||||
as appropriate, or (as noted above) use the OS/2 gccdos target for
|
||||
emx+gcc. There is also an mscdos cross-compilation target in
|
||||
os2\makefile.os2 and a sco_dos cross-compilation target in the Unix
|
||||
makefile. For Watcom 16-bit or 32-bit versions, see the comments in
|
||||
the OS/2 section below.
|
||||
|
||||
After choosing the appropriate makefile and editing as necessary or
|
||||
desired, invoke the corresponding make utility. Microsoft's NMAKE
|
||||
and the free dmake and GNU make utilities are generally the most
|
||||
versatile. The makefiles in the msdos directory can be invoked in
|
||||
place ("nmake -f msdos\makefile.msc", for example).
|
||||
|
||||
OS/2
|
||||
Either GNU make, nmake or dmake may be used with the OS/2 makefile;
|
||||
all are freely available on the net. Do "nmake -f os2\makefile.os2",
|
||||
for example, to get a list of supported targets. More generally,
|
||||
read the comments at the top of the makefile for an explanation of
|
||||
the differences between some of the same-compiler targets.
|
||||
|
||||
Win32 (WinNT or Win9x)
|
||||
For creating Win32 executables, the Microsoft Visual C++ compiler
|
||||
platforms from version 2.x up to 8.0 (Visual Studio .Net C++ 2005)
|
||||
are supported. Recent build test have been run on VC++ 6.0, 7.1
|
||||
and 8.0. The linker of newer Microsoft Visual C++ versions (beginning
|
||||
with Visual C++ 2008 - [VC++ 9.0]) create executables that are marked
|
||||
to run on Windows 2000 and newer, only. Although these Visual C++
|
||||
environments may succeed in building Win32 Info-ZIP executables,
|
||||
they cannot (and must not) be used to create binaries for public
|
||||
distribution.
|
||||
Alternative compilers for the Intel platforms are OpenWatcom C++,
|
||||
GNU C (preferably the mingw32 port, CygWin and emx/rsxnt may also
|
||||
work), Borland C++, or lcc-win32.
|
||||
DEC C/C++ for NT/Alpha may or may not still work.
|
||||
For the Watcom compiler, use WMAKE and win32\makefile.wat; for the
|
||||
Microsoft compilers, use NMAKE and win32\Makefile; for mingw32 and
|
||||
CygWin, GNU Make and win32\Makefile.gcc should do the job.
|
||||
With emx+gcc, a good choice is GNUMake 3.75 (or higher) from the
|
||||
djgpp V2 distribution used on win32\Makefile.emx.
|
||||
|
||||
The unzip32.dll WinDLL executables can be built using the appropiate
|
||||
Makefile in the win32\ subdirectory, or by using the Microsoft Visual
|
||||
C++ project files supplied below the windll subdirectory. Besides the
|
||||
MSC compilers, gcc-mingw32, Watcom C and Borland C allow to build the
|
||||
Windows UnZip DLL. By default, the Makefiles for compilers that use
|
||||
the Microsoft C runtime are configured to link against the shared
|
||||
multithreading C runtime DLL. Depending on the intended usage for
|
||||
unzip32.dll, a statically linked dll might be more suitable. The
|
||||
make scripts for MSC support build variants with static linking; you
|
||||
should look up the configuration switch DLLSTANDALONE in the MSC
|
||||
Makefile or the "Static..." build configurations in the Visual Studio
|
||||
project files.
|
||||
|
||||
WinCE (WinCE or WinNT)
|
||||
Only Microsoft Visual C++ 5.0, 6.0 or Visual C++ embedded 3.0 or later
|
||||
are supported. Use the appropiate version of the included project
|
||||
files and check wince\README for details.
|
||||
|
||||
AmigaDOS
|
||||
SAS/Lattice C and Manx Aztec C are supported. For SAS C 6.x do "smake
|
||||
-f amiga/smakefile all"; for Aztec C do "make -f amiga/makefile.azt
|
||||
all". The Aztec C version supports assembly-language versions of two
|
||||
routines; these are enabled by default.
|
||||
|
||||
Atari TOS
|
||||
Turbo C is no longer supported; use gcc and the MiNT libraries, and
|
||||
do "make". Note that all versions of gcc prior to 2.5.8 have a bug
|
||||
affecting 68000-based machines (optimizer adds 68020 instructions).
|
||||
See atari\README for comments on using other compilers.
|
||||
|
||||
Macintosh
|
||||
Metrowerks CodeWarrior Pro 4 with Universal Interfaces 3.1 is the only
|
||||
currently supported compiler, although the Mac Programmer's Workbench
|
||||
(MPW) and Think C were supported at one time and still have some hooks.
|
||||
Other Compilers may work too, no compiler specific instructions
|
||||
(pragma, header, macros, ...) were used in the code.
|
||||
For CodeWarrior Pro 4, un-BinHex the CodeWarrior project file and
|
||||
UnZip resource file (using Stuffit Expander or BinHex 4.0 or later),
|
||||
then open the project and click on the compile button.
|
||||
See ":macos:Contents" for the possible project targets.
|
||||
Link order of the standard libraries is very important: Link all
|
||||
sources first and all standard libraries last.
|
||||
|
||||
Acorn (RISC OS)
|
||||
Extract the files from the archive and place in standard 'Acorn' C
|
||||
form (i.e., *.c, *.h and *.s become c.*, h.* and s.*, respectively),
|
||||
either using the UNZIP$EXTS environment variable and a pre-built UnZip
|
||||
binary, or using Spark[FS] and doing it manually. Then copy the
|
||||
Acorn.Makefile to the main UnZip directory and either type 'amu' or
|
||||
use the desktop make utility.
|
||||
|
||||
VM/CMS
|
||||
Unpack all the files and transfer them with ASCII -> EBCDIC conver-
|
||||
sion to an appropriate directory/minidisk/whatever, then execute
|
||||
UNZVMC to compile and link all the sources. This may require C/370
|
||||
version 2.1 or later and certain `nucleus extensions,' although
|
||||
UnZip 5.3 has been reported to compile fine with the `ADCYCLE C/370
|
||||
v1.2 compiler.' Note that it will abend without access to the C/370
|
||||
runtime library. See the README.CMS file for more details.
|
||||
|
||||
MVS
|
||||
Unpack all the files and transfer them to an appropriate PDS with
|
||||
ASCII -> EBCDIC conversion enabled, then edit UNZMVSC.JOB as required,
|
||||
and execute it to compile and link all the sources. C/370 2.1 or
|
||||
later is required. See README.MVS for further details. [This is a
|
||||
new port and may need a little more work even to compile.]
|
||||
|
||||
Human68K
|
||||
[This is a Japanese machine and OS.] It appears that GNU make and
|
||||
gcc are required; presumably just do "gmake -f human68k/Makefile.gcc"
|
||||
to build everything. This port has not been tested since the 5.12
|
||||
release.
|
||||
|
||||
TOPS-20
|
||||
[No longer fully supported due to new, unported features, although
|
||||
patches are always accepted.] Unpack all files into the current
|
||||
directory only (including those in the zipfile's tops20 directory),
|
||||
then use make.mic and "do make".
|
||||
|
||||
BeOS
|
||||
You can run the BeOS makefile in place by typing "make -f
|
||||
beos/Makefile". In fact, this is how the author tests it.
|
||||
|
||||
Running the appropriate make utility should produce three executables on
|
||||
most systems, one for UnZip/ZipInfo, one for UnZipSFX, and one for fUnZip.
|
||||
(VMS is one prominent exception: fUnZip makes no sense on it. The Amiga
|
||||
produces a fourth executable called MakeSFX, which is necessary because
|
||||
Amiga self-extracting archives cannot be created by simple concatenation.
|
||||
If necessary the source amiga/makesfx.c can be compiled on other systems.)
|
||||
Read any OS-specific README files for notes on setting things up for
|
||||
normal use (especially for VMS) and for warnings about known quirks and
|
||||
bugs in various compilers (especially for MS-DOS).
|
||||
|
||||
Also note that many OSes require a timezone variable to be set correctly
|
||||
(often "TZ"); Unix and VMS generally do so by default, Win95/NT do if set
|
||||
up properly, but other OSes generally do not. See the discussion of the
|
||||
-f and -u options in the UnZip man page (or unzip.txt). BeOS doesn't
|
||||
currently support timezone information at all, but this will probably be
|
||||
added soon.
|
||||
|
||||
Then test your new UnZip on a few archives and let us know if there are
|
||||
problems (but *please* first make certain that the archives aren't actu-
|
||||
ally corrupted and that you didn't make one of the silly mistakes dis-
|
||||
cussed in the documentation). If possible, double-check any problems
|
||||
with PKUNZIP or with a previous version of UnZip prior to reporting a
|
||||
"bug." The zipfile itself may be damaged.
|
||||
|
||||
|
||||
|
||||
To install:
|
||||
===========
|
||||
|
||||
Unix
|
||||
The default prefix for the installation location is /usr/local (things
|
||||
go into the bin and man/man1 subdirectories beneath the prefix), and
|
||||
the default man-page extension is "1" (corresponding to man/man1, above).
|
||||
To install as per the defaults, do "make install"; otherwise do "make
|
||||
prefix=/your/path manext=your_extension install". (For Intel Unix flavors
|
||||
where the assembler CRC routines were used [ASM_CRC], use the install_asm
|
||||
target instead of the regular install target.) For example, to install
|
||||
in your home directory with "l" as the man-page extension (for "local"),
|
||||
do "make prefix=$HOME manext=l install". Permissions will be 755 for the
|
||||
executables and 644 for the man pages. In general root must perform in-
|
||||
stallation into a public directory. Do "rehash" if your shell requires
|
||||
it in order to find the new executables.
|
||||
|
||||
VMS
|
||||
To complete the installation, the executables may be left in place,
|
||||
or moved (or copied) to a convenient place. While other methods
|
||||
(like DCL$PATH) exist, most users define symbols to make the UnZip
|
||||
executables available as foreign commands. These symbol definitions
|
||||
may be placed in a user's SYS$LOGIN:LOGIN.COM, or in a more central
|
||||
location, like SYS$MANAGER:SYLOGIN.COM. Typical symbol definitions
|
||||
might look like these:
|
||||
|
||||
UNZIP :== $ dev:[dir]UNZIP.EXE ! UNIX-like command line.
|
||||
or:
|
||||
UNZIP :== $ dev:[dir]UNZIP_CLI.EXE ! VMS-like command line.
|
||||
|
||||
For convenience, a ZIPINFO symbol could also be defined, so:
|
||||
|
||||
ZIPINFO :== $ dev:[dir]UNZIP.EXE """-Z"""
|
||||
|
||||
On a non-VAX system, different symbols could be defined for the
|
||||
small-file and large-file programs. For example:
|
||||
|
||||
UNZIPS :== $ dev:[dir.ALPHA]UNZIP.EXE ! UNZIPS = small-file UnZip.
|
||||
UNZIP*L :== $ dev:[dir.ALPHAL]UNZIP.EXE ! UNZIP[L] = large-file UnZip.
|
||||
|
||||
The builders create help text files, UNZIP.HLP and UNZIP_CLI.HLP.
|
||||
These may be incorporated into an existing help library, or a separate
|
||||
UnZip help library may be created using commands like these, using
|
||||
either UNZIP.HLP (as shown) or UNZIP_CLI.HLP:
|
||||
|
||||
$ LIBRARY /HELP dev:[dir]existing_library.HLB UNZIP.HLP
|
||||
|
||||
$ LIBRARY /CREATE /HELP UNZIP.HLB UNZIP.HLP
|
||||
|
||||
UnZip help may then be accessed from a separate UnZip help library
|
||||
using a command like:
|
||||
|
||||
$ HELP /LIBRARY = device:[directory]UNZIP.HLB
|
||||
|
||||
For greater ease, the user (or system manager) may define a
|
||||
HLP$LIBRARY logical name to allow the HELP utility to find the UnZip
|
||||
help library automatically. See HELP HELP /USERLIBRARY for more
|
||||
details. The command procedure HLP_LIB_NEXT.COM may be used to
|
||||
determine the next available HLP$LIBRARY logical name, and could be
|
||||
adapted to define a HLP$LIBRARY logical name for an UnZip help library.
|
||||
|
||||
The kit includes MAKESFX.COM, a command procedure intended to simplify
|
||||
creating a self-extracting archive. It may be helpful to install this
|
||||
procedure near the UnZip executables. MAKESFX.COM expects another
|
||||
symbol definition, like one of these:
|
||||
|
||||
UNZIPSFX :== $ dev:[dir]UNZIPSFX.EXE ! UNIX-like command line.
|
||||
or:
|
||||
UNZIPSFX :== $ dev:[dir]UNZIPSFX_CLI.EXE ! VMS-like command line.
|
||||
|
||||
Again here, on a non-VAX system, either a small-file or a large-file
|
||||
UNZIPSFX program may be used. (MAKESFX.COM could be modified to allow
|
||||
a run-time choice to be made.)
|
||||
|
||||
OS/2, MS-DOS, NT, Atari, Amiga
|
||||
Move or copy unzip.exe (or unzip.ttp, or UnZip, or whatever) to a direc-
|
||||
tory in your path; also possibly copy the UnZip executable to zipinfo.exe
|
||||
(or ii.exe), or else create an alias or a batch/command file for ZipInfo
|
||||
("@unzip -Z %1 %2 %3 %4 %5 %6 %7 %8 %9" under MS-DOS). The latter is only
|
||||
relevant if NO_ZIPINFO was *not* defined, obviously... Under djgpp 2.x,
|
||||
zipinfo.exe is a 2K stub symbolically linked to unzip.exe.
|
||||
|
||||
Acorn RISC OS
|
||||
Copy the executables unzip, funzip and zipinfo to somewhere in your
|
||||
Run$Path. See your Welcome manual if you don't know about Run$Path.
|
||||
|
||||
BeOS
|
||||
The default prefix for the installation location is /boot/usr/local
|
||||
(things go into the bin and man/man1 subdirectories beneath the prefix),
|
||||
and the default man-page extension is "1" (corresponding to the man/man1,
|
||||
above). Of course, these Unix man-pages aren't useful until someone ports
|
||||
something that can format them... plain text versions are also installed
|
||||
with an extension of ".txt". To install, do a "make install", or to
|
||||
change the prefix, do "make prefix=/your/path install". For example, to
|
||||
install in /boot/bin, do "make prefix=/boot/bin install".
|
||||
|
||||
Macintosh
|
||||
(This port is for Macintosh OS before Mac OS X. See Unix Apple below for
|
||||
Mac OS X and later.)
|
||||
MacZip requires at least System 7 and a Macintosh with a minimum of a
|
||||
Motorola 68020 or PowerPC 601 processor. Other configurations may work
|
||||
but it is not tested at all.
|
||||
The application (MacZip) is distributed as a combination of zip and unzip
|
||||
in one program. The offical release is a fat binary with both regular 68K
|
||||
and native PowerPC versions included.
|
||||
Move the executable(s) somewhere--for example, drag it (or them) to your
|
||||
Applications folder. For easy access, make an alias in the Launcher Control
|
||||
Panel or directly on your desktop.
|
||||
This port supports also Apple-event.So you can install it in your
|
||||
WWW-Browser as a helper-app.
|
||||
Look into "macos/README.TXT" (or ":macos:README.TXT" on Mac) for further
|
||||
info.
|
||||
|
||||
Macintosh OS X (Unix Apple)
|
||||
Mac OS X and later are based on BSD Unix and are supported by the Unix
|
||||
port. See the Unix port for details. Though support is currently
|
||||
minimal, we plan to support additional Mac OS X features, such as resource
|
||||
forks, in future releases.
|
||||
|
||||
Human68K, TOPS-20, AOS/VS, MVS, VM/CMS, etc.
|
||||
Dunno, sorry...
|
62
programs/fs/unzip60/LICENSE
Normal file
62
programs/fs/unzip60/LICENSE
Normal file
@ -0,0 +1,62 @@
|
||||
This is version 2009-Jan-02 of the Info-ZIP license.
|
||||
The definitive version of this document should be available at
|
||||
ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely and
|
||||
a copy at http://www.info-zip.org/pub/infozip/license.html.
|
||||
|
||||
|
||||
Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
|
||||
|
||||
For the purposes of this copyright and license, "Info-ZIP" is defined as
|
||||
the following set of individuals:
|
||||
|
||||
Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois,
|
||||
Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth,
|
||||
Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz,
|
||||
David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko,
|
||||
Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs,
|
||||
Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda,
|
||||
Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren,
|
||||
Rich Wales, Mike White.
|
||||
|
||||
This software is provided "as is," without warranty of any kind, express
|
||||
or implied. In no event shall Info-ZIP or its contributors be held liable
|
||||
for any direct, indirect, incidental, special or consequential damages
|
||||
arising out of the use of or inability to use this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the above disclaimer and the following restrictions:
|
||||
|
||||
1. Redistributions of source code (in whole or in part) must retain
|
||||
the above copyright notice, definition, disclaimer, and this list
|
||||
of conditions.
|
||||
|
||||
2. Redistributions in binary form (compiled executables and libraries)
|
||||
must reproduce the above copyright notice, definition, disclaimer,
|
||||
and this list of conditions in documentation and/or other materials
|
||||
provided with the distribution. Additional documentation is not needed
|
||||
for executables where a command line license option provides these and
|
||||
a note regarding this option is in the executable's startup banner. The
|
||||
sole exception to this condition is redistribution of a standard
|
||||
UnZipSFX binary (including SFXWiz) as part of a self-extracting archive;
|
||||
that is permitted without inclusion of this license, as long as the
|
||||
normal SFX banner has not been removed from the binary or disabled.
|
||||
|
||||
3. Altered versions--including, but not limited to, ports to new operating
|
||||
systems, existing ports with new graphical interfaces, versions with
|
||||
modified or added functionality, and dynamic, shared, or static library
|
||||
versions not from Info-ZIP--must be plainly marked as such and must not
|
||||
be misrepresented as being the original source or, if binaries,
|
||||
compiled from the original source. Such altered versions also must not
|
||||
be misrepresented as being Info-ZIP releases--including, but not
|
||||
limited to, labeling of the altered versions with the names "Info-ZIP"
|
||||
(or any variation thereof, including, but not limited to, different
|
||||
capitalizations), "Pocket UnZip," "WiZ" or "MacZip" without the
|
||||
explicit permission of Info-ZIP. Such altered versions are further
|
||||
prohibited from misrepresentative use of the Zip-Bugs or Info-ZIP
|
||||
e-mail addresses or the Info-ZIP URL(s), such as to imply Info-ZIP
|
||||
will provide support for the altered versions.
|
||||
|
||||
4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip,"
|
||||
"UnZipSFX," "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its
|
||||
own source and binary releases.
|
347
programs/fs/unzip60/README
Normal file
347
programs/fs/unzip60/README
Normal file
@ -0,0 +1,347 @@
|
||||
This is the README file for the 20 April 2009 public release of the
|
||||
Info-ZIP group's portable UnZip zipfile-extraction program (and related
|
||||
utilities).
|
||||
|
||||
unzip60.zip portable UnZip, version 6.0, source code distribution
|
||||
unzip60.tar.Z same as above, but compress'd tar format
|
||||
unzip60.tar.gz same as above, but gzip'd tar format
|
||||
|
||||
__________________________________________________________________________
|
||||
|
||||
BEFORE YOU ASK: UnZip, its companion utility Zip, and related utilities
|
||||
and support files can be found in many places; read the file "WHERE" for
|
||||
further details. To contact the authors with suggestions, bug reports,
|
||||
or fixes, continue reading this file (README) and, if this is part of a
|
||||
source distribution, the file "ZipPorts" in the proginfo directory. Also
|
||||
in source distributions: read "BUGS" for a list of known bugs, non-bugs
|
||||
and possible future bugs; INSTALL for instructions on how to build UnZip;
|
||||
and "Contents" for a commented listing of all the distributed files.
|
||||
__________________________________________________________________________
|
||||
|
||||
|
||||
GENERAL INFO
|
||||
------------
|
||||
UnZip is an extraction utility for archives compressed in .zip format (also
|
||||
called "zipfiles"). Although highly compatible both with PKWARE's PKZIP
|
||||
and PKUNZIP utilities for MS-DOS and with Info-ZIP's own Zip program, our
|
||||
primary objectives have been portability and non-MSDOS functionality.
|
||||
|
||||
This version of UnZip has been ported to a stupendous array of hardware--
|
||||
from micros to supercomputers--and operating systems: Unix (many flavors),
|
||||
VMS, OS/2 (including DLL version), Windows NT and Windows 95 (including DLL
|
||||
version), Windows CE (GUI version), Windows 3.x (including DLL version),
|
||||
MS-DOS, AmigaDOS, Atari TOS, Acorn RISC OS, BeOS, Macintosh (GUI version),
|
||||
SMS/QDOS, MVS, VM/CMS, FlexOS, Tandem NSK, Human68k (mostly), AOS/VS (partly)
|
||||
and TOPS-20 (partly). UnZip features not found in PKUNZIP include source
|
||||
code; default extraction of directory trees (with a switch to defeat this,
|
||||
rather than the reverse); system-specific extended file attributes; and, of
|
||||
course, the ability to run under most of your favorite operating systems.
|
||||
Plus, it's free. :-)
|
||||
|
||||
For source distributions, see the main Contents file for a list of what's
|
||||
included, and read INSTALL for instructions on compiling (including OS-
|
||||
specific comments). The individual operating systems' Contents files (for
|
||||
example, vms/Contents) may list important compilation info in addition to
|
||||
explaining what files are what, so be sure to read them. Some of the ports
|
||||
have their own, special README files, so be sure to look for those, too.
|
||||
|
||||
See unzip.1 or unzip.txt for usage (or the corresponding UnZipSFX, ZipInfo,
|
||||
fUnZip and ZipGrep docs). For VMS, unzip_def.rnh or unzip_cli.help may be
|
||||
compiled into unzip.hlp and installed as a normal VMS help entry; see
|
||||
vms/descrip.mms.
|
||||
|
||||
|
||||
CHANGES AND NEW FEATURES
|
||||
------------------------
|
||||
UnZip 6.0 finally supports nowadays "large" files of sizes > 2 GiB!
|
||||
This is the first release containing support for the PKWARE Zip64
|
||||
enhancements.
|
||||
Major changes are:
|
||||
- Support PKWARE ZIP64 extensions, allowing Zip archives and Zip archive
|
||||
entries larger than 4 GiBytes and more than 65536 entries within a single
|
||||
Zip archive. This support is currently only available for Unix,
|
||||
OpenVMS and Win32/Win64.
|
||||
- Support for bzip2 compression method.
|
||||
- Support for UTF-8 encoded entry names, both through PKWARE's "General
|
||||
Purpose Flags Bit 11" indicator and Info-ZIP's new "up" unicode path
|
||||
extra field. (Currently, on Windows the UTF-8 handling is limited to
|
||||
the character subset contained in the configured non-unicode "system
|
||||
code page".)
|
||||
- Added "wrong implementation used" warning to error messages of the MSDOS
|
||||
port when used under Win32, in an attempt to reduce false bug reports.
|
||||
- Fixed "Time of Creation/Time of Use" vulnerability when setting attributes
|
||||
of extracted files, for Unix and Unix-like ports.
|
||||
- Fixed memory leak when processing invalid deflated data.
|
||||
- Fixed long-standing bug in unshrink (partial_clear), added boundary checks
|
||||
against invalid compressed data.
|
||||
- On Unix, keep inherited SGID attribute bit for extracted directories
|
||||
unless restoration of owner/group id or SUID/SGID/Tacky attributes was
|
||||
requested.
|
||||
- On Unix, allow extracted filenames to contain embedded control characters
|
||||
when explicitly requested by specifying the new command line option "-^".
|
||||
- On Unix, support restoration of symbolic link attributes.
|
||||
- On Unix, support restoration of 32-bit UID/GID data using the new "ux"
|
||||
IZUNIX3 extra field introduced with Zip 3.0.
|
||||
- Support for ODS5 extended filename syntax on new OpenVMS systems.
|
||||
- Support symbolic links zipped up on VMS.
|
||||
- On VMS (only 8.x or better), support symbolic link creation.
|
||||
- On VMS, support option to create converted text files in Stream_LF format.
|
||||
- New -D option to suppress restoration of timestamps for extracted
|
||||
directory entries (on those ports that support setting of directory
|
||||
timestamps). By specifying "-DD", this new option also allows to suppress
|
||||
timestamp restoration for ALL extracted files on all UnZip ports which
|
||||
support restoration of timestamps.
|
||||
On VMS, the default behaviour is now to skip restoration of directory
|
||||
timestamps; here, "--D" restores ALL timestamps, "-D" restores none.
|
||||
- On OS/2, Win32, and Unix, the (previously optional) feature UNIXBACKUP
|
||||
to allow saving backup copies of overwritten files on extraction is now
|
||||
enabled by default.
|
||||
|
||||
For the UnZip 6.0 release, we want to give special credit to Myles Bennet,
|
||||
who started the job of supporting ZIP64 extensions and Large-File (> 2GiB)
|
||||
and provided a first (alpha-state) port.
|
||||
|
||||
The 5.52 maintenance release fixes a few minor problems found in the 5.51
|
||||
release, closes some more security holes, adds a new AtheOS port, and
|
||||
contains a Win32 extra-field code cleanup that was not finished earlier.
|
||||
The most important changes are:
|
||||
|
||||
- (re)enabled unshrinking support by default, the LZW patents have expired
|
||||
- fixed an extraction size bug for encrypted stored entries (12 excess bytes
|
||||
were written with 5.51)
|
||||
- fixed false "uncompressed size mismatch" messages when extracting
|
||||
encrypted archive entries
|
||||
- do not restore SUID/SGID/Tacky attribute bits on Unix (BeOS, AtheOS)
|
||||
unless explicitely requested by new "-K" command line qualifier
|
||||
- optional support for "-W" qualifier to modify the pattern matching syntax
|
||||
(with -W: "*" stops at directory delimiter, "**" matches unlimited)
|
||||
- prevent buffer overflow caused by bogus extra-long Zipfile specification
|
||||
- performance enhancements for VMS port
|
||||
- fixed windll interface handling of its extraction mode qualifiers
|
||||
nfflag, ExtractOnlyNewer, noflag, PromptToOverwrite; added detailed
|
||||
explanation of their meanings and interactions to the windll documentation
|
||||
|
||||
The 5.51 maintenance release adds a command-line CE port, intended for
|
||||
batch processing. With the integration of this port, the pUnZip port
|
||||
has been revised and "revitalized".
|
||||
The most important changes for the general public are a number of
|
||||
bug fixes, mostly related to security issues:
|
||||
|
||||
- repair a serious bug in the textmode output conversion code for the 16-bit
|
||||
ports (16-bit MSDOS, OS/2 1.x, some variants of AMIGA, possibly others)
|
||||
which was introduced by the Deflate64 support of release 5.5
|
||||
- fix a long standing bug in the the inflate decompression method that
|
||||
prevented correct extraction in some rare cases
|
||||
- fixed holes in parent dir traversal security code (e.g.: ".^C." slipped
|
||||
through the previous version of the check code)
|
||||
- fixed security hole: check naming consistency in local and central header
|
||||
- fixed security hole: prevent extracted symlinks from redirecting file
|
||||
extraction paths
|
||||
|
||||
The main addition in the 5.5 release is support for PKWARE's new Deflate64(tm)
|
||||
algorithm, which appeared first in PKZIP 4.0 (published November 2000).
|
||||
As usual, some other bugfixes and clean-ups have been integrated:
|
||||
|
||||
- support for Deflate64 (Zip compression method #9)
|
||||
- support for extracting VMS variable length record text files on
|
||||
any system
|
||||
- optional "cheap autorun" feature for the SFX stub
|
||||
- security fixes:
|
||||
* strip leading slash from stored pathspecs,
|
||||
* remove "../" parent dir path components from extracted file names
|
||||
- new option "-:" to allow verbatim extraction of file names containing
|
||||
"../" parent dir path specs
|
||||
- fixed file handle leak for the DLL code
|
||||
- repaired OS2 & WinNT ACL extraction which was broken in 5.42
|
||||
|
||||
The 5.42 maintenance release fixes more bugs and cleans up the redistribution
|
||||
conditions:
|
||||
|
||||
- removal of unreduce.c and amiga/timelib.c code to get rid of the last
|
||||
distribution restrictions beyond the BSD-like Info-ZIP LICENSE
|
||||
- new generic timelib replacement (currently used by AMIGA port)
|
||||
- more reasonable mapping rules of UNIX "leading-dot" filenames to the
|
||||
DOS 8.3 name convention
|
||||
- repaired screensize detection in MORE paging code
|
||||
(was broken for DOS/OS2/WIN32 in 5.41)
|
||||
|
||||
The 5.41 maintenance release adds another new port and fixes some bugs.
|
||||
|
||||
- new BSD-like LICENSE
|
||||
- new Novell Netware NLM port
|
||||
- supports extraction of archives with more than 64k entries
|
||||
- attribute handling of VMS port was broken in UnZip 5.4
|
||||
- decryption support integrated in the main source distribution
|
||||
|
||||
The 5.4 release adds new ports, again. Other important items are changes
|
||||
to the listing format, new supplemental features and several bug fixes
|
||||
(especially concerning time-stamp handling...):
|
||||
|
||||
- new IBM OS/390 port, a UNIX derivate (POSIX with EBCDIC charset)
|
||||
- complete revision of the MacOS port
|
||||
- changed listing formats to enlarge the file size fields for more digits
|
||||
- added capability to restore directory attributes on MSDOS, OS/2, WIN32
|
||||
- enabled support of symbolic links on BeOS
|
||||
- Unix: optional Acorn filetype support, useful for volumes exported via NFS
|
||||
- several changes/additions to the DLL API
|
||||
- GUI SFX stub for Win16 (Windows 3.1) and Win32 (Windows 9x, Windows NT)
|
||||
- new free GCC compiler environments supported on WIN32
|
||||
- many time-zone handling bug fixes for WIN32, AMIGA, ...
|
||||
|
||||
The 5.32 release adds two new ports and a fix for at least one relatively
|
||||
serious bug:
|
||||
|
||||
- new FlexOS port
|
||||
- new Tandem NSK port
|
||||
- new Visual BASIC support (compatibility with the Windows DLLs)
|
||||
- new -T option (set zipfile timestamp) for virtually all ports
|
||||
- fix for timestamps beyond 2038 (e.g., 2097; crashed under DOS/Win95/NT)
|
||||
- fix for undetected "dangling" symbolic links (i.e., no pointee)
|
||||
- fix for VMS indexed-file extraction problem (stored with Zip 2.0 or 2.1)
|
||||
- further performance optimizations
|
||||
|
||||
The 5.31 release included nothing but small bug-fixes and typo corrections,
|
||||
with the exception of some minor performance tweaks.
|
||||
|
||||
The 5.3 release added still more ports and more cross-platform portability
|
||||
features:
|
||||
|
||||
- new BeOS port
|
||||
- new SMS/QDOS port
|
||||
- new Windows CE graphical port
|
||||
- VM/CMS port fully updated and tested
|
||||
- MVS port fully updated and tested
|
||||
- updated Windows DLL port, with WiZ GUI spun off to a separate package
|
||||
- full Universal Time (UTC or GMT) support for trans-timezone consistency
|
||||
- cross-platform support for 8-bit characters (ISO Latin-1, OEM code pages)
|
||||
- support for NT security descriptors (ACLs)
|
||||
- support for overwriting OS/2 directory EAs if -o option given
|
||||
- updated Solaris/SVR4 package facility
|
||||
|
||||
What is (still!) not added is multi-part archive support (a.k.a. "diskette
|
||||
spanning", though we really mean archive splitting and not the old diskette
|
||||
spanning) and a unified and more powerful DLL interface. These are the two
|
||||
highest priorities for the 6.x releases. Work on the former is almost
|
||||
certain to have commenced by the time you read this. This time we mean it!
|
||||
You betcha. :-)
|
||||
|
||||
Although the DLLs are still basically a mess, the Windows DLLs (16- and 32-
|
||||
bit) now have some documentation and a small example application. Note that
|
||||
they should now be compatible with C/C++, Visual BASIC and Delphi. Weirder
|
||||
languages (FoxBase, etc.) are probably Right Out.
|
||||
|
||||
|
||||
INTERNET RESOURCES
|
||||
------------------
|
||||
|
||||
Info-ZIP's web site is at http://www.info-zip.org/pub/infozip/
|
||||
and contains the most up-to-date information about coming releases,
|
||||
links to binaries, and common problems.
|
||||
(See http://www.info-zip.org/pub/infozip/FAQ.html for the latter.)
|
||||
Files may also be retrieved via ftp://ftp.info-zip.org/pub/infozip/ .
|
||||
Thanks to LEO (Munich, Germany) for previously hosting our primary site.
|
||||
|
||||
|
||||
DISTRIBUTION
|
||||
------------
|
||||
If you have a question regarding redistribution of Info-ZIP software, either
|
||||
as is, as packaging for a commercial product, or as an integral part of a
|
||||
commercial product, please read the Frequently Asked Questions (FAQ) section
|
||||
of the included COPYING file. All Info-ZIP releases are now covered by
|
||||
the Info-ZIP license. See the file LICENSE. The most current license
|
||||
should be available at http://www.info-zip.org/license.html and
|
||||
ftp://ftp.info-zip.org/pub/infozip/license.html.
|
||||
|
||||
Insofar as C compilers are rare on some platforms and the authors only have
|
||||
direct access to a subset of the supported systems, others may wish to pro-
|
||||
vide ready-to-run executables for new systems. In general there is no prob-
|
||||
lem with this; we require only that such distributions include this README
|
||||
file, the WHERE file, the LICENSE file (contains copyright/redistribution
|
||||
information), and the appropriate documentation files (unzip.txt and/or
|
||||
unzip.1 for UnZip, etc.). If the local system provides a way to make self-
|
||||
extracting archives in which both the executables and text files can be
|
||||
stored together, that's best (in particular, use UnZipSFX if at all possible,
|
||||
even if it's a few kilobytes bigger than the alternatives); otherwise we
|
||||
suggest a bare UnZip executable and a separate zipfile containing the re-
|
||||
maining text and binary files. If another archiving method is in common
|
||||
use on the target system (for example, Zoo or LHa), that may also be used.
|
||||
|
||||
|
||||
BUGS AND NEW PORTS: CONTACTING INFO-ZIP
|
||||
----------------------------------------
|
||||
All bug reports and patches (context diffs only, please!) should be
|
||||
submitted either through the new Info-ZIP Discussion Forum at
|
||||
http://www.info-zip.org/board/board.pl or through the Info-ZIP SourceForge
|
||||
site at http://sourceforge.net/projects/infozip/. The forum allows file
|
||||
attachments while SourceForge provides a place to post patches. The old
|
||||
Zip-Bugs@lists.wku.edu e-mail address for the Info-ZIP authors was
|
||||
discontinued after heavy continuous spam, as was the QuickTopic discussion
|
||||
forum. The above methods are public, but we also can be reached directly
|
||||
using the web reply page at http://www.info-zip.org/zip-bug.html. If you
|
||||
need to send us files privately, contact us first for instructions.
|
||||
|
||||
"Dumb questions" that aren't adequately answered in the documentation
|
||||
should also be directed to Zip-Bugs rather than to a global forum such
|
||||
as Usenet. (Kindly make certain that your question *isn't* answered by
|
||||
the documentation, however--a great deal of effort has gone into making
|
||||
it clear and complete.)
|
||||
|
||||
Suggestions for new features can be discussed on the new Discussion Forum.
|
||||
A new mailing list for Info-ZIP beta testers and interested parties may
|
||||
be created someday, but for now any issues found in the betas should use
|
||||
the forum. We make no promises to act on all suggestions or even all
|
||||
patches, but if it is something that is manifestly useful, sending the
|
||||
required patches to Zip-Bugs directly (as per the instructions in the
|
||||
ZipPorts file) is likely to produce a quicker response than asking us to
|
||||
do it--the authors are always ridiculously short on time. (Please do
|
||||
NOT send patches or encoded zipfiles to the Info-ZIP list. Please DO
|
||||
read the ZipPorts file before sending any large patch. It would be
|
||||
difficult to over-emphasize this point...)
|
||||
|
||||
If you are considering a port, not only should you read the ZipPorts file,
|
||||
but also please check in with Zip-Bugs BEFORE getting started, since the
|
||||
code is constantly being updated behind the scenes. (For example, VxWorks,
|
||||
VMOS and Netware ports were once claimed to be under construction, although
|
||||
we have yet to see any up-to-date patches.) We will arrange to send you the
|
||||
latest sources. The alternative is the possibility that your hard work will
|
||||
be tucked away in a subdirectory and mostly ignored, or completely ignored
|
||||
if someone else has already done the port (and you'd be surprised how often
|
||||
this has happened).
|
||||
|
||||
|
||||
BETA TESTING: JOINING INFO-ZIP
|
||||
-------------------------------
|
||||
If you'd like to keep up to date with our UnZip (and companion Zip utility)
|
||||
development, join the ranks of beta testers, add your own thoughts and
|
||||
contributions, or simply lurk, you may join one of our mailing lists.
|
||||
There is an announcements-only list (Info-ZIP-announce) and a general
|
||||
discussion/testing list (Info-ZIP). You must be a subscriber to post, and
|
||||
you can subscribe via the links on our Frequently Asked Questions page:
|
||||
|
||||
http://www.info-zip.org/pub/infozip/FAQ.html#lists
|
||||
|
||||
(Please note that as of late May 2004, the lists are unavailable pending
|
||||
a move to a new site; we hope to have them restored shortly. In the
|
||||
interim ...) Feel free to use our bug-reporting web page for bug reports
|
||||
and to ask questions not answered on the FAQ page above:
|
||||
|
||||
http://www.info-zip.org/zip-bug.html
|
||||
|
||||
For now the best option is to monitor and contribute to the various threads
|
||||
on the new discussion forum site at:
|
||||
|
||||
http://www.info-zip.org/board/board.pl
|
||||
|
||||
The second best way to contribute is through the various features at
|
||||
SourceForge, such as the bug posting areas.
|
||||
|
||||
There is also a closed mailing list for internal discussions of our core
|
||||
development team. This list is now kept secret to prevent us from being
|
||||
flooded with spam messages.
|
||||
|
||||
|
||||
-- Greg Roelofs (sometimes known as Cave Newt), principal UnZip developer
|
||||
guy, with inspiration from David Kirschbaum, was Author of this text.
|
||||
|
||||
-- Christian Spieler (shorthand: SPC), current UnZip maintenance coordinator,
|
||||
applied the most recent changes, with Ed Gordon providing a few additions.
|
226
programs/fs/unzip60/ToDo
Normal file
226
programs/fs/unzip60/ToDo
Normal file
@ -0,0 +1,226 @@
|
||||
================================
|
||||
For UnZip 6.1/who knows:
|
||||
================================
|
||||
|
||||
o add extraction support for other compression algorithms used by new
|
||||
PKZIP, WinZIP, 7-Zip versions
|
||||
- LZMA, compression type 14 (most important, because of its efficiency)
|
||||
- PPMd, compression type 98 (maybe, less important)
|
||||
- WavPacked, compression type 97 (maybe, less important)
|
||||
|
||||
LZMA is first-level priority for 6.1, other formats may be taken
|
||||
into consideration
|
||||
|
||||
o add support for reading AES encrypted archives
|
||||
- WinZIP format (priority 1)
|
||||
- PKZip format (priority 2)
|
||||
|
||||
top level item for 6.1
|
||||
|
||||
o add multi-part zipfile handling
|
||||
|
||||
major feature for 6.x!
|
||||
|
||||
could happen for 6.1
|
||||
|
||||
o better support for multilingual uses and different codepages;
|
||||
support unicode (UTF-8 coded) filenames and comment texts
|
||||
|
||||
a requested feature getting more and more important,
|
||||
- partially done for the Windows port in 6.0
|
||||
(support restricted for chars of the current system codepage)
|
||||
- partially done (beta state) for Unix
|
||||
(requires native codepage to be UTF-8)
|
||||
|
||||
o complete support for UTF-8 coded entry names (and comments)
|
||||
- add new "win32_wide" port to extend unicode support on Windows
|
||||
beyond the restrictions of the current (ANSI) system codepage
|
||||
- revise/extend the WinDLL interface to allow passing of "wide"
|
||||
string argument data
|
||||
- add simple built-in character translation between UTF-8 and the
|
||||
old (ISO-8851-1 / IBM850) code pages to allow old systems without
|
||||
standard UTF-8 support to read UTF-8 encoded archives.
|
||||
- extend the built-in translation tables to support other language
|
||||
regions besides "Western_Latin1" (e.g. Russian-kyrillic, Japanese,
|
||||
Chinese)
|
||||
- streamline the multilingual codepage and UTF-8 support for the UNIX
|
||||
port (standard codepage translation facility?, like WideChar<->AnsiCP
|
||||
translation functions under MS Windows)
|
||||
|
||||
should happen for 6.1
|
||||
(there is internal alpha-state code for better "wide" support on
|
||||
Windows available at the time of the 6.0 release)
|
||||
|
||||
o revise the "extended charcodes" handling in decryption password to
|
||||
support UTF-8 encoding on Unicode-aware systems where the "native"
|
||||
character coding is NOT UTF-8 (e.g. Windows).
|
||||
|
||||
o revise the command line interface for more compatibility with Zip'
|
||||
command parser
|
||||
- implement the versatile command parser from Zip 3.0.
|
||||
- add "long option" definitions for all existing options; revise
|
||||
the UnZip user manual to document the long-option alternatives.
|
||||
- add support for reading the "process these entries" and the "skip
|
||||
these entries" pattern lists from a file (or from separate files ?).
|
||||
- add a (long) option to switch off UnZip's internal pattern matching
|
||||
on filename arguments.
|
||||
|
||||
probably in 6.1,
|
||||
(first prototype of the revised command parser was available at the
|
||||
time of the 6.0 release)
|
||||
|
||||
o add command line options for miscellaneous features requested by users
|
||||
and/or development team members:
|
||||
- display the Info-ZIP software license
|
||||
- more fine-tuning for file attributes set/restored at extraction, like:
|
||||
set/clear archive attribute on DOS/OS2/WIN32;
|
||||
apply/skip standard or user-defined umask filter on UNIX (& Unix-alike)
|
||||
- additional time-stamp related processing filters
|
||||
- more listing display modifications
|
||||
- overriding the default date-time display style
|
||||
- ...
|
||||
|
||||
All these options are of minor importance and/or would collide with
|
||||
existing "one-character" options. The current UnZip maintainer does not
|
||||
want to reserve any of the few not-yet-occupied short option characters.
|
||||
for one of these features. So, any implementation effort for items
|
||||
of this feature wish-list has to be delayed until the "long option"
|
||||
support of the revised command line parser becomes available.
|
||||
|
||||
some option may get implemented in 6.1
|
||||
|
||||
o support for
|
||||
and/or development team members:
|
||||
|
||||
o add new low-level, binary API; rewrite "normal" (command-line) UnZip
|
||||
to use it
|
||||
|
||||
maybe soon (maybe 6.1)
|
||||
|
||||
o MSDOS/WIN32/others: detection of "reserved" names (= names of character
|
||||
devices, or system extensions that look like a characters device driver)
|
||||
at runtime; with the goal of emitting "meaningful" error messages and/or
|
||||
rename queries.
|
||||
(Currently, these reserved names are catched as "non-deletable files".
|
||||
On MSDOS and WIN32, when the RTL stat() function allows to identify
|
||||
character devices, the "reserved" names are automatically prefixed with
|
||||
an underscore.)
|
||||
|
||||
o redesign "file exists -- is newer/older -- overwrite/skip/rename"
|
||||
logic in extract.c and the corresponding system specific mapname()
|
||||
services; to prevent superfluous decryption key prompts for entry
|
||||
that will be skipped, later.
|
||||
|
||||
o rewrite to use fread/fseek/etc. [eventually: test
|
||||
write(bytes) vs. fwrite(words), especially on Crays/Alphas]
|
||||
|
||||
soon (probably in conjunction with multi-part handling)
|
||||
|
||||
o incorporate new backfill version of inflate()
|
||||
|
||||
wait for zlib version
|
||||
|
||||
o check NEXTBYTE for EOF in crypt.c, funzip.c and explode.c, too
|
||||
|
||||
whenever
|
||||
|
||||
o add option to force completely non-interactive operation (no queries
|
||||
for overwrite/rename, password, etc.); also allow some sort of non-
|
||||
interactive password provision? (file? command-line? env. variable?)
|
||||
|
||||
someday?
|
||||
|
||||
o add testing of extra fields (if have CRC)
|
||||
|
||||
later
|
||||
|
||||
o rewrite to allow use as a filter
|
||||
|
||||
way, way later...
|
||||
|
||||
o add Unix hard-link support?
|
||||
|
||||
way, way later...
|
||||
|
||||
o add ".ini" file support as a (more elaborate) alternative to the presently
|
||||
supported preconfiguring abilities via special environment variables
|
||||
(UNZIP on many systems...)?
|
||||
|
||||
way, way later (if ever)...
|
||||
|
||||
o add option to search zipfile contents for a string and print the
|
||||
results? ("zipgrep" option--e.g., unzip -g or unzip -S) (easy for
|
||||
fixed strings, hard for wildcards/true regex's)
|
||||
|
||||
way, way later, if at all...probably use libregex
|
||||
|
||||
o add -y "display symlinks" option to zipinfo? various sorting options?
|
||||
(-St date/time, -Sn name)?
|
||||
|
||||
who knows
|
||||
|
||||
o add "in-depth" option to zipinfo? (check local headers against
|
||||
central, etc.)--make it a better debugging tool (or just create
|
||||
zipfix)
|
||||
|
||||
who knows (zip -F, -FF already exist)
|
||||
|
||||
Some maintenance or OS specific topics for 6.0 release:
|
||||
|
||||
* add "unix-style-path -> partitioned-dataset filename" conversion
|
||||
to MVS port
|
||||
|
||||
* should we add support for (null) entry names (empty entry name field), to
|
||||
conform to the PKWARE specification?
|
||||
|
||||
|
||||
=======================================
|
||||
|
||||
Requested features:
|
||||
|
||||
- extract or exclude on basis of UID [Armin Bub, Armin.Bub@bk.bosch.de, 970904]
|
||||
|
||||
=======================================
|
||||
|
||||
o miscellaneous little stuff: whenever
|
||||
--------------------------
|
||||
|
||||
- change DOS -f/-u stuff to use DOS API for getting filetimes, not stat()
|
||||
|
||||
- add (-N?) option to lose all user input and/or switch to "(*input)()"
|
||||
function, replaceable by UzpAltMain() param
|
||||
- add -@ option to read from stdin (zip) or from file (PKZIP)? (go32 built-in)
|
||||
- add -oo option to overwrite OS/2 and DOS system and hidden files, too
|
||||
- add option to compute MD5 checksum on files and/or on entire zipfile?
|
||||
|
||||
- decide whether to use WinGUI "skipping" diagnostics in extract.c
|
||||
- combine "y/n/A/N" query/response stuff into unified section with query
|
||||
function(s) (InputFn?)
|
||||
- disable ^V code in remaining mapname() routines
|
||||
|
||||
- change filename-matching logic so case-insensitive if case-sensitive fails?
|
||||
|
||||
- allow multiple dir creation with -d option? [Bob Maynard]
|
||||
|
||||
- use gcc -pg, gprof to do profiling on unzip
|
||||
|
||||
- Doug Patriarche (doug.patriarche.bvdhp01@nt.com) Northern Telecom Canada Ltd.
|
||||
"I need to do a port of zip/unzip for Wind River Systems' VxWorks OS"
|
||||
[GRR: 15 March 95 -> "early June"]
|
||||
|
||||
|
||||
Features from old BUGS file (mostly duplicates of other entries above):
|
||||
|
||||
- ignore case for internal filename match on non-Unix systems, unless file-
|
||||
specs enclosed in single quotes
|
||||
- modify to decompress input stream if part of a pipe, but continue using
|
||||
central directory if not (BIG job!)--extended local header capability
|
||||
- add zipinfo option(s) to sort alphabetically, by date/time, in reverse, etc.
|
||||
- when listing filenames, use '?' for non-printables? [Thomas Wolff, 92.6.1]
|
||||
- add zipinfo "in-depth" option? (check local vs. central filenames, etc.)
|
||||
- create zipcat program to concatenate zipfiles
|
||||
- add -oo option (overwrite and override)? no user queries (if bad password,
|
||||
skip file; if disk full, take default action; if VMS special on non-VMS,
|
||||
unpack anyway; etc.)
|
||||
- add -Q[Q[Q]] option (quiet mode on comments, cautions, warnings and errors)?
|
||||
forget -oo, or make synonym? Default level -Q?
|
266
programs/fs/unzip60/WHERE
Normal file
266
programs/fs/unzip60/WHERE
Normal file
@ -0,0 +1,266 @@
|
||||
__________________________________________________________________________
|
||||
|
||||
This is the Info-ZIP file ``WHERE,'' last updated on 29 March 2008.
|
||||
__________________________________________________________________________
|
||||
|
||||
The latest version of this file can be found online at:
|
||||
|
||||
ftp://ftp.info-zip.org/pub/infozip/doc/WHERE
|
||||
|
||||
Note that some ftp sites may not yet have the latest versions of Zip
|
||||
and UnZip when you read this. The latest versions always appear in
|
||||
ftp://ftp.info-zip.org/pub/infozip/ (and subdirectories thereof) first,
|
||||
except for encryption binaries, which always appear in
|
||||
ftp://ftp.icce.rug.nl/infozip/ (and subdirectories) first.
|
||||
|
||||
IF YOU FIND AN ERROR: please let us know! We don't have time to
|
||||
check each and every site personally (or even collectively), so any
|
||||
number of the sites listed below may have moved or disappeared en-
|
||||
tirely. E-mail to Zip-Bugs@lists.wku.edu and we'll update this file.
|
||||
__________________________________________________________________________
|
||||
|
||||
|
||||
Info-ZIP's home WWW site is listed on Yahoo and is at:
|
||||
|
||||
ftp://ftp.info-zip.org/pub/infozip/Info-ZIP.html (master version)
|
||||
http://ftp.info-zip.org/pub/infozip/ (master version)
|
||||
http://www.info-zip.org/
|
||||
|
||||
Note that the old sites at http://www.cdrom.com/pub/infozip/ and
|
||||
http://www.freesoftware.com/pub/infozip are PERMANENTLY BROKEN. They
|
||||
cannot be updated or removed, apparently.
|
||||
|
||||
The Zip and UnZip pages have links to most known mirror sites carrying our
|
||||
source and/or binary distributions, and they generally are more up-to-date
|
||||
and have better information than what you are reading:
|
||||
|
||||
ftp://ftp.info-zip.org/pub/infozip/Zip.html
|
||||
ftp://ftp.info-zip.org/pub/infozip/UnZip.html
|
||||
|
||||
The related zlib package by Info-ZIP's Jean-loup Gailly and Mark Adler is at:
|
||||
|
||||
http://www.zlib.net/
|
||||
|
||||
Source-code archives for Info-ZIP's portable Zip, UnZip, and related
|
||||
utilities:
|
||||
|
||||
zip30.zip Zip 3.0 (deflation, bzip2, ZIP64 large archives, multi-
|
||||
volume splits; includes zipnote/zipsplit/zipcloak)
|
||||
zip30.tar.Z ditto, compress'd tar format
|
||||
|
||||
zip232.zip Zip 2.32 (deflation; includes zipnote/zipsplit/zipcloak)
|
||||
zip232.tar.Z ditto, compress'd tar format
|
||||
|
||||
zip11.zip Zip 1.1 (shrinking, implosion; compatible w. PKUNZIP 1.1)
|
||||
zip11.tar.Z ditto, compress'd tar format
|
||||
|
||||
unzip60.zip UnZip 6.0 (all methods[*]; unzip/funzip/unzipsfx/zipgrep)
|
||||
unzip60.tar.gz ditto, gzip'd tar format
|
||||
unzip60.tar.Z ditto, compress'd tar format
|
||||
|
||||
unred60.zip UnZip 6.0 add-on, contains copyrighted unreduce support
|
||||
|
||||
zcrypt29.zip encryption support for Zip 2.3[**]
|
||||
zcrypt10.zip encryption support for Zip 1.1
|
||||
|
||||
MacZip106src.zip contains all the GUI stuff and the project files to build
|
||||
the MacZip main-app. To build MacZip successfully, both
|
||||
the Zip 3.0 and UnZip 6.0 sources are required, too.
|
||||
|
||||
wiz601.zip WiZ 6.01, Windows 9x/NT GUI front-end for Info-ZIP's DLLs,
|
||||
as well as the source code and project files for the DLLs,
|
||||
and static libraries.
|
||||
|
||||
[*] Unreducing is disabled by default, but is available as add-on.
|
||||
As of July 2004, Unisys's LZW patent was expired worldwide, and
|
||||
unshrinking is turned on by default since the release of UnZip 5.52.
|
||||
See UnZip's INSTALL file for details.
|
||||
|
||||
[**] As of January 2000, US export regulations were amended to allow export
|
||||
of free encryption source code from the US. As of June 2002, these
|
||||
regulations were further relaxed to allow export of encryption binaries
|
||||
associated with free encryption source code. The Zip 2.31, UnZip 5.52
|
||||
and Wiz 5.02 archives now include full crypto source code. As of the
|
||||
Zip 2.31 release, all official binaries include encryption support; the
|
||||
former "zcr" archives ceased to exist.
|
||||
(Note that restrictions may still exist in other countries, of course.)
|
||||
|
||||
Executables archives (and related files) for Info-ZIP's software; not all
|
||||
of these will be immediately available due to lack of access to appropriate
|
||||
systems on the part of Info-ZIP members.
|
||||
|
||||
zip###x.zip MSDOS executables and docs
|
||||
zip###x1.zip OS/2 1.x (16-bit) executables and docs
|
||||
zip###x2.zip OS/2 2/3/4.x (32-bit) executables and docs
|
||||
zip###xA.zip Amiga executables and docs
|
||||
zip###xB.zip BeOS executables and docs
|
||||
zip###xC.zip VM/CMS executable and docs
|
||||
zip###xK.zip Tandem NSK executables and docs
|
||||
zip###xM.xmit MVS classic executable
|
||||
zip###xM-docs.zip MVS classic port, docs only
|
||||
zip###dN.zip WinNT/Win9x (Intel) DLL, header files, docs
|
||||
zip###xN.zip WinNT/Win9x (Intel) executables and docs
|
||||
zip###xN-axp.zip WinNT (Alpha AXP) executables and docs
|
||||
zip###xN-mip.zip WinNT (MIPS R4000) executables and docs
|
||||
zip###xN-ppc.zip WinNT (PowerPC) executables and docs
|
||||
zip###xO.zip IBM OS/390 Open Edition binaries and docs
|
||||
zip###xQ.zip SMS/QDOS executables and docs
|
||||
zip###xR.zip Acorn RISC OS executables and docs
|
||||
zip###xT.zip Atari TOS executables and docs
|
||||
zip###-vms-axp-obj.zip
|
||||
VMS (Alpha AXP) object libs, link procedure and docs
|
||||
zip###-vms-axp-exe.zip
|
||||
VMS (Alpha AXP) executables for VMS 6.1 or later and docs
|
||||
zip###-vms-vax-decc-obj.zip
|
||||
VMS (VAX) object libs (new DEC C), link procedure and docs
|
||||
zip###-vms-vax-decc-exe.zip
|
||||
VMS (VAX) executables (DEC C) for VMS 6.1 or later; docs
|
||||
zip###-vms-vax-vaxc-obj.zip
|
||||
VMS (VAX) object libs (old VAX C), link procedure and docs
|
||||
zip###x.hqx Macintosh BinHex'd executables and docs
|
||||
|
||||
unz###x.exe MSDOS self-extracting executable (16-bit unzip, ..., docs)
|
||||
unz###x3.exe MSDOS self-extracting executable (16-, 32-bit unzip, docs)
|
||||
unz###x1.exe OS/2 1.x (16-bit) self-extracting executables and docs
|
||||
unz###x2.exe OS/2 2/3/4.x (32-bit) self-extracting executables and docs
|
||||
unz###d2.zip OS/2 2/3/4.x (32-bit) DLL, header file, demo exe and docs
|
||||
unz###xA.ami Amiga self-extracting executables and docs
|
||||
unz###xA.lha Amiga executables and docs, LHa archive
|
||||
unz###xB.sfx BeOS self-extracting executables and docs
|
||||
unz###xB.tar.gz BeOS executables and docs, gzip'd tar archive
|
||||
unz###xC.mod VM/CMS executable module in "packed" format
|
||||
unz###xC-docs.zip VM/CMS docs, only
|
||||
unz###xF.zip FlexOS executable and docs
|
||||
unz###xK.zip Tandem NSK executable and docs
|
||||
unz###xM.xmit MVS classic executable
|
||||
unz###xM-docs.zip MVS classic port, docs only
|
||||
unz###dN.zip NT4/W2K/XP/2K3/W9x (32-bit Intel) DLL, header files, docs
|
||||
unz###xN.exe NT/2K/XP/2K3/W9x self-extracting i386 executables and docs
|
||||
unz###xN-axp.exe WinNT (Alpha AXP) self-extracting executables and docs
|
||||
unz###xN-mip.exe WinNT (MIPS R4000) self-extracting executables and docs
|
||||
unz###xN-ppc.exe WinNT (PowerPC) self-extracting executables and docs
|
||||
unz###xQ.sfx SMS/QDOS self-extracting executables and docs
|
||||
unz###xO.tar.Z IBM OS/390 Open edition (Unix-like), exes and docs
|
||||
unz###xR.exe Acorn RISC OS self-extracting executables and docs
|
||||
unz###xR.spk Acorn RISC OS Spark'd executables and docs
|
||||
unz###xT.tos Atari TOS self-extracting executables and docs
|
||||
unz###x-vms-axp-obj.bck VMS backup saveset,
|
||||
contains UnZip (Alpha) obj libs, link procedure, docs
|
||||
unz###x-vms-axp-obj.exe VMS (Alpha AXP) SFX archive (statically linked),
|
||||
contains UnZip (Alpha) obj libs, link procedure, docs
|
||||
unz###x-vms-axp-exe.exe VMS (Alpha AXP) SFX archive (dynamically linked),
|
||||
contains UnZip (Alpha AXP, DEC C) executables and docs,
|
||||
smaller than object archive, but requires VMS 6.1
|
||||
unz###x-vms-vax-decc-obj.bck VMS backup saveset,
|
||||
contains UnZip (new DEC C) obj libs, link procedure, docs
|
||||
unz###x-vms-vax-decc-obj.exe VMS (VAX) SFX archive (statically linked),
|
||||
contains UnZip (new DEC C) obj libs, link procedure, docs
|
||||
unz###x-vms-vax-decc-exe.exe VMS (VAX) SFX archive (dynamically linked),
|
||||
contains UnZip (new DEC C) executables and docs,
|
||||
smaller than object archive, but requires VMS 6.1
|
||||
unz###x-vms-vax-vaxc-obj.bck VMS backup saveset,
|
||||
contains UnZip (old VAX C) obj libs, link procedure, docs
|
||||
unz###x-vms-vax-vaxc-obj.exe VMS (VAX) SFX archive (statically linked),
|
||||
contains UnZip (old VAX C) obj libs, link procedure, docs
|
||||
unz###x.hqx Macintosh BinHex'd executables and docs for unzip
|
||||
(unz###x.tar.{Z,gz} Unix exes/docs for Solaris 2.x, SCO Unix, Linux, etc.,
|
||||
depending on directory/location; generally only provided
|
||||
in cases where the OS does *not* ship with a bundled C
|
||||
compiler)
|
||||
|
||||
MacZip106nc.hqx Macintosh combined Zip&UnZip application with GUI,
|
||||
executables and docs (no encryption)
|
||||
MacZip106c.hqx Macintosh combined Zip&UnZip application with GUI,
|
||||
executables and docs (with encryption)
|
||||
|
||||
wiz###xN.exe WiZ #.## 32-bit (Win9x/NT/2K/XP/2K3) app+docs (self-extr.)
|
||||
|
||||
UnzpHist.zip complete changes-history of UnZip and its precursors
|
||||
ZipHist.zip complete changes-history of Zip
|
||||
|
||||
ftp/web sites for the US-exportable sources and executables:
|
||||
|
||||
NOTE: Look for the Info-ZIP file names given above (not PKWARE or third-
|
||||
party stuff) in the following locations. Some sites like to use slightly
|
||||
different names, such as zip-#.##.tar.gz instead of zip###.tar.Z.
|
||||
|
||||
http://sourceforge.net/project/showfiles.php?group_id=118012
|
||||
[THE INFO-ZIP SOURCES HOME SITE]
|
||||
|
||||
ftp://ftp.info-zip.org/pub/infozip/ [THE INFO-ZIP HOME SITE]
|
||||
ftp://sunsite.doc.ic.ac.uk/packages/zip/ [MIRRORS THE INFO-ZIP HOME SITE]
|
||||
ftp://unix.hensa.ac.uk/mirrors/uunet/pub/archiving/zip/
|
||||
|
||||
ftp://ftp.cmdl.noaa.gov/aerosol/doc/archiver/{all,dos,os2,mac,vax_alpha}/
|
||||
ftp://garbo.uwasa.fi/pc/arcers/ [AND OTHER GARBO MIRRORS]
|
||||
ftp://garbo.uwasa.fi/unix/arcers/ [AND OTHER GARBO MIRRORS]
|
||||
ftp://ftp.elf.stuba.sk/pub/pc/pack/ [AND OTHER STUBA MIRRORS]
|
||||
ftp://ftp-os2.cdrom.com/pub/os2/archiver/
|
||||
ftp://ftp-os2.nmsu.edu/os2/archiver/
|
||||
ftp://ftp.informatik.tu-muenchen.de/pub/comp/os/os2/archiver/
|
||||
ftp://sumex-aim.stanford.edu/info-mac/cmp/
|
||||
ftp://ftp.wustl.edu/pub/aminet/util/arc/ [AND OTHER AMINET MIRRORS]
|
||||
ftp://atari.archive.umich.edu/pub/Archivers/ [AND OTHER UMICH MIRRORS]
|
||||
http://www.umich.edu/~archive/atari/Archivers/
|
||||
ftp://jake.educom.com.au/pub/infozip/acorn/ [Acorn RISC OS]
|
||||
http://www.sitec.net/maczip/ [MacZip port]
|
||||
|
||||
ftp/web sites for the encryption and decryption sources and/or executables:
|
||||
|
||||
Outside the US:
|
||||
ftp://ftp.info-zip.org/pub/infozip/ [THE INFO-ZIP HOME SITE]
|
||||
ftp://ftp.icce.rug.nl/infozip/ [THE INFO-ZIP ENCRYPTION HOME SITE]
|
||||
ftp://ftp.elf.stuba.sk/pub/pc/pack/
|
||||
ftp://garbo.uwasa.fi/pc/arcers/
|
||||
ftp://ftp.inria.fr/system/arch-compr/
|
||||
ftp://ftp.leo.org/pub/comp/os/os2/leo/archiver/
|
||||
(mail server at ftp-mailer@ftp.leo.org)
|
||||
|
||||
ftp://ftp.win.tue.nl/pub/compression/zip/
|
||||
ftp://ftp.uni-erlangen.de/pub/pc/msdos/arc-utils/zip/
|
||||
|
||||
|
||||
The primary distribution site for the MacZip port can be found at:
|
||||
|
||||
http://www.sitec.net/maczip/
|
||||
|
||||
ftp sites for VMS-format Zip and UnZip packages (sources, object files and
|
||||
executables, no encryption/decryption--see also "Mail servers" section below):
|
||||
|
||||
ftp.spc.edu [192.107.46.27] and ftp.wku.edu:
|
||||
|
||||
[.MACRO32]AAAREADME.TXT
|
||||
[.MACRO32.SAVESETS]UNZIP.BCK or UNZIP.ZIP (if already have older version)
|
||||
[.MACRO32.SAVESETS]ZIP.ZIP
|
||||
|
||||
To find other ftp/web sites:
|
||||
|
||||
The "archie" ftp database utility can be used to find an ftp site near
|
||||
you (although the command-line versions always seem to find old ver-
|
||||
sions...the `FTPsearch' server at http://ftpsearch.ntnu.no/ftpsearch
|
||||
--formerly `Archie 95'--is quite up-to-date, however). Or check a stan-
|
||||
dard WWW search engine like AltaVista (http://www.altavista.digital.com/)
|
||||
or Yahoo (http://www.yahoo.com/). If you don't know how to use these,
|
||||
DON'T ASK US--read the web sites' help pages or check the Usenet groups
|
||||
news.announce.newusers or news.answers or some such, or ask your system
|
||||
administrator.
|
||||
|
||||
Mail servers:
|
||||
|
||||
To get the encryption sources by e-mail, send the following commands
|
||||
to ftp-mailer@informatik.tu-muenchen.de:
|
||||
|
||||
get /pub/comp/os/os2/archiver/zcrypt29.zip
|
||||
quit
|
||||
|
||||
To get the VMS Zip/UnZip package by e-mail, send the following
|
||||
commands in the body of a mail message to fileserv@wku.edu (the
|
||||
"HELP" command is also accepted):
|
||||
|
||||
SEND FILESERV_TOOLS
|
||||
SEND UNZIP
|
||||
SEND ZIP
|
||||
|
||||
To get Atari executables by e-mail, send a message to
|
||||
atari@atari.archive.umich.edu for information about the mail server.
|
||||
__________________________________________________________________________
|
26
programs/fs/unzip60/acorn/Contents
Normal file
26
programs/fs/unzip60/acorn/Contents
Normal file
@ -0,0 +1,26 @@
|
||||
Contents of the "acorn" subdirectory for UnZip 5.4 and later:
|
||||
|
||||
acorn.c.acorn Acorn-specific resources
|
||||
acorn.c.riscos mainly file-handling routines for FileCore-based filesystems
|
||||
acorn.Contents this file
|
||||
acorn.GMakeFile Makefile for gcc
|
||||
acorn.h.riscos
|
||||
acorn.h.swiven
|
||||
acorn.makefile Makefile script for default Acorn C compiler
|
||||
acorn.README notes about Acorn-specific features
|
||||
acorn.RunMe1st Obey file to move files into suitable place for compilation
|
||||
on RISC OS machines
|
||||
acorn.s.swiven SWI veneers
|
||||
acorn.srcrename small executable that converts files from Unix style to
|
||||
RISC OS style, used by RunMe1st
|
||||
|
||||
Notes:
|
||||
|
||||
Use the "RunMe1st" file (it is an Obey file) to convert all the files from
|
||||
"filename/[chs]" to "[chs].filename" (so that UnZip could be easily compiled
|
||||
under RISC OS). It will also set the correct makefile.
|
||||
|
||||
To compile just set the CSD to the main UnZip directory and run 'amu'.
|
||||
|
||||
Currently only the Acorn C V5 compiler has been tested but probably also
|
||||
Acorn C V4 and the Acorn Assembler V2 will be able to compile UnZip.
|
138
programs/fs/unzip60/acorn/GMakefile
Normal file
138
programs/fs/unzip60/acorn/GMakefile
Normal file
@ -0,0 +1,138 @@
|
||||
# Makefile for UnZip, UnZipSFX, ZipInfo and fUnZip (5.53 or later)
|
||||
# using gcc 2.95.4 (or later).
|
||||
# You may look at <URL:http://hard-mofo.dsvr.net/gcc/> for an up-to-date
|
||||
# gcc port.
|
||||
|
||||
CC = gcc -mlibscl
|
||||
BIND = $(CC)
|
||||
AS = $(CC) -c
|
||||
ASM = as
|
||||
SQUEEZE = squeeze -v
|
||||
E =
|
||||
|
||||
# flags
|
||||
# CFLAGS flags for C compile
|
||||
# LFLAGS1 flags after output file spec, before obj file list
|
||||
# LFLAGS2 flags after obj file list (libraries, etc)
|
||||
#
|
||||
LIB =
|
||||
CFLAGS = -O2 -mthrowback -DNO_STRNICMP
|
||||
ASMFLAGS = -throwback -objasm -upper
|
||||
LFLAGS1 =
|
||||
LFLAGS2 = $(LIB)
|
||||
|
||||
# object file lists
|
||||
OBJS1 = o.unzip o.crc32 o.crypt o.envargs o.explode
|
||||
OBJS2 = o.extract o.fileio o.globals o.inflate o.list o.match
|
||||
OBJS3 = o.process o.ttyio o.unreduce o.unshrink o.zipinfo
|
||||
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) o.riscos o.swiven o.acorn
|
||||
OBJF = o.funzip o.crc32 o.cryptf o.globalsf o.inflatef o.ttyiof \
|
||||
o.riscos o.swiven
|
||||
OBJX = o.unzipsfx o.crc32 o.crypt_ o.extract_ o.fileio_ o.globals_ \
|
||||
o.inflate_ o.match_ o.process_ o.ttyio_ o.acorn_ o.swiven o.riscos_
|
||||
|
||||
UNZIP_H = h.unzip h.unzpriv h.globals acorn.h.riscos acorn.h.swiven
|
||||
|
||||
all: unzip funzip unzipsfx
|
||||
|
||||
|
||||
install: unzip funzip unzipsfx
|
||||
$(SQUEEZE) unzip %.unzip
|
||||
$(SQUEEZE) funzip %.funzip
|
||||
$(SQUEEZE) unzipsfx unzipsfx
|
||||
copy %.unzip %.zipinfo ~CVF
|
||||
|
||||
# rules for unzip and funzip
|
||||
o.crc32: c.crc32 $(UNZIP_H) h.zip h.crc32
|
||||
$(CC) $(CFLAGS) -c c.crc32 -o o.crc32
|
||||
o.crypt: c.crypt $(UNZIP_H) h.zip h.crypt h.crc32 h.ttyio
|
||||
$(CC) $(CFLAGS) -c c.crypt -o o.crypt
|
||||
o.envargs: c.envargs $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -c c.envargs -o o.envargs
|
||||
o.explode: c.explode $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -c c.explode -o o.explode
|
||||
o.extract: c.extract $(UNZIP_H) h.crc32 h.crypt
|
||||
$(CC) $(CFLAGS) -c c.extract -o o.extract
|
||||
o.fileio: c.fileio $(UNZIP_H) h.crc32 h.crypt h.ttyio h.ebcdic
|
||||
$(CC) $(CFLAGS) -c c.fileio -o o.fileio
|
||||
o.funzip: c.funzip $(UNZIP_H) h.crc32 h.crypt h.ttyio
|
||||
$(CC) $(CFLAGS) -c c.funzip -o o.funzip
|
||||
o.globals: c.globals $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -c c.globals -o o.globals
|
||||
o.inflate: c.inflate h.inflate $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -c c.inflate -o o.inflate
|
||||
o.list: c.list $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -c c.list -o o.list
|
||||
o.match: c.match $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -c c.match -o o.match
|
||||
o.process: c.process $(UNZIP_H) h.crc32
|
||||
$(CC) $(CFLAGS) -c c.process -o o.process
|
||||
o.ttyio: c.ttyio $(UNZIP_H) h.zip h.crypt h.ttyio
|
||||
$(CC) $(CFLAGS) -c c.ttyio -o o.ttyio
|
||||
o.unreduce: c.unreduce $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -c c.unreduce -o o.unreduce
|
||||
o.unshrink: c.unshrink $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -c c.unshrink -o o.unshrink
|
||||
o.unzip: c.unzip $(UNZIP_H) h.crypt h.unzvers h.consts
|
||||
$(CC) $(CFLAGS) -c c.unzip -o o.unzip
|
||||
o.zipinfo: c.zipinfo $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -c c.zipinfo -o o.zipinfo
|
||||
|
||||
o.crypt_: c.crypt $(UNZIP_H) h.zip h.crypt h.crc32 h.ttyio
|
||||
$(CC) $(CFLAGS) -DSFX -c c.crypt -o o.crypt_
|
||||
o.extract_: c.extract $(UNZIP_H) h.crc32 h.crypt
|
||||
$(CC) $(CFLAGS) -DSFX -c c.extract -o o.extract_
|
||||
o.fileio_: c.fileio $(UNZIP_H) h.crc32 h.crypt h.ttyio h.ebcdic
|
||||
$(CC) $(CFLAGS) -DSFX -c c.fileio -o o.fileio_
|
||||
o.globals_: c.globals $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -DSFX -c c.globals -o o.globals_
|
||||
o.inflate_: c.inflate h.inflate $(UNZIP_H) h.crypt
|
||||
$(CC) $(CFLAGS) -DSFX -c c.inflate -o o.inflate_
|
||||
o.match_: c.match $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -DSFX -c c.match -o o.match_
|
||||
o.process_: c.process $(UNZIP_H) h.crc32
|
||||
$(CC) $(CFLAGS) -DSFX -c c.process -o o.process_
|
||||
o.ttyio_: c.ttyio $(UNZIP_H) h.zip h.crypt h.ttyio
|
||||
$(CC) $(CFLAGS) -DSFX -c c.ttyio -o o.ttyio_
|
||||
|
||||
o.unzipsfx: c.unzip $(UNZIP_H) h.crypt h.unzvers h.consts
|
||||
$(CC) $(CFLAGS) -DSFX -c c.unzip -o o.unzipsfx
|
||||
|
||||
o.cryptf: c.crypt $(UNZIP_H) h.zip h.crypt h.crc32 h.ttyio
|
||||
$(CC) $(CFLAGS) -DFUNZIP -c c.crypt -o o.cryptf
|
||||
o.globalsf: c.globals $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -DFUNZIP -c c.globals -o o.globalsf
|
||||
o.inflatef: c.inflate h.inflate $(UNZIP_H) h.crypt
|
||||
$(CC) $(CFLAGS) -DFUNZIP -c c.inflate -o o.inflatef
|
||||
o.ttyiof: c.ttyio $(UNZIP_H) h.zip h.crypt h.ttyio
|
||||
$(CC) $(CFLAGS) -DFUNZIP -c c.ttyio -o o.ttyiof
|
||||
|
||||
o.acorn: acorn.c.acorn $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -I@ -c acorn.c.acorn
|
||||
o.acorn_: acorn.c.acorn $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -I@ -c -DSFX -DSFX_EXDIR -o o.acorn_ acorn.c.acorn
|
||||
|
||||
o.riscos: acorn.c.riscos $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -I@ -c acorn.c.riscos
|
||||
o.riscos_: acorn.c.riscos $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -I@ -c -DSFX -DSFX_EXDIR -o o.riscos_ acorn.c.riscos
|
||||
|
||||
o.swiven: acorn.s.swiven
|
||||
$(ASM) $(ASMFLAGS) acorn.s.swiven -o o.swiven
|
||||
|
||||
unzip: $(OBJS)
|
||||
$(BIND) -o unzip$(E) $(LFLAGS1) $(OBJS) $(LFLAGS2)
|
||||
funzip: $(OBJF)
|
||||
$(BIND) -o funzip$(E) $(LFLAGS1) $(OBJF) $(LFLAGS2)
|
||||
unzipsfx: $(OBJX)
|
||||
$(BIND) -o unzipsfx$(E) $(LFLAGS1) $(OBJX) $(LFLAGS2)
|
||||
|
||||
clean:
|
||||
remove unzip
|
||||
remove funzip
|
||||
remove zipinfo
|
||||
remove unzipsfx
|
||||
create o.!fake! 0
|
||||
wipe o.* ~cf
|
||||
|
||||
# end of Makefile
|
69
programs/fs/unzip60/acorn/ReadMe
Normal file
69
programs/fs/unzip60/acorn/ReadMe
Normal file
@ -0,0 +1,69 @@
|
||||
Acorn-specific usage instructions
|
||||
---------------------------------
|
||||
|
||||
As zipfiles can come from a variety of sources apart from Acorn machines,
|
||||
consideration had to be given to the handling of dot-extensions, e.g.
|
||||
"DOSFILE.TXT", "unix-filename.tar.gz". These are extracted as "DOSFILE/TXT"
|
||||
and "unix-filename/tar/gz"; their names may or may not be truncated,
|
||||
depending on where the files are being created: what filing system and, for
|
||||
Filecore-based filing systems such as ADFS or an IDEFS or SCSIFS, which
|
||||
disk/partition format (names will not be truncated if you're using E+ or F+).
|
||||
|
||||
Where truncation occurs, you must be REALLY careful about extracting files
|
||||
from archives. The files
|
||||
|
||||
dummy_source.c and dummy_source.h
|
||||
|
||||
will both be extracted as
|
||||
|
||||
dummy_sour
|
||||
|
||||
UnZip will prompt you for confirmation of the over-writing of these files,
|
||||
but you must be really careful unless you wish to lose files! Also, because
|
||||
UnZip is a unix-ported program, the filenames are CASE SENSITIVE.
|
||||
|
||||
*unzip new/zip newfile
|
||||
|
||||
will extract 'newfile', but not 'NewFile', 'NEWFILE' or any other
|
||||
combinations. However, you can use the -C option to force operations to
|
||||
disregard the case of filenames.
|
||||
|
||||
The Acorn UnZip port has an additional feature to cope with the extraction of
|
||||
files containing 'c' code. As you may be aware, Acorn Desktop C requires all
|
||||
files called "foo.c" to be renamed to "c.foo", ie "foo" in a directory called
|
||||
"c".
|
||||
|
||||
There are two ways of using this feature.
|
||||
|
||||
- The old way: use a colon-separated environment variable named "Unzip$Exts".
|
||||
|
||||
Any extensions found in this variable will be extracted to directories
|
||||
named after the extension, with the extension stripped. For example:
|
||||
|
||||
*Set Unzip$Exts "c:h:o:s"
|
||||
*unzip foo/zip
|
||||
|
||||
- The new way: use the -/ option. For example:
|
||||
|
||||
Any extensions found in the parameter for this option will be extracted to
|
||||
directories named after the extension, with the extension stripped. For
|
||||
example:
|
||||
|
||||
*unzip -/c:h:o:s foo/zip
|
||||
|
||||
If foo/zip contains a file named "foo.c", this file will be written as "foo"
|
||||
in directory "c". This can be used to include "c:h:o:s:txt" to pull all the
|
||||
text files out to a separate directory.
|
||||
|
||||
UnZip fully supports SparkFS Extra Field. This means that zipfiles created
|
||||
with SparkFS or Zip (on RISC OS) will be correctly unzipped, including
|
||||
filetypes.
|
||||
|
||||
UnZipSFX can be used to create self-extracting archives. To use it, just
|
||||
create a common zipfile using Zip (or SparkFS), then load the UnZipSFX
|
||||
executable into an editor (eg. Edit, Zap), go with the caret the end of the
|
||||
file (using CTRL-CursorDown) and drag the zipfile to the editor window (in
|
||||
other words, append the zipfile to the UnZipSFX executable). Now, saving the
|
||||
resulting file (with filetype Absolute (&FF8)), you have a self-extracting
|
||||
archive (ie. double-clicking on it will unzip the contents of the original
|
||||
zipfile to the currently selected directory).
|
17
programs/fs/unzip60/acorn/RunMe1st
Normal file
17
programs/fs/unzip60/acorn/RunMe1st
Normal file
@ -0,0 +1,17 @@
|
||||
| This Obey file prepares the UnZip port for a Desktop C re-compile.
|
||||
| Run it and it will copy all the needed files into the correct
|
||||
| place.
|
||||
|
||||
| Set the correct type of 'srcrename' so that the only requirement
|
||||
| for the user is to set 'RunMe1st' to Obey
|
||||
SetType <Obey$Dir>.srcrename FF8
|
||||
|
||||
| Run 'srcrename' on the main UnZip directory with recursion enabled
|
||||
/<Obey$Dir>.srcrename -r -e c:h:s:o <Obey$Dir>.^
|
||||
|
||||
| Create the 'o' directory
|
||||
CDir <Obey$Dir>.^.o
|
||||
|
||||
| Put the Makefile in its correct place and set the correct filetype
|
||||
SetType <Obey$Dir>.makefile FE1
|
||||
Copy <Obey$Dir>.makefile <Obey$Dir>.^.makefile ~C ~V F
|
994
programs/fs/unzip60/acorn/acorn.c
Normal file
994
programs/fs/unzip60/acorn/acorn.c
Normal file
@ -0,0 +1,994 @@
|
||||
/*
|
||||
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 unzip.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
|
||||
*/
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
acorn.c
|
||||
|
||||
RISCOS-specific routines for use with Info-ZIP's UnZip 5.2 and later.
|
||||
|
||||
Contains: do_wild() <-- generic enough to put in fileio.c?
|
||||
mapattr()
|
||||
mapname()
|
||||
checkdir()
|
||||
mkdir()
|
||||
setRISCOSexfield()
|
||||
printRISCOSexfield()
|
||||
close_outfile()
|
||||
stamp_file()
|
||||
version()
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#define UNZIP_INTERNAL
|
||||
#include "^.unzip.h"
|
||||
#include "riscos.h"
|
||||
|
||||
#define FTYPE_FFF (1<<17) /* set filetype to &FFF when extracting */
|
||||
|
||||
#ifdef WILD_STOP_AT_DIR
|
||||
# define WESEP , (oU.W_flag ? '.' : '\0')
|
||||
#else
|
||||
# define WESEP
|
||||
#endif
|
||||
|
||||
static int created_dir; /* used in mapname(), checkdir() */
|
||||
static int renamed_fullpath; /* ditto */
|
||||
static int has_mimemap = -1; /* used in mimemap() */
|
||||
|
||||
extern int mkdir(const char *path, int mode);
|
||||
static int has_NFS_ext(const char *name);
|
||||
static void setRISCOSexfield(ZCONST char *path, ZCONST void *ef_spark);
|
||||
#ifdef DEBUG
|
||||
static void printRISCOSexfield(int isdir, ZCONST void *extra_field);
|
||||
#endif
|
||||
static int uxtime2acornftime(unsigned *pexadr, unsigned *pldadr, time_t ut);
|
||||
static int mimemap(const char *name);
|
||||
|
||||
|
||||
#ifndef SFX
|
||||
|
||||
/**********************/
|
||||
/* Function do_wild() */ /* for porting: dir separator; match(ignore_case) */
|
||||
/**********************/
|
||||
|
||||
char *do_wild(__G__ wildspec)
|
||||
__GDEF
|
||||
ZCONST char *wildspec; /* only used first time on a given dir */
|
||||
{
|
||||
static DIR *wild_dir = (DIR *)NULL;
|
||||
static ZCONST char *wildname;
|
||||
static char *dirname, matchname[FILNAMSIZ];
|
||||
static int notfirstcall=FALSE, have_dirname, dirnamelen;
|
||||
struct dirent *file;
|
||||
|
||||
/* Even when we're just returning wildspec, we *always* do so in
|
||||
* matchname[]--calling routine is allowed to append four characters
|
||||
* to the returned string, and wildspec may be a pointer to argv[].
|
||||
*/
|
||||
if (!notfirstcall) { /* first call: must initialize everything */
|
||||
notfirstcall = TRUE;
|
||||
|
||||
/* break the wildspec into a directory part and a wildcard filename */
|
||||
if ((wildname = (ZCONST char *)strrchr(wildspec, '.')) ==
|
||||
(ZCONST char *)NULL)
|
||||
{
|
||||
dirname = ".";
|
||||
dirnamelen = 1;
|
||||
have_dirname = FALSE;
|
||||
wildname = wildspec;
|
||||
} else {
|
||||
++wildname; /* point at character after '/' */
|
||||
dirnamelen = wildname - wildspec;
|
||||
if ((dirname = (char *)malloc(dirnamelen+1)) == (char *)NULL) {
|
||||
Info(slide, 0x201, ((char *)slide,
|
||||
"warning: cannot allocate wildcard buffers\n"));
|
||||
strncpy(matchname, wildspec, FILNAMSIZ);
|
||||
matchname[FILNAMSIZ-1] = '\0';
|
||||
return matchname; /* but maybe filespec was not a wildcard */
|
||||
}
|
||||
strncpy(dirname, wildspec, dirnamelen);
|
||||
dirname[dirnamelen] = '\0'; /* terminate for strcpy below */
|
||||
have_dirname = TRUE;
|
||||
}
|
||||
|
||||
if ((wild_dir = opendir(dirname)) != (DIR *)NULL) {
|
||||
while ((file = readdir(wild_dir)) != (struct dirent *)NULL) {
|
||||
if (file->d_name[0] == '/' && wildname[0] != '/')
|
||||
continue; /* Unix: '*' and '?' do not match leading dot */
|
||||
if (match(file->d_name, wildname, 0 WESEP)) { /* 0=case sens.*/
|
||||
if (have_dirname) {
|
||||
strcpy(matchname, dirname);
|
||||
strcpy(matchname+dirnamelen, file->d_name);
|
||||
} else
|
||||
strcpy(matchname, file->d_name);
|
||||
return matchname;
|
||||
}
|
||||
}
|
||||
/* if we get to here directory is exhausted, so close it */
|
||||
closedir(wild_dir);
|
||||
wild_dir = (DIR *)NULL;
|
||||
}
|
||||
|
||||
/* return the raw wildspec in case that works (e.g., directory not
|
||||
* searchable, but filespec was not wild and file is readable) */
|
||||
strncpy(matchname, wildspec, FILNAMSIZ);
|
||||
matchname[FILNAMSIZ-1] = '\0';
|
||||
return matchname;
|
||||
}
|
||||
|
||||
/* last time through, might have failed opendir but returned raw wildspec */
|
||||
if (wild_dir == (DIR *)NULL) {
|
||||
notfirstcall = FALSE; /* nothing left to try--reset for new wildspec */
|
||||
if (have_dirname)
|
||||
free(dirname);
|
||||
return (char *)NULL;
|
||||
}
|
||||
|
||||
/* If we've gotten this far, we've read and matched at least one entry
|
||||
* successfully (in a previous call), so dirname has been copied into
|
||||
* matchname already.
|
||||
*/
|
||||
while ((file = readdir(wild_dir)) != (struct dirent *)NULL)
|
||||
if (match(file->d_name, wildname, 0 WESEP)) { /* 0 == case sens. */
|
||||
if (have_dirname) {
|
||||
/* strcpy(matchname, dirname); */
|
||||
strcpy(matchname+dirnamelen, file->d_name);
|
||||
} else
|
||||
strcpy(matchname, file->d_name);
|
||||
return matchname;
|
||||
}
|
||||
|
||||
closedir(wild_dir); /* have read at least one dir entry; nothing left */
|
||||
wild_dir = (DIR *)NULL;
|
||||
notfirstcall = FALSE; /* reset for new wildspec */
|
||||
if (have_dirname)
|
||||
free(dirname);
|
||||
return (char *)NULL;
|
||||
|
||||
} /* end function do_wild() */
|
||||
|
||||
#endif /* !SFX */
|
||||
|
||||
|
||||
|
||||
/**************************/
|
||||
/* Function has_NFS_ext() */
|
||||
/**************************/
|
||||
|
||||
static int has_NFS_ext(const char* name)
|
||||
{
|
||||
int i = strlen(name) - 4;
|
||||
|
||||
return (i >= 0 && name[i] == ',' && (i > 0 || name[i-1]=='/') &&
|
||||
isxdigit(name[i+1]) && isxdigit(name[i+2]) && isxdigit(name[i+3]));
|
||||
} /* end function has_NFS_ext() */
|
||||
|
||||
|
||||
|
||||
/**********************/
|
||||
/* Function mapattr() */
|
||||
/**********************/
|
||||
|
||||
int mapattr(__G)
|
||||
__GDEF
|
||||
{
|
||||
ulg tmp = G.crec.external_file_attributes;
|
||||
|
||||
switch (G.pInfo->hostnum) {
|
||||
case AMIGA_:
|
||||
tmp = (unsigned)(tmp>>17 & 7); /* Amiga RWE bits */
|
||||
G.pInfo->file_attr = (unsigned)(tmp<<6 | tmp<<3 | tmp);
|
||||
break;
|
||||
case THEOS_:
|
||||
tmp &= 0xF1FFFFFFL;
|
||||
if ((tmp & 0xF0000000L) != 0x40000000L)
|
||||
tmp &= 0x01FFFFFFL; /* not a dir, mask all ftype bits */
|
||||
else
|
||||
tmp &= 0x41FFFFFFL; /* leave directory bit as set */
|
||||
/* fall through! */
|
||||
case ACORN_:
|
||||
case UNIX_:
|
||||
case VMS_:
|
||||
case ATARI_:
|
||||
case ATHEOS_:
|
||||
case BEOS_:
|
||||
case QDOS_:
|
||||
case TANDEM_:
|
||||
G.pInfo->file_attr = (unsigned)(tmp >> 16);
|
||||
if (G.pInfo->file_attr != 0 || !G.extra_field) {
|
||||
break;
|
||||
} else {
|
||||
/* Some (non-Info-ZIP) implementations of Zip for Unix and
|
||||
VMS (and probably others ??) leave 0 in the upper 16-bit
|
||||
part of the external_file_attributes field. Instead, they
|
||||
store file permission attributes in some extra field.
|
||||
As a work-around, we search for the presence of one of
|
||||
these extra fields and fall back to the MSDOS compatible
|
||||
part of external_file_attributes if one of the known
|
||||
e.f. types has been detected.
|
||||
Later, we might implement extraction of the permission
|
||||
bits from the VMS extra field. But for now, the work-around
|
||||
should be sufficient to provide "readable" extracted files.
|
||||
(For ASI Unix e.f., an experimental remap of the e.f.
|
||||
mode value IS already provided!)
|
||||
*/
|
||||
ush ebID;
|
||||
unsigned ebLen;
|
||||
uch *ef = G.extra_field;
|
||||
unsigned ef_len = G.crec.extra_field_length;
|
||||
int r = FALSE;
|
||||
|
||||
while (!r && ef_len >= EB_HEADSIZE) {
|
||||
ebID = makeword(ef);
|
||||
ebLen = (unsigned)makeword(ef+EB_LEN);
|
||||
if (ebLen > (ef_len - EB_HEADSIZE))
|
||||
/* discoverd some e.f. inconsistency! */
|
||||
break;
|
||||
switch (ebID) {
|
||||
case EF_ASIUNIX:
|
||||
if (ebLen >= (EB_ASI_MODE+2)) {
|
||||
G.pInfo->file_attr =
|
||||
(unsigned)makeword(ef+(EB_HEADSIZE+EB_ASI_MODE));
|
||||
/* force stop of loop: */
|
||||
ef_len = (ebLen + EB_HEADSIZE);
|
||||
break;
|
||||
}
|
||||
/* else: fall through! */
|
||||
case EF_PKVMS:
|
||||
/* "found nondecypherable e.f. with perm. attr" */
|
||||
r = TRUE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ef_len -= (ebLen + EB_HEADSIZE);
|
||||
ef += (ebLen + EB_HEADSIZE);
|
||||
}
|
||||
if (!r)
|
||||
break;
|
||||
}
|
||||
/* fall through! */
|
||||
/* all remaining cases: expand MSDOS read-only bit into write perms */
|
||||
case FS_FAT_:
|
||||
/* PKWARE's PKZip for Unix marks entries as FS_FAT_, but stores the
|
||||
* Unix attributes in the upper 16 bits of the external attributes
|
||||
* field, just like Info-ZIP's Zip for Unix. We try to use that
|
||||
* value, after a check for consistency with the MSDOS attribute
|
||||
* bits (see below).
|
||||
*/
|
||||
G.pInfo->file_attr = (unsigned)(tmp >> 16);
|
||||
/* fall through! */
|
||||
case FS_HPFS_:
|
||||
case FS_NTFS_:
|
||||
case MAC_:
|
||||
case TOPS20_:
|
||||
default:
|
||||
/* Ensure that DOS subdir bit is set when the entry's name ends
|
||||
* in a '/'. Some third-party Zip programs fail to set the subdir
|
||||
* bit for directory entries.
|
||||
*/
|
||||
if ((tmp & 0x10) == 0) {
|
||||
extent fnlen = strlen(G.filename);
|
||||
if (fnlen > 0 && G.filename[fnlen-1] == '/')
|
||||
tmp |= 0x10;
|
||||
}
|
||||
/* read-only bit --> write perms; subdir bit --> dir exec bit */
|
||||
tmp = !(tmp & 1) << 1 | (tmp & 0x10) >> 4;
|
||||
if ((G.pInfo->file_attr & 0700) == (unsigned)(0400 | tmp<<6))
|
||||
/* keep previous G.pInfo->file_attr setting, when its "owner"
|
||||
* part appears to be consistent with DOS attribute flags!
|
||||
*/
|
||||
break;
|
||||
G.pInfo->file_attr = (unsigned)(0444 | tmp<<6 | tmp<<3 | tmp);
|
||||
break;
|
||||
} /* end switch (host-OS-created-by) */
|
||||
|
||||
G.pInfo->file_attr&=0xFFFF;
|
||||
|
||||
G.pInfo->file_attr|=(0xFFDu<<20);
|
||||
|
||||
if (has_NFS_ext(G.filename)) {
|
||||
int ftype=strtol(G.filename+strlen(G.filename)-3,NULL,16)&0xFFF;
|
||||
|
||||
G.pInfo->file_attr = (G.pInfo->file_attr & 0x000FFFFF) | (ftype<<20);
|
||||
} else {
|
||||
int type = mimemap(G.filename);
|
||||
if (type == -1)
|
||||
type = (G.crec.internal_file_attributes & 1) ? 0xFFF : 0xFFD;
|
||||
G.pInfo->file_attr = (G.pInfo->file_attr & 0x000FFFFF) | (type<<20);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
} /* end function mapattr() */
|
||||
|
||||
|
||||
|
||||
/************************/
|
||||
/* Function mimemap() */
|
||||
/************************/
|
||||
|
||||
static int mimemap(const char *name)
|
||||
{
|
||||
const char *ext = name;
|
||||
int type;
|
||||
|
||||
if (has_mimemap < 0)
|
||||
has_mimemap =
|
||||
!(SWI_OS_CLI("%RMEnsure MimeMap 0.05 RMLoad System:Modules.Network.MimeMap")
|
||||
|| SWI_OS_CLI("%RMEnsure MimeMap 0.05"));
|
||||
|
||||
if (!has_mimemap)
|
||||
return -1; /* no MimeMap module; fall back on text flag test */
|
||||
|
||||
do {
|
||||
while (*ext && *ext!='.')
|
||||
ext++;
|
||||
if (!*ext)
|
||||
return -1; /* no suitable extension; fallback */
|
||||
type = SWI_MimeMap_Translate(ext++);
|
||||
} while (type == -1);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/************************/
|
||||
/* Function mapname() */
|
||||
/************************/
|
||||
|
||||
int mapname(__G__ renamed)
|
||||
__GDEF
|
||||
int renamed;
|
||||
/*
|
||||
* returns:
|
||||
* MPN_OK - no problem detected
|
||||
* MPN_INF_TRUNC - caution (truncated filename)
|
||||
* MPN_INF_SKIP - info "skip entry" (dir doesn't exist)
|
||||
* MPN_ERR_SKIP - error -> skip entry
|
||||
* MPN_ERR_TOOLONG - error -> path is too long
|
||||
* MPN_NOMEM - error (memory allocation failed) -> skip entry
|
||||
* [also MPN_VOL_LABEL, MPN_CREATED_DIR]
|
||||
*/
|
||||
{
|
||||
char pathcomp[FILNAMSIZ]; /* path-component buffer */
|
||||
char *pp, *cp=(char *)NULL; /* character pointers */
|
||||
char *lastsemi=(char *)NULL; /* pointer to last semi-colon in pathcomp */
|
||||
int error = MPN_OK;
|
||||
register unsigned workch; /* hold the character being tested */
|
||||
char *checkswap=NULL; /* pointer the the extension to check */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Initialize various pointers and counters and stuff.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (G.pInfo->vollabel)
|
||||
return MPN_VOL_LABEL; /* can't set disk volume labels in RISCOS */
|
||||
|
||||
/* can create path as long as not just freshening, or if user told us */
|
||||
G.create_dirs = (!uO.fflag || renamed);
|
||||
|
||||
created_dir = FALSE; /* not yet */
|
||||
|
||||
/* user gave full pathname: don't prepend rootpath */
|
||||
renamed_fullpath = (renamed && (*G.filename == '/'));
|
||||
|
||||
if (checkdir(__G__ (char *)NULL, INIT) == MPN_NOMEM)
|
||||
return MPN_NOMEM; /* initialize path buffer, unless no memory */
|
||||
|
||||
*pathcomp = '\0'; /* initialize translation buffer */
|
||||
pp = pathcomp; /* point to translation buffer */
|
||||
if (uO.jflag) /* junking directories */
|
||||
cp = (char *)strrchr(G.filename, '/');
|
||||
if (cp == (char *)NULL) /* no '/' or not junking dirs */
|
||||
cp = G.filename; /* point to internal zipfile-member pathname */
|
||||
else
|
||||
++cp; /* point to start of last component of path */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Begin main loop through characters in filename.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
while ((workch = (uch)*cp++) != 0) {
|
||||
|
||||
switch (workch) {
|
||||
case '/': /* can assume -j flag not given */
|
||||
*pp = '\0';
|
||||
if (((error = checkdir(__G__ pathcomp, APPEND_DIR))
|
||||
& MPN_MASK) > MPN_INF_TRUNC)
|
||||
return error;
|
||||
pp = pathcomp; /* reset conversion buffer for next piece */
|
||||
lastsemi = (char *)NULL; /* leave direct. semi-colons alone */
|
||||
checkswap=NULL; /* reset checking at start of new leafname */
|
||||
break;
|
||||
|
||||
case '.':
|
||||
*pp++ = '/';
|
||||
checkswap=pp;
|
||||
break;
|
||||
|
||||
case ';': /* VMS version (or DEC-20 attrib?) */
|
||||
lastsemi = pp;
|
||||
*pp++ = ';'; /* keep for now; remove VMS ";##" */
|
||||
break; /* later, if requested */
|
||||
|
||||
case ' ': /* change spaces to hard-spaces */
|
||||
*pp++ = 160; /* (ISO 8859-1 Latin-1 codepage) */
|
||||
break;
|
||||
|
||||
/* The following substitutions, unless stated otherwise, follow
|
||||
* those for DOSFS. They translate special symbols into other
|
||||
* characters which have no special meaning to RISC OS. */
|
||||
case '#': *pp++ = '?'; break; /* single-char wildcard */
|
||||
case '&': *pp++ = '+'; break;
|
||||
case '@': *pp++ = '='; break;
|
||||
case '%': *pp++ = ';'; break;
|
||||
case '$': *pp++ = '<'; break;
|
||||
case '^': *pp++ = '>'; break; /* parent-dir reference */
|
||||
|
||||
/* The following substitutions deal with the remaining special
|
||||
* symbols. ('.' is handled above.) */
|
||||
case '*': *pp++ = 0xD7; break; /* Latin-1 'multiply' */
|
||||
case '"': *pp++ = '~'; break;
|
||||
case ':': *pp++ = ';'; break;
|
||||
case '\\': *pp++ = '/'; break;
|
||||
case '|': *pp++ = 0xA6; break; /* Latin-1 'broken bar' */
|
||||
|
||||
default:
|
||||
/* allow European characters in filenames: */
|
||||
if (isprint(workch) || (128 <= workch && workch <= 254))
|
||||
*pp++ = (char)workch;
|
||||
} /* end switch */
|
||||
|
||||
} /* end while loop */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Report if directory was created (and no file to create: filename ended
|
||||
in '/'), check name to be sure it exists, and combine path and name be-
|
||||
fore exiting.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (G.filename[strlen(G.filename) - 1] == '/') {
|
||||
checkdir(__G__ G.filename, GETPATH);
|
||||
if (created_dir) {
|
||||
if (QCOND2) {
|
||||
Info(slide, 0, ((char *)slide, " creating: %s\n",
|
||||
FnFilter1(G.filename)));
|
||||
}
|
||||
/* set dir time (note trailing '/') */
|
||||
return (error & ~MPN_MASK) | MPN_CREATED_DIR;
|
||||
}
|
||||
/* dir existed already; don't look for data to extract */
|
||||
return (error & ~MPN_MASK) | MPN_INF_SKIP;
|
||||
}
|
||||
|
||||
*pp = '\0'; /* done with pathcomp: terminate it */
|
||||
|
||||
/* if not saving them, remove VMS version numbers (appended ";###") */
|
||||
if (!uO.V_flag && lastsemi) {
|
||||
pp = lastsemi + 1;
|
||||
while (isdigit((uch)(*pp)))
|
||||
++pp;
|
||||
if (*pp == '\0') /* only digits between ';' and end: nuke */
|
||||
*lastsemi = '\0';
|
||||
}
|
||||
|
||||
if (*pathcomp == '\0') {
|
||||
Info(slide, 1, ((char *)slide, "mapname: conversion of %s failed\n",
|
||||
FnFilter1(G.filename)));
|
||||
return (error & ~MPN_MASK) | MPN_ERR_SKIP;
|
||||
}
|
||||
|
||||
if (checkswap!=NULL) {
|
||||
if (checkext(checkswap)) {
|
||||
if ((error = checkdir(__G__ checkswap, APPEND_DIR)) > 1)
|
||||
return error;
|
||||
*(checkswap-1)=0; /* remove extension from pathcomp */
|
||||
}
|
||||
}
|
||||
|
||||
if (!uO.acorn_nfs_ext && has_NFS_ext(pathcomp)) {
|
||||
/* remove the filetype extension unless requested otherwise */
|
||||
/* the filetype should be already set by mapattr() */
|
||||
pathcomp[strlen(pathcomp)-4]=0;
|
||||
}
|
||||
|
||||
checkdir(__G__ pathcomp, APPEND_NAME); /* returns 1 if truncated: care? */
|
||||
checkdir(__G__ G.filename, GETPATH);
|
||||
|
||||
return error;
|
||||
|
||||
} /* end function mapname() */
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************/
|
||||
/* Function checkdir() */
|
||||
/***********************/
|
||||
|
||||
int checkdir(__G__ pathcomp, flag)
|
||||
__GDEF
|
||||
char *pathcomp;
|
||||
int flag;
|
||||
/*
|
||||
* returns:
|
||||
* MPN_OK - no problem detected
|
||||
* MPN_INF_TRUNC - (on APPEND_NAME) truncated filename
|
||||
* MPN_INF_SKIP - path doesn't exist, not allowed to create
|
||||
* MPN_ERR_SKIP - path doesn't exist, tried to create and failed; or path
|
||||
* exists and is not a directory, but is supposed to be
|
||||
* MPN_ERR_TOOLONG - path is too long
|
||||
* MPN_NOMEM - can't allocate memory for filename buffers
|
||||
*/
|
||||
{
|
||||
static int rootlen = 0; /* length of rootpath */
|
||||
static char *rootpath; /* user's "extract-to" directory */
|
||||
static char *buildpath; /* full path (so far) to extracted file */
|
||||
static char *end; /* pointer to end of buildpath ('\0') */
|
||||
|
||||
# define FN_MASK 7
|
||||
# define FUNCTION (flag & FN_MASK)
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
APPEND_DIR: append the path component to the path being built and check
|
||||
for its existence. If doesn't exist and we are creating directories, do
|
||||
so for this one; else signal success or error as appropriate.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (FUNCTION == APPEND_DIR) {
|
||||
int too_long = FALSE;
|
||||
#ifdef SHORT_NAMES
|
||||
char *old_end = end;
|
||||
#endif
|
||||
|
||||
Trace((stderr, "appending dir segment [%s]\n", FnFilter1(pathcomp)));
|
||||
while ((*end = *pathcomp++) != '\0')
|
||||
++end;
|
||||
#ifdef SHORT_NAMES /* path components restricted to 14 chars, typically */
|
||||
if ((end-old_end) > FILENAME_MAX) /* GRR: proper constant? */
|
||||
*(end = old_end + FILENAME_MAX) = '\0';
|
||||
#endif
|
||||
|
||||
/* GRR: could do better check, see if overrunning buffer as we go:
|
||||
* check end-buildpath after each append, set warning variable if
|
||||
* within 20 of FILNAMSIZ; then if var set, do careful check when
|
||||
* appending. Clear variable when begin new path. */
|
||||
|
||||
/* next check: need to append '/', at least one-char name, '\0' */
|
||||
if ((end-buildpath) > FILNAMSIZ-3)
|
||||
too_long = TRUE; /* check if extracting dir? */
|
||||
if (stat(buildpath, &G.statbuf)) { /* path doesn't exist */
|
||||
if (!G.create_dirs) { /* told not to create (freshening) */
|
||||
free(buildpath);
|
||||
return MPN_INF_SKIP; /* path doesn't exist: nothing to do */
|
||||
}
|
||||
if (too_long) {
|
||||
Info(slide, 1, ((char *)slide,
|
||||
"checkdir error: path too long: %s\n",
|
||||
FnFilter1(buildpath)));
|
||||
fflush(stderr);
|
||||
free(buildpath);
|
||||
/* no room for filenames: fatal */
|
||||
return MPN_ERR_TOOLONG;
|
||||
}
|
||||
if (mkdir(buildpath, 0777) == -1) { /* create the directory */
|
||||
Info(slide, 1, ((char *)slide,
|
||||
"checkdir error: cannot create %s\n\
|
||||
unable to process %s.\n",
|
||||
FnFilter2(buildpath), FnFilter1(G.filename)));
|
||||
free(buildpath);
|
||||
/* path didn't exist, tried to create, failed */
|
||||
return MPN_ERR_SKIP;
|
||||
}
|
||||
created_dir = TRUE;
|
||||
} else if (!S_ISDIR(G.statbuf.st_mode)) {
|
||||
Info(slide, 1, ((char *)slide,
|
||||
"checkdir error: %s exists but is not directory\n\
|
||||
unable to process %s.\n",
|
||||
FnFilter2(buildpath), FnFilter1(G.filename)));
|
||||
free(buildpath);
|
||||
/* path existed but wasn't dir */
|
||||
return MPN_ERR_SKIP;
|
||||
}
|
||||
if (too_long) {
|
||||
Info(slide, 1, ((char *)slide,
|
||||
"checkdir error: path too long: %s\n", FnFilter1(buildpath)));
|
||||
free(buildpath);
|
||||
/* no room for filenames: fatal */
|
||||
return MPN_ERR_TOOLONG;
|
||||
}
|
||||
*end++ = '.'; /************* was '/' *************/
|
||||
*end = '\0';
|
||||
Trace((stderr, "buildpath now = [%s]\n", FnFilter1(buildpath)));
|
||||
return MPN_OK;
|
||||
|
||||
} /* end if (FUNCTION == APPEND_DIR) */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
GETPATH: copy full path to the string pointed at by pathcomp, and free
|
||||
buildpath.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (FUNCTION == GETPATH) {
|
||||
strcpy(pathcomp, buildpath);
|
||||
Trace((stderr, "getting and freeing path [%s]\n",
|
||||
FnFilter1(pathcomp)));
|
||||
free(buildpath);
|
||||
buildpath = end = (char *)NULL;
|
||||
return MPN_OK;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
APPEND_NAME: assume the path component is the filename; append it and
|
||||
return without checking for existence.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (FUNCTION == APPEND_NAME) {
|
||||
#ifdef SHORT_NAMES
|
||||
char *old_end = end;
|
||||
#endif
|
||||
|
||||
Trace((stderr, "appending filename [%s]\n", FnFilter1(pathcomp)));
|
||||
while ((*end = *pathcomp++) != '\0') {
|
||||
++end;
|
||||
#ifdef SHORT_NAMES /* truncate name at 14 characters, typically */
|
||||
if ((end-old_end) > FILENAME_MAX) /* GRR: proper constant? */
|
||||
*(end = old_end + FILENAME_MAX) = '\0';
|
||||
#endif
|
||||
if ((end-buildpath) >= FILNAMSIZ) {
|
||||
*--end = '\0';
|
||||
Info(slide, 0x201, ((char *)slide,
|
||||
"checkdir warning: path too long; truncating\n\
|
||||
%s\n -> %s\n",
|
||||
FnFilter1(G.filename), FnFilter2(buildpath)));
|
||||
return MPN_INF_TRUNC; /* filename truncated */
|
||||
}
|
||||
}
|
||||
Trace((stderr, "buildpath now = [%s]\n", FnFilter1(buildpath)));
|
||||
/* could check for existence here, prompt for new name... */
|
||||
return MPN_OK;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
INIT: allocate and initialize buffer space for the file currently being
|
||||
extracted. If file was renamed with an absolute path, don't prepend the
|
||||
extract-to path.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
/* GRR: for VMS and TOPS-20, add up to 13 to strlen */
|
||||
|
||||
if (FUNCTION == INIT) {
|
||||
Trace((stderr, "initializing buildpath to "));
|
||||
if ((buildpath = (char *)malloc(strlen(G.filename)+rootlen+1))
|
||||
== (char *)NULL)
|
||||
return MPN_NOMEM;
|
||||
if ((rootlen > 0) && !renamed_fullpath) {
|
||||
strcpy(buildpath, rootpath);
|
||||
end = buildpath + rootlen;
|
||||
} else {
|
||||
*buildpath = '\0';
|
||||
end = buildpath;
|
||||
}
|
||||
Trace((stderr, "[%s]\n", FnFilter1(buildpath)));
|
||||
return MPN_OK;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
ROOT: if appropriate, store the path in rootpath and create it if
|
||||
necessary; else assume it's a zipfile member and return. This path
|
||||
segment gets used in extracting all members from every zipfile specified
|
||||
on the command line.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#if (!defined(SFX) || defined(SFX_EXDIR))
|
||||
if (FUNCTION == ROOT) {
|
||||
Trace((stderr, "initializing root path to [%s]\n",
|
||||
FnFilter1(pathcomp)));
|
||||
if (pathcomp == (char *)NULL) {
|
||||
rootlen = 0;
|
||||
return MPN_OK;
|
||||
}
|
||||
if (rootlen > 0) /* rootpath was already set, nothing to do */
|
||||
return MPN_OK;
|
||||
if ((rootlen = strlen(pathcomp)) > 0) {
|
||||
char *tmproot;
|
||||
|
||||
if ((tmproot = (char *)malloc(rootlen+2)) == (char *)NULL) {
|
||||
rootlen = 0;
|
||||
return MPN_NOMEM;
|
||||
}
|
||||
strcpy(tmproot, pathcomp);
|
||||
if (tmproot[rootlen-1] == '.') { /****** was '/' ********/
|
||||
tmproot[--rootlen] = '\0';
|
||||
}
|
||||
if (rootlen > 0 && (SSTAT(tmproot, &G.statbuf) ||
|
||||
!S_ISDIR(G.statbuf.st_mode)))
|
||||
{ /* path does not exist */
|
||||
if (!G.create_dirs /* || isshexp(tmproot) */ ) {
|
||||
free(tmproot);
|
||||
rootlen = 0;
|
||||
/* skip (or treat as stored file) */
|
||||
return MPN_INF_SKIP;
|
||||
}
|
||||
/* create the directory (could add loop here scanning tmproot
|
||||
* to create more than one level, but why really necessary?) */
|
||||
if (mkdir(tmproot, 0777) == -1) {
|
||||
Info(slide, 1, ((char *)slide,
|
||||
"checkdir: cannot create extraction directory: %s\n",
|
||||
FnFilter1(tmproot)));
|
||||
free(tmproot);
|
||||
rootlen = 0;
|
||||
/* path didn't exist, tried to create, and failed: */
|
||||
/* file exists, or 2+ subdir levels required */
|
||||
return MPN_ERR_SKIP;
|
||||
}
|
||||
}
|
||||
tmproot[rootlen++] = '.'; /*********** was '/' *************/
|
||||
tmproot[rootlen] = '\0';
|
||||
if ((rootpath = (char *)realloc(tmproot, rootlen+1)) == NULL) {
|
||||
free(tmproot);
|
||||
rootlen = 0;
|
||||
return MPN_NOMEM;
|
||||
}
|
||||
Trace((stderr, "rootpath now = [%s]\n", FnFilter1(rootpath)));
|
||||
}
|
||||
return MPN_OK;
|
||||
}
|
||||
#endif /* !SFX || SFX_EXDIR */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
END: free rootpath, immediately prior to program exit.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (FUNCTION == END) {
|
||||
Trace((stderr, "freeing rootpath\n"));
|
||||
if (rootlen > 0) {
|
||||
free(rootpath);
|
||||
rootlen = 0;
|
||||
}
|
||||
return MPN_OK;
|
||||
}
|
||||
|
||||
return MPN_INVALID; /* should never reach */
|
||||
|
||||
} /* end function checkdir() */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/********************/
|
||||
/* Function mkdir() */
|
||||
/********************/
|
||||
|
||||
int mkdir(path, mode)
|
||||
const char *path;
|
||||
int mode; /* ignored */
|
||||
/*
|
||||
* returns: 0 - successful
|
||||
* -1 - failed (errno not set, however)
|
||||
*/
|
||||
{
|
||||
return (SWI_OS_File_8((char *)path) == NULL)? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************************/
|
||||
/* extra_field-related functions */
|
||||
/*********************************/
|
||||
|
||||
static void setRISCOSexfield(ZCONST char *path, ZCONST void *ef_spark)
|
||||
{
|
||||
if (ef_spark!=NULL) {
|
||||
extra_block *block=(extra_block *)ef_spark;
|
||||
SWI_OS_File_1((char *)path,block->loadaddr,block->execaddr,block->attr);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static void printRISCOSexfield(int isdir, ZCONST void *extra_field)
|
||||
{
|
||||
extra_block *block=(extra_block *)extra_field;
|
||||
printf("\n This file has RISC OS file informations in the local extra field.\n");
|
||||
|
||||
if (isdir) {
|
||||
/* I prefer not to print this string... should change later... */
|
||||
/* printf(" The file is a directory.\n");*/
|
||||
} else if ((block->loadaddr & 0xFFF00000) != 0xFFF00000) {
|
||||
printf(" Load address: %.8X\n",block->loadaddr);
|
||||
printf(" Exec address: %.8X\n",block->execaddr);
|
||||
} else {
|
||||
/************* should change this to use OS_FSControl 18 to get filetype string ************/
|
||||
char tmpstr[16];
|
||||
char ftypestr[32];
|
||||
int flen;
|
||||
sprintf(tmpstr,"File$Type_%03x",(block->loadaddr & 0x000FFF00) >> 8);
|
||||
if (SWI_OS_ReadVarVal(tmpstr,ftypestr,32,&flen)==NULL) {
|
||||
ftypestr[flen]=0;
|
||||
printf(" Filetype: %s (&%.3X)\n",ftypestr,(block->loadaddr & 0x000FFF00) >> 8);
|
||||
} else {
|
||||
printf(" Filetype: &%.3X\n",(block->loadaddr & 0x000FFF00) >> 8);
|
||||
}
|
||||
}
|
||||
printf(" Access: ");
|
||||
if (block->attr & (1<<3))
|
||||
printf("L");
|
||||
if (block->attr & (1<<0))
|
||||
printf("W");
|
||||
if (block->attr & (1<<1))
|
||||
printf("R");
|
||||
printf("/");
|
||||
if (block->attr & (1<<4))
|
||||
printf("w");
|
||||
if (block->attr & (1<<5))
|
||||
printf("r");
|
||||
printf("\n\n");
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/**********************************************/
|
||||
/* internal help function for time conversion */
|
||||
/**********************************************/
|
||||
static int uxtime2acornftime(unsigned *pexadr, unsigned *pldadr, time_t ut)
|
||||
{
|
||||
unsigned timlo; /* 3 lower bytes of acorn file-time plus carry byte */
|
||||
unsigned timhi; /* 2 high bytes of acorn file-time */
|
||||
|
||||
timlo = ((unsigned)ut & 0x00ffffffU) * 100 + 0x00996a00U;
|
||||
timhi = ((unsigned)ut >> 24);
|
||||
timhi = timhi * 100 + 0x0000336eU + (timlo >> 24);
|
||||
if (timhi & 0xffff0000U)
|
||||
return 1; /* calculation overflow, do not change time */
|
||||
|
||||
/* insert the five time bytes into loadaddr and execaddr variables */
|
||||
*pexadr = (timlo & 0x00ffffffU) | ((timhi & 0x000000ffU) << 24);
|
||||
*pldadr = (*pldadr & 0xffffff00U) | ((timhi >> 8) & 0x000000ffU);
|
||||
|
||||
return 0; /* subject to future extension to signal overflow */
|
||||
}
|
||||
|
||||
|
||||
/****************************/
|
||||
/* Function close_outfile() */
|
||||
/****************************/
|
||||
|
||||
void close_outfile(__G)
|
||||
__GDEF
|
||||
{
|
||||
zvoid *spark_ef;
|
||||
|
||||
fclose(G.outfile);
|
||||
|
||||
if ((spark_ef = getRISCOSexfield(G.extra_field, G.lrec.extra_field_length))
|
||||
!= NULL) {
|
||||
setRISCOSexfield(G.filename, spark_ef);
|
||||
} else {
|
||||
unsigned int loadaddr, execaddr;
|
||||
int attr;
|
||||
int mode=G.pInfo->file_attr&0xffff; /* chmod equivalent mode */
|
||||
|
||||
time_t m_time;
|
||||
#ifdef USE_EF_UT_TIME
|
||||
iztimes z_utime;
|
||||
#endif
|
||||
|
||||
/* skip restoring time stamps on user's request */
|
||||
if (uO.D_flag <= 1) {
|
||||
#ifdef USE_EF_UT_TIME
|
||||
if (G.extra_field &&
|
||||
#ifdef IZ_CHECK_TZ
|
||||
G.tz_is_valid &&
|
||||
#endif
|
||||
(ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0,
|
||||
G.lrec.last_mod_dos_datetime, &z_utime, NULL)
|
||||
& EB_UT_FL_MTIME))
|
||||
{
|
||||
TTrace((stderr, "close_outfile: Unix e.f. modif. time = %ld\n",
|
||||
z_utime.mtime));
|
||||
m_time = z_utime.mtime;
|
||||
} else
|
||||
#endif /* USE_EF_UT_TIME */
|
||||
m_time = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
|
||||
}
|
||||
|
||||
/* set the file's time-stamp and attributes */
|
||||
SWI_OS_File_5(G.filename, NULL, &loadaddr, NULL, NULL, &attr);
|
||||
|
||||
if (uO.D_flag <= 1)
|
||||
/* set the file's modification time */
|
||||
uxtime2acornftime(&execaddr, &loadaddr, m_time);
|
||||
|
||||
loadaddr = (loadaddr & 0xfff000ffU) |
|
||||
((G.pInfo->file_attr&0xfff00000) >> 12);
|
||||
|
||||
attr=(attr&0xffffff00) | ((mode&0400) >> 8) | ((mode&0200) >> 6) |
|
||||
((mode&0004) << 2) | ((mode&0002) << 4);
|
||||
|
||||
SWI_OS_File_1(G.filename, loadaddr, execaddr, attr);
|
||||
}
|
||||
|
||||
} /* end function close_outfile() */
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef TIMESTAMP
|
||||
|
||||
/***************************/
|
||||
/* Function stamp_file() */
|
||||
/***************************/
|
||||
|
||||
int stamp_file(fname, modtime)
|
||||
ZCONST char *fname;
|
||||
time_t modtime;
|
||||
{
|
||||
unsigned int loadaddr, execaddr;
|
||||
int attr;
|
||||
|
||||
/* set the file's modification time */
|
||||
if (SWI_OS_File_5((char *)fname, NULL, &loadaddr, NULL, NULL, &attr)
|
||||
!= NULL)
|
||||
return -1;
|
||||
|
||||
if (uxtime2acornftime(&execaddr, &loadaddr, modtime) != 0)
|
||||
return -1;
|
||||
|
||||
return (SWI_OS_File_1((char *)fname, loadaddr, execaddr, attr) == NULL) ?
|
||||
0 : -1;
|
||||
|
||||
} /* end function stamp_file() */
|
||||
|
||||
#endif /* TIMESTAMP */
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef SFX
|
||||
|
||||
/************************/
|
||||
/* Function version() */
|
||||
/************************/
|
||||
|
||||
void version(__G)
|
||||
__GDEF
|
||||
{
|
||||
sprintf((char *)slide, LoadFarString(CompiledWith),
|
||||
#ifdef __GNUC__
|
||||
"gcc ", __VERSION__,
|
||||
#else
|
||||
# ifdef __CC_NORCROFT
|
||||
"Norcroft ", "cc",
|
||||
# else
|
||||
"cc", "",
|
||||
# endif
|
||||
#endif
|
||||
|
||||
"RISC OS",
|
||||
|
||||
" (Acorn Computers Ltd)",
|
||||
|
||||
#ifdef __DATE__
|
||||
" on ", __DATE__
|
||||
#else
|
||||
"", ""
|
||||
#endif
|
||||
);
|
||||
|
||||
(*G.message)((zvoid *)&G, slide, (ulg)strlen((char *)slide), 0);
|
||||
|
||||
} /* end function version() */
|
||||
|
||||
#endif /* !SFX */
|
128
programs/fs/unzip60/acorn/makefile
Normal file
128
programs/fs/unzip60/acorn/makefile
Normal file
@ -0,0 +1,128 @@
|
||||
# Makefile for UnZip, UnZipSFX, ZipInfo and fUnZip (5.53 or later)
|
||||
# last modified: 25 Dec 2006
|
||||
|
||||
# add -g to CC to debug
|
||||
# add -d to BIND to debug
|
||||
CC = cc
|
||||
BIND = link
|
||||
AS = $(CC) -c
|
||||
ASM = objasm
|
||||
SQUEEZE = squeeze -v
|
||||
E =
|
||||
|
||||
# flags
|
||||
# CFLAGS flags for C compile
|
||||
# LFLAGS1 flags after output file spec, before obj file list
|
||||
# LFLAGS2 flags after obj file list (libraries, etc)
|
||||
#
|
||||
LIB =
|
||||
CBASE = -throwback -wn -DNO_STRNICMP
|
||||
CFLAGS = $(CBASE) -IC:,@.
|
||||
ASMFLAGS = -Throwback -Stamp -NoCache -CloseExec -quit
|
||||
LFLAGS1 =
|
||||
LFLAGS2 = $(LIB) C:o.Stubs
|
||||
|
||||
# object file lists
|
||||
OBJS1 = unzip.o crc32.o crypt.o envargs.o explode.o
|
||||
OBJS2 = extract.o fileio.o globals.o inflate.o list.o match.o
|
||||
OBJS3 = process.o ttyio.o ubz2err.o unreduce.o unshrink.o zipinfo.o
|
||||
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) riscos.o swiven.o acorn.o
|
||||
OBJF = funzip.o crc32.o cryptf.o globalsf.o inflatef.o ttyiof.o \
|
||||
riscos.o swiven.o
|
||||
OBJX = unzipsfx.o crc32.o crypt_.o extract_.o fileio_.o globals.o \
|
||||
inflate.o match.o process_.o ttyio.o ubz2err_.o \
|
||||
acorn_.o swiven.o riscos_.o
|
||||
|
||||
UNZIP_H = unzip.h unzpriv.h globals.h acorn/riscos.h acorn/swiven.h
|
||||
|
||||
all: unzip funzip unzipsfx
|
||||
|
||||
|
||||
install: unzip funzip unzipsfx
|
||||
$(SQUEEZE) unzip %.unzip
|
||||
$(SQUEEZE) funzip %.funzip
|
||||
$(SQUEEZE) unzipsfx unzipsfx
|
||||
copy %.unzip %.zipinfo ~CVF
|
||||
|
||||
# suffix rules
|
||||
.SUFFIXES: .o .c
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
.s.o:
|
||||
$(ASM) $(ASMFLAGS) -from @*.s -to @*.o
|
||||
|
||||
# rules for unzip and funzip
|
||||
crc32.o: crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
crypt.o: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
envargs.o: envargs.c $(UNZIP_H)
|
||||
explode.o: explode.c $(UNZIP_H)
|
||||
extract.o: extract.c $(UNZIP_H) crc32.h crypt.h
|
||||
fileio.o: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
|
||||
funzip.o: funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
|
||||
globals.o: globals.c $(UNZIP_H)
|
||||
inflate.o: inflate.c inflate.h $(UNZIP_H)
|
||||
list.o: list.c $(UNZIP_H)
|
||||
match.o: match.c $(UNZIP_H)
|
||||
process.o: process.c $(UNZIP_H) crc32.h
|
||||
ttyio.o: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
ubz2err.o: ubz2err.c $(UNZIP_H)
|
||||
unreduce.o: unreduce.c $(UNZIP_H)
|
||||
unshrink.o: unshrink.c $(UNZIP_H)
|
||||
unzip.o: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
|
||||
zipinfo.o: zipinfo.c $(UNZIP_H)
|
||||
|
||||
crypt_.o: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
$(CC) $(CFLAGS) -DSFX -c c.crypt -o o.crypt_
|
||||
extract_.o: extract.c $(UNZIP_H) crc32.h crypt.h
|
||||
$(CC) $(CFLAGS) -DSFX -c c.extract -o o.extract_
|
||||
fileio_.o: fileio.c $(UNZIP_H) crc32.h crypt.h
|
||||
$(CC) $(CFLAGS) -DSFX -c c.fileio -o o.fileio_
|
||||
globals_.o: globals.c $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -DFUNZIP -c c.globals -o o.globals_
|
||||
inflate_.o: inflate.c inflate.h $(UNZIP_H) crypt.h
|
||||
$(CC) $(CFLAGS) -DFUNZIP -c c.inflate -o o.inflate_
|
||||
process_.o: process.c $(UNZIP_H) crc32.h
|
||||
$(CC) $(CFLAGS) -DSFX -c c.process -o o.process_
|
||||
ttyio_.o: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
$(CC) $(CFLAGS) -DFUNZIP -c c.ttyio -o o.ttyio_
|
||||
ubz2err_.o: ubz2err.c $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -DSFX -c c.ubz2err -o o.ubz2err_
|
||||
|
||||
unzipsfx.o: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
|
||||
$(CC) $(CFLAGS) -DSFX -c c.unzip -o o.unzipsfx
|
||||
|
||||
o.cryptf: c.crypt $(UNZIP_H) h.zip h.crypt h.crc32 h.ttyio
|
||||
$(CC) $(CFLAGS) -DFUNZIP -c c.crypt -o o.cryptf
|
||||
o.globalsf: c.globals $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -DFUNZIP -c c.globals -o o.globalsf
|
||||
o.inflatef: c.inflate h.inflate $(UNZIP_H) h.crypt
|
||||
$(CC) $(CFLAGS) -DFUNZIP -c c.inflate -o o.inflatef
|
||||
o.ttyiof: c.ttyio $(UNZIP_H) h.zip h.crypt h.ttyio
|
||||
$(CC) $(CFLAGS) -DFUNZIP -c c.ttyio -o o.ttyiof
|
||||
|
||||
acorn.o: acorn/acorn.c $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -c acorn/acorn.c
|
||||
acorn_.o: acorn/acorn.c $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -c -DSFX -DSFX_EXDIR -o acorn_.o acorn/acorn.c
|
||||
|
||||
riscos.o: acorn/riscos.c $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -c acorn/riscos.c
|
||||
riscos_.o: acorn/riscos.c $(UNZIP_H)
|
||||
$(CC) $(CFLAGS) -c -DSFX -DSFX_EXDIR -o riscos_.o acorn/riscos.c
|
||||
|
||||
swiven.o: acorn/swiven.s
|
||||
$(ASM) $(ASMFLAGS) -from acorn.s.swiven -to o.swiven
|
||||
|
||||
unzip: $(OBJS)
|
||||
$(BIND) -o unzip$(E) $(LFLAGS1) $(OBJS) $(LFLAGS2)
|
||||
funzip: $(OBJF)
|
||||
$(BIND) -o funzip$(E) $(LFLAGS1) $(OBJF) $(LFLAGS2)
|
||||
unzipsfx: $(OBJX)
|
||||
$(BIND) -o unzipsfx$(E) $(LFLAGS1) $(OBJX) $(LFLAGS2)
|
||||
|
||||
clean: ;remove unzip; remove funzip;
|
||||
remove zipinfo; remove unzipsfx;
|
||||
create o.!fake! 0
|
||||
wipe o.* ~cf
|
||||
|
||||
# end of Makefile
|
364
programs/fs/unzip60/acorn/riscos.c
Normal file
364
programs/fs/unzip60/acorn/riscos.c
Normal file
@ -0,0 +1,364 @@
|
||||
/*
|
||||
Copyright (c) 1990-2002 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/* riscos.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* #define NO_UNZIPH_STUFF */
|
||||
#define UNZIP_INTERNAL
|
||||
#include "unzip.h"
|
||||
#include "riscos.h"
|
||||
|
||||
#define MAXEXT 16
|
||||
|
||||
char *exts2swap = NULL; /* Extensions to swap (actually, directory names) */
|
||||
|
||||
int stat(char *filename,struct stat *res)
|
||||
{
|
||||
int attr; /* object attributes */
|
||||
unsigned int load; /* load address */
|
||||
unsigned int exec; /* exec address */
|
||||
int type; /* type: 0 not found, 1 file, 2 dir, 3 image */
|
||||
|
||||
if (!res)
|
||||
return -1;
|
||||
|
||||
if (SWI_OS_File_5(filename,&type,&load,&exec,(int *)&res->st_size,&attr)!=NULL)
|
||||
return -1;
|
||||
|
||||
if (type==0)
|
||||
return -1;
|
||||
|
||||
res->st_dev=0;
|
||||
res->st_ino=0;
|
||||
res->st_nlink=0;
|
||||
res->st_uid=1;
|
||||
res->st_gid=1;
|
||||
res->st_rdev=0;
|
||||
res->st_blksize=1024;
|
||||
|
||||
res->st_mode = ((attr & 0001) << 8) | ((attr & 0002) << 6) |
|
||||
((attr & 0020) >> 2) | ((attr & 0040) >> 4);
|
||||
|
||||
switch (type) {
|
||||
case 1: /* File */
|
||||
res->st_mode |= S_IFREG;
|
||||
break;
|
||||
case 2: /* Directory */
|
||||
res->st_mode |= S_IFDIR | 0700;
|
||||
break;
|
||||
case 3: /* Image file */
|
||||
if (uO.scanimage)
|
||||
res->st_mode |= S_IFDIR | 0700;
|
||||
else
|
||||
res->st_mode |= S_IFREG;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((((unsigned int) load) >> 20) == 0xfff) { /* date stamped file */
|
||||
register unsigned int t1, t2, tc;
|
||||
|
||||
t1 = (unsigned int) (exec);
|
||||
t2 = (unsigned int) (load & 0xff);
|
||||
|
||||
tc = 0x6e996a00U;
|
||||
if (t1 < tc)
|
||||
t2--;
|
||||
t1 -= tc;
|
||||
t2 -= 0x33; /* 00:00:00 Jan. 1 1970 = 0x336e996a00 */
|
||||
|
||||
t1 = (t1 / 100) + (t2 * 42949673U); /* 0x100000000 / 100 = 42949672.96 */
|
||||
t1 -= (t2 / 25); /* compensate for .04 error */
|
||||
|
||||
res->st_atime = res->st_mtime = res->st_ctime = t1;
|
||||
}
|
||||
else
|
||||
res->st_atime = res->st_mtime = res->st_ctime = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef SFX
|
||||
|
||||
DIR *opendir(char *dirname)
|
||||
{
|
||||
DIR *thisdir;
|
||||
int type;
|
||||
int attr;
|
||||
os_error *er;
|
||||
|
||||
thisdir=(DIR *)malloc(sizeof(DIR));
|
||||
if (thisdir==NULL)
|
||||
return NULL;
|
||||
|
||||
thisdir->dirname=(char *)malloc(strlen(dirname)+1);
|
||||
if (thisdir->dirname==NULL) {
|
||||
free(thisdir);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy(thisdir->dirname,dirname);
|
||||
if (thisdir->dirname[strlen(thisdir->dirname)-1]=='.')
|
||||
thisdir->dirname[strlen(thisdir->dirname)-1]=0;
|
||||
|
||||
if (er=SWI_OS_File_5(thisdir->dirname,&type,NULL,NULL,NULL,&attr),er!=NULL ||
|
||||
type<=1 || (type==3 && !uO.scanimage))
|
||||
{
|
||||
free(thisdir->dirname);
|
||||
free(thisdir);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
thisdir->buf=malloc(DIR_BUFSIZE);
|
||||
if (thisdir->buf==NULL) {
|
||||
free(thisdir->dirname);
|
||||
free(thisdir);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
thisdir->size=DIR_BUFSIZE;
|
||||
thisdir->offset=0;
|
||||
thisdir->read=0;
|
||||
|
||||
return thisdir;
|
||||
}
|
||||
|
||||
struct dirent *readdir(DIR *d)
|
||||
{
|
||||
static struct dirent dent;
|
||||
|
||||
if (d->read==0) { /* no more objects read in the buffer */
|
||||
if (d->offset==-1) { /* no more objects to read */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
d->read=255;
|
||||
if (SWI_OS_GBPB_9(d->dirname,d->buf,&d->read,&d->offset,DIR_BUFSIZE,NULL)!=NULL)
|
||||
return NULL;
|
||||
|
||||
if (d->read==0) {
|
||||
d->offset=-1;
|
||||
return NULL;
|
||||
}
|
||||
d->read--;
|
||||
d->act=(char *)d->buf;
|
||||
}
|
||||
else { /* some object is ready in buffer */
|
||||
d->read--;
|
||||
d->act=(char *)(d->act+strlen(d->act)+1);
|
||||
}
|
||||
|
||||
strcpy(dent.d_name,d->act);
|
||||
dent.d_namlen=strlen(dent.d_name);
|
||||
|
||||
/* If we're returning the last item, check if there are any more.
|
||||
* If there are, nothing will happen; if not, then d->offset = -1 */
|
||||
if (!d->read)
|
||||
SWI_OS_GBPB_9(d->dirname,d->buf,&d->read,&d->offset,0,NULL);
|
||||
|
||||
return &dent;
|
||||
}
|
||||
|
||||
void closedir(DIR *d)
|
||||
{
|
||||
if (d->buf!=NULL)
|
||||
free(d->buf);
|
||||
if (d->dirname!=NULL)
|
||||
free(d->dirname);
|
||||
free(d);
|
||||
}
|
||||
|
||||
int unlink(f)
|
||||
char *f; /* file to delete */
|
||||
/* Delete the file *f, returning non-zero on failure. */
|
||||
{
|
||||
os_error *er;
|
||||
char canon[256];
|
||||
int size=255;
|
||||
|
||||
er=SWI_OS_FSControl_37(f,canon,&size);
|
||||
if (er==NULL) {
|
||||
er=SWI_OS_FSControl_27(canon,0x100);
|
||||
}
|
||||
else {
|
||||
er=SWI_OS_FSControl_27(f,0x100);
|
||||
}
|
||||
return (int)er;
|
||||
}
|
||||
|
||||
int rmdir(char *d)
|
||||
{
|
||||
int objtype;
|
||||
char *s;
|
||||
int len;
|
||||
|
||||
len = strlen(d);
|
||||
if ((s = malloc(len + 1)) == NULL)
|
||||
return -1;
|
||||
|
||||
strcpy(s,d);
|
||||
if (s[len-1]=='.')
|
||||
s[len-1]=0;
|
||||
|
||||
if (SWI_OS_File_5(s,&objtype,NULL,NULL,NULL,NULL)!=NULL) {
|
||||
free(s);
|
||||
return -1;
|
||||
}
|
||||
if (objtype<2 || (!uO.scanimage && objtype==3)) {
|
||||
/* this is a file or it doesn't exist */
|
||||
free(s);
|
||||
return -1;
|
||||
}
|
||||
if (SWI_OS_File_6(s)!=NULL) {
|
||||
free(s);
|
||||
return -1;
|
||||
}
|
||||
free(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* !SFX */
|
||||
|
||||
int chmod(char *file, int mode)
|
||||
{
|
||||
/*************** NOT YET IMPLEMENTED!!!!!! ******************/
|
||||
/* I don't know if this will be needed or not... */
|
||||
file=file;
|
||||
mode=mode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void setfiletype(char *fname,int ftype)
|
||||
{
|
||||
char str[256];
|
||||
sprintf(str,"SetType %s &%3.3X",fname,ftype);
|
||||
SWI_OS_CLI(str);
|
||||
}
|
||||
|
||||
void getRISCOSexts(char *envstr)
|
||||
{
|
||||
char *envptr; /* value returned by getenv */
|
||||
|
||||
envptr = getenv(envstr);
|
||||
if (envptr == NULL || *envptr == 0) return;
|
||||
|
||||
exts2swap=malloc(1+strlen(envptr));
|
||||
if (exts2swap == NULL)
|
||||
return;
|
||||
|
||||
strcpy(exts2swap, envptr);
|
||||
}
|
||||
|
||||
int checkext(char *suff)
|
||||
{
|
||||
register char *extptr = exts2swap ? exts2swap : "";
|
||||
register char *suffptr;
|
||||
register int e,s;
|
||||
|
||||
while(*extptr) {
|
||||
suffptr=suff;
|
||||
e=*extptr; s=*suffptr;
|
||||
while (e && e!=':' && s && s!='.' && s!='/' && e==s) {
|
||||
e=*++extptr; s=*++suffptr;
|
||||
}
|
||||
if (e==':') e=0;
|
||||
if (s=='.' || s=='/') s=0;
|
||||
if (!e && !s) {
|
||||
return 1;
|
||||
}
|
||||
while(*extptr!=':' && *extptr!='\0') /* skip to next extension */
|
||||
extptr++;
|
||||
if (*extptr!='\0')
|
||||
extptr++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void swapext(char *name, char *exptr)
|
||||
{
|
||||
char ext[MAXEXT];
|
||||
register char *p1=exptr+1;
|
||||
register char *p2=ext;
|
||||
int extchar=*exptr;
|
||||
|
||||
while(*p1 && *p1!='.' && *p1!='/')
|
||||
*p2++=*p1++;
|
||||
*p2=0;
|
||||
p2=exptr-1;
|
||||
p1--;
|
||||
while(p2 >= name)
|
||||
*p1--=*p2--;
|
||||
p1=name;
|
||||
p2=ext;
|
||||
while(*p2)
|
||||
*p1++=*p2++;
|
||||
*p1=(extchar=='/'?'.':'/');
|
||||
}
|
||||
|
||||
void remove_prefix(void)
|
||||
{
|
||||
SWI_DDEUtils_Prefix(NULL);
|
||||
}
|
||||
|
||||
void set_prefix(void)
|
||||
{
|
||||
char *pref;
|
||||
int size=0;
|
||||
|
||||
if (SWI_OS_FSControl_37("@",pref,&size)!=NULL)
|
||||
return;
|
||||
|
||||
size=1-size;
|
||||
|
||||
if (pref=malloc(size),pref!=NULL) {
|
||||
if (SWI_OS_FSControl_37("@",pref,&size)!=NULL) {
|
||||
free(pref);
|
||||
return;
|
||||
}
|
||||
|
||||
if (SWI_DDEUtils_Prefix(pref)==NULL) {
|
||||
atexit(remove_prefix);
|
||||
}
|
||||
|
||||
free(pref);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef localtime
|
||||
# undef localtime
|
||||
#endif
|
||||
|
||||
#ifdef gmtime
|
||||
# undef gmtime
|
||||
#endif
|
||||
|
||||
/* Acorn's implementation of localtime() and gmtime()
|
||||
* doesn't consider the timezone offset, so we have to
|
||||
* add it before calling the library functions
|
||||
*/
|
||||
|
||||
struct tm *riscos_localtime(const time_t *timer)
|
||||
{
|
||||
time_t localt=*timer;
|
||||
|
||||
localt+=SWI_Read_Timezone()/100;
|
||||
|
||||
return localtime(&localt);
|
||||
}
|
||||
|
||||
struct tm *riscos_gmtime(const time_t *timer)
|
||||
{
|
||||
time_t localt=*timer;
|
||||
|
||||
localt+=SWI_Read_Timezone()/100;
|
||||
|
||||
return gmtime(&localt);
|
||||
}
|
136
programs/fs/unzip60/acorn/riscos.h
Normal file
136
programs/fs/unzip60/acorn/riscos.h
Normal file
@ -0,0 +1,136 @@
|
||||
/*
|
||||
Copyright (c) 1990-2001 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/* riscos.h */
|
||||
|
||||
#ifndef __riscos_h
|
||||
#define __riscos_h
|
||||
|
||||
#include <time.h>
|
||||
|
||||
typedef struct {
|
||||
int errnum;
|
||||
char errmess[252];
|
||||
} os_error;
|
||||
|
||||
#ifndef __swiven_h
|
||||
# include "swiven.h"
|
||||
#endif
|
||||
|
||||
#define MAXPATHLEN 256
|
||||
#define MAXFILENAMELEN 64 /* should be 11 for ADFS, 13 for DOS, 64 seems a sensible value... */
|
||||
#define DIR_BUFSIZE 1024 /* this should be enough to read a whole E-Format directory */
|
||||
|
||||
struct stat {
|
||||
unsigned int st_dev;
|
||||
int st_ino;
|
||||
unsigned int st_mode;
|
||||
int st_nlink;
|
||||
unsigned short st_uid;
|
||||
unsigned short st_gid;
|
||||
unsigned int st_rdev;
|
||||
unsigned int st_size;
|
||||
unsigned int st_blksize;
|
||||
time_t st_atime;
|
||||
time_t st_mtime;
|
||||
time_t st_ctime;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char *dirname;
|
||||
void *buf;
|
||||
int size;
|
||||
char *act;
|
||||
int offset;
|
||||
int read;
|
||||
} DIR;
|
||||
|
||||
|
||||
struct dirent {
|
||||
unsigned int d_off; /* offset of next disk directory entry */
|
||||
int d_fileno; /* file number of entry */
|
||||
size_t d_reclen; /* length of this record */
|
||||
size_t d_namlen; /* length of d_name */
|
||||
char d_name[MAXFILENAMELEN]; /* name */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
unsigned int load_addr;
|
||||
unsigned int exec_addr;
|
||||
int lenght;
|
||||
int attrib;
|
||||
int objtype;
|
||||
char name[13];
|
||||
} riscos_direntry;
|
||||
|
||||
typedef struct {
|
||||
short ID;
|
||||
short size;
|
||||
int ID_2;
|
||||
unsigned int loadaddr;
|
||||
unsigned int execaddr;
|
||||
int attr;
|
||||
int zero;
|
||||
} extra_block;
|
||||
|
||||
|
||||
#define S_IFMT 0770000
|
||||
|
||||
#define S_IFDIR 0040000
|
||||
#define S_IFREG 0100000 /* 0200000 in UnixLib !?!?!?!? */
|
||||
|
||||
#ifndef S_IEXEC
|
||||
# define S_IEXEC 0000100
|
||||
# define S_IWRITE 0000200
|
||||
# define S_IREAD 0000400
|
||||
#endif
|
||||
|
||||
#ifndef NO_UNZIPH_STUFF
|
||||
# include <time.h>
|
||||
# if (!defined(HAVE_STRNICMP) & !defined(NO_STRNICMP))
|
||||
# define NO_STRNICMP
|
||||
# endif
|
||||
# ifndef DATE_FORMAT
|
||||
# define DATE_FORMAT DF_DMY
|
||||
# endif
|
||||
# define lenEOL 1
|
||||
# define PutNativeEOL *q++ = native(LF);
|
||||
# define USE_STRM_INPUT
|
||||
# define USE_FWRITE
|
||||
# define PIPE_ERROR (errno == 9999) /* always false */
|
||||
# define isatty(x) (TRUE) /* used in funzip.c to find if stdin redirected:
|
||||
should find a better way, now just work as if stdin never redirected */
|
||||
# define USE_EF_UT_TIME
|
||||
# if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))
|
||||
# define TIMESTAMP
|
||||
# endif
|
||||
# define localtime riscos_localtime
|
||||
# define gmtime riscos_gmtime
|
||||
#endif /* !NO_UNZIPH_STUFF */
|
||||
|
||||
#define _raw_getc() SWI_OS_ReadC()
|
||||
|
||||
extern char *exts2swap; /* Extensions to swap */
|
||||
|
||||
int stat(char *filename,struct stat *res);
|
||||
DIR *opendir(char *dirname);
|
||||
struct dirent *readdir(DIR *d);
|
||||
void closedir(DIR *d);
|
||||
int unlink(char *f);
|
||||
int rmdir(char *d);
|
||||
int chmod(char *file, int mode);
|
||||
void setfiletype(char *fname,int ftype);
|
||||
void getRISCOSexts(char *envstr);
|
||||
int checkext(char *suff);
|
||||
void swapext(char *name, char *exptr);
|
||||
void remove_prefix(void);
|
||||
void set_prefix(void);
|
||||
struct tm *riscos_localtime(const time_t *timer);
|
||||
struct tm *riscos_gmtime(const time_t *timer);
|
||||
|
||||
#endif /* !__riscos_h */
|
BIN
programs/fs/unzip60/acorn/srcrename
Normal file
BIN
programs/fs/unzip60/acorn/srcrename
Normal file
Binary file not shown.
69
programs/fs/unzip60/acorn/swiven.h
Normal file
69
programs/fs/unzip60/acorn/swiven.h
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/* swiven.h */
|
||||
|
||||
#ifndef __swiven_h
|
||||
#define __swiven_h
|
||||
|
||||
os_error *SWI_OS_FSControl_26(char *source, char *dest, int actionmask);
|
||||
/* copy */
|
||||
|
||||
os_error *SWI_OS_FSControl_27(char *filename, int actionmask);
|
||||
/* wipe */
|
||||
|
||||
os_error *SWI_OS_GBPB_9(char *dirname, void *buf, int *number,
|
||||
int *offset, int size, char *match);
|
||||
/* read dir */
|
||||
|
||||
os_error *SWI_OS_File_1(char *filename, unsigned int loadaddr,
|
||||
unsigned int execaddr, int attrib);
|
||||
/* write file attributes */
|
||||
|
||||
os_error *SWI_OS_File_5(char *filename, int *objtype, unsigned int *loadaddr,
|
||||
unsigned int *execaddr, int *length, int *attrib);
|
||||
/* read file info */
|
||||
|
||||
os_error *SWI_OS_File_6(char *filename);
|
||||
/* delete */
|
||||
|
||||
os_error *SWI_OS_File_7(char *filename, int loadaddr, int execaddr, int size);
|
||||
/* create an empty file */
|
||||
|
||||
os_error *SWI_OS_File_8(char *dirname);
|
||||
/* create a directory */
|
||||
|
||||
os_error *SWI_OS_File_18(char *filename, int filetype);
|
||||
/* set a file's type */
|
||||
|
||||
os_error *SWI_OS_CLI(char *cmd);
|
||||
/* execute a command */
|
||||
|
||||
int SWI_OS_ReadC(void);
|
||||
/* get a key from the keyboard buffer */
|
||||
|
||||
os_error *SWI_OS_ReadVarVal(char *var, char *buf, int len, int *bytesused);
|
||||
/* reads an OS varibale */
|
||||
|
||||
os_error *SWI_OS_FSControl_54(char *buffer, int dir, char *fsname, int *size);
|
||||
/* reads the path of a specified directory */
|
||||
|
||||
os_error *SWI_OS_FSControl_37(char *pathname, char *buffer, int *size);
|
||||
/* canonicalise path */
|
||||
|
||||
os_error *SWI_DDEUtils_Prefix(char *dir);
|
||||
/* sets the 'prefix' directory */
|
||||
|
||||
int SWI_Read_Timezone(void);
|
||||
/* returns the timezone offset (centiseconds) */
|
||||
|
||||
int SWI_MimeMap_Translate(const char *ext);
|
||||
/* given a filename extn, returns the filetype (or -1 if no match).
|
||||
* Uses the MimeMap module */
|
||||
|
||||
#endif /* !__swiven_h */
|
316
programs/fs/unzip60/acorn/swiven.s
Normal file
316
programs/fs/unzip60/acorn/swiven.s
Normal file
@ -0,0 +1,316 @@
|
||||
;===========================================================================
|
||||
; Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
|
||||
;
|
||||
; See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
; (the contents of which are also included in unzip.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
|
||||
;===========================================================================
|
||||
; SWI veneers used by Zip/Unzip
|
||||
;
|
||||
|
||||
r0 RN 0
|
||||
r1 RN 1
|
||||
r2 RN 2
|
||||
r3 RN 3
|
||||
r4 RN 4
|
||||
r5 RN 5
|
||||
r6 RN 6
|
||||
r7 RN 7
|
||||
r8 RN 8
|
||||
r9 RN 9
|
||||
r10 RN 10
|
||||
r11 RN 11
|
||||
r12 RN 12
|
||||
sp RN 13
|
||||
lr RN 14
|
||||
pc RN 15
|
||||
|
||||
sl RN 10
|
||||
fp RN 11
|
||||
ip RN 12
|
||||
|
||||
|
||||
XOS_Bit EQU &020000
|
||||
|
||||
OS_GBPB EQU &00000C
|
||||
OS_File EQU &000008
|
||||
OS_FSControl EQU &000029
|
||||
OS_CLI EQU &000005
|
||||
OS_ReadC EQU &000004
|
||||
OS_ReadVarVal EQU &000023
|
||||
DDEUtils_Prefix EQU &042580
|
||||
Territory_ReadCurrentTimeZone EQU &043048
|
||||
MimeMap_Translate EQU &050B00
|
||||
|
||||
MACRO
|
||||
STARTCODE $name
|
||||
EXPORT $name
|
||||
$name
|
||||
MEND
|
||||
|
||||
|
||||
AREA |C$$code|, CODE, READONLY
|
||||
|
||||
; os_error *SWI_OS_FSControl_26(char *source, char *dest, int actionmask);
|
||||
|
||||
STARTCODE SWI_OS_FSControl_26
|
||||
|
||||
MOV ip, lr
|
||||
|
||||
MOV r3, r2
|
||||
MOV r2, r1
|
||||
MOV r1, r0
|
||||
MOV r0, #26
|
||||
|
||||
SWI OS_FSControl + XOS_Bit
|
||||
|
||||
MOVVC r0, #0
|
||||
|
||||
MOVS pc, ip
|
||||
|
||||
|
||||
; os_error *SWI_OS_FSControl_27(char *filename, int actionmask);
|
||||
|
||||
STARTCODE SWI_OS_FSControl_27
|
||||
|
||||
MOV ip, lr
|
||||
|
||||
MOV r3, r1
|
||||
MOV r1, r0
|
||||
MOV r0, #27
|
||||
|
||||
SWI OS_FSControl + XOS_Bit
|
||||
|
||||
MOVVC r0, #0
|
||||
|
||||
MOVS pc, ip
|
||||
|
||||
|
||||
; os_error *SWI_OS_GBPB_9(char *dirname, void *buf, int *number,
|
||||
; int *offset, int size, char *match);
|
||||
|
||||
STARTCODE SWI_OS_GBPB_9
|
||||
|
||||
MOV ip, sp
|
||||
STMFD sp!, {r2-r6,lr}
|
||||
LDMIA ip, {r5,r6}
|
||||
LDR r4, [r3]
|
||||
LDR r3, [r2]
|
||||
MOV r2, r1
|
||||
MOV r1, r0
|
||||
MOV r0, #9
|
||||
SWI OS_GBPB + XOS_Bit
|
||||
LDMVSFD sp!, {r2-r6,pc}^
|
||||
MOV r0, #0
|
||||
LDMFD sp, {r5,r6}
|
||||
STR r3, [r5]
|
||||
STR r4, [r6]
|
||||
LDMFD sp!, {r2-r6,pc}^
|
||||
|
||||
|
||||
; os_error *SWI_OS_File_1(char *filename, int loadaddr, int execaddr, int attrib);
|
||||
|
||||
STARTCODE SWI_OS_File_1
|
||||
|
||||
STMFD sp!, {r5,lr}
|
||||
MOV r5, r3
|
||||
MOV r3, r2
|
||||
MOV r2, r1
|
||||
MOV r1, r0
|
||||
MOV r0, #1
|
||||
SWI OS_File + XOS_Bit
|
||||
MOVVC r0, #0
|
||||
LDMFD sp!, {r5,pc}^
|
||||
|
||||
|
||||
|
||||
; os_error *SWI_OS_File_5(char *filename, int *objtype, int *loadaddr,
|
||||
; int *execaddr, int *length, int *attrib);
|
||||
|
||||
STARTCODE SWI_OS_File_5
|
||||
|
||||
STMFD sp!, {r1-r5,lr}
|
||||
MOV r1, r0
|
||||
MOV r0, #5
|
||||
SWI OS_File + XOS_Bit
|
||||
LDMVSFD sp!, {r1-r5,pc}^
|
||||
LDR lr, [sp]
|
||||
TEQ lr, #0
|
||||
STRNE r0, [lr]
|
||||
LDR lr, [sp, #4]
|
||||
TEQ lr ,#0
|
||||
STRNE r2, [lr]
|
||||
LDR lr, [sp, #8]
|
||||
TEQ lr, #0
|
||||
STRNE r3, [lr]
|
||||
LDR lr, [sp ,#24]
|
||||
TEQ lr, #0
|
||||
STRNE r4, [lr]
|
||||
LDR lr, [sp ,#28]
|
||||
TEQ lr, #0
|
||||
STRNE r5, [lr]
|
||||
MOV r0, #0
|
||||
LDMFD sp!, {r1-r5,pc}^
|
||||
|
||||
|
||||
; os_error *SWI_OS_File_6(char *filename);
|
||||
|
||||
STARTCODE SWI_OS_File_6
|
||||
|
||||
STMFD sp!, {r4-r5,lr}
|
||||
MOV r1, r0
|
||||
MOV r0, #6
|
||||
SWI OS_File + XOS_Bit
|
||||
MOVVC r0, #0
|
||||
LDMFD sp!, {r4-r5,pc}^
|
||||
|
||||
|
||||
; os_error *SWI_OS_File_7(char *filename, int loadaddr, int execaddr, int size);
|
||||
|
||||
STARTCODE SWI_OS_File_7
|
||||
|
||||
STMFD sp!, {r4-r5,lr}
|
||||
MOV r5, r3
|
||||
MOV r4, #0
|
||||
MOV r3, r2
|
||||
MOV r2, r1
|
||||
MOV r1, r0
|
||||
MOV r0, #7
|
||||
SWI OS_File + XOS_Bit
|
||||
MOVVC r0, #0
|
||||
LDMFD sp!, {r4-r5,pc}^
|
||||
|
||||
|
||||
; os_error *SWI_OS_File_8(char *dirname);
|
||||
|
||||
STARTCODE SWI_OS_File_8
|
||||
|
||||
STMFD sp!, {r4,lr}
|
||||
MOV r1, r0
|
||||
MOV r4, #0
|
||||
MOV r0, #8
|
||||
SWI OS_File + XOS_Bit
|
||||
MOVVC r0, #0
|
||||
LDMFD sp!, {r4,pc}^
|
||||
|
||||
|
||||
; os_error *SWI_OS_File_18(char *filename, int filetype);
|
||||
|
||||
STARTCODE SWI_OS_File_18
|
||||
|
||||
STMFD sp!, {r4-r5,lr}
|
||||
MOV r2, r1
|
||||
MOV r1, r0
|
||||
MOV r0, #18
|
||||
SWI OS_File + XOS_Bit
|
||||
MOVVC r0, #0
|
||||
LDMFD sp!, {r4-r5,pc}^
|
||||
|
||||
|
||||
; os_error *SWI_OS_CLI(char *cmd);
|
||||
|
||||
STARTCODE SWI_OS_CLI
|
||||
|
||||
MOV ip, lr
|
||||
SWI OS_CLI + XOS_Bit
|
||||
MOVVC r0, #0
|
||||
MOVS pc, ip
|
||||
|
||||
|
||||
; int SWI_OS_ReadC(void);
|
||||
|
||||
STARTCODE SWI_OS_ReadC
|
||||
|
||||
MOV ip, lr
|
||||
SWI OS_ReadC + XOS_Bit
|
||||
MOVS pc, ip
|
||||
|
||||
|
||||
; os_error *SWI_OS_ReadVarVal(char *var, char *buf, int len, int *bytesused);
|
||||
|
||||
STARTCODE SWI_OS_ReadVarVal
|
||||
|
||||
STMFD sp!, {r4,lr}
|
||||
MOV ip, r3
|
||||
MOV r3, #0
|
||||
MOV r4, #0
|
||||
SWI OS_ReadVarVal + XOS_Bit
|
||||
LDMVSFD sp!, {r4,pc}^
|
||||
TEQ ip, #0
|
||||
STRNE r2, [ip]
|
||||
MOV r0, #0
|
||||
LDMFD sp!, {r4,pc}^
|
||||
|
||||
|
||||
; os_error *SWI_OS_FSControl_54(char *buffer, int dir, char *fsname, int *size);
|
||||
|
||||
STARTCODE SWI_OS_FSControl_54
|
||||
|
||||
STMFD sp!, {r3-r6,lr}
|
||||
LDR r5, [r3]
|
||||
MOV r3, r2
|
||||
MOV r2, r1
|
||||
MOV r1, r0
|
||||
MOV r0, #54
|
||||
SWI OS_FSControl + XOS_Bit
|
||||
LDMVSFD sp!, {r3-r6,pc}^
|
||||
MOV r0, #0
|
||||
LDMFD sp!, {r3}
|
||||
STR r5, [r3]
|
||||
LDMFD sp!, {r4-r6,pc}^
|
||||
|
||||
|
||||
; os_error *SWI_OS_FSControl_37(char *pathname, char *buffer, int *size);
|
||||
|
||||
STARTCODE SWI_OS_FSControl_37
|
||||
|
||||
STMFD sp!, {r2,r3-r5,lr}
|
||||
LDR r5, [r2]
|
||||
MOV r3, #0
|
||||
MOV r4, #0
|
||||
MOV r2, r1
|
||||
MOV r1, r0
|
||||
MOV r0, #37
|
||||
SWI OS_FSControl + XOS_Bit
|
||||
LDMVSFD sp!, {r2,r3-r5,pc}^
|
||||
MOV r0, #0
|
||||
LDMFD sp!, {r2}
|
||||
STR r5, [r2]
|
||||
LDMFD sp!, {r3-r5,pc}^
|
||||
|
||||
|
||||
; os_error *SWI_DDEUtils_Prefix(char *dir);
|
||||
|
||||
STARTCODE SWI_DDEUtils_Prefix
|
||||
|
||||
MOV ip, lr
|
||||
SWI DDEUtils_Prefix + XOS_Bit
|
||||
MOVVC r0, #0
|
||||
MOVS pc, ip
|
||||
|
||||
; int SWI_Read_Timezone(void);
|
||||
|
||||
STARTCODE SWI_Read_Timezone
|
||||
|
||||
MOV ip, lr
|
||||
SWI Territory_ReadCurrentTimeZone + XOS_Bit
|
||||
MOVVC r0, r1
|
||||
MOVVS r0, #0
|
||||
MOVS pc, ip
|
||||
|
||||
|
||||
; int SWI_MimeMap_Translate(char *ext);
|
||||
|
||||
STARTCODE SWI_MimeMap_Translate
|
||||
MOV ip,lr
|
||||
MOV r1, r0
|
||||
MOV r0, #3
|
||||
MOV r2, #0
|
||||
SWI MimeMap_Translate + XOS_Bit
|
||||
MOVVC r0, r3
|
||||
MVNVS r0, #0 ; return -1 on error
|
||||
MOVS pc, ip
|
||||
|
||||
|
||||
END
|
32
programs/fs/unzip60/amiga/Contents
Normal file
32
programs/fs/unzip60/amiga/Contents
Normal file
@ -0,0 +1,32 @@
|
||||
Contents of the "amiga" directory for UnZip 5.5 and later:
|
||||
|
||||
Contents this file
|
||||
amiga.c Amiga-specific file I/O routines
|
||||
amiga.h Amiga-specific header file
|
||||
filedate.c SetFileDate clone for OS 1.3, and other low-level resources
|
||||
|
||||
smakefile SAS/C makefile for UnZip, fUnZip, and UnZipSFX
|
||||
|
||||
makefile.azt Aztec C makefile for UnZip, fUnZip, and UnZipSFX
|
||||
stat.c stat() emulation for Aztec, along with opendir()/readdir()/etc
|
||||
z-stat.h replacement stat.h header file for use with stat.c
|
||||
crc_68.a assembler version of crc32.c
|
||||
flate.a assembler version of inflate_codes() (define ASM_INFLATECODES)
|
||||
|
||||
makesfx.c source for MakeSFX, without which UnZipSFX is not usable
|
||||
|
||||
Notes:
|
||||
|
||||
The crc_68.a source file is not currently used by the SAS/C makefile,
|
||||
nor is flate.a; as of UnZip 5.2 neither of these wants args in
|
||||
registers.
|
||||
|
||||
The DICE makefile has been removed since no one is supporting that
|
||||
compiler anymore.
|
||||
|
||||
As of UnZip 5.2, if you have AmigaDOS 2.1 or newer and have set your
|
||||
timezone in the Locale preferences editor, this will be an adequate
|
||||
substitute for setting TZ. If you do not set TZ to your current timezone,
|
||||
files will be restored with times corrsponding to "EST5EDT", U.S. Eastern
|
||||
time. See ../proginfo/timezone.txt for directions on how to set the
|
||||
TZ variable.
|
1034
programs/fs/unzip60/amiga/amiga.c
Normal file
1034
programs/fs/unzip60/amiga/amiga.c
Normal file
File diff suppressed because it is too large
Load Diff
190
programs/fs/unzip60/amiga/amiga.h
Normal file
190
programs/fs/unzip60/amiga/amiga.h
Normal file
@ -0,0 +1,190 @@
|
||||
/*
|
||||
Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/* amiga.h
|
||||
*
|
||||
* Globular definitions that affect all of AmigaDom.
|
||||
*
|
||||
* Originally included in unzip.h, extracted for simplicity and eeze of
|
||||
* maintenance by John Bush.
|
||||
*
|
||||
* THIS FILE IS #INCLUDE'd by unzpriv.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __amiga_amiga_h
|
||||
#define __amiga_amiga_h
|
||||
|
||||
#include "amiga/z-stat.h" /* substitute for <stat.h> and <direct.h> */
|
||||
#include <limits.h>
|
||||
#ifndef NO_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
#else
|
||||
int mkdir(const char *_name);
|
||||
#endif
|
||||
|
||||
/* we only have dinky old-sk00l 32 bit filesystems */
|
||||
#ifdef LARGE_FILE_SUPPORT
|
||||
# undef LARGE_FILE_SUPPORT
|
||||
#endif
|
||||
|
||||
typedef long zoff_t;
|
||||
#define ZOFF_T_DEFINED
|
||||
typedef struct stat z_stat;
|
||||
#define Z_STAT_DEFINED
|
||||
|
||||
#ifdef AZTEC_C /* Manx Aztec C, 5.0 or newer only */
|
||||
# include <clib/dos_protos.h>
|
||||
# include <pragmas/dos_lib.h> /* do inline dos.library calls */
|
||||
# define O_BINARY 0
|
||||
# define direct dirent
|
||||
|
||||
# ifndef IZTZ_DEFINESTDGLOBALS
|
||||
# define IZTZ_DEFINESTDGLOBALS
|
||||
# endif
|
||||
|
||||
# define DECLARE_TIMEZONE
|
||||
# define ASM_INFLATECODES
|
||||
# define ASM_CRC
|
||||
|
||||
/* This compiler environment supplies a flat 32-bit address space */
|
||||
/* where C rtl functions are capable of handling large (32-bit-wide) */
|
||||
/* allocations and I/O. But, for speed on old 68000 CPUs, standard */
|
||||
/* ints are 16-bits wide per default. ("size_t" is defined as */
|
||||
/* "unsigned long" in this case.) The Deflate64 support requires */
|
||||
/* the variables for handling the decompression buffer to hold */
|
||||
/* 32-bit wide integers. The INT_16BIT symbol defined below forces */
|
||||
/* the declarations of these variables to use "unsigned long" type. */
|
||||
# ifndef _INT32
|
||||
# define INT_16BIT /* or deflate64 stuff will fail */
|
||||
# endif
|
||||
|
||||
/* Note that defining REENTRANT will not eliminate all global/static */
|
||||
/* variables. The functions we use from c.lib, including stdio, are */
|
||||
/* not reentrant. Neither are the stuff in amiga/stat.c or the time */
|
||||
/* functions in amiga/filedate.c, because they just augment c.lib. */
|
||||
/* If you want a fully reentrant and reexecutable "pure" UnZip with */
|
||||
/* Aztec C, assemble and link in the startup module purify.a by Paul */
|
||||
/* Kienitz. REENTRANT should be used just to reduce memory waste. */
|
||||
#endif /* AZTEC_C */
|
||||
|
||||
|
||||
#ifdef __SASC
|
||||
/* NOTE: SAS/C COMPILATION HAS BEEN UNSUPPORTED THROUGH MANY UNZIP VERSIONS. */
|
||||
/* (Which is too bad, because it would probably perform better than Aztec.) */
|
||||
|
||||
/* includes */
|
||||
# include <sys/types.h>
|
||||
# include <sys/dir.h>
|
||||
# include <dos.h>
|
||||
# include <exec/memory.h>
|
||||
# include <exec/execbase.h>
|
||||
# if (defined(_M68020) && (!defined(__USE_SYSBASE)))
|
||||
/* on 68020 or higher processors it is faster */
|
||||
# define __USE_SYSBASE /* to use the pragma libcall instead of syscall */
|
||||
# endif /* to access functions of the exec.library */
|
||||
# include <proto/exec.h> /* see SAS/C manual:part 2,chapter 2,pages 6-7 */
|
||||
# include <proto/dos.h>
|
||||
# include <proto/locale.h>
|
||||
|
||||
# ifdef DEBUG
|
||||
# include <sprof.h> /* profiler header file */
|
||||
# endif
|
||||
# if ( (!defined(O_BINARY)) && defined(O_RAW))
|
||||
# define O_BINARY O_RAW
|
||||
# endif
|
||||
# if (defined(_SHORTINT) && !defined(USE_FWRITE))
|
||||
# define USE_FWRITE /* define if write() returns 16-bit int */
|
||||
# endif
|
||||
# if (!defined(REENTRANT) && !defined(FUNZIP))
|
||||
# define REENTRANT /* define if unzip is going to be pure */
|
||||
# endif
|
||||
# if defined(REENTRANT) && defined(DYNALLOC_CRCTAB)
|
||||
# undef DYNALLOC_CRCTAB
|
||||
# endif
|
||||
# ifdef MWDEBUG
|
||||
# include <stdio.h> /* both stdio.h and stdlib.h must be included */
|
||||
# include <stdlib.h> /* before memwatch.h */
|
||||
# include "memwatch.h"
|
||||
# undef getenv
|
||||
# endif /* MWDEBUG */
|
||||
# ifndef IZTZ_SETLOCALTZINFO
|
||||
/* XXX !! We have really got to find a way to operate without these. */
|
||||
# define IZTZ_SETLOCALTZINFO
|
||||
# endif
|
||||
#endif /* SASC */
|
||||
|
||||
|
||||
#define MALLOC_WORK
|
||||
#define USE_EF_UT_TIME
|
||||
#if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))
|
||||
# define TIMESTAMP
|
||||
#endif
|
||||
|
||||
#ifndef IZTZ_GETLOCALETZINFO
|
||||
# define IZTZ_GETLOCALETZINFO GetPlatformLocalTimezone
|
||||
#endif
|
||||
/* the amiga port uses Info-ZIP's own timezone library, which includes
|
||||
* a "working" mktime() implementation
|
||||
*/
|
||||
#ifndef HAVE_MKTIME
|
||||
# define HAVE_MKTIME
|
||||
#endif
|
||||
|
||||
/* check that TZ environment variable is defined before using UTC times */
|
||||
#if (!defined(NO_IZ_CHECK_TZ) && !defined(IZ_CHECK_TZ))
|
||||
# define IZ_CHECK_TZ
|
||||
#endif
|
||||
|
||||
#define AMIGA_FILENOTELEN 80
|
||||
#ifndef DATE_FORMAT
|
||||
# define DATE_FORMAT DF_MDY
|
||||
#endif
|
||||
#define lenEOL 1
|
||||
#define PutNativeEOL *q++ = native(LF);
|
||||
#define PIPE_ERROR 0
|
||||
|
||||
#ifdef GLOBAL /* crypt.c usage conflicts with AmigaDOS headers */
|
||||
# undef GLOBAL
|
||||
#endif
|
||||
|
||||
/* Funkshine Prough Toe Taipes */
|
||||
|
||||
extern int real_timezone_is_set;
|
||||
void tzset(void);
|
||||
#define VALID_TIMEZONE(tempvar) (tzset(), real_timezone_is_set)
|
||||
|
||||
int Agetch(void); /* getch() like function, in amiga/filedate.c */
|
||||
LONG FileDate(char *, time_t[]);
|
||||
int screensize(int *ttrows, int *ttcols);
|
||||
void _abort(void); /* ctrl-C trap */
|
||||
|
||||
#define SCREENSIZE(ttrows, ttcols) screensize(ttrows, ttcols)
|
||||
#define SCREENWIDTH 80
|
||||
#define SCREENLWRAP 1
|
||||
#define TABSIZE 8
|
||||
|
||||
/* Static variables that we have to add to Uz_Globs: */
|
||||
#define SYSTEM_SPECIFIC_GLOBALS \
|
||||
int filenote_slot;\
|
||||
char *(filenotes[DIR_BLKSIZ]);\
|
||||
int created_dir, renamed_fullpath, rootlen;\
|
||||
char *rootpath, *buildpath, *build_end;\
|
||||
DIR *wild_dir;\
|
||||
ZCONST char *wildname;\
|
||||
char *dirname, matchname[FILNAMSIZ];\
|
||||
int dirnamelen, notfirstcall;
|
||||
|
||||
/* filenotes[] and filenote_slot are for the -N option that restores */
|
||||
/* comments of Zip archive entries as AmigaDOS filenotes. The others */
|
||||
/* are used by functions in amiga/amiga.c only. */
|
||||
/* created_dir and renamed_fullpath are used by mapname() and checkdir(). */
|
||||
/* rootlen, rootpath, buildpath, and build_end are used by checkdir(). */
|
||||
/* wild_dir, dirname, wildname, matchname[], dirnamelen and notfirstcall */
|
||||
/* are used by do_wild(). */
|
||||
#endif /* __amiga_amiga_h */
|
599
programs/fs/unzip60/amiga/filedate.c
Normal file
599
programs/fs/unzip60/amiga/filedate.c
Normal file
@ -0,0 +1,599 @@
|
||||
/*
|
||||
Copyright (c) 1990-2002 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
|
||||
*/
|
||||
/* Low-level Amiga routines shared between Zip and UnZip.
|
||||
*
|
||||
* Contains: FileDate()
|
||||
* getenv() [replaces inadequate standard library version]
|
||||
* setenv() [SAS/C only, replaces standard library version]
|
||||
* set_TZ() [SAS/C only]
|
||||
* GetPlatformLocalTimezone() [callback from timezone.c tzset()]
|
||||
* time()
|
||||
* sendpkt()
|
||||
* Agetch()
|
||||
*
|
||||
* The first five are used by most Info-ZIP programs except fUnZip.
|
||||
* The last two are used by all except the non-CRYPT version of fUnZip.
|
||||
* Probably some of the stuff in here is unused by ZipNote and ZipSplit too...
|
||||
* sendpkt() is used by Agetch() and FileDate(), and by screensize() in
|
||||
* amiga/amiga.c (UnZip); time() is used only by Zip.
|
||||
*/
|
||||
|
||||
|
||||
/* HISTORY/CHANGES
|
||||
* 2 Sep 92, Greg Roelofs, Original coding.
|
||||
* 6 Sep 92, John Bush, Incorporated into UnZip 5.1
|
||||
* 6 Sep 92, John Bush, Interlude "FileDate()" defined, which calls or
|
||||
* redefines SetFileDate() depending upon AMIGADOS2 definition.
|
||||
* 11 Oct 92, John Bush, Eliminated AMIGADOS2 switch by determining
|
||||
* revision via OpenLibrary() call. Now only one version of
|
||||
* the program runs on both platforms (1.3.x vs. 2.x)
|
||||
* 11 Oct 92, John Bush, Merged with Zip version and changed arg passing
|
||||
* to take time_t input instead of struct DateStamp.
|
||||
* Arg passing made to conform with utime().
|
||||
* 22 Nov 92, Paul Kienitz, fixed includes for Aztec and cleaned up some
|
||||
* lint-ish errors; simplified test for AmigaDOS version.
|
||||
* 11 Nov 95, Paul Kienitz, added Agetch() for crypt password input and
|
||||
* UnZip's "More" prompt -- simplifies crypt.h and avoids
|
||||
* use of library code redundant with sendpkt(). Made it
|
||||
* available to fUnZip, which does not use FileDate().
|
||||
* 22 Nov 95, Paul Kienitz, created a new tzset() that gets the current
|
||||
* timezone from the Locale preferences. These exist only under
|
||||
* AmigaDOS 2.1 and up, but it is probably correctly set on more
|
||||
* Amigas than the TZ environment variable is. We check that
|
||||
* only if TZ is not validly set. We do not parse daylight
|
||||
* savings syntax except to check for presence vs. absence of a
|
||||
* DST part; United States rules are assumed. This is better
|
||||
* than the tzset()s in the Amiga compilers' libraries do.
|
||||
* 15 Jan 96, Chr. Spieler, corrected the logic when to select low level
|
||||
* sendpkt() (when FileDate(), Agetch() or windowheight() is used),
|
||||
* and AMIGA's Agetch() (CRYPT, and UnZip(SFX)'s UzpMorePause()).
|
||||
* 10 Feb 96, Paul Kienitz, re-fiddled that selection logic again, moved
|
||||
* stuff around for clarity.
|
||||
* 16 Mar 96, Paul Kienitz, created a replacement localtime() to go with the
|
||||
* new tzset(), because Aztec's is hopelessly broken. Also
|
||||
* gmtime(), which localtime() calls.
|
||||
* 12 Apr 96, Paul Kienitz, daylight savings was being handled incorrectly.
|
||||
* 21 Apr 96, Paul Kienitz, had to replace time() as well, Aztec's returns
|
||||
* local time instead of GMT. That's why their localtime() was bad,
|
||||
* because it assumed time_t was already local, and gmtime() was
|
||||
* the one that checked TZ.
|
||||
* 23 Apr 96, Chr. Spieler, deactivated time() replacement for UnZip stuff.
|
||||
* Currently, the UnZip sources do not make use of time() (and do
|
||||
* not supply the working mktime() replacement, either!).
|
||||
* 29 Apr 96, Paul Kienitz, created a replacement getenv() out of code that
|
||||
* was previously embedded in tzset(), for reliable global test
|
||||
* of whether TZ is set or not.
|
||||
* 19 Jun 96, Haidinger Walter, re-adapted for current SAS/C compiler.
|
||||
* 7 Jul 96, Paul Kienitz, smoothed together compiler-related changes.
|
||||
* 4 Feb 97, Haidinger Walter, added set_TZ() for SAS/C.
|
||||
* 23 Apr 97, Paul Kienitz, corrected Unix->Amiga DST error by adding
|
||||
* mkgmtime() so localtime() could be used.
|
||||
* 28 Apr 97, Christian Spieler, deactivated mkgmtime() definition for ZIP;
|
||||
* the Zip sources supply this function as part of util.c.
|
||||
* 24 May 97, Haidinger Walter, added time_lib support for SAS/C and moved
|
||||
* set_TZ() to time_lib.c.
|
||||
* 12 Jul 97, Paul Kienitz, adapted time_lib stuff for Aztec.
|
||||
* 26 Jul 97, Chr. Spieler, old mkgmtime() fixed (ydays[] def, sign vs unsign).
|
||||
* 30 Dec 97, Haidinger Walter, adaptation for SAS/C using z-stat.h functions.
|
||||
* 19 Feb 98, Haidinger Walter, removed alloc_remember, more SAS.C fixes.
|
||||
* 23 Apr 98, Chr. Spieler, removed mkgmtime(), changed FileDate to convert to
|
||||
* Amiga file-time directly.
|
||||
* 24 Apr 98, Paul Kienitz, clip Unix dates earlier than 1978 in FileDate().
|
||||
* 02 Sep 98, Paul Kienitz, C. Spieler, always include zip.h to get a defined
|
||||
* header inclusion sequence that resolves all header dependencies.
|
||||
* 06 Jun 00, Paul Kienitz, removed time_lib.c due to its incompatible license,
|
||||
* moved set_TZ() back here, replaced minimal tzset() and localtime()
|
||||
* with new versions derived from GNU glibc source. Gave locale_TZ()
|
||||
* reasonable European defaults for daylight savings.
|
||||
* 17 Jun 00, Paul Kienitz, threw out GNU code because of objections to the GPL
|
||||
* virus, replaced with similar functions based on the public domain
|
||||
* timezone code at ftp://elsie.nci.nih.gov/pub. As with the GNU
|
||||
* stuff, support for timezone files and leap seconds was removed.
|
||||
* 23 Aug 00, Paul Kienitz, moved timezone code out from here into separate
|
||||
* platform-independent module 'timezone.c'.
|
||||
* 31 Dec 00, Christian Spieler, moved system-specific timezone help funcions
|
||||
* back in here, from 'timezone.c'.
|
||||
* 07 Jan 01, Paul Kienitz, Chr. Spieler, added missing #include "timezone.h"
|
||||
* and "symbolic" preprocessor constants for time calculations.
|
||||
* 15 Jan 02, Paul Kienitz, excluded all time handling code from compilation
|
||||
* for Zip utilities (when "defined(UTIL)")
|
||||
*/
|
||||
|
||||
#ifndef __amiga_filedate_c
|
||||
#define __amiga_filedate_c
|
||||
|
||||
|
||||
#include "zip.h"
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <exec/types.h>
|
||||
#include <exec/execbase.h>
|
||||
#include <exec/memory.h>
|
||||
#include <dos/dosextens.h>
|
||||
|
||||
#ifdef AZTEC_C
|
||||
# include <libraries/dos.h>
|
||||
# include <libraries/dosextens.h>
|
||||
# include <clib/exec_protos.h>
|
||||
# include <clib/dos_protos.h>
|
||||
# include <clib/locale_protos.h>
|
||||
# include <pragmas/exec_lib.h>
|
||||
# include <pragmas/dos_lib.h>
|
||||
# include <pragmas/locale_lib.h>
|
||||
# define ESRCH ENOENT
|
||||
# define EOSERR EIO
|
||||
#endif
|
||||
|
||||
#ifdef __SASC
|
||||
# include <stdlib.h>
|
||||
# if (defined(_M68020) && (!defined(__USE_SYSBASE)))
|
||||
/* on 68020 or higher processors it is faster */
|
||||
# define __USE_SYSBASE /* to use the pragma libcall instead of syscall */
|
||||
# endif /* to access functions of the exec.library */
|
||||
# include <proto/exec.h> /* see SAS/C manual:part 2,chapter 2,pages 6-7 */
|
||||
# include <proto/dos.h>
|
||||
# include <proto/locale.h>
|
||||
# ifdef DEBUG
|
||||
# include <sprof.h>
|
||||
# endif
|
||||
# ifdef MWDEBUG
|
||||
# include <stdio.h> /* include both before memwatch.h again just */
|
||||
# include <stdlib.h> /* to be safe */
|
||||
# include "memwatch.h"
|
||||
# endif /* MWDEBUG */
|
||||
#endif /* __SASC */
|
||||
|
||||
#include "crypt.h" /* just so we can tell if CRYPT is supported */
|
||||
|
||||
|
||||
#if (!defined(FUNZIP) && !defined(UTIL))
|
||||
|
||||
#include "timezone.h" /* for AMIGA-specific timezone callbacks */
|
||||
|
||||
#ifndef SUCCESS
|
||||
# define SUCCESS (-1L)
|
||||
# define FAILURE 0L
|
||||
#endif
|
||||
|
||||
#define ReqVers 36L /* required library version for SetFileDate() */
|
||||
#define ENVSIZE 100 /* max space allowed for an environment var */
|
||||
|
||||
extern struct ExecBase *SysBase;
|
||||
|
||||
#ifndef min
|
||||
# define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
# define max(a, b) ((a) < (b) ? (b) : (a))
|
||||
#endif
|
||||
|
||||
#if defined(ZIP) || defined(HAVE_MKTIME)
|
||||
static const unsigned short ydays[] =
|
||||
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
|
||||
#else
|
||||
extern const unsigned short ydays[]; /* in unzip's fileio.c */
|
||||
#endif
|
||||
|
||||
#define LEAP(y) (((y) % 4 == 0 && (y) % 100 != 0) || (y) % 400 == 0)
|
||||
#define YDAYS(m, y) (ydays[m] + (m > 1 && LEAP(y)))
|
||||
/* Number of leap years from 1978 to `y' (not including `y' itself). */
|
||||
#define ANLEAP(y) (((y) - 1977) / 4 - ((y) - 1901) / 100 + ((y) - 1601) / 400)
|
||||
#define SECSPERMIN 60
|
||||
#define MINSPERHOUR 60
|
||||
#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
|
||||
#define SECSPERDAY 86400L
|
||||
|
||||
/* prototypes */
|
||||
char *getenv(const char *var);
|
||||
#ifdef __SASC
|
||||
/* XXX !! We have really got to find a way to operate without these. */
|
||||
int setenv(const char *var, const char *value, int overwrite);
|
||||
void set_TZ(long time_zone, int day_light);
|
||||
#endif
|
||||
|
||||
LONG FileDate(char *filename, time_t u[]);
|
||||
LONG sendpkt(struct MsgPort *pid, LONG action, LONG *args, LONG nargs);
|
||||
int Agetch(void);
|
||||
|
||||
/* =============================================================== */
|
||||
|
||||
/***********************/
|
||||
/* Function filedate() */
|
||||
/***********************/
|
||||
|
||||
/* FileDate() (originally utime.c), by Paul Wells. Modified by John Bush
|
||||
* and others (see also sendpkt() comments, below); NewtWare SetFileDate()
|
||||
* clone cheaply ripped off from utime().
|
||||
*/
|
||||
|
||||
/* DESCRIPTION
|
||||
* This routine chooses between 2 methods to set the file date on AMIGA.
|
||||
* Since AmigaDOS 2.x came out, SetFileDate() was available in ROM (v.36
|
||||
* and higher). Under AmigaDOS 1.3.x (less than v.36 ROM), SetFileDate()
|
||||
* must be accomplished by constructing a message packet and sending it
|
||||
* to the file system handler of the file to be stamped.
|
||||
*
|
||||
* The system's ROM version is extracted from the external system Library
|
||||
* base.
|
||||
*
|
||||
* NOTE: although argument passing conforms with utime(), note the
|
||||
* following differences:
|
||||
* - Return value is boolean success/failure.
|
||||
* - If a structure or array is passed, only the first value
|
||||
* is used, which *may* correspond to date accessed and not
|
||||
* date modified.
|
||||
*/
|
||||
|
||||
LONG FileDate(filename, u)
|
||||
char *filename;
|
||||
time_t u[];
|
||||
{
|
||||
LONG SetFileDate(UBYTE *filename, struct DateStamp *pDate);
|
||||
LONG sendpkt(struct MsgPort *pid, LONG action, LONG *args, LONG nargs);
|
||||
struct MsgPort *taskport;
|
||||
BPTR dirlock, lock;
|
||||
struct FileInfoBlock *fib;
|
||||
LONG pktargs[4];
|
||||
UBYTE *ptr;
|
||||
long ret;
|
||||
|
||||
struct DateStamp pDate;
|
||||
struct tm *ltm;
|
||||
int years;
|
||||
|
||||
tzset();
|
||||
/* Amiga file date is based on 01-Jan-1978 00:00:00 (local time):
|
||||
* 8 years and 2 leapdays difference from Unix time.
|
||||
*/
|
||||
ltm = localtime(&u[0]);
|
||||
years = ltm->tm_year + 1900;
|
||||
if (years < 1978)
|
||||
pDate.ds_Days = pDate.ds_Minute = pDate.ds_Tick = 0;
|
||||
else {
|
||||
pDate.ds_Days = (years - 1978) * 365L + (ANLEAP(years)) +
|
||||
YDAYS(ltm->tm_mon, years) + (ltm->tm_mday - 1);
|
||||
pDate.ds_Minute = ltm->tm_hour * 60 + ltm->tm_min;
|
||||
pDate.ds_Tick = ltm->tm_sec * TICKS_PER_SECOND;
|
||||
}
|
||||
|
||||
if (SysBase->LibNode.lib_Version >= ReqVers)
|
||||
{
|
||||
return (SetFileDate(filename,&pDate)); /* native routine at 2.0+ */
|
||||
}
|
||||
else /* !(SysBase->lib_Version >=ReqVers) */
|
||||
{
|
||||
if( !(taskport = (struct MsgPort *)DeviceProc(filename)) )
|
||||
{
|
||||
errno = ESRCH; /* no such process */
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if( !(lock = Lock(filename,SHARED_LOCK)) )
|
||||
{
|
||||
errno = ENOENT; /* no such file */
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if( !(fib = (struct FileInfoBlock *)AllocMem(
|
||||
(long)sizeof(struct FileInfoBlock),MEMF_PUBLIC|MEMF_CLEAR)) )
|
||||
{
|
||||
errno = ENOMEM; /* insufficient memory */
|
||||
UnLock(lock);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if( Examine(lock,fib)==FAILURE )
|
||||
{
|
||||
errno = EOSERR; /* operating system error */
|
||||
UnLock(lock);
|
||||
FreeMem(fib,(long)sizeof(*fib));
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
dirlock = ParentDir(lock);
|
||||
ptr = (UBYTE *)AllocMem(64L,MEMF_PUBLIC);
|
||||
strcpy((ptr+1),fib->fib_FileName);
|
||||
*ptr = strlen(fib->fib_FileName);
|
||||
FreeMem(fib,(long)sizeof(*fib));
|
||||
UnLock(lock);
|
||||
|
||||
/* now fill in argument array */
|
||||
|
||||
pktargs[0] = 0;
|
||||
pktargs[1] = (LONG)dirlock;
|
||||
pktargs[2] = (LONG)&ptr[0] >> 2;
|
||||
pktargs[3] = (LONG)&pDate;
|
||||
|
||||
errno = ret = sendpkt(taskport,ACTION_SET_DATE,pktargs,4L);
|
||||
|
||||
FreeMem(ptr,64L);
|
||||
UnLock(dirlock);
|
||||
|
||||
return SUCCESS;
|
||||
} /* ?(SysBase->lib_Version >= ReqVers) */
|
||||
} /* FileDate() */
|
||||
|
||||
|
||||
char *getenv(const char *var) /* not reentrant! */
|
||||
{
|
||||
static char space[ENVSIZE];
|
||||
struct Process *me = (void *) FindTask(NULL);
|
||||
void *old_window = me->pr_WindowPtr;
|
||||
char *ret = NULL;
|
||||
|
||||
me->pr_WindowPtr = (void *) -1; /* suppress any "Please insert" popups */
|
||||
if (SysBase->LibNode.lib_Version >= ReqVers) {
|
||||
if (GetVar((char *) var, space, ENVSIZE - 1, /*GVF_GLOBAL_ONLY*/ 0) > 0)
|
||||
ret = space;
|
||||
} else { /* early AmigaDOS, get env var the crude way */
|
||||
BPTR hand, foot, spine;
|
||||
int z = 0;
|
||||
if (foot = Lock("ENV:", ACCESS_READ)) {
|
||||
spine = CurrentDir(foot);
|
||||
if (hand = Open((char *) var, MODE_OLDFILE)) {
|
||||
z = Read(hand, space, ENVSIZE - 1);
|
||||
Close(hand);
|
||||
}
|
||||
UnLock(CurrentDir(spine));
|
||||
}
|
||||
if (z > 0) {
|
||||
space[z] = '\0';
|
||||
ret = space;
|
||||
}
|
||||
}
|
||||
me->pr_WindowPtr = old_window;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __SASC
|
||||
int setenv(const char *var, const char *value, int overwrite)
|
||||
{
|
||||
struct Process *me = (void *) FindTask(NULL);
|
||||
void *old_window = me->pr_WindowPtr;
|
||||
int ret = -1;
|
||||
|
||||
me->pr_WindowPtr = (void *) -1; /* suppress any "Please insert" popups */
|
||||
if (SysBase->LibNode.lib_Version >= ReqVers)
|
||||
ret = !SetVar((char *)var, (char *)value, -1, GVF_GLOBAL_ONLY | LV_VAR);
|
||||
else {
|
||||
BPTR hand, foot, spine;
|
||||
long len = value ? strlen(value) : 0;
|
||||
if (foot = Lock("ENV:", ACCESS_READ)) {
|
||||
spine = CurrentDir(foot);
|
||||
if (len) {
|
||||
if (hand = Open((char *) var, MODE_NEWFILE)) {
|
||||
ret = Write(hand, (char *) value, len + 1) >= len;
|
||||
Close(hand);
|
||||
}
|
||||
} else
|
||||
ret = DeleteFile((char *) var);
|
||||
UnLock(CurrentDir(spine));
|
||||
}
|
||||
}
|
||||
me->pr_WindowPtr = old_window;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Stores data from timezone and daylight to ENV:TZ. */
|
||||
/* ENV:TZ is required to exist by some other SAS/C library functions, */
|
||||
/* like stat() or fstat(). */
|
||||
void set_TZ(long time_zone, int day_light)
|
||||
{
|
||||
char put_tz[MAXTIMEZONELEN]; /* string for putenv: "TZ=aaabbb:bb:bbccc" */
|
||||
int offset;
|
||||
void *exists; /* dummy ptr to see if global envvar TZ already exists */
|
||||
exists = (void *)getenv(TZ_ENVVAR);
|
||||
/* see if there is already an envvar TZ_ENVVAR. If not, create it */
|
||||
if (exists == NULL) {
|
||||
/* create TZ string by pieces: */
|
||||
sprintf(put_tz, "GMT%+ld", time_zone / 3600L);
|
||||
if (time_zone % 3600L) {
|
||||
offset = (int) labs(time_zone % 3600L);
|
||||
sprintf(put_tz + strlen(put_tz), ":%02d", offset / 60);
|
||||
if (offset % 60)
|
||||
sprintf(put_tz + strlen(put_tz), ":%02d", offset % 60);
|
||||
}
|
||||
if (day_light)
|
||||
strcat(put_tz,"DST");
|
||||
setenv(TZ_ENVVAR, put_tz, 1);
|
||||
}
|
||||
}
|
||||
#endif /* __SASC */
|
||||
|
||||
/* set state as well as possible from settings found in locale.library */
|
||||
int GetPlatformLocalTimezone(sp, fill_tzstate_from_rules)
|
||||
register struct state * ZCONST sp;
|
||||
void (*fill_tzstate_from_rules)(struct state * ZCONST sp_res,
|
||||
ZCONST struct rule * ZCONST start,
|
||||
ZCONST struct rule * ZCONST end);
|
||||
{
|
||||
struct Library *LocaleBase;
|
||||
struct Locale *ll;
|
||||
struct Process *me = (void *) FindTask(NULL);
|
||||
void *old_window = me->pr_WindowPtr;
|
||||
BPTR eh;
|
||||
int z, valid = FALSE;
|
||||
|
||||
/* read timezone from locale.library if TZ envvar missing */
|
||||
me->pr_WindowPtr = (void *) -1; /* suppress any "Please insert" popups */
|
||||
if (LocaleBase = OpenLibrary("locale.library", 0)) {
|
||||
if (ll = OpenLocale(NULL)) {
|
||||
z = ll->loc_GMTOffset; /* in minutes */
|
||||
if (z == -300) {
|
||||
if (eh = Lock("ENV:sys/locale.prefs", ACCESS_READ)) {
|
||||
UnLock(eh);
|
||||
valid = TRUE;
|
||||
} else
|
||||
z = 300; /* bug: locale not initialized, default bogus! */
|
||||
} else
|
||||
valid = TRUE;
|
||||
if (valid) {
|
||||
struct rule startrule, stoprule;
|
||||
|
||||
sp->timecnt = 0;
|
||||
sp->typecnt = 1;
|
||||
sp->charcnt = 2;
|
||||
sp->chars[0] = sp->chars[1] = '\0';
|
||||
sp->ttis[0].tt_abbrind = 0;
|
||||
sp->ttis[1].tt_abbrind = 1;
|
||||
sp->ttis[0].tt_gmtoff = -z * MINSPERHOUR;
|
||||
sp->ttis[1].tt_gmtoff = -z * MINSPERHOUR + SECSPERHOUR;
|
||||
sp->ttis[0].tt_isdst = 0;
|
||||
sp->ttis[1].tt_isdst = 1;
|
||||
stoprule.r_type = MONTH_NTH_DAY_OF_WEEK;
|
||||
stoprule.r_day = 0;
|
||||
stoprule.r_week = 5;
|
||||
stoprule.r_mon = 10;
|
||||
stoprule.r_time = 2 * SECSPERHOUR;
|
||||
startrule = stoprule;
|
||||
startrule.r_mon = 4;
|
||||
startrule.r_week = 1;
|
||||
if (z >= -180 && z < 150) {
|
||||
/* At this point we make a really gratuitous assumption: */
|
||||
/* if the time zone could be Europe, we use the European */
|
||||
/* Union rules without checking what country we're in. */
|
||||
/* The AmigaDOS locale country codes do not, at least in */
|
||||
/* 2.x versions of the OS, recognize very many countries */
|
||||
/* outside of Europe and North America. */
|
||||
sp->typecnt = 2;
|
||||
startrule.r_mon = 3; /* one week earlier than US DST */
|
||||
startrule.r_week = 5;
|
||||
} else if (z >= 150 && z <= 480 &&
|
||||
/* no DST in alaska, hawaii */
|
||||
(ll->loc_CountryCode == 0x55534100 /*"USA"*/ ||
|
||||
ll->loc_CountryCode == 0x43414E00 /*"CAN"*/))
|
||||
sp->typecnt = 2;
|
||||
/* We check the country code for U.S. or Canada because */
|
||||
/* most of Latin America has no DST. Even in these two */
|
||||
/* countries there are some exceptions... */
|
||||
/* else if... Feel free to add more cases here! */
|
||||
|
||||
if (sp->typecnt > 1)
|
||||
(*fill_tzstate_from_rules)(sp, &startrule, &stoprule);
|
||||
}
|
||||
CloseLocale(ll);
|
||||
}
|
||||
CloseLibrary(LocaleBase);
|
||||
}
|
||||
me->pr_WindowPtr = old_window;
|
||||
return valid;
|
||||
}
|
||||
|
||||
#ifdef ZIP
|
||||
time_t time(time_t *tp)
|
||||
{
|
||||
time_t t;
|
||||
struct DateStamp ds;
|
||||
DateStamp(&ds);
|
||||
t = ds.ds_Tick / TICKS_PER_SECOND + ds.ds_Minute * 60
|
||||
+ (ds.ds_Days + 2922) * SECSPERDAY;
|
||||
t = mktime(gmtime(&t));
|
||||
/* gmtime leaves ds in the local timezone, mktime converts it to GMT */
|
||||
if (tp) *tp = t;
|
||||
return t;
|
||||
}
|
||||
#endif /* ZIP */
|
||||
|
||||
#endif /* !FUNZIP && !UTIL */
|
||||
|
||||
|
||||
#if CRYPT || !defined(FUNZIP)
|
||||
|
||||
/* sendpkt.c
|
||||
* by A. Finkel, P. Lindsay, C. Sheppner
|
||||
* returns Res1 of the reply packet
|
||||
*/
|
||||
/*
|
||||
#include <exec/types.h>
|
||||
#include <exec/memory.h>
|
||||
#include <libraries/dos.h>
|
||||
#include <libraries/dosextens.h>
|
||||
#include <proto/exec.h>
|
||||
#include <proto/dos.h>
|
||||
*/
|
||||
|
||||
LONG sendpkt(struct MsgPort *pid, LONG action, LONG *args, LONG nargs);
|
||||
|
||||
LONG sendpkt(pid,action,args,nargs)
|
||||
struct MsgPort *pid; /* process identifier (handler message port) */
|
||||
LONG action, /* packet type (desired action) */
|
||||
*args, /* a pointer to argument list */
|
||||
nargs; /* number of arguments in list */
|
||||
{
|
||||
|
||||
struct MsgPort *replyport, *CreatePort(UBYTE *, long);
|
||||
void DeletePort(struct MsgPort *);
|
||||
struct StandardPacket *packet;
|
||||
LONG count, *pargs, res1;
|
||||
|
||||
replyport = CreatePort(NULL,0L);
|
||||
if( !replyport ) return(0);
|
||||
|
||||
packet = (struct StandardPacket *)AllocMem(
|
||||
(long)sizeof(struct StandardPacket),MEMF_PUBLIC|MEMF_CLEAR);
|
||||
if( !packet )
|
||||
{
|
||||
DeletePort(replyport);
|
||||
return(0);
|
||||
}
|
||||
|
||||
packet->sp_Msg.mn_Node.ln_Name = (char *)&(packet->sp_Pkt);
|
||||
packet->sp_Pkt.dp_Link = &(packet->sp_Msg);
|
||||
packet->sp_Pkt.dp_Port = replyport;
|
||||
packet->sp_Pkt.dp_Type = action;
|
||||
|
||||
/* copy the args into the packet */
|
||||
pargs = &(packet->sp_Pkt.dp_Arg1); /* address of 1st argument */
|
||||
for( count=0; count<nargs; count++ )
|
||||
pargs[count] = args[count];
|
||||
|
||||
PutMsg(pid,(struct Message *)packet); /* send packet */
|
||||
|
||||
WaitPort(replyport);
|
||||
GetMsg(replyport);
|
||||
|
||||
res1 = packet->sp_Pkt.dp_Res1;
|
||||
|
||||
FreeMem((char *)packet,(long)sizeof(*packet));
|
||||
DeletePort(replyport);
|
||||
|
||||
return(res1);
|
||||
|
||||
} /* sendpkt() */
|
||||
|
||||
#endif /* CRYPT || !FUNZIP */
|
||||
|
||||
|
||||
#if CRYPT || (defined(UNZIP) && !defined(FUNZIP))
|
||||
|
||||
/* Agetch() reads one raw keystroke -- uses sendpkt() */
|
||||
|
||||
int Agetch(void)
|
||||
{
|
||||
LONG sendpkt(struct MsgPort *pid, LONG action, LONG *args, LONG nargs);
|
||||
struct Task *me = FindTask(NULL);
|
||||
struct CommandLineInterface *cli = BADDR(((struct Process *) me)->pr_CLI);
|
||||
BPTR fh = cli->cli_StandardInput; /* this is immune to < redirection */
|
||||
void *conp = ((struct FileHandle *) BADDR(fh))->fh_Type;
|
||||
char longspace[8];
|
||||
long *flag = (long *) ((ULONG) &longspace[4] & ~3); /* LONGWORD ALIGNED! */
|
||||
UBYTE c;
|
||||
|
||||
*flag = 1;
|
||||
sendpkt(conp, ACTION_SCREEN_MODE, flag, 1); /* assume success */
|
||||
Read(fh, &c, 1);
|
||||
*flag = 0;
|
||||
sendpkt(conp, ACTION_SCREEN_MODE, flag, 1);
|
||||
if (c == 3) /* ^C in input */
|
||||
Signal(me, SIGBREAKF_CTRL_C);
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif /* CRYPT || (UNZIP && !FUNZIP) */
|
||||
|
||||
#endif /* __amiga_filedate_c*/
|
257
programs/fs/unzip60/amiga/makefile.azt
Normal file
257
programs/fs/unzip60/amiga/makefile.azt
Normal file
@ -0,0 +1,257 @@
|
||||
# Makefile for UnZip 5.53 using Manx Aztec C 5.2, last revised 25 Dec 06.
|
||||
# Define EXTRA=xxx on the Make command line for e.g. -dUSE_UNSHRINK.
|
||||
|
||||
EXTRA =
|
||||
|
||||
DEFINES = -d AMIGA $(EXTRA)
|
||||
VERNUMS = -d __VERSION__=5 -d __REVISION__=2
|
||||
|
||||
CC = cc
|
||||
LD = ln
|
||||
|
||||
LDLIBS = -lc16
|
||||
|
||||
# release version:
|
||||
# ----------------
|
||||
CFLAGS = -ps -wcpr0u -sabfmnpu $(DEFINES)
|
||||
# -ps means short ints, -wcpr0u is type checking, -sabfmnpu is optimizations..
|
||||
# Option flags MORE and ASM_* are now set in the Aztec section of amiga/amiga.h;
|
||||
# it's cleaner, and that way any changes forces a recompile.
|
||||
LDFLAGS = +q -m
|
||||
# Linker arg -m suppresses warnings about overriding c.lib functions.
|
||||
|
||||
# debug version:
|
||||
# --------------
|
||||
CFLAGD = -ps -wcpr0u -bs -s0f0n $(DEFINES)
|
||||
# -bs is include source debugging info, -s0f0n is avoid hard-to-debug optimizations
|
||||
LDFLAGD = +q -m -g -w
|
||||
# -g activates source-level debugging (a .dbg file), -w saves assembly-level symbols
|
||||
|
||||
# the directory for object files:
|
||||
O = obA/
|
||||
|
||||
OBJS = $(O)unzip.o $(O)envargs.o $(O)process.o $(O)extract.o \
|
||||
$(O)explode.o $(O)ubz2err.o $(O)unshrink.o $(O)unreduce.o \
|
||||
$(O)inflate.o $(O)match.o $(O)zipinfo.o $(O)list.o $(O)globals.o \
|
||||
$(O)crypt.o $(O)ttyio.o $(O)fileio.o $(O)crc32.o $(O)timezone.o \
|
||||
$(O)amiga.o $(O)crc_68.o $(O)flate.o
|
||||
|
||||
XOBJS = $(O)unzip.xo $(O)process.xo $(O)extract.xo $(O)ubz2err.xo \
|
||||
$(O)inflate.xo $(O)match.xo $(O)globals.xo $(O)crypt.xo \
|
||||
$(O)ttyio.xo $(O)fileio.xo $(O)crc32.xo $(O)timezone.xo \
|
||||
$(O)amiga.xo $(O)crc_68.o $(O)flate.xo
|
||||
|
||||
FOBJS = $(O)funzip.o $(O)inflate.fo $(O)crypt.fo $(O)ttyio.fo $(O)globals.fo \
|
||||
$(O)crc32.fo $(O)filedate.fo $(O)crc_68.o $(O)flate.fo
|
||||
|
||||
DBJS = $(O)unzip.od $(O)envargs.od $(O)process.od \
|
||||
$(O)extract.od $(O)explode.od $(O)unshrink.od $(O)unreduce.od \
|
||||
$(O)inflate.od $(O)match.od $(O)zipinfo.od $(O)list.od $(O)globals.od \
|
||||
$(O)crypt.od $(O)ttyio.od $(O)fileio.od $(O)crc32.od $(O)timezone.od \
|
||||
$(O)amiga.od $(O)crc_68.o $(O)flate.o
|
||||
|
||||
XDBJS = $(O)unzip.xd $(O)process.xd $(O)extract.xd \
|
||||
$(O)inflate.xd $(O)match.xd $(O)globals.xd $(O)crypt.xd \
|
||||
$(O)ttyio.xd $(O)fileio.xd $(O)crc32.xd $(O)timezone.xd \
|
||||
$(O)amiga.xd $(O)crc_68.o $(O)flate.xo
|
||||
|
||||
FDBJS = $(O)funzip.od $(O)inflate.fd $(O)crypt.fd $(O)ttyio.fd $(O)globals.fd \
|
||||
$(O)crc32.fd $(O)filedate.fd $(O)crc_68.o $(O)flate.fo
|
||||
|
||||
|
||||
.c.o :
|
||||
$(CC) -o $@ $(CFLAGS) $*.c
|
||||
|
||||
.c.xo:
|
||||
$(CC) -o $@ -d SFX $(CFLAGS) $*.c
|
||||
|
||||
.c.fo:
|
||||
$(CC) -o $@ -d FUNZIP $(CFLAGS) $*.c
|
||||
|
||||
.c.od :
|
||||
$(CC) -o $@ $(CFLAGD) $*.c
|
||||
|
||||
.c.xd:
|
||||
$(CC) -o $@ -d SFX $(CFLAGD) $*.c
|
||||
|
||||
.c.fd:
|
||||
$(CC) -o $@ -d FUNZIP $(CFLAGD) $*.c
|
||||
|
||||
# HERE WE GO:
|
||||
|
||||
all : Unzip UnzipSFX fUnzip MakeSFX
|
||||
|
||||
u : Unzip
|
||||
|
||||
f : fUnzip
|
||||
|
||||
x : UnzipSFX
|
||||
|
||||
m : MakeSFX
|
||||
|
||||
dall: Unzip.dbg UnzipSFX.dbg fUnzip.dbg MakeSFX.dbg
|
||||
|
||||
ud : Unzip.dbg
|
||||
|
||||
fd : fUnzip.dbg
|
||||
|
||||
xd : UnzipSFX.dbg
|
||||
|
||||
md : MakeSFX.dbg
|
||||
|
||||
|
||||
Unzip : $(OBJS)
|
||||
$(LD) $(LDFLAGS) -o Unzip $(OBJS) $(LDLIBS)
|
||||
-@delete Unzip.dbg
|
||||
|
||||
UnzipSFX : $(XOBJS) MakeSFX
|
||||
$(LD) $(LDFLAGS) -o UnzipSFX $(XOBJS) $(LDLIBS)
|
||||
-@delete UnzipSFX.dbg
|
||||
|
||||
fUnzip : $(FOBJS)
|
||||
$(LD) $(LDFLAGS) -o fUnzip $(FOBJS) $(LDLIBS)
|
||||
-@delete fUnzip.dbg
|
||||
|
||||
MakeSFX : amiga/makesfx.c
|
||||
$(CC) $(CFLAGS) -o t:makesfx.o amiga/makesfx.c
|
||||
$(LD) $(LDFLAGS) -o MakeSFX t:makesfx.o $(LDLIBS)
|
||||
-@delete MakeSFX.dbg
|
||||
-@delete t:makesfx.o
|
||||
|
||||
|
||||
Unzip.dbg : $(DBJS)
|
||||
$(LD) $(LDFLAGD) -o Unzip $(DBJS) $(LDLIBS)
|
||||
|
||||
UnzipSFX.dbg : $(XDBJS) MakeSFX.dbg
|
||||
$(LD) $(LDFLAGD) -o UnzipSFX $(XDBJS) $(LDLIBS)
|
||||
|
||||
fUnzip.dbg : $(FDBJS)
|
||||
$(LD) $(LDFLAGD) -o fUnzip $(FDBJS) $(LDLIBS)
|
||||
|
||||
MakeSFX.dbg : amiga/makesfx.c
|
||||
$(CC) $(CFLAGD) -o t:makesfx.o amiga/makesfx.c
|
||||
$(LD) $(LDFLAGD) -o MakeSFX t:makesfx.o $(LDLIBS)
|
||||
-@delete t:makesfx.o
|
||||
|
||||
|
||||
clean :
|
||||
-delete $(OBJS)
|
||||
-delete $(XOBJS)
|
||||
-delete $(FOBJS)
|
||||
-delete $(DBJS)
|
||||
-delete $(XDBJS)
|
||||
-delete $(FDBJS)
|
||||
-delete amiga/gbloffs amiga/Fgbloffs amiga/Xgbloffs
|
||||
|
||||
cleaner : clean
|
||||
-delete UnZip fUnZip UnZipSFX MakeSFX *.dbg
|
||||
|
||||
# header dependencies:
|
||||
|
||||
$(OBJS) $(XOBJS) $(FOBJS) : unzip.h unzpriv.h globals.h \
|
||||
amiga/amiga.h amiga/z-stat.h
|
||||
$(DBJS) $(XDBJS) $(FDBJS) : unzip.h unzpriv.h globals.h \
|
||||
amiga/amiga.h amiga/z-stat.h
|
||||
|
||||
$(O)crypt.o $(O)crypt.fo $(O)timezone.o $(O)ttyio.o $(O)ttyio.fo : zip.h
|
||||
$(O)crypt.od $(O)crypt.fd $(O)timezone.od $(O)ttyio.od $(O)ttyio.fd : zip.h
|
||||
|
||||
$(O)inflate.o $(O)inflate.fo $(O)inflate.od $(O)inflate.fd : inflate.h
|
||||
|
||||
$(O)fileio.o $(O)fileio.od : ebcdic.h
|
||||
|
||||
$(O)funzip.o $(O)funzip.od : crc32.h
|
||||
$(O)crc32.o $(O)crc32.fo $(O)crc32.xo : crc32.h
|
||||
$(O)crc32.od $(O)crc32.fd $(O)crc32.xd : crc32.h
|
||||
$(O)crypt.o $(O)crypt.fo $(O)crypt.xo : crc32.h
|
||||
$(O)crypt.od $(O)crypt.fd $(O)crypt.xd : crc32.h
|
||||
$(O)extract.o $(O)extract.xo $(O)extract.od $(O)extract.xd : crc32.h
|
||||
$(O)fileio.o $(O)fileio.xo $(O)fileio.od $(O)fileio.xd : crc32.h
|
||||
$(O)process.o $(O)process.xo $(O)process.od $(O)process.xd : crc32.h
|
||||
|
||||
$(O)crypt.o $(O)crypt.fo $(O)crypt.xo : crypt.h
|
||||
$(O)crypt.od $(O)crypt.fd $(O)crypt.xd : crypt.h
|
||||
$(O)ttyio.o $(O)ttyio.fo $(O)ttyio.xo : crypt.h
|
||||
$(O)ttyio.od $(O)ttyio.fd $(O)ttyio.xd : crypt.h
|
||||
$(O)unzip.o $(O)unzip.xo $(O)funzip.o : crypt.h
|
||||
$(O)unzip.od $(O)unzip.xd $(O)funzip.od : crypt.h
|
||||
$(O)fileio.o $(O)fileio.xo $(O)extract.o $(O)extract.xo : crypt.h
|
||||
$(O)fileio.od $(O)fileio.xd $(O)extract.od $(O)extract.xd : crypt.h
|
||||
$(O)inflate.o $(O)inflate.fo $(O)inflate.xo $(O)filedate.fo : crypt.h
|
||||
$(O)inflate.od $(O)inflate.fd $(O)inflate.xd $(O)filedate.fd : crypt.h
|
||||
amiga/gbloffs amiga/Fgbloffs amiga/Xgbloffs : crypt.h
|
||||
|
||||
$(O)crypt.o $(O)crypt.fo $(O)crypt.xo : ttyio.h
|
||||
$(O)crypt.od $(O)crypt.fd $(O)crypt.xd : ttyio.h
|
||||
$(O)ttyio.o $(O)ttyio.fo $(O)ttyio.xo : ttyio.h
|
||||
$(O)ttyio.od $(O)ttyio.fd $(O)ttyio.xd : ttyio.h
|
||||
$(O)funzip.o $(O)fileio.o $(O)fileio.xo : ttyio.h
|
||||
$(O)funzip.od $(O)fileio.od $(O)fileio.xd : ttyio.h
|
||||
|
||||
$(O)timezone.o $(O)timezone.xo $(O)amiga.o $(O)amiga.xo : timezone.h
|
||||
$(O)timezone.od $(O)timezone.xd $(O)amiga.od $(O)amiga.xd : timezone.h
|
||||
|
||||
$(O)unzip.o $(O)unzip.xo $(O)unzip.od $(O)unzip.xd : unzvers.h consts.h
|
||||
|
||||
|
||||
# Special case object files:
|
||||
|
||||
$(O)amiga.o : amiga/filedate.c amiga/stat.c amiga/amiga.c unzvers.h
|
||||
rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
|
||||
$(CC) -o $(O)amiga.o $(CFLAGS) $(VERNUMS) amiga/amiga.c
|
||||
|
||||
$(O)amiga.xo : amiga/filedate.c amiga/stat.c amiga/amiga.c unzvers.h
|
||||
$(CC) -o $(O)amiga.xo $(CFLAGS) $(VERNUMS) -d SFX amiga/amiga.c
|
||||
|
||||
$(O)amiga.od : amiga/filedate.c amiga/stat.c amiga/amiga.c unzvers.h
|
||||
rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
|
||||
$(CC) -o $(O)amiga.od $(CFLAGD) $(VERNUMS) amiga/amiga.c
|
||||
|
||||
$(O)amiga.xd : amiga/filedate.c amiga/stat.c amiga/amiga.c unzvers.h
|
||||
$(CC) -o $(O)amiga.xd $(CFLAGD) $(VERNUMS) -d SFX amiga/amiga.c
|
||||
|
||||
$(O)crc_68.o : amiga/crc_68.a
|
||||
as -n -o $(O)crc_68.o amiga/crc_68.a
|
||||
# no debug version of crc_68
|
||||
|
||||
$(O)filedate.fo : amiga/filedate.c
|
||||
$(CC) -o $(O)filedate.fo -d FUNZIP $(CFLAGS) amiga/filedate.c
|
||||
|
||||
$(O)filedate.fd : amiga/filedate.c
|
||||
$(CC) -o $(O)filedate.fd -d FUNZIP $(CFLAGD) amiga/filedate.c
|
||||
|
||||
# The file t:G_offs.a is generated on the fly by programs we compile
|
||||
# and then run, and then it's included into amiga/flate.a to provide
|
||||
# definitions for it. There are no debug versions of flate.o.
|
||||
|
||||
$(O)flate.o : amiga/flate.a amiga/gbloffs
|
||||
amiga/gbloffs > t:G_offs.a
|
||||
as -n -o $(O)flate.o -eINT16 amiga/flate.a
|
||||
-@delete t:G_offs.a
|
||||
|
||||
$(O)flate.fo : amiga/flate.a amiga/Fgbloffs
|
||||
amiga/Fgbloffs > t:G_offs.a
|
||||
as -n -o $(O)flate.fo -eINT16 -eFUNZIP -eAZTEC amiga/flate.a
|
||||
-@delete t:G_offs.a
|
||||
|
||||
$(O)flate.xo : amiga/flate.a amiga/Xgbloffs
|
||||
amiga/Xgbloffs > t:G_offs.a
|
||||
as -n -o $(O)flate.xo -eINT16 -eSFX amiga/flate.a
|
||||
-@delete t:G_offs.a
|
||||
|
||||
# Here are the programs that generate different versions of G_offs.a:
|
||||
|
||||
amiga/gbloffs : gbloffs.c unzip.h unzpriv.h globals.h amiga/amiga.h crypt.h
|
||||
$(CC) -o t:gbloffs.o $(CFLAGS) gbloffs.c
|
||||
$(LD) $(LDFLAGS) -o amiga/gbloffs t:gbloffs.o $(LDLIBS)
|
||||
-@delete t:gbloffs.o
|
||||
|
||||
amiga/Fgbloffs : gbloffs.c unzip.h unzpriv.h globals.h amiga/amiga.h crypt.h
|
||||
$(CC) -o t:gbloffs.o $(CFLAGS) -d FUNZIP gbloffs.c
|
||||
$(LD) $(LDFLAGS) -o amiga/Fgbloffs t:gbloffs.o $(LDLIBS)
|
||||
-@delete t:gbloffs.o
|
||||
|
||||
amiga/Xgbloffs : gbloffs.c unzip.h unzpriv.h globals.h amiga/amiga.h crypt.h
|
||||
$(CC) -o t:gbloffs.o $(CFLAGS) -d SFX gbloffs.c
|
||||
$(LD) $(LDFLAGS) -o amiga/Xgbloffs t:gbloffs.o $(LDLIBS)
|
||||
-@delete t:gbloffs.o
|
184
programs/fs/unzip60/amiga/makesfx.c
Normal file
184
programs/fs/unzip60/amiga/makesfx.c
Normal file
@ -0,0 +1,184 @@
|
||||
/*
|
||||
Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/* MakeSFX: join UnZipSFX and a .zip archive into a single self-extracting */
|
||||
/* Amiga program. On most systems simple concatenation does the job but for */
|
||||
/* the Amiga a special tool is needed. By Paul Kienitz, no rights reserved. */
|
||||
/* This program is written portably, so if anyone really wants to they can */
|
||||
/* produce Amiga self-extracting programs on a non-Amiga. We are careful */
|
||||
/* not to mix Motorola-format longwords read from files with native long */
|
||||
/* integers. Not necessarily limited to use with only the Zip format -- */
|
||||
/* just combine any archive with any self-extractor program that is capable */
|
||||
/* of reading a HUNK_DEBUG section at the end as an archive. */
|
||||
|
||||
#include <stat.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef __SASC
|
||||
# include <proto/dos.h>
|
||||
# ifdef DEBUG
|
||||
# include <sprof.h>
|
||||
# endif
|
||||
#endif /* __SASC */
|
||||
#ifdef AZTEC_C
|
||||
# include <dos/dos.h>
|
||||
# include <clib/dos_protos.h>
|
||||
#endif /* AZTEC_C */
|
||||
|
||||
typedef unsigned long ulg;
|
||||
typedef unsigned char uch;
|
||||
typedef unsigned short bool;
|
||||
#define false 0
|
||||
#define true 1
|
||||
|
||||
/* the following are extracted from Commodore include file dos/doshunks.h: */
|
||||
#define HUNK_NAME 1000L
|
||||
#define HUNK_CODE 1001L
|
||||
#define HUNK_DATA 1002L
|
||||
#define HUNK_BSS 1003L
|
||||
#define HUNK_RELOC32 1004L
|
||||
#define HUNK_SYMBOL 1008L
|
||||
#define HUNK_DEBUG 1009L
|
||||
#define HUNK_END 1010L
|
||||
#define HUNK_HEADER 1011L
|
||||
#define HUNK_OVERLAY 1013L
|
||||
#define HUNK_BREAK 1014L
|
||||
|
||||
/* Convert a big-endian (Motorola) sequence of four bytes to a longword: */
|
||||
#define CHARS2LONG(b) (((ulg)(b)[0] << 24) | ((ulg)(b)[1] << 16) | \
|
||||
((ulg)(b)[2] << 8) | ((ulg)(b)[3]))
|
||||
/* b must be (uch *) in each of these. Now the reverse: */
|
||||
#define LONG2CHARS(b,l) ((b)[0] = (uch)((l) >> 24), (b)[1] = (uch)((l) >> 16),\
|
||||
(b)[2] = (uch)((l) >> 8), (b)[3] = (uch)(l))
|
||||
|
||||
#define COPYBUFFER 16384
|
||||
|
||||
ulg totalwritten = 0;
|
||||
|
||||
|
||||
bool CopyData(FILE *out, FILE *inn, ulg archivesize,
|
||||
char *outname, char *inname)
|
||||
{
|
||||
static uch buf[COPYBUFFER];
|
||||
ulg written;
|
||||
size_t chunk;
|
||||
|
||||
if (archivesize) {
|
||||
LONG2CHARS(buf, HUNK_DEBUG);
|
||||
written = (archivesize + 3) / 4;
|
||||
LONG2CHARS(buf + 4, written);
|
||||
if (fwrite(buf, 1, 8, out) < 8) {
|
||||
printf("Error writing in-between data to %s\n", outname);
|
||||
return false;
|
||||
}
|
||||
totalwritten += 8;
|
||||
}
|
||||
written = 0;
|
||||
do {
|
||||
chunk = fread(buf, 1, COPYBUFFER, inn);
|
||||
if (ferror(inn)) {
|
||||
printf("Error reading data from %s\n", inname);
|
||||
return false;
|
||||
}
|
||||
if (!archivesize && !written) { /* true only for first block read */
|
||||
if (CHARS2LONG(buf) != HUNK_HEADER) {
|
||||
printf("%s is not an Amiga executable.\n", inname);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (fwrite(buf, 1, chunk, out) < chunk) {
|
||||
printf("Error writing %s to %s\n", archivesize ? "archive data" :
|
||||
"self-extractor code", outname);
|
||||
return false;
|
||||
}
|
||||
written += chunk;
|
||||
totalwritten += chunk;
|
||||
} while (!feof(inn));
|
||||
if (archivesize) {
|
||||
if (written != archivesize) {
|
||||
printf("Wrong number of bytes copied from archive %s\n", outname);
|
||||
return false;
|
||||
}
|
||||
LONG2CHARS(buf, 0);
|
||||
chunk = 3 - (written + 3) % 4;
|
||||
LONG2CHARS(buf + chunk, HUNK_END);
|
||||
chunk += 4;
|
||||
if (fwrite(buf, 1, chunk, out) < chunk) {
|
||||
printf("Error writing end-marker data to %s\n", outname);
|
||||
return false;
|
||||
}
|
||||
totalwritten += chunk;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void main(int argc, char **argv)
|
||||
{
|
||||
FILE *out, *arch, *tool;
|
||||
char *toolname = argv[3];
|
||||
struct stat ss;
|
||||
int ret;
|
||||
ulg archivesize;
|
||||
|
||||
if (argc < 3 || argc > 4) {
|
||||
printf("Usage: %s <result-file> <zip-archive> [<self-extractor-"
|
||||
"program>]\nThe third arg defaults to \"UnZipSFX\" in the"
|
||||
" current dir or C:.\n", argv[0]);
|
||||
exit(20);
|
||||
}
|
||||
if (!(arch = fopen(argv[2], "rb"))) {
|
||||
printf("Could not find archive file %s\n", argv[2]);
|
||||
exit(10);
|
||||
}
|
||||
if (stat(argv[2], &ss) || !(archivesize = ss.st_size)) {
|
||||
fclose(arch);
|
||||
printf("Could not check size of archive %s, or file is empty.\n",
|
||||
argv[2]);
|
||||
exit(10);
|
||||
}
|
||||
if (argc < 4)
|
||||
toolname = "UnZipSFX";
|
||||
if (!(tool = fopen(toolname, "rb"))) {
|
||||
BPTR lk = Lock("C:", ACCESS_READ);
|
||||
BPTR ocd = lk ? CurrentDir(lk) : 0;
|
||||
if (!(tool = fopen(toolname, "rb"))) {
|
||||
fclose(arch);
|
||||
printf("Could not find self-extractor program %s\n", toolname);
|
||||
if (lk)
|
||||
UnLock(CurrentDir(ocd));
|
||||
exit(10);
|
||||
}
|
||||
if (lk)
|
||||
UnLock(CurrentDir(ocd));
|
||||
}
|
||||
if (!(out = fopen(argv[1], "wb"))) {
|
||||
fclose(arch);
|
||||
fclose(tool);
|
||||
printf("Could not create output file %s\n", argv[1]);
|
||||
exit(10);
|
||||
}
|
||||
ret = CopyData(out, tool, 0, argv[1], toolname)
|
||||
&& CopyData(out, arch, archivesize, argv[1], argv[2]) ? 0 : 10;
|
||||
fclose(out);
|
||||
fclose(arch);
|
||||
fclose(tool);
|
||||
if (ret) {
|
||||
printf("Deleting %s\n", argv[1]);
|
||||
remove(argv[1]);
|
||||
} else
|
||||
printf("%s successfully written, size %lu bytes.\n",
|
||||
argv[1], totalwritten);
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
|
||||
#if (defined(AZTEC_C) && defined(MCH_AMIGA))
|
||||
void _wb_parse(void) { } /* avoid unneeded infrastructure */
|
||||
#endif
|
629
programs/fs/unzip60/amiga/smakefile
Normal file
629
programs/fs/unzip60/amiga/smakefile
Normal file
@ -0,0 +1,629 @@
|
||||
#===========================================================================
|
||||
# Makefile for UnZip, ZipInfo, fUnZip, MakeSFX AMIGA SAS/C Version 6.58
|
||||
# Version: 5.53 last revised: 25 Dec 06
|
||||
#===========================================================================
|
||||
# from John Bush <john.bush@east.sun.com>
|
||||
# or: <JBush@bix.com>
|
||||
|
||||
# updated for SAS/C Version 6.56+ and AmigaDOS 3.1 (V40)
|
||||
# by Haidinger Walter <walthaid@unix.ict.tuwien.ac.at>
|
||||
|
||||
# additional supplements and maintenance by Paul Kienitz
|
||||
|
||||
# This makefile should work with at least AmigaDOS 2.04 (V37) (not tested)
|
||||
# and will probably not work with AmigaDOS 1.3 (V34)
|
||||
|
||||
# If you have any improvements, critics or else please feel free to mail.
|
||||
# Any response is appreciated. Haidinger Walter <walthaid@unix.ict.tuwien.ac.at>
|
||||
|
||||
# Available targets:
|
||||
# all builds all executables below
|
||||
# unzip builds unzip executable
|
||||
# unzipsfx builds unzipsfx executable
|
||||
# funzip builds funzip executable
|
||||
# makesfx builds makesfx executable
|
||||
# clean remove all files created by the compilation
|
||||
# spotless like clean target but removes binaries too
|
||||
|
||||
|
||||
##########################
|
||||
# USER MACRO DEFINITIONS #
|
||||
##########################
|
||||
|
||||
# Set the processor to generate code for UnZip and fUnZip. Specify one of:
|
||||
# ANY 68000 68010 68020 68030 68040 68060 (Default: ANY or 68000)
|
||||
|
||||
# Use of the assembly versions is not supported yet since some of the asm
|
||||
# source file do not assemble with 68000 instructions.
|
||||
# Any help is appreciated of course.
|
||||
|
||||
CUSECPU = ANY
|
||||
|
||||
# Uncomment both CUTIL and LUTIL to make use of utility.library of OS 2.04+
|
||||
# The utility.library is *not* used for UnZipSFX to ensure maximum portability
|
||||
# between the different Amiga systems (minimal config: 68000 and OS 1.2).
|
||||
# You can change this by adding the $(LUTIL) macro in the UnZipSFX linking
|
||||
# rules (See below: Final output targets, UnZipSFX:).
|
||||
# WARNINGS when using the utility library:
|
||||
# 1. All Executables will *only* work with AmigaDOS 2.04 (v37) or higher.
|
||||
# 2. You *need not* compile/link with short-integers using the
|
||||
# utility.library. It will crash your machine. See Libraries below.
|
||||
#
|
||||
# Default: commented (not used)
|
||||
#
|
||||
#CUTIL = UTILLIB DEFINE=_UTILLIB
|
||||
#LUTIL = WITH SC:LIB/utillib.with # include necessary linker defines
|
||||
|
||||
|
||||
# Choose one stack-handling method (default=faster)
|
||||
# StackExtend: Dynamic runtime stack extension. You won't notice stack overflows.
|
||||
# StackCheck: On a stack overflow a requester appears which allows you to exit.
|
||||
# Note that either stack watching will slow down your executable because of the
|
||||
# extra code run on each function entry. On the other hand, you won't crash
|
||||
# anymore due to stack overflows. However, you should not have *any* stack
|
||||
# problems with info-zip if you raise your stack to 20000 (which I'd
|
||||
# recommend as a minimum default stack for all applications) or more using the
|
||||
# shell stack command. Type 'Stack 20000' or add it to your S:Shell-Startup.
|
||||
# BTW: Typing 'Stack' prints your current stack size.
|
||||
#
|
||||
CSTACK = NOSTACKCHECK STACKEXTEND # slow, but always works
|
||||
#CSTACK = STACKCHECK NOSTACKEXTEND # slow, requester & graceful exit
|
||||
#CSTACK = NOSTACKCHECK NOSTACKEXTEND # faster but relies on larger stack (>=10K)
|
||||
|
||||
#
|
||||
# LIBRARIES
|
||||
# ---------
|
||||
|
||||
# Choose one DATAOPTS , SASLIB and LSTARTUP
|
||||
# Always comment/uncomment all macros of a set.
|
||||
|
||||
# Library to use with near data and 2-byte integers
|
||||
# Notes: o slower than 4-byte integers with 68000 cpu
|
||||
# o *not* recommended due to poor overall performance
|
||||
# o see comment in amiga/osdep.h
|
||||
#DATAOPTS = DATA=NEAR SHORTINTEGERS DEF=_NEAR_DATA
|
||||
#SASLIB = scs
|
||||
#LSTARTUP = cres.o
|
||||
|
||||
# Library to use with near data and 4-byte integers (DEFAULT)
|
||||
# *** use this with the utility.library ***
|
||||
DATAOPTS = DATA=NEAR DEF=_NEAR_DATA
|
||||
SASLIB = sc
|
||||
LSTARTUP = cres.o
|
||||
|
||||
# Library to use with far data and 2-byte integers
|
||||
# use if DYN_ALLOC is not defined
|
||||
# old default - far data always works but is slower
|
||||
#DATAOPTS = DATA=FAR SHORTINTEGERS DEF=_FAR_DATA
|
||||
#SASLIB = scsnb
|
||||
#LSTARTUP = c.o
|
||||
|
||||
# Library to use with far data and 4-byte integers
|
||||
# if everything else fails: try this
|
||||
#DATAOPTS = DATA=FAR DEF=_FAR_DATA
|
||||
#SASLIB = scnb
|
||||
#LSTARTUP = c.o
|
||||
|
||||
|
||||
#
|
||||
# DEBUGGING
|
||||
# ---------
|
||||
|
||||
# Default: No debugging information added.
|
||||
# The two macros below will be overwritten if you choose to add
|
||||
# debug info, therefore need to comment.
|
||||
CDBG = NODEBUG NOPROFILE NOCOVERAGE # default: no debug info
|
||||
LDBG = STRIPDEBUG # default: no debug info
|
||||
|
||||
# Compiler and loader debug flags. Uncomment as needed. Recomment when done.
|
||||
# Optimization disabled for faster compilation (by using NOOPT)
|
||||
#CDBG1 = DEF=DEBUG DEF=DEBUG_TIME # enables Info-ZIP's debug output
|
||||
|
||||
# Enable profiling and coverage when desired. Option COVERAGE commented
|
||||
# seperately because running coverage may corrupt your drive in case of a
|
||||
# system crash since a file 'cover.dat' is created in your working directory.
|
||||
# Note that the use of COVERAGE forces the use of the c.o startup module.
|
||||
#CDBG2 = PROFILE
|
||||
#CDBG3 = COVERAGE # must use c.o startup code:
|
||||
#LSTARTUP = c.o # Uncomment *only* when you use COVERAGE
|
||||
|
||||
# *Uncomment* _HERE_ macros CDBG and LDBG to include debugging information
|
||||
#CDBG = $(CDBG1) $(CDBG2) $(CDBG3) ADDSYM DEBUG=FULLFLUSH STACKCHECK NOOPT
|
||||
#LDBG = ADDSYM
|
||||
# Optional use of memwatch.library which can be found in your
|
||||
# sc:extras/memlib directory. Please read the short docs (memlib.doc).
|
||||
# Note that memlib has a small bug: MWTerm() displays always the first entry.
|
||||
# Get the latest version from aminet (dev/debug/memlib.lha) or
|
||||
# contact me to get the patch. Uncomment all macros to use.
|
||||
#CMEMLIB = DEFINE=MWDEBUG=1 # define to enable library
|
||||
#LMEMLIB = SC:LIB/memwatch.lib # path to library
|
||||
#LSTARTUP = c.o # must use c.o with memlib!
|
||||
|
||||
|
||||
#
|
||||
# MAPPING
|
||||
# -------
|
||||
|
||||
# Map filenames used when mapping (no need to comment)
|
||||
#
|
||||
MAPFS = unzip.map # UnZip map filename
|
||||
MAPFX = unzipsfx.map # UnZipSFX map filename
|
||||
MAPFF = funzip.map # fUnZip map filename
|
||||
MAPFM = makesfx.map # MakeSFX map filename
|
||||
|
||||
# Map file output: Uncomment to highlight and bold headings.
|
||||
#
|
||||
#MAPFSTYLE = FANCY
|
||||
|
||||
# Map flags for each EXECUTABLE. Uncomment to enable mapping.
|
||||
# For map options please refer to:
|
||||
# SAS/C v6 manual, volume 1: user's guide, chapter 8, page 136: map
|
||||
# Default: all options enabled: f,h,l,o,s,x
|
||||
# |-> options start here
|
||||
#LMAPS = $(MAPFSTYLE) MAP $(MAPFS) f,h,l,o,s,x # UnZip maps
|
||||
#LMAPX = $(MAPFSTYLE) MAP $(MAPFX) f,h,l,o,s,x # UnZipSFX maps
|
||||
#LMAPF = $(MAPFSTYLE) MAP $(MAPFF) f,h,l,o,s,x # fUnZip maps
|
||||
#LMAPM = $(MAPFSTYLE) MAP $(MAPFM) f,h,l,o,s,x # MakeSFX maps
|
||||
|
||||
|
||||
#
|
||||
# LISTINGS
|
||||
# --------
|
||||
|
||||
# Listfile-extensions for each executable (enter *with* dot)
|
||||
#
|
||||
LISTEXTS = .lst # extension for UnZip and MakeSFX listfiles
|
||||
LISTEXTX = .xlst # extension for UnZipSFX listfiles
|
||||
LISTEXTF = .flst # extension for fUnZip listfiles
|
||||
|
||||
|
||||
# List files and cross references for each OBJECT.
|
||||
# Add/remove flags as needed. All listed by default.
|
||||
# Use LISTINCLUDES only to determine the dependencies for smake
|
||||
#
|
||||
CLISTOPT = LISTHEADERS LISTMACROS # LISTSYSTEM LISTINCLUDES
|
||||
CXREFOPT = XHEAD XSYS
|
||||
#
|
||||
# Uncomment to enable listing (default: commented)
|
||||
# *** WARNING: List files require *lots* of disk space!
|
||||
#
|
||||
#CLIST = LIST $(CLISTOPT)
|
||||
#CXREF = XREF $(CXREFOPT)
|
||||
|
||||
|
||||
#
|
||||
# SUPPRESSED COMPILER WARNINGS
|
||||
# ----------------------------
|
||||
|
||||
# Compiler warnings to ignore
|
||||
#
|
||||
# Warning 105 : module does not define any externally-known symbols
|
||||
# Warning 304 : Dead assignment eliminated...
|
||||
# Note 306 : ...function inlined...
|
||||
# Warning 317 : possibly uninitialized variable...
|
||||
# Comment to enable.
|
||||
#
|
||||
CIGNORE = IGNORE=105,304,306,317
|
||||
|
||||
|
||||
#
|
||||
# OBJECT EXTENSIONS
|
||||
#
|
||||
|
||||
# Extensions used for objects of each executeable.
|
||||
# Transformation rules require unique extensions.
|
||||
# Enter *with* dot.
|
||||
#
|
||||
O = .o # general extension for objects
|
||||
OX = .xo # extension for special UnZipSFX objects
|
||||
OF = .fo # extension for special fUnZip objects
|
||||
|
||||
|
||||
# Filename used to store converted options from environment variable
|
||||
# LOCAL_UNZIP. Default: scoptions_local_unzip
|
||||
#
|
||||
CWITHOPT = scoptions_local_unzip
|
||||
|
||||
|
||||
# Filenames to store compiler options to prevent command line overflow
|
||||
#
|
||||
# Options file for UnZip and fUnZip
|
||||
CFILEC = scoptions-unzip
|
||||
# Options file for UnZipSFX
|
||||
CFILEX = scoptions-unzipsfx
|
||||
# Special options for MakeSFX
|
||||
CFILEM = scoptions-makesfx
|
||||
|
||||
|
||||
# Temp filenames for object lists to load using linker "WITH" command.
|
||||
#
|
||||
OBJLISTS = unzip_objlist.with # UnZip object list
|
||||
OBJLISTX = unzipsfx_objlist.with # UnZipSFX object list
|
||||
OBJLISTF = funzip_objlist.with # fUnZip object list
|
||||
OBJLISTM = makesfx_objlist.with # MakeSFX object list
|
||||
|
||||
|
||||
# Filenames to store linker options
|
||||
#
|
||||
LWITHS = unzip.lnk # UnZip linker options
|
||||
LWITHX = unzipsfx.lnk # UnZipSFX linker options
|
||||
LWITHF = funzip.lnk # fUnZip linker options
|
||||
LWITHM = makesfx.lnk # MakeSFX linker options
|
||||
|
||||
|
||||
######################################
|
||||
# NOTHING TO CHANGE BEYOND HERE ... #
|
||||
######################################
|
||||
|
||||
|
||||
# Compiler definitions
|
||||
#
|
||||
CC = sc
|
||||
#
|
||||
# Optimizer flags
|
||||
#
|
||||
OPTPASSES = 6 # set number of global optimizer passes
|
||||
#
|
||||
OPT1 = OPT OPTINL OPTINLOCAL OPTTIME OPTLOOP OPTSCHED
|
||||
OPT2 = OPTCOMP=$(OPTPASSES) OPTDEP=$(OPTPASSES) OPTRDEP=$(OPTPASSES)
|
||||
OPT = $(OPT1) $(OPT2)
|
||||
|
||||
# Compiler flags
|
||||
#
|
||||
# cpu flags for UnZip and fUnZip
|
||||
CCPUOPTSF = CPU=$(CUSECPU) $(CUTIL)
|
||||
# cpu flags for UnzipSFX and MakeSFX (ensures portability to all Amigas)
|
||||
CCPUOPTXM = CPU=ANY
|
||||
|
||||
CDEFINES = $(CMEMLIB) $(CDEFINES) DEF=AMIGA DEF=PROTO
|
||||
COPTIONS = CODE=NEAR NMINC VERBOSE STRINGMERGE PARAMETERS=BOTH
|
||||
COPTIONS = $(COPTIONS) ERRORREXX NOERRORCONSOLE MEMSIZE=HUGE $(CLIST) $(CXREF)
|
||||
COPTIONS = $(COPTIONS) $(CSTACK) STRICT UNSCHAR NOICONS
|
||||
COPTIONS = $(COPTIONS) $(CIGNORE) $(OPT) $(CDBG)
|
||||
# common compiler flags
|
||||
CFLAGSC = $(CDEFINES) $(DATAOPTS) $(COPTIONS)
|
||||
# special compiler flags with $(DATAOPTS) excluded
|
||||
CFLAGSS = $(CDEFINES) $(COPTIONS)
|
||||
|
||||
# Linker definitions
|
||||
# See SASLIB definition above
|
||||
#
|
||||
LD = slink
|
||||
# special linker flags for UnZip to create pure (i.e. resident) binary.
|
||||
LDFLAGSS = FROM SC:LIB/$(LSTARTUP)
|
||||
# common linker flags for all other executeables
|
||||
LDFLAGSC = FROM SC:LIB/c.o
|
||||
|
||||
LDFLAGS2 = NOICONS $(LDBG)
|
||||
# special linker flags to select library set above
|
||||
LIBFLAGSS = LIB $(LMEMLIB) SC:LIB/$(SASLIB).lib SC:LIB/amiga.lib
|
||||
# common linker flags
|
||||
LIBFLAGSC = LIB $(LMEMLIB) SC:LIB/sc.lib SC:LIB/amiga.lib
|
||||
|
||||
|
||||
##################
|
||||
# TARGET OBJECTS #
|
||||
##################
|
||||
|
||||
|
||||
# UnZip Objects
|
||||
OBJS1 = unzip$(O) crc32$(O) crypt$(O) envargs$(O) explode$(O)
|
||||
OBJS2 = extract$(O) fileio$(O) globals$(O) list$(O) inflate$(O) match$(O)
|
||||
OBJS3 = process$(O) ttyio$(O) ubz2err$(O) unreduce$(O) unshrink$(O) zipinfo$(O)
|
||||
OBJSA = amiga$(O) timezone$(O)
|
||||
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJSA)
|
||||
|
||||
# UnZipSFX Objects
|
||||
OBJX1 = unzip$(OX) extract$(OX) inflate$(OX) match$(OX) process$(OX)
|
||||
OBJXI = crypt$(OX) crc32$(OX) fileio$(OX) globals$(OX) ttyio$(OX) ubz2err$(OX)
|
||||
OBJXA = amiga$(OX) timezone$(OX)
|
||||
OBJX = $(OBJX1) $(OBJXI) $(OBJXA)
|
||||
|
||||
# fUnZip Objects
|
||||
OBJF1 = funzip$(O)
|
||||
OBJF2 = crc32$(OF) crypt$(OF) globals$(OF) inflate$(OF) ttyio$(OF)
|
||||
OBJFA = filedate$(OF) stat$(O)
|
||||
OBJF = $(OBJF1) $(OBJF2) $(OBJFA)
|
||||
|
||||
# MakeSFX Objects
|
||||
OBJM = makesfx$(O)
|
||||
|
||||
# Common header files
|
||||
UNZIP_H1 = unzip.h unzpriv.h globals.h
|
||||
UNZIP_HA = amiga/amiga.h amiga/z-stat.h
|
||||
UNZIP_H = $(UNZIP_H1) $(UNZIP_HA)
|
||||
|
||||
# Output targets
|
||||
UNZIPS = UnZip UnZipSFX fUnZip MakeSFX
|
||||
|
||||
|
||||
#######################################
|
||||
# DEFAULT TARGET AND PROCESSING RULES #
|
||||
#######################################
|
||||
|
||||
all: request flush $(UNZIPS)
|
||||
|
||||
# UnZip transformation rules
|
||||
#
|
||||
.c$(O) :
|
||||
$(CC) WITH=$(CFILEC) LISTFILE=$>$(LISTEXTS) OBJNAME=$@ $*.c
|
||||
|
||||
# UnZipSFX transformation rules
|
||||
#
|
||||
.c$(OX):
|
||||
$(CC) DEF=SFX WITH=$(CFILEC) LISTFILE=$>$(LISTEXTX) OBJNAME=$@ $*.c
|
||||
|
||||
# fUnZip transformation rules
|
||||
#
|
||||
.c$(OF):
|
||||
$(CC) DEF=FUNZIP WITH=$(CFILEC) LISTFILE=$>$(LISTEXTF) OBJNAME=$@ $*.c
|
||||
|
||||
|
||||
#########################
|
||||
# Final output targets. #
|
||||
#########################
|
||||
|
||||
unzip: local_unzip CommonFlags $(OBJS)
|
||||
@Echo "$(OBJS)" >$(OBJLISTS)
|
||||
Type $(OBJLISTS)
|
||||
# -----
|
||||
# Note: Change $(LDFLAGSS) to $(LDFLAGSC) if DYN_ALLOC is *not* defined.
|
||||
# -----
|
||||
@Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTS) $(LIBFLAGSS) " \
|
||||
"$(LDFLAGS2) $(LMAPS)" >$(LWITHS)
|
||||
Type $(LWITHS)
|
||||
$(LD) TO UnZip WITH $(LWITHS)
|
||||
|
||||
funzip: local_unzip CommonFlags $(OBJF)
|
||||
@Echo "$(OBJF)" >$(OBJLISTF)
|
||||
Type $(OBJLISTF)
|
||||
@Echo "$(LDFLAGSC) $(LUTIL) WITH $(OBJLISTF) $(LIBFLAGSS) " \
|
||||
"$(LDFLAGS2) $(LMAPF)" >$(LWITHF)
|
||||
Type $(LWITHF)
|
||||
$(LD) TO fUnZip WITH $(LWITHF)
|
||||
|
||||
unzipsfx: local_unzip SFXFlags $(OBJX)
|
||||
@Echo "$(OBJX)" >$(OBJLISTX)
|
||||
Type $(OBJLISTX)
|
||||
# ----
|
||||
# Note: Insert $(LUTIL) here, to use utility library with UnZipSFX.
|
||||
# ----- vvvvvvv
|
||||
@Echo "$(LDFLAGSC) WITH $(OBJLISTX) $(LIBFLAGSS) " \
|
||||
"$(LDFLAGS2) $(LMAPX)" >$(LWITHX)
|
||||
Type $(LWITHX)
|
||||
$(LD) TO UnZipSFX WITH $(LWITHX)
|
||||
|
||||
|
||||
makesfx: MakeSFXFlags $(OBJM)
|
||||
@Echo "$(OBJM)" >$(OBJLISTM)
|
||||
Type $(OBJLISTM)
|
||||
@Echo "$(LDFLAGSC) $(LUTIL) WITH $(OBJLISTM) $(LIBFLAGSC) " \
|
||||
"$(LDFLAGS2) $(LMAPM)" >$(LWITHM)
|
||||
Type $(LWITHM)
|
||||
# never use short-integers with MakeSFX !
|
||||
$(LD) TO MakeSFX WITH $(LWITHM)
|
||||
|
||||
clean:
|
||||
-Delete >nil: $(OBJS) quiet
|
||||
-Delete >nil: $(OBJX) quiet
|
||||
-Delete >nil: $(OBJF) quiet
|
||||
-Delete >nil: $(OBJM) quiet
|
||||
-Delete >nil: $(OBJLISTS) $(OBJLISTX) $(OBJLISTF) $(OBJLISTM) quiet
|
||||
-Delete >nil: $(MAPFS) $(MAPFX) $(MAPFF) $(MAPFM) quiet
|
||||
-Delete >nil: \#?$(LISTEXTS) \#?$(LISTEXTX) \#?$(LISTEXTF) quiet
|
||||
-Delete >nil: $(CWITHOPT) $(CFILEC) $(CFILEX) $(CFILEM) quiet
|
||||
-Delete >nil: SCOPTIONS SASCOPTS quiet
|
||||
-Delete >nil: $(LWITHS) $(LWITHX) $(LWITHF) $(LWITHM) quiet
|
||||
-Delete >nil: \#?.q.?? \#?.tmp \#?.cov quiet
|
||||
|
||||
spotless: clean
|
||||
-Delete >nil: $(UNZIPS) quiet
|
||||
|
||||
|
||||
# UnZip dependencies:
|
||||
# (objects not needed by Amiga port are commented)
|
||||
|
||||
# special rule for adding Amiga internal version number to UnZip
|
||||
amiga$(O): amiga/amiga.c amiga/filedate.c amiga/stat.c $(UNZIP_H) crypt.h timezone.h env:Workbench
|
||||
stat$(O): amiga/stat.c amiga/z-stat.h
|
||||
filedate$(O): amiga/filedate.c crypt.h timezone.h
|
||||
api$(O): api.c $(UNZIP_H) unzvers.h #zlib.h
|
||||
apihelp$(O): apihelp.c $(UNZIP_H) unzvers.h
|
||||
crc32$(O): crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
crypt$(O): crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
envargs$(O): envargs.c $(UNZIP_H)
|
||||
explode$(O): explode.c $(UNZIP_H)
|
||||
extract$(O): extract.c $(UNZIP_H) crc32.h crypt.h
|
||||
fileio$(O): fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
|
||||
globals$(O): globals.c $(UNZIP_H)
|
||||
inflate$(O): inflate.c $(UNZIP_H) inflate.h #zlib.h
|
||||
list$(O): list.c $(UNZIP_H)
|
||||
match$(O): match.c $(UNZIP_H)
|
||||
process$(O): process.c $(UNZIP_H) crc32.h
|
||||
timezone$(O): timezone.c $(UNZIP_H) zip.h timezone.h
|
||||
ttyio$(O): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
ubz2err$(O): ubz2err.c $(UNZIP_H)
|
||||
unreduce$(O): unreduce.c $(UNZIP_H)
|
||||
unshrink$(O): unshrink.c $(UNZIP_H)
|
||||
unzip$(O): unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h #zlib.h
|
||||
#unzipstb$(O): unzipstb.c $(UNZIP_H) unzvers.h
|
||||
zipinfo$(O): zipinfo.c $(UNZIP_H)
|
||||
|
||||
|
||||
# UnZipSFX dependencies:
|
||||
#
|
||||
# special rule for adding Amiga internal version number to UnZipSFX
|
||||
amiga$(OX): amiga/amiga.c amiga/filedate.c amiga/stat.c $(UNZIP_H) crypt.h timezone.h
|
||||
unzip$(OX): unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
|
||||
crc32$(OX): crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
crypt$(OX): crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
extract$(OX): extract.c $(UNZIP_H) crc32.h crypt.h
|
||||
fileio$(OX): fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
|
||||
globals$(OX): globals.c $(UNZIP_H)
|
||||
inflate$(OX): inflate.c $(UNZIP_H) inflate.h #zlib.h
|
||||
match$(OX): match.c $(UNZIP_H)
|
||||
process$(OX): process.c $(UNZIP_H) crc32.h
|
||||
timezone$(OX): timezone.c $(UNZIP_H) zip.h timezone.h
|
||||
ttyio$(OX): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
ubz2err$(OX): ubz2err.c $(UNZIP_H)
|
||||
|
||||
|
||||
# fUnZip dependencies:
|
||||
#
|
||||
funzip$(O): funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
|
||||
crc32$(OF): crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
crypt$(OF): crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
globals$(OF): globals.c $(UNZIP_H)
|
||||
inflate$(OF): inflate.c $(UNZIP_H) inflate.h crypt.h #zlib.h
|
||||
ttyio$(OF): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
filedate$(OF): amiga/filedate.c crypt.h
|
||||
|
||||
|
||||
# MakeSFX dependencies
|
||||
#
|
||||
# special transformation rules to never use shortintegers:
|
||||
makesfx$(O): amiga/makesfx.c
|
||||
$(CC) WITH=$(CFILEM) LISTFILE=$>$(LISTEXTS) OBJNAME=$@ $*.c
|
||||
|
||||
|
||||
########################
|
||||
# DEPENDECIES END HERE #
|
||||
########################
|
||||
|
||||
# flush all libraries to provide more mem for compilation
|
||||
flush:
|
||||
@Avail flush >nil:
|
||||
|
||||
# write common compiler flags to file and echo to user
|
||||
CommonFlags:
|
||||
@Echo "$(CFLAGSC)" "$(CCPUOPTSF)" >$(CFILEC)
|
||||
@Type "$(CWITHOPT)" >>$(CFILEC)
|
||||
-Type $(CFILEC)
|
||||
|
||||
SFXFlags:
|
||||
@Echo "$(CFLAGSC)" "$(CCPUOPTXM)" >$(CFILEX)
|
||||
@Type "$(CWITHOPT)" >>$(CFILEX)
|
||||
-Type $(CFILEX)
|
||||
|
||||
# write special MakeSFX flags
|
||||
MakeSFXFlags:
|
||||
@Echo "$(CFLAGSS) $(CCPUOPTXM) DATA=NEAR NOSHORTINTEGERS" >$(CFILEM)
|
||||
# not really needed but if someday used:
|
||||
@Type "$(CWITHOPT)" >>$(CFILEM)
|
||||
-Type $(CFILEM)
|
||||
|
||||
|
||||
# special rule for adding Amiga internal version number to amiga.c
|
||||
amiga$(O):
|
||||
rx > env:VersionDate "say '""'translate(date('E'),'.','/')'""'"
|
||||
$(CC) WITH=$(CFILEC) LISTFILE=$>$(LISTEXTS) OBJNAME=$@ $*.c
|
||||
-Delete env:VersionDate
|
||||
|
||||
|
||||
# needed in amiga/amiga.c
|
||||
# should be set in startup-sequence, but just in case:
|
||||
# (only works with OS 2.04 and above)
|
||||
|
||||
env\:WorkBench:
|
||||
@Execute < < (Workbench_smk.tmp)
|
||||
FailAt 21
|
||||
If not exists ENV:Workbench
|
||||
Version >nil:
|
||||
SetEnv Workbench $$Workbench
|
||||
Endif
|
||||
<
|
||||
|
||||
|
||||
# #################
|
||||
# ### LOCAL_UNZIP ###
|
||||
# #################
|
||||
#
|
||||
# Read environment variable LOCAL_UNZIP and convert options from old Lattice
|
||||
# v5 to new SAS/C v6 format. You may also use the new DEFINE= syntax but
|
||||
# be sure not to mix v5 and v6 options, otherwise lctosc will be confused.
|
||||
#
|
||||
# e.g.: to define FOO_ONE and FOO_TWO enter:
|
||||
#
|
||||
# SetEnv LOCAL_UNZIP "-DFOO_ONE -DFOO_TWO"
|
||||
#
|
||||
# To make this permanent, i.e. survive an reboot, put the statement into
|
||||
# your startup-sequence or (for AmigaDOS 2.0 or higher only) make sure
|
||||
# LOCAL_UNZIP is stored in the ENVARC: directory too. To do this, simply
|
||||
# copy the file from ENV: to ENVARC:
|
||||
# Copy ENV:LOCAL_UNZIP ENVARC:
|
||||
#
|
||||
# For a list of all valid non-standard compilation options see the INSTALL
|
||||
# file in the root zip tree. Please read the notes there before using the
|
||||
# non-standard options.
|
||||
#
|
||||
# e.g.: To use the non-standard timezone environment variable "INFOZIP_TZ"
|
||||
# (or another arbitary name) instead of "TZ", type in your shell:
|
||||
#
|
||||
# Setenv LOCAL_UNZIP "-DTZ_ENVVAR=*"INFOZIP_TZ*""
|
||||
#
|
||||
# Note that you need to escape the quotes of INFOZIP_TZ with leading stars.
|
||||
# To verify that LOCAL_UNZIP has been saved correctly, use the Getenv command:
|
||||
#
|
||||
# Getenv LOCAL_UNZIP
|
||||
#
|
||||
# ...should display:
|
||||
#
|
||||
# -DTZ_ENVVAR="INFOZIP_TZ"
|
||||
#
|
||||
|
||||
local_unzip:
|
||||
@Execute < < (Local_UnZip_smk.tmp)
|
||||
Failat 21
|
||||
Echo ""
|
||||
If exists ENV:LOCAL_UNZIP
|
||||
Echo "Using environment variable LOCAL_UNZIP !"
|
||||
Echo "LOCAL_UNZIP: " NOLINE
|
||||
GetEnv LOCAL_UNZIP
|
||||
Copy >NIL: ENV:LOCAL_UNZIP SASCOPTS
|
||||
Else
|
||||
Echo "You could use envvar LOCAL_UNZIP to set your special compilation options."
|
||||
Echo "See the makefile for more information (LOCAL_UNZIP section)."
|
||||
Delete >nil: SASCOPTS quiet
|
||||
Endif
|
||||
Echo ""
|
||||
; Do not remove the lctosc command! If LOCAL_UNZIP is unset, an
|
||||
; empty file is created which needed by CommonFlags !
|
||||
; Moreover, lctosc also accepts new v6 options, i.e. only changes
|
||||
; known v5 options. Try `lctosc -Dfoo' and `lctosc DEFINE=foo'.
|
||||
; However, you *must not* mix v5 and v6 options!
|
||||
lctosc > $(CWITHOPT)
|
||||
; Now make sure that env:sc/scoptions are NOT used
|
||||
; we just create an empty file. The options are stored elsewhere.
|
||||
Echo > SCOPTIONS "" NOLINE
|
||||
<
|
||||
|
||||
|
||||
|
||||
# Echo request to the user
|
||||
#
|
||||
request:
|
||||
@Echo ""
|
||||
@Echo " This makefile is for use with SAS/C version 6.58."
|
||||
@Echo " If you still have an older version, please upgrade!"
|
||||
@Echo " Patches are available on the Aminet under biz/patch/sc\#?."
|
||||
@Echo ""
|
||||
@Echo " Just a simple request..."
|
||||
@Echo " Please give me a mail that you compiled whether you encounter any errors"
|
||||
@Echo " or not. I'd just like to know how many Amiga users actually make use of"
|
||||
@Echo " this makefile."
|
||||
@Echo " If you mail me, I'll put you on my mailing-list and notify you whenever"
|
||||
@Echo " new versions of Info-Zip are released."
|
||||
@Echo " Have a look at the makefile for changes like CPU type, UtilLib, Stack, etc."
|
||||
@Echo " Feel free to mail comments, suggestions, critics..."
|
||||
@Echo " Enjoy Info-Zip !"
|
||||
@Echo " Haidinger Walter, <walthaid@unix.ict.tuwien.ac.at>"
|
||||
@Echo ""
|
||||
|
||||
# Echo help in case of an error
|
||||
#
|
||||
.ONERROR:
|
||||
@Echo ""
|
||||
@Echo "[sigh] An error running this makefile was detected."
|
||||
@Echo "This message may also appear if you interrupted smake by pressing CTRL-C."
|
||||
@Echo "Contact Info-ZIP authors at Zip-Bugs@lists.wku.edu or me for help."
|
||||
@Echo "Haidinger Walter, <walthaid@unix.ict.tuwien.ac.at>"
|
293
programs/fs/unzip60/amiga/stat.c
Normal file
293
programs/fs/unzip60/amiga/stat.c
Normal file
@ -0,0 +1,293 @@
|
||||
/*
|
||||
Copyright (c) 1990-2000 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
|
||||
*/
|
||||
/* Here we have a handmade stat() function because Aztec's c.lib stat() */
|
||||
/* does not support an st_mode field, which we need... also a chmod(). */
|
||||
|
||||
/* This stat() is by Paul Wells, modified by Paul Kienitz. */
|
||||
/* Originally for use with Aztec C >= 5.0 and Lattice C <= 4.01 */
|
||||
/* Adapted for SAS/C 6.5x by Haidinger Walter */
|
||||
|
||||
/* POLICY DECISION: We will not attempt to remove global variables from */
|
||||
/* this source file for Aztec C. These routines are essentially just */
|
||||
/* augmentations of Aztec's c.lib, which is itself not reentrant. If */
|
||||
/* we want to produce a fully reentrant UnZip, we will have to use a */
|
||||
/* suitable startup module, such as purify.a for Aztec by Paul Kienitz. */
|
||||
|
||||
#ifndef __amiga_stat_c
|
||||
#define __amiga_stat_c
|
||||
|
||||
#include <exec/types.h>
|
||||
#include <exec/memory.h>
|
||||
#include "amiga/z-stat.h" /* fake version of stat.h */
|
||||
#include <string.h>
|
||||
|
||||
#ifdef AZTEC_C
|
||||
# include <libraries/dos.h>
|
||||
# include <libraries/dosextens.h>
|
||||
# include <clib/exec_protos.h>
|
||||
# include <clib/dos_protos.h>
|
||||
# include <pragmas/exec_lib.h>
|
||||
# include <pragmas/dos_lib.h>
|
||||
#endif
|
||||
#ifdef __SASC
|
||||
# include <sys/dir.h> /* SAS/C dir function prototypes */
|
||||
# include <sys/types.h>
|
||||
# include <proto/exec.h>
|
||||
# include <proto/dos.h>
|
||||
#endif
|
||||
|
||||
#ifndef SUCCESS
|
||||
# define SUCCESS (-1)
|
||||
# define FAILURE (0)
|
||||
#endif
|
||||
|
||||
|
||||
void close_leftover_open_dirs(void); /* prototype */
|
||||
|
||||
static DIR *dir_cleanup_list = NULL; /* for resource tracking */
|
||||
|
||||
/* CALL THIS WHEN HANDLING CTRL-C OR OTHER UNEXPECTED EXIT! */
|
||||
void close_leftover_open_dirs(void)
|
||||
{
|
||||
while (dir_cleanup_list)
|
||||
closedir(dir_cleanup_list);
|
||||
}
|
||||
|
||||
|
||||
unsigned short disk_not_mounted;
|
||||
|
||||
extern int stat(const char *file, struct stat *buf);
|
||||
|
||||
stat(file,buf)
|
||||
const char *file;
|
||||
struct stat *buf;
|
||||
{
|
||||
|
||||
struct FileInfoBlock *inf;
|
||||
BPTR lock;
|
||||
time_t ftime;
|
||||
struct tm local_tm;
|
||||
|
||||
if( (lock = Lock((char *)file,SHARED_LOCK))==0 )
|
||||
/* file not found */
|
||||
return(-1);
|
||||
|
||||
if( !(inf = (struct FileInfoBlock *)AllocMem(
|
||||
(long)sizeof(struct FileInfoBlock),MEMF_PUBLIC|MEMF_CLEAR)) )
|
||||
{
|
||||
UnLock(lock);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if( Examine(lock,inf)==FAILURE )
|
||||
{
|
||||
FreeMem((char *)inf,(long)sizeof(*inf));
|
||||
UnLock(lock);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* fill in buf */
|
||||
buf->st_dev =
|
||||
buf->st_nlink =
|
||||
buf->st_uid =
|
||||
buf->st_gid =
|
||||
buf->st_rdev = 0;
|
||||
buf->st_ino = inf->fib_DiskKey;
|
||||
buf->st_blocks = inf->fib_NumBlocks;
|
||||
buf->st_size = inf->fib_Size;
|
||||
|
||||
/* now the date. AmigaDOS has weird datestamps---
|
||||
* ds_Days is the number of days since 1-1-1978;
|
||||
* however, as Unix wants date since 1-1-1970...
|
||||
*/
|
||||
|
||||
ftime =
|
||||
(inf->fib_Date.ds_Days * 86400 ) +
|
||||
(inf->fib_Date.ds_Minute * 60 ) +
|
||||
(inf->fib_Date.ds_Tick / TICKS_PER_SECOND ) +
|
||||
(86400 * 8 * 365 ) +
|
||||
(86400 * 2 ); /* two leap years */
|
||||
|
||||
/* tzset(); */ /* this should be handled by mktime(), instead */
|
||||
/* ftime += timezone; */
|
||||
local_tm = *gmtime(&ftime);
|
||||
local_tm.tm_isdst = -1;
|
||||
ftime = mktime(&local_tm);
|
||||
|
||||
buf->st_ctime =
|
||||
buf->st_atime =
|
||||
buf->st_mtime = ftime;
|
||||
|
||||
buf->st_mode = (inf->fib_DirEntryType < 0 ? S_IFREG : S_IFDIR);
|
||||
|
||||
/* lastly, throw in the protection bits */
|
||||
buf->st_mode |= ((inf->fib_Protection ^ 0xF) & 0xFF);
|
||||
|
||||
FreeMem((char *)inf, (long)sizeof(*inf));
|
||||
UnLock((BPTR)lock);
|
||||
|
||||
return(0);
|
||||
|
||||
}
|
||||
|
||||
int fstat(int handle, struct stat *buf)
|
||||
{
|
||||
/* fake some reasonable values for stdin */
|
||||
buf->st_mode = (S_IREAD|S_IWRITE|S_IFREG);
|
||||
buf->st_size = -1;
|
||||
buf->st_mtime = time(&buf->st_mtime);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* opendir(), readdir(), closedir(), rmdir(), and chmod() by Paul Kienitz. */
|
||||
|
||||
DIR *opendir(const char *path)
|
||||
{
|
||||
DIR *dd = AllocMem(sizeof(DIR), MEMF_PUBLIC);
|
||||
if (!dd) return NULL;
|
||||
if (!(dd->d_parentlock = Lock((char *)path, MODE_OLDFILE))) {
|
||||
disk_not_mounted = IoErr() == ERROR_DEVICE_NOT_MOUNTED;
|
||||
FreeMem(dd, sizeof(DIR));
|
||||
return NULL;
|
||||
} else
|
||||
disk_not_mounted = 0;
|
||||
if (!Examine(dd->d_parentlock, &dd->d_fib) || dd->d_fib.fib_EntryType < 0) {
|
||||
UnLock(dd->d_parentlock);
|
||||
FreeMem(dd, sizeof(DIR));
|
||||
return NULL;
|
||||
}
|
||||
dd->d_cleanuplink = dir_cleanup_list; /* track them resources */
|
||||
if (dir_cleanup_list)
|
||||
dir_cleanup_list->d_cleanupparent = &dd->d_cleanuplink;
|
||||
dd->d_cleanupparent = &dir_cleanup_list;
|
||||
dir_cleanup_list = dd;
|
||||
return dd;
|
||||
}
|
||||
|
||||
void closedir(DIR *dd)
|
||||
{
|
||||
if (dd) {
|
||||
if (dd->d_cleanuplink)
|
||||
dd->d_cleanuplink->d_cleanupparent = dd->d_cleanupparent;
|
||||
*(dd->d_cleanupparent) = dd->d_cleanuplink;
|
||||
if (dd->d_parentlock)
|
||||
UnLock(dd->d_parentlock);
|
||||
FreeMem(dd, sizeof(DIR));
|
||||
}
|
||||
}
|
||||
|
||||
struct dirent *readdir(DIR *dd)
|
||||
{
|
||||
return (ExNext(dd->d_parentlock, &dd->d_fib) ? (struct dirent *)dd : NULL);
|
||||
}
|
||||
|
||||
|
||||
#ifdef AZTEC_C
|
||||
|
||||
int rmdir(const char *path)
|
||||
{
|
||||
return (DeleteFile((char *)path) ? 0 : IoErr());
|
||||
}
|
||||
|
||||
int chmod(const char *filename, int bits) /* bits are as for st_mode */
|
||||
{
|
||||
long protmask = (bits & 0xFF) ^ 0xF;
|
||||
return !SetProtection((char *)filename, protmask);
|
||||
}
|
||||
|
||||
|
||||
/* This here removes unnecessary bulk from the executable with Aztec: */
|
||||
void _wb_parse(void) { }
|
||||
|
||||
/* fake a unix function that does not apply to amigados: */
|
||||
int umask(void) { return 0; }
|
||||
|
||||
|
||||
# include <signal.h>
|
||||
|
||||
/* C library signal() messes up debugging yet adds no actual usefulness */
|
||||
typedef void (*__signal_return_type)(int);
|
||||
__signal_return_type signal() { return SIG_ERR; }
|
||||
|
||||
|
||||
/* The following replaces Aztec's argv-parsing function for compatibility with
|
||||
Unix-like syntax used on other platforms. It also fixes the problem the
|
||||
standard _cli_parse() has of accepting only lower-ascii characters. */
|
||||
|
||||
int _argc, _arg_len;
|
||||
char **_argv, *_arg_lin;
|
||||
|
||||
void _cli_parse(struct Process *pp, long alen, register UBYTE *aptr)
|
||||
{
|
||||
register UBYTE *cp;
|
||||
register struct CommandLineInterface *cli;
|
||||
register short c;
|
||||
register short starred = 0;
|
||||
# ifdef PRESTART_HOOK
|
||||
void Prestart_Hook(void);
|
||||
# endif
|
||||
|
||||
cli = (struct CommandLineInterface *) (pp->pr_CLI << 2);
|
||||
cp = (UBYTE *) (cli->cli_CommandName << 2);
|
||||
_arg_len = cp[0] + alen + 2;
|
||||
if (!(_arg_lin = AllocMem((long) _arg_len, 0L)))
|
||||
return;
|
||||
c = cp[0];
|
||||
strncpy(_arg_lin, cp + 1, c);
|
||||
_arg_lin[c] = 0;
|
||||
for (cp = _arg_lin + c + 1; alen && (*aptr < '\n' || *aptr > '\r'); alen--)
|
||||
*cp++ = *aptr++;
|
||||
*cp = 0;
|
||||
aptr = cp = _arg_lin + c + 1;
|
||||
for (_argc = 1; ; _argc++) {
|
||||
while (*cp == ' ' || *cp == '\t')
|
||||
cp++;
|
||||
if (!*cp)
|
||||
break;
|
||||
if (*cp == '"') {
|
||||
cp++;
|
||||
while (c = *cp++) {
|
||||
if (c == '"' && !starred) {
|
||||
*aptr++ = 0;
|
||||
starred = 0;
|
||||
break;
|
||||
} else if (c == '\\' && !starred)
|
||||
starred = 1;
|
||||
else {
|
||||
*aptr++ = c;
|
||||
starred = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while ((c = *cp++) && c != ' ' && c != '\t')
|
||||
*aptr++ = c;
|
||||
*aptr++ = 0;
|
||||
}
|
||||
if (c == 0)
|
||||
--cp;
|
||||
}
|
||||
*aptr = 0;
|
||||
if (!(_argv = AllocMem((_argc + 1) * sizeof(*_argv), 0L))) {
|
||||
_argc = 0;
|
||||
return;
|
||||
}
|
||||
for (c = 0, cp = _arg_lin; c < _argc; c++) {
|
||||
_argv[c] = cp;
|
||||
cp += strlen(cp) + 1;
|
||||
}
|
||||
_argv[c] = NULL;
|
||||
# ifdef PRESTART_HOOK
|
||||
Prestart_Hook();
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif /* AZTEC_C */
|
||||
|
||||
#endif /* __amiga_stat_c */
|
95
programs/fs/unzip60/amiga/z-stat.h
Normal file
95
programs/fs/unzip60/amiga/z-stat.h
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
Copyright (c) 1990-2000 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
|
||||
*/
|
||||
#ifndef __amiga_z_stat_h
|
||||
#define __amiga_z_stat_h
|
||||
|
||||
/* Since older versions of the Lattice C compiler for Amiga, and all current */
|
||||
/* versions of the Manx Aztec C compiler for Amiga, either provide no stat() */
|
||||
/* function or provide one inadequate for unzip (Aztec's has no st_mode */
|
||||
/* field), we provide our own stat() function in stat.c by Paul Wells, and */
|
||||
/* this fake stat.h file by Paul Kienitz. Paul Wells originally used the */
|
||||
/* Lattice stat.h but that does not work for Aztec and is not distributable */
|
||||
/* with this package, so I made a separate one. This has to be pulled into */
|
||||
/* unzip.h when compiling an Amiga version, as "amiga/z-stat.h". */
|
||||
|
||||
/* We also provide here a "struct dirent" for use with opendir() & readdir() */
|
||||
/* functions included in amiga/stat.c. If you use amiga/stat.c, this must */
|
||||
/* be included wherever you use either readdir() or stat(). */
|
||||
|
||||
#ifdef AZTEC_C
|
||||
# define __STAT_H
|
||||
#else /* __SASC */
|
||||
/* do not include the following header, replacement definitions are here */
|
||||
# define _STAT_H /* do not include SAS/C <stat.h> */
|
||||
# define _DIRENT_H /* do not include SAS/C <dirent.h> */
|
||||
# define _SYS_DIR_H /* do not include SAS/C <sys/dir.h> */
|
||||
# define _COMMIFMT_H /* do not include SAS/C <sys/commifmt.h> */
|
||||
# include <dos.h>
|
||||
#endif
|
||||
#include <libraries/dos.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
struct stat {
|
||||
unsigned short st_mode;
|
||||
time_t st_ctime, st_atime, st_mtime;
|
||||
long st_size;
|
||||
long st_ino;
|
||||
long st_blocks;
|
||||
short st_attr, st_dev, st_nlink, st_uid, st_gid, st_rdev;
|
||||
};
|
||||
|
||||
#define S_IFDIR (1<<11)
|
||||
#define S_IFREG (1<<10)
|
||||
|
||||
#if 0
|
||||
/* these values here are totally random: */
|
||||
# define S_IFLNK (1<<14)
|
||||
# define S_IFSOCK (1<<13)
|
||||
# define S_IFCHR (1<<8)
|
||||
# define S_IFIFO (1<<7)
|
||||
# define S_IFMT (S_IFDIR|S_IFREG|S_IFCHR|S_IFLNK)
|
||||
#else
|
||||
# define S_IFMT (S_IFDIR|S_IFREG)
|
||||
#endif
|
||||
|
||||
#define S_IHIDDEN (1<<7)
|
||||
#define S_ISCRIPT (1<<6)
|
||||
#define S_IPURE (1<<5)
|
||||
#define S_IARCHIVE (1<<4)
|
||||
#define S_IREAD (1<<3)
|
||||
#define S_IWRITE (1<<2)
|
||||
#define S_IEXECUTE (1<<1)
|
||||
#define S_IDELETE (1<<0)
|
||||
|
||||
int stat(const char *name, struct stat *buf);
|
||||
int fstat(int handle, struct stat *buf); /* returns dummy values */
|
||||
|
||||
typedef struct dirent {
|
||||
struct dirent *d_cleanuplink,
|
||||
**d_cleanupparent;
|
||||
BPTR d_parentlock;
|
||||
struct FileInfoBlock d_fib;
|
||||
} DIR;
|
||||
#define d_name d_fib.fib_FileName
|
||||
|
||||
extern unsigned short disk_not_mounted; /* flag set by opendir() */
|
||||
|
||||
DIR *opendir(const char *);
|
||||
void closedir(DIR *);
|
||||
void close_leftover_open_dirs(void); /* call this if aborted in mid-run */
|
||||
struct dirent *readdir(DIR *);
|
||||
int umask(void);
|
||||
|
||||
#ifdef AZTEC_C
|
||||
int rmdir(const char *);
|
||||
int chmod(const char *filename, int bits);
|
||||
#endif
|
||||
|
||||
#endif /* __amiga_z_stat_h */
|
7
programs/fs/unzip60/aosvs/Contents
Normal file
7
programs/fs/unzip60/aosvs/Contents
Normal file
@ -0,0 +1,7 @@
|
||||
Contents of the "aosvs" subdirectory for UnZip 5.3 and later:
|
||||
|
||||
Contents this file
|
||||
README compilation notes, history, etc.
|
||||
make_unz.cli command script to make UnZip only (not UnZipSFX or fUnZip)
|
||||
aosvs.c AOS/VS-specific support routines
|
||||
aosvs.h AOS/VS-specific typedefs and header stuff
|
145
programs/fs/unzip60/aosvs/README
Normal file
145
programs/fs/unzip60/aosvs/README
Normal file
@ -0,0 +1,145 @@
|
||||
[e-mail excerpt from Dave Lovelace explaining AOS/VS port, compiler, etc.]
|
||||
|
||||
> From: Dave Lovelace <davel@cyberspace.org>
|
||||
> Subject: Re: zip on Data General AOS/VS
|
||||
> Date: Wed, 17 May 1995 11:02:03 -0400 (EDT)
|
||||
>
|
||||
> The diffs for zip & unzip are both in the same file. I've also included the
|
||||
> extra source files which I wrote, the CLI macros which I used to compile
|
||||
> & link the things, & my own history of what I did. Note that some of the
|
||||
> changes I made reversed earlier changes, & this was written for my own
|
||||
> use (or for others here if I leave or die or something). I hope it will help.
|
||||
>
|
||||
> This was compiled using DG's C compiler for AOS/VS, rev 4.10. It has been
|
||||
> compiled only on an MV-5500 running AOS/VS rev 7.70, but the resulting
|
||||
> programs have been distributed & run on several different MVs running various
|
||||
> versions of AOS/VS, so it should be fairly independent of at least minor rev
|
||||
> variations. To the best of my knowledge it has *not* been tested under
|
||||
> AOS/VS II, & I really don't know anything about that environment; possibly
|
||||
> the special AOS/VS file info I'm storing in the extra field will have some
|
||||
> different format there.
|
||||
|
||||
|
||||
|
||||
[README/history info from Dave Lovelace]
|
||||
|
||||
In modifying this for use on AOS/VS, I found only a few changes
|
||||
were needed for DG C 4.10:
|
||||
|
||||
2. There was a bug in the inflate() code, because memset()
|
||||
was being called with a non-char pointer. Pretty obviously
|
||||
the other systems where this was used do not have char pointers
|
||||
different from other pointers. IT IS QUITE POSSIBLE THAT OTHER
|
||||
BUGS OF THIS SORT EXIST. Testing did not uncover any.
|
||||
3. In fileio.c, it appears that utime() is being called correctly,
|
||||
but it does not set the file's time and always returns failure.
|
||||
Since the AOS/VS tar and cpio programs provided by DG also suffer
|
||||
from the fault of not setting file times, I must conclude that
|
||||
this is by design. At any rate, I modified the code (with
|
||||
compilation conditional on a macro AOS_VS) to not say "error"
|
||||
when this occurs.
|
||||
|
||||
One change which I think would be desirable: if the filename isn't
|
||||
already a relative or absolute pathname (specifying a unique location),
|
||||
the program follows the searchlist under AOS/VS. It will unexpectedly
|
||||
replace files anywhere in your searchlist. (If you don't use the
|
||||
-o option, it will ask you first, but not tell you where the file
|
||||
to be replaced resides.) I suspect this could be handled by prepending
|
||||
./ to any filenames which don't already begin with /. (I haven't
|
||||
checked how this would work inside the program. Possibly this
|
||||
could be done in every case - I don't think PKZIP ever stores an
|
||||
absolute pathname.)
|
||||
|
||||
To see the compile options I used, look at the file MAKE.AOS_VS.CLI
|
||||
You may of course need to change the searchlist to use that macro.
|
||||
|
||||
------------------------------------------------------------------
|
||||
15-dec-93
|
||||
I fixed some of the above things, introducing new problems. It now
|
||||
won't follow the searchlist - but the logic prevents it from creating
|
||||
directories (if they aren't explicitly in the ZIP, anyway). But
|
||||
UNZIP now sets the creation time to the time stored in the ZIP, and
|
||||
ZIP now stores that instead of the TLM. I had to introduce an
|
||||
extra module, with some code of my own and some other public domain
|
||||
code, to accomplish this.
|
||||
|
||||
------------------------------------------------------------------
|
||||
1-jun-94
|
||||
I found an additional bug: the header was causing void to be #define'd
|
||||
as int, and prototypes weren't being used. I changed UNZIP.H and
|
||||
added a define of PROTO to the MAKE.AOS_VS.CLI and REMAKE.CLI macros.
|
||||
|
||||
I found and fixed the bug that prevented the (creation) times from
|
||||
being set on files with explicit paths. (The Unix-style paths didn't
|
||||
work as inputs to the AOS/VS ?CREATE system call.)
|
||||
|
||||
Additional known bugs:
|
||||
|
||||
1. I have not yet located the source of the bug that prevents the
|
||||
date/time from being set (also ACLs etc.) when an existing file
|
||||
is overwritten. For some reason the call to delete & recreate
|
||||
the file is not being reached.
|
||||
|
||||
2. We need to do something in ZIP to store (as comments?) the file's
|
||||
type and ACL, and then here in UNZIP extract these and apply
|
||||
them. This is not going to be trivial to make foolproof, but
|
||||
it's badly needed.
|
||||
|
||||
------------------------------------------------------------------
|
||||
2-jun-94
|
||||
I fixed #1 above. The compiler was checking whether UNIX was defined,
|
||||
and it wasn't. It appears that *some* of the places UNIX is used are
|
||||
things we can't get along with, so I changed the code to check for
|
||||
AOS_VS as well. It seems to work just fine.
|
||||
|
||||
I also introduced a function zvs_credir() to create a directory
|
||||
(as opposed to a CPD, though it can create CPDs to with the proper
|
||||
file-type parameter). Directories in a path which are being created
|
||||
will now be directories instead of CPDs.
|
||||
|
||||
The big change that's needed now is to have ZIP store (somehow)
|
||||
the file's ACL and file type, and then to have UNZIP use this
|
||||
information to recreate the file as it was before ZIPping. Ideally,
|
||||
ZIP should also store links and CPD max-block info as well. Planned
|
||||
strategy: either in the name field but after the name, or in a comment,
|
||||
store the packet returned by ?FSTAT (using sys_fstat()), and then
|
||||
use this packet for the ?CREATE call in zvs_create().
|
||||
|
||||
------------------------------------------------------------------
|
||||
22-Jul-94
|
||||
The changes to use the extra-field field for AOS/VS file info are in
|
||||
place. In general, if a ZIPfile was created with the current rev of
|
||||
ZIP.PR, the files should be restored with file type, ACL, etc. OK.
|
||||
I didn't test to make sure element size & max index levels come
|
||||
through OK, but I think they should.
|
||||
|
||||
Unix symbolic links are now UNZIPped OK, but ZIP.PR isn't yet able
|
||||
to ZIP links. When it is, UNZIP should be ready.
|
||||
|
||||
In general UNZIP now ignores the searchlist fairly well, but not
|
||||
perfectly. If the directory of a file you're UNZIPping can be
|
||||
referenced elsewhere in the searchlist, UNZIP will find the file
|
||||
there. (For example, if the file UDD/BBASIC/ZZPGSUBSET.SR is in
|
||||
the ZIPfile, and : is in your searchlist, then UDD and UDD:BBASIC
|
||||
will be created under your current directory, but UNZIP will still
|
||||
find :UDD:BBASIC:ZZPGSUBSET.SR instead of =UDD:BBASIC:ZZPGSUBSET.SR.
|
||||
|
||||
Filenames (which are now stored in uppercase by ZIP.PR) must be
|
||||
matched exactly if specified. This applies to Unix path structure
|
||||
as well as case.
|
||||
|
||||
------------------------------------------------------------------
|
||||
4-Aug-94
|
||||
I fixed a bug which caused (for links only) the Unix pathname to
|
||||
be put through ux_to_vs_name twice. The result was that a path
|
||||
such as dir1/dir2/fname went first to :dir1:dir2:fname and
|
||||
then to dir1?dir2?fname.
|
||||
|
||||
I also added the /NOSEA switch to the cc/link lines in the macros
|
||||
MAKE.AOS_VS.CLI and REMAKE.CLI. This should prevent any confusion
|
||||
over whether a file exists somewhere other than relative to the current
|
||||
dir. This would disable calls to system() from using the searchlist,
|
||||
but in this program I think they're all useless & hopefully inactive
|
||||
anyway.
|
||||
|
||||
------------------------------------------------------------------
|
1585
programs/fs/unzip60/aosvs/aosvs.c
Normal file
1585
programs/fs/unzip60/aosvs/aosvs.c
Normal file
File diff suppressed because it is too large
Load Diff
66
programs/fs/unzip60/aosvs/aosvs.h
Normal file
66
programs/fs/unzip60/aosvs/aosvs.h
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
aosvs.h
|
||||
|
||||
AOS/VS-specific header file for use with Info-ZIP's UnZip 5.2 and later.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/* stuff to set up for system calls (?FSTAT & ?SACL) and the extra field */
|
||||
|
||||
#include <paru.h> /* parameter definitions */
|
||||
#include <packets/filestatus.h> /* AOS/VS ?FSTAT packet defs */
|
||||
#include <packets/create.h> /* AOS/VS ?CREATE packet defs */
|
||||
#include <sys_calls.h> /* AOS/VS system call interface */
|
||||
|
||||
#define ZEXTRA_HEADID "VS"
|
||||
#define ZEXTRA_SENTINEL "FCI"
|
||||
#define ZEXTRA_REV ((uch)10) /* change/use this in later revs */
|
||||
|
||||
|
||||
/* functions defined in zvs_create.c */
|
||||
|
||||
extern int zvs_create(ZCONST char *fname, long cretim, long modtim,
|
||||
long acctim, char *pacl, int ftyp, int eltsize,
|
||||
int maxindlev);
|
||||
extern int zvs_credir(ZCONST char *dname, long cretim, long modtim,
|
||||
long acctim, char *pacl, int ftyp, long maxblocks,
|
||||
int hashfsize, int maxindlev);
|
||||
extern long dgdate(short mm, short dd, short yy);
|
||||
extern char *ux_to_vs_name(char *outname, ZCONST char *inname);
|
||||
|
||||
|
||||
/* could probably avoid the unions - all elements in each one are the same
|
||||
* size, and we're going to assume this */
|
||||
|
||||
typedef union zvsfstat_stru {
|
||||
P_FSTAT norm_fstat_packet; /* normal fstat packet */
|
||||
P_FSTAT_DIR dir_fstat_packet; /* DIR/CPD fstat packet */
|
||||
P_FSTAT_UNIT unit_fstat_packet; /* unit (device) fstat packet */
|
||||
P_FSTAT_IPC ipc_fstat_packet; /* IPC file fstat packet */
|
||||
} ZVSFSTAT_STRU;
|
||||
|
||||
typedef union zvscreate_stru {
|
||||
P_CREATE norm_create_packet; /* normal create packet */
|
||||
P_CREATE_DIR dir_create_packet; /* DIR/CPD create packet */
|
||||
P_CREATE_IPC ipc_create_packet; /* IPC file create packet */
|
||||
} ZVSCREATE_STRU;
|
||||
|
||||
|
||||
typedef struct zextrafld {
|
||||
char extra_header_id[2]; /* set to VS - in theory, an int */
|
||||
char extra_data_size[2]; /* size of rest (little-endian) */
|
||||
char extra_sentinel[4]; /* set to FCI w/ trailing null */
|
||||
uch extra_rev; /* set to 10 for rev 1.0 */
|
||||
ZVSFSTAT_STRU fstat_packet; /* the fstat packet */
|
||||
char aclbuf[$MXACL]; /* the raw ACL */
|
||||
} ZEXTRAFLD;
|
5
programs/fs/unzip60/aosvs/make_unz.cli
Normal file
5
programs/fs/unzip60/aosvs/make_unz.cli
Normal file
@ -0,0 +1,5 @@
|
||||
push
|
||||
prompt pop
|
||||
searchlist :c_4.10 :c_4.10:lang_rt [!searchlist]
|
||||
cc/link/NOUNX/NOSEA SYSV/DEFINE TERMIO/DEFINE AOS_VS/DEFINE=1 PROTO/DEFINE S_IFLNK/DEFINE=0120000 TIME.H/INCLUDE <unzip crc32 crypt envargs explode extract fileio globals inflate list match process ttyio ubz2err unreduce unshrink zipinfo aosvs>.c
|
||||
pop
|
714
programs/fs/unzip60/api.c
Normal file
714
programs/fs/unzip60/api.c
Normal file
@ -0,0 +1,714 @@
|
||||
/*
|
||||
Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2009-Jan-02 or later
|
||||
(the contents of which are also included in unzip.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 an UnZip engine for use directly from C/C++
|
||||
programs. The functions are:
|
||||
|
||||
ZCONST UzpVer *UzpVersion(void);
|
||||
unsigned UzpVersion2(UzpVer2 *version)
|
||||
int UzpMain(int argc, char *argv[]);
|
||||
int UzpAltMain(int argc, char *argv[], UzpInit *init);
|
||||
int UzpValidate(char *archive, int AllCodes);
|
||||
void UzpFreeMemBuffer(UzpBuffer *retstr);
|
||||
int UzpUnzipToMemory(char *zip, char *file, UzpOpts *optflgs,
|
||||
UzpCB *UsrFuncts, UzpBuffer *retstr);
|
||||
|
||||
non-WINDLL only (a special WINDLL variant is defined in windll/windll.c):
|
||||
int UzpGrep(char *archive, char *file, char *pattern, int cmd, int SkipBin,
|
||||
UzpCB *UsrFuncts);
|
||||
|
||||
OS/2 only (for now):
|
||||
int UzpFileTree(char *name, cbList(callBack), char *cpInclude[],
|
||||
char *cpExclude[]);
|
||||
|
||||
You must define `DLL' in order to include the API extensions.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifdef OS2
|
||||
# define INCL_DOSMEMMGR
|
||||
# include <os2.h>
|
||||
#endif
|
||||
|
||||
#define UNZIP_INTERNAL
|
||||
#include "unzip.h"
|
||||
#ifdef WINDLL
|
||||
# ifdef POCKET_UNZIP
|
||||
# include "wince/intrface.h"
|
||||
# else
|
||||
# include "windll/windll.h"
|
||||
# endif
|
||||
#endif
|
||||
#include "unzvers.h"
|
||||
#include <setjmp.h>
|
||||
|
||||
#ifdef DLL /* This source file supplies DLL-only interface code. */
|
||||
|
||||
#ifndef POCKET_UNZIP /* WinCE pUnZip defines this elsewhere. */
|
||||
jmp_buf dll_error_return;
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Documented API entry points
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
ZCONST UzpVer * UZ_EXP UzpVersion() /* returns pointer to const struct */
|
||||
{
|
||||
static ZCONST UzpVer version = { /* doesn't change between calls */
|
||||
/* structure size */
|
||||
UZPVER_LEN,
|
||||
/* version flags */
|
||||
#ifdef BETA
|
||||
# ifdef ZLIB_VERSION
|
||||
3,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
#else
|
||||
# ifdef ZLIB_VERSION
|
||||
2,
|
||||
# else
|
||||
0,
|
||||
# endif
|
||||
#endif
|
||||
/* betalevel and date strings */
|
||||
UZ_BETALEVEL, UZ_VERSION_DATE,
|
||||
/* zlib_version string */
|
||||
#ifdef ZLIB_VERSION
|
||||
ZLIB_VERSION,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
/*== someday each of these may have a separate patchlevel: ==*/
|
||||
/* unzip version */
|
||||
{UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, 0},
|
||||
/* zipinfo version */
|
||||
{ZI_MAJORVER, ZI_MINORVER, UZ_PATCHLEVEL, 0},
|
||||
/* os2dll version (retained for backward compatibility) */
|
||||
{UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, 0},
|
||||
/* windll version (retained for backward compatibility)*/
|
||||
{UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, 0},
|
||||
#ifdef OS2DLL
|
||||
/* os2dll API minimum compatible version*/
|
||||
{UZ_OS2API_COMP_MAJOR, UZ_OS2API_COMP_MINOR, UZ_OS2API_COMP_REVIS, 0}
|
||||
#else /* !OS2DLL */
|
||||
#ifdef WINDLL
|
||||
/* windll API minimum compatible version*/
|
||||
{UZ_WINAPI_COMP_MAJOR, UZ_WINAPI_COMP_MINOR, UZ_WINAPI_COMP_REVIS, 0}
|
||||
#else /* !WINDLL */
|
||||
/* generic DLL API minimum compatible version*/
|
||||
{UZ_GENAPI_COMP_MAJOR, UZ_GENAPI_COMP_MINOR, UZ_GENAPI_COMP_REVIS, 0}
|
||||
#endif /* ?WINDLL */
|
||||
#endif /* ?OS2DLL */
|
||||
};
|
||||
|
||||
return &version;
|
||||
}
|
||||
|
||||
unsigned UZ_EXP UzpVersion2(UzpVer2 *version)
|
||||
{
|
||||
|
||||
if (version->structlen != sizeof(UzpVer2))
|
||||
return sizeof(UzpVer2);
|
||||
|
||||
#ifdef BETA
|
||||
version->flag = 1;
|
||||
#else
|
||||
version->flag = 0;
|
||||
#endif
|
||||
strcpy(version->betalevel, UZ_BETALEVEL);
|
||||
strcpy(version->date, UZ_VERSION_DATE);
|
||||
|
||||
#ifdef ZLIB_VERSION
|
||||
/* Although ZLIB_VERSION is a compile-time constant, we implement an
|
||||
"overrun-safe" copy because its actual value is not under our control.
|
||||
*/
|
||||
strncpy(version->zlib_version, ZLIB_VERSION,
|
||||
sizeof(version->zlib_version) - 1);
|
||||
version->zlib_version[sizeof(version->zlib_version) - 1] = '\0';
|
||||
version->flag |= 2;
|
||||
#else
|
||||
version->zlib_version[0] = '\0';
|
||||
#endif
|
||||
|
||||
/* someday each of these may have a separate patchlevel: */
|
||||
version->unzip.major = UZ_MAJORVER;
|
||||
version->unzip.minor = UZ_MINORVER;
|
||||
version->unzip.patchlevel = UZ_PATCHLEVEL;
|
||||
|
||||
version->zipinfo.major = ZI_MAJORVER;
|
||||
version->zipinfo.minor = ZI_MINORVER;
|
||||
version->zipinfo.patchlevel = UZ_PATCHLEVEL;
|
||||
|
||||
/* these are retained for backward compatibility only: */
|
||||
version->os2dll.major = UZ_MAJORVER;
|
||||
version->os2dll.minor = UZ_MINORVER;
|
||||
version->os2dll.patchlevel = UZ_PATCHLEVEL;
|
||||
|
||||
version->windll.major = UZ_MAJORVER;
|
||||
version->windll.minor = UZ_MINORVER;
|
||||
version->windll.patchlevel = UZ_PATCHLEVEL;
|
||||
|
||||
#ifdef OS2DLL
|
||||
/* os2dll API minimum compatible version*/
|
||||
version->dllapimin.major = UZ_OS2API_COMP_MAJOR;
|
||||
version->dllapimin.minor = UZ_OS2API_COMP_MINOR;
|
||||
version->dllapimin.patchlevel = UZ_OS2API_COMP_REVIS;
|
||||
#else /* !OS2DLL */
|
||||
#ifdef WINDLL
|
||||
/* windll API minimum compatible version*/
|
||||
version->dllapimin.major = UZ_WINAPI_COMP_MAJOR;
|
||||
version->dllapimin.minor = UZ_WINAPI_COMP_MINOR;
|
||||
version->dllapimin.patchlevel = UZ_WINAPI_COMP_REVIS;
|
||||
#else /* !WINDLL */
|
||||
/* generic DLL API minimum compatible version*/
|
||||
version->dllapimin.major = UZ_GENAPI_COMP_MAJOR;
|
||||
version->dllapimin.minor = UZ_GENAPI_COMP_MINOR;
|
||||
version->dllapimin.patchlevel = UZ_GENAPI_COMP_REVIS;
|
||||
#endif /* ?WINDLL */
|
||||
#endif /* ?OS2DLL */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef SFX
|
||||
#ifndef WINDLL
|
||||
|
||||
int UZ_EXP UzpAltMain(int argc, char *argv[], UzpInit *init)
|
||||
{
|
||||
int r, (*dummyfn)();
|
||||
|
||||
|
||||
CONSTRUCTGLOBALS();
|
||||
|
||||
if (init->structlen >= (sizeof(ulg) + sizeof(dummyfn)) && init->msgfn)
|
||||
G.message = init->msgfn;
|
||||
|
||||
if (init->structlen >= (sizeof(ulg) + 2*sizeof(dummyfn)) && init->inputfn)
|
||||
G.input = init->inputfn;
|
||||
|
||||
if (init->structlen >= (sizeof(ulg) + 3*sizeof(dummyfn)) && init->pausefn)
|
||||
G.mpause = init->pausefn;
|
||||
|
||||
if (init->structlen >= (sizeof(ulg) + 4*sizeof(dummyfn)) && init->userfn)
|
||||
(*init->userfn)(); /* allow void* arg? */
|
||||
|
||||
r = unzip(__G__ argc, argv);
|
||||
DESTROYGLOBALS();
|
||||
RETURN(r);
|
||||
}
|
||||
|
||||
#endif /* !WINDLL */
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __16BIT__
|
||||
|
||||
void UZ_EXP UzpFreeMemBuffer(UzpBuffer *retstr)
|
||||
{
|
||||
if (retstr != NULL && retstr->strptr != NULL) {
|
||||
free(retstr->strptr);
|
||||
retstr->strptr = NULL;
|
||||
retstr->strlength = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef WINDLL
|
||||
|
||||
static int UzpDLL_Init OF((zvoid *pG, UzpCB *UsrFuncts));
|
||||
|
||||
static int UzpDLL_Init(pG, UsrFuncts)
|
||||
zvoid *pG;
|
||||
UzpCB *UsrFuncts;
|
||||
{
|
||||
int (*dummyfn)();
|
||||
|
||||
if (UsrFuncts->structlen >= (sizeof(ulg) + sizeof(dummyfn)) &&
|
||||
UsrFuncts->msgfn)
|
||||
((Uz_Globs *)pG)->message = UsrFuncts->msgfn;
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
if (UsrFuncts->structlen >= (sizeof(ulg) + 2*sizeof(dummyfn)) &&
|
||||
UsrFuncts->inputfn)
|
||||
((Uz_Globs *)pG)->input = UsrFuncts->inputfn;
|
||||
|
||||
if (UsrFuncts->structlen >= (sizeof(ulg) + 3*sizeof(dummyfn)) &&
|
||||
UsrFuncts->pausefn)
|
||||
((Uz_Globs *)pG)->mpause = UsrFuncts->pausefn;
|
||||
|
||||
if (UsrFuncts->structlen >= (sizeof(ulg) + 4*sizeof(dummyfn)) &&
|
||||
UsrFuncts->passwdfn)
|
||||
((Uz_Globs *)pG)->decr_passwd = UsrFuncts->passwdfn;
|
||||
|
||||
if (UsrFuncts->structlen >= (sizeof(ulg) + 5*sizeof(dummyfn)) &&
|
||||
UsrFuncts->statrepfn)
|
||||
((Uz_Globs *)pG)->statreportcb = UsrFuncts->statrepfn;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
int UZ_EXP UzpUnzipToMemory(char *zip, char *file, UzpOpts *optflgs,
|
||||
UzpCB *UsrFuncts, UzpBuffer *retstr)
|
||||
{
|
||||
int r;
|
||||
#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO))
|
||||
char *intern_zip, *intern_file;
|
||||
#endif
|
||||
|
||||
CONSTRUCTGLOBALS();
|
||||
#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO))
|
||||
intern_zip = (char *)malloc(strlen(zip)+1);
|
||||
if (intern_zip == NULL) {
|
||||
DESTROYGLOBALS();
|
||||
return PK_MEM;
|
||||
}
|
||||
intern_file = (char *)malloc(strlen(file)+1);
|
||||
if (intern_file == NULL) {
|
||||
DESTROYGLOBALS();
|
||||
free(intern_zip);
|
||||
return PK_MEM;
|
||||
}
|
||||
ISO_TO_INTERN(zip, intern_zip);
|
||||
ISO_TO_INTERN(file, intern_file);
|
||||
# define zip intern_zip
|
||||
# define file intern_file
|
||||
#endif
|
||||
/* Copy those options that are meaningful for UzpUnzipToMemory, instead of
|
||||
* a simple "memcpy(G.UzO, optflgs, sizeof(UzpOpts));"
|
||||
*/
|
||||
uO.pwdarg = optflgs->pwdarg;
|
||||
uO.aflag = optflgs->aflag;
|
||||
uO.C_flag = optflgs->C_flag;
|
||||
uO.qflag = optflgs->qflag; /* currently, overridden in unzipToMemory */
|
||||
|
||||
if (!UzpDLL_Init((zvoid *)&G, UsrFuncts)) {
|
||||
DESTROYGLOBALS();
|
||||
return PK_BADERR;
|
||||
}
|
||||
G.redirect_data = 1;
|
||||
|
||||
r = (unzipToMemory(__G__ zip, file, retstr) <= PK_WARN);
|
||||
|
||||
DESTROYGLOBALS();
|
||||
#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO))
|
||||
# undef file
|
||||
# undef zip
|
||||
free(intern_file);
|
||||
free(intern_zip);
|
||||
#endif
|
||||
if (!r && retstr->strlength) {
|
||||
free(retstr->strptr);
|
||||
retstr->strptr = NULL;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#endif /* !WINDLL */
|
||||
#endif /* !__16BIT__ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef OS2DLL
|
||||
|
||||
int UZ_EXP UzpFileTree(char *name, cbList(callBack), char *cpInclude[],
|
||||
char *cpExclude[])
|
||||
{
|
||||
int r;
|
||||
|
||||
CONSTRUCTGLOBALS();
|
||||
uO.qflag = 2;
|
||||
uO.vflag = 1;
|
||||
uO.C_flag = 1;
|
||||
G.wildzipfn = name;
|
||||
G.process_all_files = TRUE;
|
||||
if (cpInclude) {
|
||||
char **ptr = cpInclude;
|
||||
|
||||
while (*ptr != NULL) ptr++;
|
||||
G.filespecs = ptr - cpInclude;
|
||||
G.pfnames = cpInclude, G.process_all_files = FALSE;
|
||||
}
|
||||
if (cpExclude) {
|
||||
char **ptr = cpExclude;
|
||||
|
||||
while (*ptr != NULL) ptr++;
|
||||
G.xfilespecs = ptr - cpExclude;
|
||||
G.pxnames = cpExclude, G.process_all_files = FALSE;
|
||||
}
|
||||
|
||||
G.processExternally = callBack;
|
||||
r = process_zipfiles(__G)==0;
|
||||
DESTROYGLOBALS();
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif /* OS2DLL */
|
||||
#endif /* !SFX */
|
||||
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Helper functions
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
void setFileNotFound(__G)
|
||||
__GDEF
|
||||
{
|
||||
G.filenotfound++;
|
||||
}
|
||||
|
||||
|
||||
#ifndef SFX
|
||||
|
||||
int unzipToMemory(__GPRO__ char *zip, char *file, UzpBuffer *retstr)
|
||||
{
|
||||
int r;
|
||||
char *incname[2];
|
||||
|
||||
if ((zip == NULL) || (strlen(zip) > ((WSIZE>>2) - 160)))
|
||||
return PK_PARAM;
|
||||
if ((file == NULL) || (strlen(file) > ((WSIZE>>2) - 160)))
|
||||
return PK_PARAM;
|
||||
|
||||
G.process_all_files = FALSE;
|
||||
G.extract_flag = TRUE;
|
||||
uO.qflag = 2;
|
||||
G.wildzipfn = zip;
|
||||
|
||||
G.pfnames = incname;
|
||||
incname[0] = file;
|
||||
incname[1] = NULL;
|
||||
G.filespecs = 1;
|
||||
|
||||
r = process_zipfiles(__G);
|
||||
if (retstr) {
|
||||
retstr->strptr = (char *)G.redirect_buffer;
|
||||
retstr->strlength = G.redirect_size;
|
||||
}
|
||||
return r; /* returns `PK_???' error values */
|
||||
}
|
||||
|
||||
#endif /* !SFX */
|
||||
|
||||
/*
|
||||
With the advent of 64 bit support, for now I am assuming that
|
||||
if the size of the file is greater than an unsigned long, there
|
||||
will simply not be enough memory to handle it, and am returning
|
||||
FALSE.
|
||||
*/
|
||||
int redirect_outfile(__G)
|
||||
__GDEF
|
||||
{
|
||||
#ifdef ZIP64_SUPPORT
|
||||
__int64 check_conversion;
|
||||
#endif
|
||||
|
||||
if (G.redirect_size != 0 || G.redirect_buffer != NULL)
|
||||
return FALSE;
|
||||
|
||||
#ifndef NO_SLIDE_REDIR
|
||||
G.redirect_slide = !G.pInfo->textmode;
|
||||
#endif
|
||||
#if (lenEOL != 1)
|
||||
if (G.pInfo->textmode) {
|
||||
G.redirect_size = (ulg)(G.lrec.ucsize * lenEOL);
|
||||
if (G.redirect_size < G.lrec.ucsize)
|
||||
G.redirect_size = (ulg)((G.lrec.ucsize > (ulg)-2L) ?
|
||||
G.lrec.ucsize : -2L);
|
||||
#ifdef ZIP64_SUPPORT
|
||||
check_conversion = G.lrec.ucsize * lenEOL;
|
||||
#endif
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
G.redirect_size = (ulg)G.lrec.ucsize;
|
||||
#ifdef ZIP64_SUPPORT
|
||||
check_conversion = (__int64)G.lrec.ucsize;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ZIP64_SUPPORT
|
||||
if ((__int64)G.redirect_size != check_conversion)
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
#ifdef __16BIT__
|
||||
if ((ulg)((extent)G.redirect_size) != G.redirect_size)
|
||||
return FALSE;
|
||||
#endif
|
||||
#ifdef OS2
|
||||
DosAllocMem((void **)&G.redirect_buffer, G.redirect_size+1,
|
||||
PAG_READ|PAG_WRITE|PAG_COMMIT);
|
||||
G.redirect_pointer = G.redirect_buffer;
|
||||
#else
|
||||
G.redirect_pointer =
|
||||
G.redirect_buffer = malloc((extent)(G.redirect_size+1));
|
||||
#endif
|
||||
if (!G.redirect_buffer)
|
||||
return FALSE;
|
||||
G.redirect_pointer[G.redirect_size] = '\0';
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int writeToMemory(__GPRO__ ZCONST uch *rawbuf, extent size)
|
||||
{
|
||||
int errflg = FALSE;
|
||||
|
||||
if ((uch *)rawbuf != G.redirect_pointer) {
|
||||
extent redir_avail = (G.redirect_buffer + G.redirect_size) -
|
||||
G.redirect_pointer;
|
||||
|
||||
/* Check for output buffer overflow */
|
||||
if (size > redir_avail) {
|
||||
/* limit transfer data to available space, set error return flag */
|
||||
size = redir_avail;
|
||||
errflg = TRUE;
|
||||
}
|
||||
memcpy(G.redirect_pointer, rawbuf, size);
|
||||
}
|
||||
G.redirect_pointer += size;
|
||||
return errflg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int close_redirect(__G)
|
||||
__GDEF
|
||||
{
|
||||
if (G.pInfo->textmode) {
|
||||
*G.redirect_pointer = '\0';
|
||||
G.redirect_size = (ulg)(G.redirect_pointer - G.redirect_buffer);
|
||||
if ((G.redirect_buffer =
|
||||
realloc(G.redirect_buffer, G.redirect_size + 1)) == NULL) {
|
||||
G.redirect_size = 0;
|
||||
return EOF;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef SFX
|
||||
#ifndef __16BIT__
|
||||
#ifndef WINDLL
|
||||
|
||||
/* Purpose: Determine if file in archive contains the string szSearch
|
||||
|
||||
Parameters: archive = archive name
|
||||
file = file contained in the archive. This cannot be
|
||||
a wildcard to be meaningful
|
||||
pattern = string to search for
|
||||
cmd = 0 - case-insensitive search
|
||||
1 - case-sensitve search
|
||||
2 - case-insensitive, whole words only
|
||||
3 - case-sensitive, whole words only
|
||||
SkipBin = if true, skip any files that have control
|
||||
characters other than CR, LF, or tab in the first
|
||||
100 characters.
|
||||
|
||||
Returns: TRUE if a match is found
|
||||
FALSE if no match is found
|
||||
-1 on error
|
||||
|
||||
Comments: This does not pretend to be as useful as the standard
|
||||
Unix grep, which returns the strings associated with a
|
||||
particular pattern, nor does it search past the first
|
||||
matching occurrence of the pattern.
|
||||
*/
|
||||
|
||||
int UZ_EXP UzpGrep(char *archive, char *file, char *pattern, int cmd,
|
||||
int SkipBin, UzpCB *UsrFuncts)
|
||||
{
|
||||
int retcode = FALSE, compare;
|
||||
ulg i, j, patternLen, buflen;
|
||||
char * sz, *p;
|
||||
UzpOpts flgopts;
|
||||
UzpBuffer retstr;
|
||||
|
||||
memzero(&flgopts, sizeof(UzpOpts)); /* no special options */
|
||||
|
||||
if (!UzpUnzipToMemory(archive, file, &flgopts, UsrFuncts, &retstr)) {
|
||||
return -1; /* not enough memory, file not found, or other error */
|
||||
}
|
||||
|
||||
if (SkipBin) {
|
||||
if (retstr.strlength < 100)
|
||||
buflen = retstr.strlength;
|
||||
else
|
||||
buflen = 100;
|
||||
for (i = 0; i < buflen; i++) {
|
||||
if (iscntrl(retstr.strptr[i])) {
|
||||
if ((retstr.strptr[i] != 0x0A) &&
|
||||
(retstr.strptr[i] != 0x0D) &&
|
||||
(retstr.strptr[i] != 0x09))
|
||||
{
|
||||
/* OK, we now think we have a binary file of some sort */
|
||||
free(retstr.strptr);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
patternLen = strlen(pattern);
|
||||
|
||||
if (retstr.strlength < patternLen) {
|
||||
free(retstr.strptr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
sz = malloc(patternLen + 3); /* add two in case doing whole words only */
|
||||
if (cmd > 1) {
|
||||
strcpy(sz, " ");
|
||||
strcat(sz, pattern);
|
||||
strcat(sz, " ");
|
||||
} else
|
||||
strcpy(sz, pattern);
|
||||
|
||||
if ((cmd == 0) || (cmd == 2)) {
|
||||
for (i = 0; i < strlen(sz); i++)
|
||||
sz[i] = toupper(sz[i]);
|
||||
for (i = 0; i < retstr.strlength; i++)
|
||||
retstr.strptr[i] = toupper(retstr.strptr[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < (retstr.strlength - patternLen); i++) {
|
||||
p = &retstr.strptr[i];
|
||||
compare = TRUE;
|
||||
for (j = 0; j < patternLen; j++) {
|
||||
/* We cannot do strncmp here, as we may be dealing with a
|
||||
* "binary" file, such as a word processing file, or perhaps
|
||||
* even a true executable of some sort. */
|
||||
if (p[j] != sz[j]) {
|
||||
compare = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (compare == TRUE) {
|
||||
retcode = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(sz);
|
||||
free(retstr.strptr);
|
||||
|
||||
return retcode;
|
||||
}
|
||||
#endif /* !WINDLL */
|
||||
#endif /* !__16BIT__ */
|
||||
|
||||
|
||||
|
||||
int UZ_EXP UzpValidate(char *archive, int AllCodes)
|
||||
{
|
||||
int retcode;
|
||||
CONSTRUCTGLOBALS();
|
||||
|
||||
uO.jflag = 1;
|
||||
uO.tflag = 1;
|
||||
uO.overwrite_none = 0;
|
||||
G.extract_flag = (!uO.zipinfo_mode &&
|
||||
!uO.cflag && !uO.tflag && !uO.vflag && !uO.zflag
|
||||
#ifdef TIMESTAMP
|
||||
&& !uO.T_flag
|
||||
#endif
|
||||
);
|
||||
|
||||
uO.qflag = 2; /* turn off all messages */
|
||||
G.fValidate = TRUE;
|
||||
G.pfnames = (char **)&fnames[0]; /* assign default filename vector */
|
||||
|
||||
if (archive == NULL) { /* something is screwed up: no filename */
|
||||
DESTROYGLOBALS();
|
||||
retcode = PK_NOZIP;
|
||||
goto exit_retcode;
|
||||
}
|
||||
|
||||
if (strlen(archive) >= FILNAMSIZ) {
|
||||
/* length of supplied archive name exceed the system's filename limit */
|
||||
DESTROYGLOBALS();
|
||||
retcode = PK_PARAM;
|
||||
goto exit_retcode;
|
||||
}
|
||||
|
||||
G.wildzipfn = (char *)malloc(FILNAMSIZ);
|
||||
strcpy(G.wildzipfn, archive);
|
||||
#if (defined(WINDLL) && !defined(CRTL_CP_IS_ISO))
|
||||
_ISO_INTERN(G.wildzipfn);
|
||||
#endif
|
||||
|
||||
#ifdef WINDLL
|
||||
Wiz_NoPrinting(TRUE);
|
||||
#endif
|
||||
|
||||
G.process_all_files = TRUE; /* for speed */
|
||||
|
||||
if (setjmp(dll_error_return) != 0) {
|
||||
#ifdef WINDLL
|
||||
Wiz_NoPrinting(FALSE);
|
||||
#endif
|
||||
free(G.wildzipfn);
|
||||
DESTROYGLOBALS();
|
||||
retcode = PK_BADERR;
|
||||
goto exit_retcode;
|
||||
}
|
||||
|
||||
retcode = process_zipfiles(__G);
|
||||
|
||||
free(G.wildzipfn);
|
||||
#ifdef WINDLL
|
||||
Wiz_NoPrinting(FALSE);
|
||||
#endif
|
||||
DESTROYGLOBALS();
|
||||
|
||||
/* PK_WARN == 1 and PK_FIND == 11. When we are just looking at an
|
||||
archive, we should still be able to see the files inside it,
|
||||
even if we can't decode them for some reason.
|
||||
|
||||
We also still want to be able to get at files even if there is
|
||||
something odd about the zip archive, hence allow PK_WARN,
|
||||
PK_FIND, IZ_UNSUP as well as PK_ERR
|
||||
*/
|
||||
|
||||
exit_retcode:
|
||||
if (AllCodes)
|
||||
return retcode;
|
||||
|
||||
if ((retcode == PK_OK) || (retcode == PK_WARN) || (retcode == PK_ERR) ||
|
||||
(retcode == IZ_UNSUP) || (retcode == PK_FIND))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif /* !SFX */
|
||||
#endif /* DLL */
|
155
programs/fs/unzip60/apihelp.c
Normal file
155
programs/fs/unzip60/apihelp.c
Normal file
@ -0,0 +1,155 @@
|
||||
/*
|
||||
Copyright (c) 1990-2001 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/* apihelp.c */
|
||||
|
||||
#ifdef API_DOC
|
||||
|
||||
#define UNZIP_INTERNAL
|
||||
#include "unzip.h"
|
||||
#include "unzvers.h"
|
||||
|
||||
|
||||
APIDocStruct APIDoc[] = {
|
||||
{
|
||||
"UZPVERSION" , "UzpVersion" ,
|
||||
"UzpVer *UzpVersion(void);",
|
||||
"Get version numbers of the API and the underlying UnZip code.\n\n"
|
||||
"\t\tThis is used for comparing the version numbers of the run-time\n"
|
||||
"\t\tDLL code with those expected from the unzip.h at compile time.\n"
|
||||
"\t\tIf the version numbers do not match, there may be compatibility\n"
|
||||
"\t\tproblems with further use of the DLL.\n\n"
|
||||
" Example:\t/* Check the major version number of the DLL code. */\n"
|
||||
"\t\tUzpVer *pVersion;\n"
|
||||
"\t\tpVersion = UzpVersion();\n"
|
||||
"\t\tif (pVersion->unzip.major != UZ_MAJORVER)\n"
|
||||
"\t\t fprintf(stderr, \"error: using wrong version of DLL\\n\");\n\n"
|
||||
"\t\tSee unzip.h for details and unzipstb.c for an example.\n"
|
||||
},
|
||||
|
||||
{
|
||||
"UZPMAIN" , "UzpMain" ,
|
||||
"int UzpMain(int argc, char *argv[]);",
|
||||
"Provide a direct entry point to the command line interface.\n\n"
|
||||
"\t\tThis is used by the UnZip stub but you can use it in your\n"
|
||||
"\t\town program as well. Output is sent to stdout.\n"
|
||||
"\t\t0 on return indicates success.\n\n"
|
||||
" Example:\t/* Extract 'test.zip' silently, junking paths. */\n"
|
||||
"\t\tchar *argv[] = { \"-q\", \"-j\", \"test.zip\" };\n"
|
||||
"\t\tint argc = 3;\n"
|
||||
"\t\tif (UzpMain(argc,argv))\n"
|
||||
"\t\t printf(\"error: unzip failed\\n\");\n\n"
|
||||
"\t\tSee unzip.h for details.\n"
|
||||
},
|
||||
|
||||
{
|
||||
"UZPALTMAIN" , "UzpAltMain" ,
|
||||
"int UzpAltMain(int argc, char *argv[], UzpInit *init);",
|
||||
"Provide a direct entry point to the command line interface,\n"
|
||||
"optionally installing replacement I/O handler functions.\n\n"
|
||||
"\t\tAs with UzpMain(), output is sent to stdout by default.\n"
|
||||
"\t\t`InputFn *inputfn' is not yet implemented. 0 on return\n"
|
||||
"\t\tindicates success.\n\n"
|
||||
" Example:\t/* Replace normal output and `more' functions. */\n"
|
||||
"\t\tchar *argv[] = { \"-q\", \"-j\", \"test.zip\" };\n"
|
||||
"\t\tint argc = 3;\n"
|
||||
"\t\tUzpInit init = { 16, MyMessageFn, NULL, MyPauseFn };\n"
|
||||
"\t\tif (UzpAltMain(argc,argv,&init))\n"
|
||||
"\t\t printf(\"error: unzip failed\\n\");\n\n"
|
||||
"\t\tSee unzip.h for details.\n"
|
||||
},
|
||||
|
||||
{
|
||||
"UZPUNZIPTOMEMORY", "UzpUnzipToMemory",
|
||||
"int UzpUnzipToMemory(char *zip, char *file, UzpBuffer *retstr);",
|
||||
"Pass the name of the zip file and the name of the file\n"
|
||||
"\t\tyou wish to extract. UzpUnzipToMemory will create a\n"
|
||||
"\t\tbuffer and return it in *retstr; 0 on return indicates\n"
|
||||
"\t\tfailure.\n\n"
|
||||
"\t\tSee unzip.h for details.\n"
|
||||
},
|
||||
|
||||
{
|
||||
"UZPFILETREE", "UzpFileTree",
|
||||
"int UzpFileTree(char *name, cbList(callBack),\n"
|
||||
"\t\t\tchar *cpInclude[], char *cpExclude[]);",
|
||||
"Pass the name of the zip file, a callback function, an\n"
|
||||
"\t\tinclude and exclude file list. UzpFileTree calls the\n"
|
||||
"\t\tcallback for each valid file found in the zip file.\n"
|
||||
"\t\t0 on return indicates failure.\n\n"
|
||||
"\t\tSee unzip.h for details.\n"
|
||||
},
|
||||
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
||||
static int function_help OF((__GPRO__ APIDocStruct *doc, char *fname));
|
||||
|
||||
|
||||
|
||||
static int function_help(__G__ doc, fname)
|
||||
__GDEF
|
||||
APIDocStruct *doc;
|
||||
char *fname;
|
||||
{
|
||||
strcpy(slide, fname);
|
||||
/* strupr(slide); non-standard */
|
||||
while (doc->compare && STRNICMP(doc->compare,slide,strlen(fname)))
|
||||
doc++;
|
||||
if (!doc->compare)
|
||||
return 0;
|
||||
else
|
||||
Info(slide, 0, ((char *)slide,
|
||||
" Function:\t%s\n\n Syntax:\t%s\n\n Purpose:\t%s",
|
||||
doc->function, doc->syntax, doc->purpose));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void APIhelp(__G__ argc, argv)
|
||||
__GDEF
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
if (argc > 1) {
|
||||
struct APIDocStruct *doc;
|
||||
|
||||
if (function_help(__G__ APIDoc, argv[1]))
|
||||
return;
|
||||
#ifdef SYSTEM_API_DETAILS
|
||||
if (function_help(__G__ SYSTEM_API_DETAILS, argv[1]))
|
||||
return;
|
||||
#endif
|
||||
Info(slide, 0, ((char *)slide,
|
||||
"%s is not a documented command.\n\n", argv[1]));
|
||||
}
|
||||
|
||||
Info(slide, 0, ((char *)slide, "\
|
||||
This API provides a number of external C and REXX functions for handling\n\
|
||||
zipfiles in OS/2. Programmers are encouraged to expand this API.\n\
|
||||
\n\
|
||||
C functions: -- See unzip.h for details\n\
|
||||
UzpVer *UzpVersion(void);\n\
|
||||
int UzpMain(int argc, char *argv[]);\n\
|
||||
int UzpAltMain(int argc, char *argv[], UzpInit *init);\n\
|
||||
int UzpUnzipToMemory(char *zip, char *file, UzpBuffer *retstr);\n\
|
||||
int UzpFileTree(char *name, cbList(callBack),\n\
|
||||
char *cpInclude[], char *cpExclude[]);\n\n"));
|
||||
|
||||
#ifdef SYSTEM_API_BRIEF
|
||||
Info(slide, 0, ((char *)slide, SYSTEM_API_BRIEF));
|
||||
#endif
|
||||
|
||||
Info(slide, 0, ((char *)slide,
|
||||
"\nFor more information, type 'unzip -A <function-name>'\n"));
|
||||
}
|
||||
|
||||
#endif /* API_DOC */
|
12
programs/fs/unzip60/atari/Contents
Normal file
12
programs/fs/unzip60/atari/Contents
Normal file
@ -0,0 +1,12 @@
|
||||
Contents of the "atari" sub-archive for UnZip 5.3 and later:
|
||||
|
||||
Contents this file
|
||||
README.old old notes on compiling UnZip, from author of Atari port
|
||||
Makefile.old makefile for GNU C compiler and MiNT libraries
|
||||
Makefile newer, Unix-based makefile (lots of unnecessary baggage :-( )
|
||||
make_unz.mup script file for invoking makefile(s)?
|
||||
atari.c Atari-specific routines
|
||||
|
||||
The maintainers of the Atari port have fallen behind in their duties; the
|
||||
code *probably* compiles, but it has not been tested recently. Feel free
|
||||
to send zip-bugs e-mail about this sorry state of affairs.
|
304
programs/fs/unzip60/atari/Makefile
Normal file
304
programs/fs/unzip60/atari/Makefile
Normal file
@ -0,0 +1,304 @@
|
||||
#==============================================================================
|
||||
# Makefile for UnZip, UnZipSFX and fUnZip: Atari ("real" makes only)
|
||||
# Version: 5.53 25 December 2006
|
||||
#==============================================================================
|
||||
|
||||
|
||||
# INSTRUCTIONS (such as they are):
|
||||
#
|
||||
# "make" -- makes UnZip on a generic Atari
|
||||
#
|
||||
# CF are flags for the C compiler. LF are flags for the loader. LF2 are more
|
||||
# flags for the loader, if they need to be at the end of the line instead of at
|
||||
# the beginning (for example, some libraries). FL and FL2 are the corre-
|
||||
# sponding flags for fUnZip. LOCAL_UNZIP is an environment variable that can
|
||||
# be used to add default C flags to your compile without editing the Makefile
|
||||
# (e.g., -DDEBUG_STRUC, or -FPi87 on PCs using Microsoft C).
|
||||
#
|
||||
# Be sure to test your new UnZip (and UnZipSFX and fUnZip); successful compila-
|
||||
# tion does not always imply a working program.
|
||||
|
||||
|
||||
#####################
|
||||
# MACRO DEFINITIONS #
|
||||
#####################
|
||||
|
||||
# Defaults most systems use (use LOCAL_UNZIP in environment to add flags,
|
||||
# such as -DDOSWILD).
|
||||
|
||||
# UnZip flags
|
||||
CC = gcc# try using "gcc" target rather than changing this (if you do,
|
||||
LD = $(CC)# you MUST change LD, too--else "unresolved symbol: ___main")
|
||||
LOC = $(LOCAL_UNZIP)
|
||||
CF = $(CFLAGS) $(LOC)
|
||||
LF = -o unzip$E
|
||||
LF2 = -s
|
||||
|
||||
# UnZipSFX flags
|
||||
SL = -o unzipsfx$E
|
||||
SL2 = $(LF2)
|
||||
|
||||
# fUnZip flags
|
||||
FL = -o funzip$E
|
||||
FL2 = $(LF2)
|
||||
|
||||
# general-purpose stuff
|
||||
CP = ln -s
|
||||
LN = ln
|
||||
RM = rm -f
|
||||
CHMOD = chmod
|
||||
STRIP = strip
|
||||
E = .ttp
|
||||
O = .o
|
||||
M = atari
|
||||
SHELL = /bin/sh
|
||||
|
||||
# object files
|
||||
OBJS1 = unzip$O crc32$O crypt$O envargs$O explode$O
|
||||
OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
|
||||
OBJS3 = process$O ttyio$O ubz2err$O unreduce$O unshrink$O zipinfo$O
|
||||
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
|
||||
LOBJS = $(OBJS)
|
||||
OBJSDLL = $(OBJS) api$O
|
||||
OBJX = unzipsfx$O crc32$O crypt_$O extract_$O fileio_$O \
|
||||
globals_$O inflate_$O match_$O process_$O ttyio_$O ubz2err_$O $M_$O
|
||||
LOBJX = $(OBJX)
|
||||
OBJF = funzip$O crc32$O cryptf$O globalsf$O inflatef$O ttyiof$O
|
||||
#OBJS_OS2 = $(OBJS1:.o=.obj) $(OBJS2:.o=.obj) os2.obj
|
||||
#OBJF_OS2 = $(OBJF:.o=.obj)
|
||||
|
||||
UNZIP_H = unzip.h unzpriv.h globals.h
|
||||
|
||||
# installation
|
||||
INSTALL = cp# probably can change this to 'install' if you have it
|
||||
# on some systems, manext=l and MANDIR=/usr/man/man$(manext) may be appropriate
|
||||
manext = 1
|
||||
prefix = /usr/local
|
||||
BINDIR = $(prefix)/bin# where to install executables
|
||||
MANDIR = $(prefix)/man/man$(manext)# where to install man pages
|
||||
INSTALLEDBIN = $(BINDIR)/funzip$E $(BINDIR)/zipinfo$E $(BINDIR)/unzipsfx$E \
|
||||
$(BINDIR)/unzip$E
|
||||
INSTALLEDMAN = $(MANDIR)/unzip.$(manext) $(MANDIR)/funzip.$(manext) \
|
||||
$(MANDIR)/unzipsfx.$(manext) $(MANDIR)/zipinfo.$(manext)
|
||||
#
|
||||
UNZIPS = unzip$E funzip$E unzipsfx$E
|
||||
# this is a little ugly...well, no, it's a lot ugly:
|
||||
MANS = man/unzip.1 man/unzipsfx.1 man/zipinfo.1 man/funzip.1
|
||||
DOCS = unzip.txt unzipsfx.txt zipinfo.txt funzip.txt
|
||||
|
||||
|
||||
###############################################
|
||||
# BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES #
|
||||
###############################################
|
||||
|
||||
# this is for GNU make; comment out and notify zip-bugs if it causes errors
|
||||
.SUFFIXES: .c .o .obj
|
||||
|
||||
# yes, we should be able to use the $O macro to combine these two, but it
|
||||
# fails on some brain-damaged makes (e.g., AIX's)...no big deal
|
||||
.c.o:
|
||||
$(CC) -c $(CF) $*.c
|
||||
|
||||
.c.obj:
|
||||
$(CC) -c $(CF) $*.c
|
||||
|
||||
|
||||
####################
|
||||
# DEFAULT HANDLING #
|
||||
####################
|
||||
|
||||
|
||||
all: unzips
|
||||
unzips: $(UNZIPS)
|
||||
docs: $(DOCS)
|
||||
unzipsman: unzips docs
|
||||
unzipsdocs: unzips docs
|
||||
|
||||
|
||||
unzip$E: $(OBJS)
|
||||
$(LD) $(LF) $(LOBJS) $(LF2)
|
||||
|
||||
unzipsfx$E: $(OBJX)
|
||||
$(LD) $(SL) $(LOBJX) $(SL2)
|
||||
|
||||
funzip$E: $(OBJF)
|
||||
$(LD) $(FL) $(OBJF) $(FL2)
|
||||
|
||||
|
||||
crc32$O: crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
crypt$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
envargs$O: envargs.c $(UNZIP_H)
|
||||
explode$O: explode.c $(UNZIP_H)
|
||||
extract$O: extract.c $(UNZIP_H) crc32.h crypt.h
|
||||
fileio$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
|
||||
funzip$O: funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
|
||||
globals$O: globals.c $(UNZIP_H)
|
||||
inflate$O: inflate.c inflate.h $(UNZIP_H)
|
||||
list$O: list.c $(UNZIP_H)
|
||||
match$O: match.c $(UNZIP_H)
|
||||
process$O: process.c $(UNZIP_H) crc32.h
|
||||
ttyio$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
ubz2err$O: ubz2err.c $(UNZIP_H)
|
||||
unreduce$O: unreduce.c $(UNZIP_H)
|
||||
unshrink$O: unshrink.c $(UNZIP_H)
|
||||
unzip$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
|
||||
zipinfo$O: zipinfo.c $(UNZIP_H)
|
||||
|
||||
# unzipsfx only
|
||||
crypt_$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
$(CP) crypt.c crypt_.c
|
||||
$(CC) -c $(CF) -DSFX crypt_.c
|
||||
$(RM) crypt_.c
|
||||
|
||||
extract_$O: extract.c $(UNZIP_H) crc32.h crypt.h
|
||||
$(CP) extract.c extract_.c
|
||||
$(CC) -c $(CF) -DSFX extract_.c
|
||||
$(RM) extract_.c
|
||||
|
||||
fileio_$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
|
||||
$(CP) fileio.c fileio_.c
|
||||
$(CC) -c $(CF) -DSFX fileio_.c
|
||||
$(RM) fileio_.c
|
||||
|
||||
globals_$O: globals.c $(UNZIP_H)
|
||||
$(CP) globals.c globals_.c
|
||||
$(CC) -c $(CF) -DSFX globals_.c
|
||||
$(RM) globals_.c
|
||||
|
||||
inflate_$O: inflate.c inflate.h $(UNZIP_H) crypt.h
|
||||
$(CP) inflate.c inflate_.c
|
||||
$(CC) -c $(CF) -DSFX inflate_.c
|
||||
$(RM) inflate_.c
|
||||
|
||||
match_$O: match.c $(UNZIP_H)
|
||||
$(CP) match.c match_.c
|
||||
$(CC) -c $(CF) -DSFX match_.c
|
||||
$(RM) match_.c
|
||||
|
||||
process_$O: process.c $(UNZIP_H) crc32.h
|
||||
$(CP) process.c process_.c
|
||||
$(CC) -c $(CF) -DSFX process_.c
|
||||
$(RM) process_.c
|
||||
|
||||
ttyio_$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
$(CP) ttyio.c ttyio_.c
|
||||
$(CC) -c $(CF) -DSFX ttyio_.c
|
||||
$(RM) ttyio_.c
|
||||
|
||||
ubz2err$O: ubz2err.c $(UNZIP_H)
|
||||
$(CP) ubz2err.c ubz2err_.c
|
||||
$(CC) -c $(CF) -DSFX ubz2err_.c
|
||||
$(RM) ubz2err_.c
|
||||
|
||||
unzipsfx$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
|
||||
$(CP) unzip.c unzipsfx.c
|
||||
$(CC) -c $(CF) -DSFX unzipsfx.c
|
||||
$(RM) unzipsfx.c
|
||||
|
||||
|
||||
# funzip only
|
||||
cryptf$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
$(CP) crypt.c cryptf.c
|
||||
$(CC) -c $(CF) -DFUNZIP cryptf.c
|
||||
$(RM) cryptf.c
|
||||
|
||||
globalsf$O: globals.c $(UNZIP_H)
|
||||
$(CP) globals.c globalsf.c
|
||||
$(CC) -c $(CF) -DFUNZIP globalsf.c
|
||||
$(RM) globalsf.c
|
||||
|
||||
inflatef$O: inflate.c inflate.h $(UNZIP_H) crypt.h
|
||||
$(CP) inflate.c inflatef.c
|
||||
$(CC) -c $(CF) -DFUNZIP inflatef.c
|
||||
$(RM) inflatef.c
|
||||
|
||||
ttyiof$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
$(CP) ttyio.c ttyiof.c
|
||||
$(CC) -c $(CF) -DFUNZIP ttyiof.c
|
||||
$(RM) ttyiof.c
|
||||
|
||||
|
||||
# system-specific code
|
||||
atari$O: atari/atari.c $(UNZIP_H)
|
||||
$(CC) -c $(CF) atari/atari.c
|
||||
|
||||
atari_$O: atari/atari.c $(UNZIP_H)
|
||||
$(CP) atari/atari.c atari_.c
|
||||
$(CC) -c $(CF) -DSFX atari_.c
|
||||
$(RM) atari_.c
|
||||
|
||||
|
||||
# this really only works for Unix targets, unless specify E and O on cmd line
|
||||
clean:
|
||||
@echo ""
|
||||
@echo ' This is a Unix-specific target. (Just so you know.)'
|
||||
@echo ""
|
||||
rm -f $(OBJS) api$O apihelp$O unzipstb$O $(OBJF) $(OBJX) $(UNZIPS)
|
||||
|
||||
install: $(UNZIPS) $(MANS)
|
||||
$(INSTALL) $(UNZIPS) $(BINDIR)
|
||||
$(RM) $(BINDIR)/zipinfo$E
|
||||
$(LN) $(BINDIR)/unzip$E $(BINDIR)/zipinfo$E
|
||||
$(INSTALL) man/unzip.1 $(MANDIR)/unzip.$(manext)
|
||||
$(INSTALL) man/unzipsfx.1 $(MANDIR)/unzipsfx.$(manext)
|
||||
$(INSTALL) man/zipinfo.1 $(MANDIR)/zipinfo.$(manext)
|
||||
$(INSTALL) man/funzip.1 $(MANDIR)/funzip.$(manext)
|
||||
$(CHMOD) 755 $(INSTALLEDBIN)
|
||||
$(CHMOD) 644 $(INSTALLEDMAN)
|
||||
|
||||
# alternatively, could use zip method: -cd $(BINDIR); rm -f $(UNZIPS) [etc.]
|
||||
uninstall:
|
||||
rm -f $(INSTALLEDBIN) $(INSTALLEDMAN)
|
||||
|
||||
|
||||
TESTZIP = testmake.zip # the test zipfile
|
||||
|
||||
# test some basic features of the build
|
||||
test: check
|
||||
|
||||
check: unzips
|
||||
@echo ' This is a Unix-specific target. (Just so you know.)'
|
||||
if test ! -f $(TESTZIP); then \
|
||||
echo " error: can't find test file $(TESTZIP)"; exit 1; fi
|
||||
#
|
||||
echo " testing extraction"
|
||||
./unzip -b $(TESTZIP) testmake.zipinfo
|
||||
if test $? ; then \
|
||||
echo " error: file extraction from $(TESTZIP) failed"; exit 1; fi
|
||||
#
|
||||
echo ' testing zipinfo (unzip -Z)'
|
||||
./unzip -Z $(TESTZIP) > testmake.unzip-Z
|
||||
if diff testmake.unzip-Z testmake.zipinfo; then ;; else \
|
||||
echo ' error: zipinfo output doesn't match stored version'; fi
|
||||
$(RM) testmake.unzip-Z testmake.zipinfo
|
||||
#
|
||||
echo ' testing unzip -d exdir option'
|
||||
./unzip -b $(TESTZIP) -d testun
|
||||
cat testun/notes
|
||||
#
|
||||
echo ' testing unzip -o and funzip (ignore funzip warning)'
|
||||
./unzip -boq $(TESTZIP) notes -d testun
|
||||
./funzip < $(TESTZIP) > testun/notes2
|
||||
if diff testun/notes testun/notes2; then ;; else \
|
||||
echo 'error: funzip output disagrees with unzip'; fi
|
||||
#
|
||||
echo ' testing unzipsfx (self-extractor)'
|
||||
cat unzipsfx $(TESTZIP) > testsfx
|
||||
$(CHMOD) 0700 testsfx
|
||||
./testsfx -b notes
|
||||
if diff notes testun/notes; then ;; else \
|
||||
echo ' error: unzipsfx file disagrees with unzip'; fi
|
||||
$(RM) testsfx notes testun/notes testun/notes2
|
||||
rmdir testun
|
||||
#
|
||||
echo ' testing complete.'
|
||||
|
||||
|
||||
################################
|
||||
# INDIVIDUAL MACHINE MAKERULES #
|
||||
################################
|
||||
|
||||
# these are left over for backward compatibility/convenience
|
||||
|
||||
generic: unzips
|
||||
atari: unzips
|
229
programs/fs/unzip60/atari/Makefile.old
Normal file
229
programs/fs/unzip60/atari/Makefile.old
Normal file
@ -0,0 +1,229 @@
|
||||
#==============================================================================
|
||||
# Makefile for UnZip, UnZipSFX and fUnZip: Atari ST Chris Herborth
|
||||
# Version: UnZip 5.20+, MiNT, GNU C 25 December 2006
|
||||
#==============================================================================
|
||||
|
||||
# Based on the original unix Makefile and modified by Chris Herborth
|
||||
# (cherborth@semprini.waterloo-rdp.on.ca), Nov.13/93.
|
||||
|
||||
# Be sure to test your new UnZip (and UnZipSFX and fUnZip); successful com-
|
||||
# pilation does not always imply a working program.
|
||||
|
||||
|
||||
#####################
|
||||
# MACRO DEFINITIONS #
|
||||
#####################
|
||||
|
||||
# Defaults most systems use (use LOCAL_UNZIP in environment to add flags,
|
||||
# such as -DDOSWILD).
|
||||
|
||||
# UnZip flags
|
||||
# NOTE: 'cgcc' is my cross-compiler; you'll probably use 'gcc' instead.
|
||||
CC = cgcc
|
||||
LD = cgcc
|
||||
LOC = $(LOCAL_UNZIP) -ansi -D__MINT__ -U__STRICT_ANSI__
|
||||
|
||||
CF = -mbaserel -mpcrel -O2 -fomit-frame-pointer -I. $(LOC)
|
||||
# CF = -O -I. $(LOC)
|
||||
# CF = -mbaserel -O -I. $(LOC)
|
||||
LF = -mbaserel -mpcrel -o unzip.ttp
|
||||
LF2 = -s -lbiio
|
||||
|
||||
# UnZipSFX flags
|
||||
XC = -DSFX
|
||||
XL = -mbaserel -mpcrel -o unzipsfx.ttp
|
||||
XL2 = $(LF2)
|
||||
|
||||
# fUnZip flags
|
||||
FC = -DFUNZIP
|
||||
FL = -mbaserel -mpcrel -o funzip.ttp
|
||||
FL2 = $(LF2)
|
||||
|
||||
# general-purpose stuff
|
||||
CP = cp
|
||||
LN = ln -s
|
||||
RM = rm -f
|
||||
E = .ttp
|
||||
O = .o
|
||||
M = atari
|
||||
SHELL = /bin/sh
|
||||
|
||||
# object files
|
||||
OBJS1 = unzip$O crc32$O crypt$O envargs$O explode$O
|
||||
OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
|
||||
OBJS3 = process$O ttyio$O ubz2err$O unreduce$O unshrink$O zipinfo$O
|
||||
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
|
||||
LOBJS = $(OBJS)
|
||||
OBJX = unzipsfx$O crc32$O crypt_$O extract_$O fileio_$O \
|
||||
globals_$O inflate_$O match_$O process_$O ttyio_$O ubz2err_$O $M_$O
|
||||
OBJF = funzip$O crc32$O cryptf$O globalsf$O inflatef$O ttyiof$O
|
||||
|
||||
UNZIP_H = unzip.h unzpriv.h globals.h
|
||||
|
||||
# installation
|
||||
INSTALL = cp# probably can change this to 'install' if you have it
|
||||
# on some systems, manext=l and MANDIR=/usr/man/man$(manext) may be appropriate
|
||||
manext = 1
|
||||
MANDIR = /usr/local/man/man$(manext)# where to install man pages
|
||||
BINDIR = /usr/local/bin# where to install executables
|
||||
#
|
||||
UNZIPS = unzip$E funzip$E unzipsfx$E zipinfo$E
|
||||
MANS = unzip.$(manext) unzipsfx.$(manext) zipinfo.$(manext) funzip.$(manext)
|
||||
DOCS = unzip.txt unzipsfx.txt zipinfo.txt funzip.txt
|
||||
# this is a little ugly...
|
||||
INSTALLED = $(BINDIR)/unzip$E $(BINDIR)/zipinfo$E $(BINDIR)/funzip$E \
|
||||
$(BINDIR)/unzipsfx$E $(MANDIR)/unzipsfx.$(manext) \
|
||||
$(MANDIR)/unzip.$(manext) $(MANDIR)/zipinfo.$(manext) \
|
||||
$(MANDIR)/funzip.$(manext)
|
||||
|
||||
###############################################
|
||||
# BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES #
|
||||
###############################################
|
||||
|
||||
.c$O:
|
||||
$(CC) -c $(CF) $*.c
|
||||
|
||||
|
||||
all: unzips
|
||||
unzips: $(UNZIPS)
|
||||
docs: $(DOCS)
|
||||
unzipsman: unzips docs
|
||||
unzipsdocs: unzips docs
|
||||
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) $(OBJF) $(OBJX) $(UNZIPS)
|
||||
|
||||
install: $(UNZIPS) $(MANS)
|
||||
$(INSTALL) $(UNZIPS) $(BINDIR)
|
||||
$(LN) $(BINDIR)/unzip$E $(BINDIR)/zipinfo$E
|
||||
$(INSTALL) man/unzip.1 $(MANDIR)/unzip.$(manext)
|
||||
$(INSTALL) man/unzipsfx.1 $(MANDIR)/unzipsfx.$(manext)
|
||||
$(INSTALL) man/zipinfo.1 $(MANDIR)/zipinfo.$(manext)
|
||||
$(INSTALL) man/funzip.1 $(MANDIR)/funzip.$(manext)
|
||||
|
||||
# alternatively, could use zip method: -cd $(BINDIR); rm -f $(UNZIPS) [etc.]
|
||||
uninstall:
|
||||
rm -f $(INSTALLED)
|
||||
|
||||
|
||||
unzip$E: $(OBJS) # add `&' if parallel makes supported
|
||||
$(LD) $(LF) $(LOBJS) $(LF2)
|
||||
|
||||
unzipsfx$E: $(OBJX) # add `&' if parallel makes supported
|
||||
$(LD) $(XL) $(OBJX) $(XL2)
|
||||
|
||||
funzip$E: $(OBJF) # add `&' if parallel makes supported
|
||||
$(LD) $(FL) $(OBJF) $(FL2)
|
||||
|
||||
zipinfo$E: unzip$E
|
||||
@echo\
|
||||
' This is a Unix-inspired target. If your filesystem does not support'
|
||||
@echo\
|
||||
' symbolic links, copy unzip.ttp to zipinfo.ttp rather than linking it,'
|
||||
@echo\
|
||||
' or else invoke as "unzip -Z".'
|
||||
$(LN) unzip$E zipinfo$E
|
||||
|
||||
|
||||
crc32$O: crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
crypt$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
envargs$O: envargs.c $(UNZIP_H)
|
||||
explode$O: explode.c $(UNZIP_H)
|
||||
extract$O: extract.c $(UNZIP_H) crc32.h crypt.h
|
||||
fileio$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
|
||||
funzip$O: funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
|
||||
globals$O: globals.c $(UNZIP_H)
|
||||
inflate$O: inflate.c inflate.h $(UNZIP_H)
|
||||
list$O: list.c $(UNZIP_H)
|
||||
match$O: match.c $(UNZIP_H)
|
||||
process$O: process.c $(UNZIP_H) crc32.h
|
||||
ttyio$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
ubz2err$O: ubz2err.c $(UNZIP_H)
|
||||
unreduce$O: unreduce.c $(UNZIP_H)
|
||||
unshrink$O: unshrink.c $(UNZIP_H)
|
||||
unzip$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
|
||||
zipinfo$O: zipinfo.c $(UNZIP_H)
|
||||
|
||||
# unzipsfx only
|
||||
crypt_$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
$(CP) crypt.c crypt_.c
|
||||
$(CC) -c $(CF) $(XC) crypt_.c
|
||||
$(RM) crypt_.c
|
||||
|
||||
extract_$O: extract.c $(UNZIP_H) crc32.h crypt.h
|
||||
$(CP) extract.c extract_.c
|
||||
$(CC) -c $(CF) $(XC) extract_.c
|
||||
$(RM) extract_.c
|
||||
|
||||
fileio_$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
|
||||
$(CP) fileio.c fileio_.c
|
||||
$(CC) -c $(CF) $(XC) fileio_.c
|
||||
$(RM) fileio_.c
|
||||
|
||||
globals_$O: globals.c $(UNZIP_H)
|
||||
$(CP) globals.c globals_.c
|
||||
$(CC) -c $(CF) $(XC) globals_.c
|
||||
$(RM) globals_.c
|
||||
|
||||
inflate_$O: inflate.c inflate.h $(UNZIP_H) crypt.h
|
||||
$(CP) inflate.c inflate_.c
|
||||
$(CC) -c $(CF) $(XC) inflate_.c
|
||||
$(RM) inflate_.c
|
||||
|
||||
match_$O: match.c $(UNZIP_H)
|
||||
$(CP) match.c match_.c
|
||||
$(CC) -c $(CF) $(XC) match_.c
|
||||
$(RM) match_.c
|
||||
|
||||
process_$O: process.c $(UNZIP_H) crc32.h
|
||||
$(CP) process.c process_.c
|
||||
$(CC) -c $(CF) $(XC) process_.c
|
||||
$(RM) process_.c
|
||||
|
||||
ttyio_$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
$(CP) ttyio.c ttyio_.c
|
||||
$(CC) -c $(CF) $(XC) ttyio_.c
|
||||
$(RM) ttyio_.c
|
||||
|
||||
ubz2err_$O: ubz2err.c $(UNZIP_H)
|
||||
$(CP) ubz2err.c ubz2err_.c
|
||||
$(CC) -c $(CF) $(XC) ubz2err_.c
|
||||
$(RM) ubz2err_.c
|
||||
|
||||
unzipsfx$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
|
||||
$(CP) unzip.c unzip_.c
|
||||
$(CC) -c $(CF) $(XC) unzip_.c
|
||||
$(RM) unzip_.c
|
||||
|
||||
|
||||
# funzip only
|
||||
cryptf$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
$(CP) crypt.c cryptf.c
|
||||
$(CC) -c $(CF) $(FC) cryptf.c
|
||||
$(RM) cryptf.c
|
||||
|
||||
globalsf$O: globals.c $(UNZIP_H)
|
||||
$(CP) globals.c globalsf.c
|
||||
$(CC) -c $(CF) $(FC) globalsf.c
|
||||
$(RM) globalsf.c
|
||||
|
||||
inflatef$O: inflate.c inflate.h $(UNZIP_H) crypt.h
|
||||
$(CP) inflate.c inflatef.c
|
||||
$(CC) -c $(CF) $(FC) inflatef.c
|
||||
$(RM) inflatef.c
|
||||
|
||||
ttyiof$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
$(CP) ttyio.c ttyiof.c
|
||||
$(CC) -c $(CF) $(FC) ttyiof.c
|
||||
$(RM) ttyiof.c
|
||||
|
||||
|
||||
# system-specific code
|
||||
atari$O: atari/atari.c $(UNZIP_H) # Atari only
|
||||
$(CC) -c $(CF) atari/atari.c
|
||||
|
||||
atari_$O: atari/atari.c $(UNZIP_H) # unzipsfx only
|
||||
$(CP) atari/atari.c atari_.c
|
||||
$(CC) -c $(CF) $(XC) atari_.c
|
||||
$(RM) atari_.c
|
43
programs/fs/unzip60/atari/README.old
Normal file
43
programs/fs/unzip60/atari/README.old
Normal file
@ -0,0 +1,43 @@
|
||||
Here it is... the UnZip 5.1 port for the Atari ST/TT/Falcon!
|
||||
|
||||
This took me longer than I expected thanks to a difference between the
|
||||
MiNT library and most UNIX libraries... symlinks are 0x16000
|
||||
instead of 0xa000... I'm told this isn't even defined in POSIX, so I
|
||||
can't really complain. At least we've got a filesystem that can use
|
||||
symlinks!
|
||||
|
||||
This port requires GNU C and allows you to build an unzip/zipinfo/funzip
|
||||
that supports long filenames (on appropriate filesystems, thanks to the
|
||||
MiNT library), as well as symlinks. It also does "proper" (ie, DOS-style)
|
||||
translation of text-file end-of-line characters. The programs also build
|
||||
as shared-text binaries, so you can start unzipping several files at once
|
||||
in the background and only a small part of unzip will be duplicated in
|
||||
memory.
|
||||
|
||||
I build unzip with the MiNT library, GNU C 2.5.8 (2.5.7 and lower have a
|
||||
rather sever problem in the optimiser that affects 68000 code only; it
|
||||
adds 68020-only instructions to the 68000 code). Oh, and I tested it
|
||||
extensively under MiNT's minix filesystem as well as the bogus DOS
|
||||
filesystem that "normal" Atari partitions have.
|
||||
|
||||
The Makefile won't need any editing if you want to built unzip et al. on
|
||||
a minix filesystem; if you want to install it on a DOS filesystem, use
|
||||
"cp" instead of "ln" for zipinfo. [Or, to save disk space, make a script/
|
||||
command-file which invokes "unzip -Z ...". --CN] This is such a good
|
||||
idea that I'm annoyed that Greg thought of it and I didn't... ;-) If
|
||||
you're using a shell worth your while, you can alias zipinfo to
|
||||
'unzip -Z' and then forget all about this paragraph.
|
||||
|
||||
If you want to compile this using Turbo C (aka Pure C in North America)
|
||||
you're on your own... That's ok, I'll make a nice binary version of
|
||||
unzip available as soon as the official 5.1 version is released (give or
|
||||
take a few days).
|
||||
|
||||
Enjoy! Cave Newt should be given kudos for keeping this monster easy to
|
||||
port... ;-) [Hah! But thanks anyway. :-) --CN]
|
||||
|
||||
PLEASE email me to tell me if you've uploaded the source or binary
|
||||
versions of Unzip 5.x to any BBS systems or commercial online systems so
|
||||
we can update the WHERE file!
|
||||
|
||||
-Chris Herborth-
|
1019
programs/fs/unzip60/atari/atari.c
Normal file
1019
programs/fs/unzip60/atari/atari.c
Normal file
File diff suppressed because it is too large
Load Diff
8
programs/fs/unzip60/atari/make_unz.mup
Normal file
8
programs/fs/unzip60/atari/make_unz.mup
Normal file
@ -0,0 +1,8 @@
|
||||
#rm -f *.o *.ttp *.sym
|
||||
#make370 SHELL=/bin/mupfel.ttp CFLAGS=" -O -DATARI" unzips
|
||||
make370 SHELL=/bin/mupfel.ttp CFLAGS="-g -D__NO_INLINE__ -DATARI" E=.ttp unzip.ttp LF2=
|
||||
make370 SHELL=/bin/mupfel.ttp CFLAGS="-g -D__NO_INLINE__ -DATARI" E=.sym unzip.sym LF2="-B/bin/sym-"
|
||||
#make370 SHELL=/bin/mupfel.ttp CFLAGS="-O -DATARI" -n unzips > make_all.mup
|
||||
#fixstk 32K pgp.ttp
|
||||
prgflags 017 007 *.ttp
|
||||
|
10
programs/fs/unzip60/atheos/Contents
Normal file
10
programs/fs/unzip60/atheos/Contents
Normal file
@ -0,0 +1,10 @@
|
||||
Contents of the "atheos" sub-directory for UnZip 5.52 and later:
|
||||
|
||||
Contents this file
|
||||
README notes from the author of the AtheOS port
|
||||
Makefile makefile for building UnZip
|
||||
athcfg.h AtheOS-specific configuration settings
|
||||
atheos.c AtheOS-specific routines (similar to the BeOS/Unix ones)
|
||||
atheos.h structures for the AtheOS extra field
|
||||
|
||||
- Ruslan Nickolaev (nruslan@hotbox.ru)
|
322
programs/fs/unzip60/atheos/Makefile
Normal file
322
programs/fs/unzip60/atheos/Makefile
Normal file
@ -0,0 +1,322 @@
|
||||
######################################################################
|
||||
#
|
||||
# Makefile for Info-ZIP's unzip, unzipsfx, and funzip on AtheOS
|
||||
# Version 5.53
|
||||
#
|
||||
# Copyright (C) 1998-2006 Info-ZIP
|
||||
# Chris Herborth (chrish@qnx.com)
|
||||
# Copyright (C) 2004 Nikolaev Ruslan (nruslan@hotbox.ru)
|
||||
#
|
||||
# To automatically install the fresh new unzip, use the "install" target:
|
||||
# make -f atheos/Makefile install
|
||||
######################################################################
|
||||
SHELL = /bin/bash
|
||||
|
||||
# Punish those of you not running on SMP hardware...
|
||||
MAKE = make -j 4 -f atheos/Makefile
|
||||
|
||||
# UnZipSFX flags
|
||||
SL = -o unzipsfx
|
||||
SL2 = $(LF2)
|
||||
|
||||
# fUnZip flags
|
||||
FL = -o funzip
|
||||
FL2 = $(LF2)
|
||||
|
||||
# general-purpose stuff
|
||||
CP = cp
|
||||
AS = as
|
||||
RM = rm -f
|
||||
LN = ln -sf
|
||||
CHMOD = chmod
|
||||
E =
|
||||
O = .o
|
||||
M = atheos
|
||||
|
||||
OSDEP_H = atheos/athcfg.h
|
||||
|
||||
# define
|
||||
|
||||
# object files
|
||||
OBJS1 = unzip$O crc32$O crc_i386$O crypt$O envargs$O explode$O
|
||||
OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
|
||||
OBJS3 = process$O ttyio$O ubz2err$O unreduce$O unshrink$O zipinfo$O
|
||||
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
|
||||
LOBJS = $(OBJS)
|
||||
OBJSDLL = $(OBJS) api$O
|
||||
OBJX = unzipsfx$O crc32_$O crc_i386$O crypt_$O extract_$O fileio_$O globals_$O inflate_$O match_$O process_$O ttyio_$O ubz2err_$O $M_$O
|
||||
LOBJX = $(OBJX)
|
||||
OBJF = funzip$O crc32f$O crc_i386$O cryptf$O globalsf$O inflatef$O ttyiof$O
|
||||
UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)
|
||||
|
||||
# installation
|
||||
INSTALL = install
|
||||
manext = 1
|
||||
prefix = /usr
|
||||
BINDIR = $(prefix)/bin
|
||||
MANDIR = $(prefix)/man/man$(manext)
|
||||
INSTALLEDBIN = $(BINDIR)/funzip$E $(BINDIR)/zipinfo$E $(BINDIR)/unzipsfx$E $(BINDIR)/unzip$E
|
||||
INSTALLEDMAN = $(MANDIR)/unzip.$(manext) $(MANDIR)/funzip.$(manext) $(MANDIR)/unzipsfx.$(manext) $(MANDIR)/zipinfo.$(manext)
|
||||
#
|
||||
UNZIPS = unzip$E funzip$E unzipsfx$E zipinfo$E
|
||||
# this is a little ugly...well, no, it's a lot ugly:
|
||||
MANS = man/unzip.1 man/unzipsfx.1 man/zipinfo.1 man/funzip.1 man/zipgrep.1
|
||||
|
||||
######################################################################
|
||||
CC=gcc
|
||||
LD=gcc
|
||||
CF=-O3 -march=i586 -Wall -I. -DPASSWD_FROM_STDIN -DASM_CRC -DUSE_UNSHRINK $(LOCAL_UNZIP)
|
||||
LF=-o unzip
|
||||
LF2=
|
||||
TARGET=$(UNZIPS)
|
||||
######################################################################
|
||||
# Helpful targets
|
||||
all:
|
||||
@echo 'TARGET = $(TARGET)'
|
||||
@echo 'CC = $(CC)'
|
||||
if [ -n "$(TARGET)" ] ; then \
|
||||
$(MAKE) CC=$(CC) CF="$(CF)" LD="$(LD)" \
|
||||
LF="$(LF)" LF2="$(LF2)" CCPP="$(CC)" CPPF="$(CF)" \
|
||||
OBJS="$(OBJS)" LOBJS="$(LOBJS)" OBJX="$(OBJX)" \
|
||||
LOBJX="$(LOBJX)" $(TARGET) ; \
|
||||
else \
|
||||
$(MAKE) help ; \
|
||||
fi
|
||||
|
||||
help:
|
||||
@echo ''
|
||||
@echo "This Makefile lets you build Info-ZIP's zip."
|
||||
@echo ''
|
||||
@echo 'To build zip for this computer using the default compiler, just do:'
|
||||
@echo ''
|
||||
@echo ' make -f atheos/Makefile'
|
||||
@echo ''
|
||||
|
||||
######################################################################
|
||||
# Basic compile instructions and dependencies
|
||||
|
||||
# this is for GNU make; comment out and notify zip-bugs if it causes errors
|
||||
.SUFFIXES: .c .o
|
||||
|
||||
# default for compiling C files
|
||||
.c.o:
|
||||
$(CC) -c $(CF) $*.c
|
||||
|
||||
|
||||
unzips: $(UNZIPS)
|
||||
objs: $(OBJS)
|
||||
objsdll: $(OBJSDLL)
|
||||
unzipsman: unzips
|
||||
|
||||
|
||||
unzip$E: $(OBJS)
|
||||
$(LD) $(LF) $(LOBJS) $(LF2)
|
||||
$(CHMOD) +x unzip$E
|
||||
|
||||
unzipsfx$E: $(OBJX)
|
||||
$(LD) $(SL) $(LOBJX) $(SL2)
|
||||
$(CHMOD) +x unzipsfx$E
|
||||
|
||||
funzip$E: $(OBJF)
|
||||
$(LD) $(FL) $(OBJF) $(FL2)
|
||||
$(CHMOD) +x funzip$E
|
||||
|
||||
zipinfo$E: unzip$E
|
||||
$(LN) unzip$E zipinfo$E
|
||||
|
||||
crc32$O: crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
crypt$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
envargs$O: envargs.c $(UNZIP_H)
|
||||
explode$O: explode.c $(UNZIP_H)
|
||||
extract$O: extract.c $(UNZIP_H) crc32.h crypt.h
|
||||
fileio$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
|
||||
funzip$O: funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
|
||||
globals$O: globals.c $(UNZIP_H)
|
||||
inflate$O: inflate.c inflate.h $(UNZIP_H)
|
||||
list$O: list.c $(UNZIP_H)
|
||||
match$O: match.c $(UNZIP_H)
|
||||
process$O: process.c $(UNZIP_H) crc32.h
|
||||
ttyio$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
ubz2err$O: ubz2err.c $(UNZIP_H)
|
||||
unreduce$O: unreduce.c $(UNZIP_H)
|
||||
unshrink$O: unshrink.c $(UNZIP_H)
|
||||
unzip$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
|
||||
zipinfo$O: zipinfo.c $(UNZIP_H)
|
||||
|
||||
crc_i386$O: crc_i386.S
|
||||
$(CC) -E crc_i386.S > crc_i386s.s
|
||||
$(AS) -o $@ crc_i386s.s
|
||||
$(RM) crc_i386s.s
|
||||
|
||||
# unzipsfx only
|
||||
unzipsfx$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
|
||||
$(CP) unzip.c unzipsfx.c
|
||||
$(CC) -c $(CF) -DSFX unzipsfx.c
|
||||
$(RM) unzipsfx.c
|
||||
|
||||
crc32_$O: crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
$(CP) crc32.c crc32_.c
|
||||
$(CC) -c $(CF) -DSFX crc32_.c
|
||||
$(RM) crc32_.c
|
||||
|
||||
crypt_$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
$(CP) crypt.c crypt_.c
|
||||
$(CC) -c $(CF) -DSFX crypt_.c
|
||||
$(RM) crypt_.c
|
||||
|
||||
extract_$O: extract.c $(UNZIP_H) crc32.h crypt.h
|
||||
$(CP) extract.c extract_.c
|
||||
$(CC) -c $(CF) -DSFX extract_.c
|
||||
$(RM) extract_.c
|
||||
|
||||
fileio_$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
|
||||
$(CP) fileio.c fileio_.c
|
||||
$(CC) -c $(CF) -DSFX fileio_.c
|
||||
$(RM) fileio_.c
|
||||
|
||||
globals_$O: globals.c $(UNZIP_H)
|
||||
$(CP) globals.c globals_.c
|
||||
$(CC) -c $(CF) -DSFX globals_.c
|
||||
$(RM) globals_.c
|
||||
|
||||
inflate_$O: inflate.c inflate.h $(UNZIP_H) crypt.h
|
||||
$(CP) inflate.c inflate_.c
|
||||
$(CC) -c $(CF) -DSFX inflate_.c
|
||||
$(RM) inflate_.c
|
||||
|
||||
match_$O: match.c
|
||||
$(CP) match.c match_.c
|
||||
$(CC) -c $(CF) -DSFX match_.c
|
||||
$(RM) match_.c
|
||||
|
||||
process_$O: process.c $(UNZIP_H) crc32.h
|
||||
$(CP) process.c process_.c
|
||||
$(CC) -c $(CF) -DSFX process_.c
|
||||
$(RM) process_.c
|
||||
|
||||
ttyio_$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
$(CP) ttyio.c ttyio_.c
|
||||
$(CC) -c $(CF) -DSFX ttyio_.c
|
||||
$(RM) ttyio_.c
|
||||
|
||||
ubz2err$O: ubz2err.c $(UNZIP_H)
|
||||
$(CP) ubz2err.c ubz2err_.c
|
||||
$(CC) -c $(CF) -DSFX ubz2err_.c
|
||||
$(RM) ubz2err_.c
|
||||
|
||||
# funzip only
|
||||
crc32f$O: crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
$(CP) crc32.c crc32f.c
|
||||
$(CC) -c $(CF) -DFUNZIP crc32f.c
|
||||
$(RM) crc32f.c
|
||||
|
||||
cryptf$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
$(CP) crypt.c cryptf.c
|
||||
$(CC) -c $(CF) -DFUNZIP cryptf.c
|
||||
$(RM) cryptf.c
|
||||
|
||||
globalsf$O: globals.c $(UNZIP_H)
|
||||
$(CP) globals.c globalsf.c
|
||||
$(CC) -c $(CF) -DFUNZIP globalsf.c
|
||||
$(RM) globalsf.c
|
||||
|
||||
inflatef$O: inflate.c inflate.h $(UNZIP_H) crypt.h
|
||||
$(CP) inflate.c inflatef.c
|
||||
$(CC) -c $(CF) -DFUNZIP inflatef.c
|
||||
$(RM) inflatef.c
|
||||
|
||||
ttyiof$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
$(CP) ttyio.c ttyiof.c
|
||||
$(CC) -c $(CF) -DFUNZIP ttyiof.c
|
||||
$(RM) ttyiof.c
|
||||
|
||||
# AtheOS specific code
|
||||
atheos$O: atheos/atheos.c $(UNZIP_H) unzvers.h atheos/atheos.h
|
||||
$(CC) -c $(CF) atheos/atheos.c
|
||||
|
||||
# version() not used by unzipsfx, so no unzvers.h dependency
|
||||
atheos_$O: atheos/atheos.c $(UNZIP_H) atheos/atheos.h # unzipsfx only
|
||||
$(CP) atheos/atheos.c atheos_.c
|
||||
$(CC) -c $(CF) -Iatheos -DSFX atheos_.c
|
||||
$(RM) atheos_.c
|
||||
|
||||
# this really only works for Unix targets, unless E and O specified on cmd line
|
||||
clean:
|
||||
$(RM) $(UNZIPS) $(OBJS) $(OBJF) $(OBJX) api$O apihelp$O crc_gcc$O unzipstb$O
|
||||
|
||||
install: all
|
||||
$(INSTALL) -m 755 $(UNZIPS) $(BINDIR)
|
||||
$(RM) $(BINDIR)/zipinfo$E
|
||||
$(LN) unzip$E $(BINDIR)/zipinfo$E
|
||||
$(RM) $(BINDIR)/zipgrep$E
|
||||
$(INSTALL) -m 755 unix/zipgrep $(BINDIR)/zipgrep$E
|
||||
$(INSTALL) -m 644 man/unzip.1 $(MANDIR)/unzip.$(manext)
|
||||
$(INSTALL) -m 644 man/unzipsfx.1 $(MANDIR)/unzipsfx.$(manext)
|
||||
$(INSTALL) -m 644 man/zipinfo.1 $(MANDIR)/zipinfo.$(manext)
|
||||
$(INSTALL) -m 644 man/funzip.1 $(MANDIR)/funzip.$(manext)
|
||||
$(INSTALL) -m 644 man/zipgrep.1 $(MANDIR)/zipgrep.$(manext)
|
||||
|
||||
# alternatively, could use zip method: -cd $(BINDIR); $(RM) $(UNZIPS) [etc.]
|
||||
uninstall:
|
||||
$(RM) $(INSTALLEDBIN) $(INSTALLEDMAN)
|
||||
|
||||
|
||||
TESTZIP = testmake.zip # the test zipfile
|
||||
|
||||
# test some basic features of the build
|
||||
test: check
|
||||
|
||||
check:
|
||||
@echo '##### This is a Unix-specific target. (Just so you know.)'
|
||||
@echo '##### Make sure unzip, funzip and unzipsfx are compiled and'
|
||||
@echo '##### in this directory.'
|
||||
@if test ! -f ./unzip; then \
|
||||
echo "##### ERROR: can't find ./unzip"; exit 1; fi
|
||||
@if test ! -f ./funzip; then \
|
||||
echo "##### ERROR: can't find ./funzip"; exit 1; fi
|
||||
@if test ! -f ./unzipsfx; then \
|
||||
echo "##### ERROR: can't find ./unzipsfx"; exit 1; fi
|
||||
#
|
||||
@if test ! -f $(TESTZIP); then \
|
||||
echo "##### ERROR: can't find test file $(TESTZIP)"; exit 1; fi
|
||||
#
|
||||
@echo "##### testing extraction"
|
||||
@./unzip -bo $(TESTZIP) testmake.zipinfo
|
||||
@if test ! -f testmake.zipinfo ; then \
|
||||
echo "##### ERROR: file extraction from $(TESTZIP) failed"; \
|
||||
exit 1; fi
|
||||
#
|
||||
@echo '##### testing zipinfo (unzip -Z)'
|
||||
@./unzip -Z $(TESTZIP) > testmake.unzip-Z
|
||||
@if diff testmake.unzip-Z testmake.zipinfo; then echo "OK."; else \
|
||||
echo "##### WARNING: zipinfo output doesn't match stored version"; \
|
||||
echo '##### (If the only difference is the file times, compare your'; \
|
||||
echo '##### timezone with the Central European timezone, which is one'; \
|
||||
echo '##### hour east of Greenwich but effectively 2 hours east'; \
|
||||
echo '##### during summer Daylight Savings Time. The upper two'; \
|
||||
echo '##### lines should correspond to your local time when the'; \
|
||||
echo '##### files were created, on 19 November 1998 at 10:46pm CET.'; \
|
||||
echo '##### If the times are consistent, please ignore this warning.)'; \
|
||||
fi
|
||||
@$(RM) testmake.unzip-Z testmake.zipinfo
|
||||
#
|
||||
@echo '##### testing unzip -d exdir option'
|
||||
@./unzip -bo $(TESTZIP) -d testun notes
|
||||
@cat testun/notes
|
||||
#
|
||||
@echo '##### testing unzip -o and funzip (ignore funzip warning)'
|
||||
@./unzip -boq $(TESTZIP) notes -d testun
|
||||
@./funzip < $(TESTZIP) > testun/notes2
|
||||
@if diff testun/notes testun/notes2; then true; else \
|
||||
echo '##### ERROR: funzip output disagrees with unzip'; fi
|
||||
#
|
||||
@echo '##### testing unzipsfx (self-extractor)'
|
||||
@cat unzipsfx $(TESTZIP) > testsfx
|
||||
@$(CHMOD) 0700 testsfx
|
||||
@./testsfx -bo notes
|
||||
@if diff notes testun/notes; then true; else \
|
||||
echo '##### ERROR: unzipsfx file disagrees with unzip'; fi
|
||||
@$(RM) testsfx notes testun/notes testun/notes2
|
||||
@rmdir testun
|
||||
#
|
||||
@echo '##### testing complete.'
|
16
programs/fs/unzip60/atheos/README
Normal file
16
programs/fs/unzip60/atheos/README
Normal file
@ -0,0 +1,16 @@
|
||||
UnZip 5.51 for AtheOS/Syllable
|
||||
|
||||
This port is based on both BeOS and UNIX versions.
|
||||
As BeOS version it can extract specific file attributes.
|
||||
|
||||
TODO
|
||||
----
|
||||
There is only one thing to be fixed:
|
||||
write_attr() should return count of bytes written. However that's a bug
|
||||
related with AFS only.
|
||||
|
||||
Please report any bugs to Zip-Bugs@lists.wku.edu.
|
||||
If this bug related with AtheOS/Syllable only, you can mail me directly:
|
||||
nruslan@hotbox.ru.
|
||||
- Ruslan Nickolaev (nruslan@hotbox.ru)
|
||||
Sep 06/2004
|
70
programs/fs/unzip60/atheos/athcfg.h
Normal file
70
programs/fs/unzip60/atheos/athcfg.h
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
Copyright (c) 1990-2004 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/*---------------------------------------------------------------------------
|
||||
AtheOS/Syllable specific configuration section:
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __athcfg_h
|
||||
#define __athcfg_h
|
||||
|
||||
/* ensure that Unix-specific code portions are excluded */
|
||||
#ifdef UNIX
|
||||
# undef UNIX
|
||||
#endif
|
||||
#include <sys/types.h> /* off_t, time_t, dev_t, ... */
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <fcntl.h> /* O_BINARY for open() w/o CR/LF translation */
|
||||
#include <limits.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
|
||||
#define GOT_UTIMBUF
|
||||
#define DIRENT
|
||||
#if (!defined(HAVE_STRNICMP) & !defined(NO_STRNICMP))
|
||||
# define NO_STRNICMP
|
||||
#endif
|
||||
#define INT_SPRINTF
|
||||
#define SYMLINKS
|
||||
|
||||
#ifndef DATE_FORMAT
|
||||
# define DATE_FORMAT DF_MDY /* GRR: customize with locale.h somehow? */
|
||||
#endif
|
||||
#define lenEOL 1
|
||||
#define PutNativeEOL *q++ = native(LF);
|
||||
#define SCREENSIZE(ttrows, ttcols) screensize(ttrows, ttcols)
|
||||
#define SCREENWIDTH 80
|
||||
#define SCREENLWRAP 1
|
||||
#if (!defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME))
|
||||
# define USE_EF_UT_TIME
|
||||
#endif
|
||||
#define SET_SYMLINK_ATTRIBS
|
||||
#define SET_DIR_ATTRIB
|
||||
#if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))
|
||||
# define TIMESTAMP
|
||||
#endif
|
||||
#define RESTORE_UIDGID
|
||||
|
||||
/* Static variables that we have to add to Uz_Globs: */
|
||||
#define SYSTEM_SPECIFIC_GLOBALS \
|
||||
int created_dir, renamed_fullpath;\
|
||||
char *rootpath, *buildpath, *end;\
|
||||
ZCONST char *wildname;\
|
||||
char *dirname, matchname[FILNAMSIZ];\
|
||||
int rootlen, have_dirname, dirnamelen, notfirstcall;\
|
||||
zvoid *wild_dir;
|
||||
|
||||
/* created_dir, and renamed_fullpath are used by both mapname() and */
|
||||
/* checkdir(). */
|
||||
/* rootlen, rootpath, buildpath and end are used by checkdir(). */
|
||||
/* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */
|
||||
/* and notfirstcall are used by do_wild(). */
|
||||
|
||||
#endif /* !__athcfg_h */
|
1415
programs/fs/unzip60/atheos/atheos.c
Normal file
1415
programs/fs/unzip60/atheos/atheos.c
Normal file
File diff suppressed because it is too large
Load Diff
53
programs/fs/unzip60/atheos/atheos.h
Normal file
53
programs/fs/unzip60/atheos/atheos.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
Copyright (c) 1990-2004 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/* atheos.h -- A few handy things for the AtheOS port
|
||||
*
|
||||
* (c) 1997 Chris Herborth (chrish@qnx.com) - BeOS port
|
||||
* (c) 2004 Ruslan Nickolaev (nruslan@hotbox.ru) - AtheOS port
|
||||
*
|
||||
* This is covered under the usual Info-ZIP copyright
|
||||
*/
|
||||
|
||||
#ifndef _ATHEOS_H_
|
||||
#define _ATHEOS_H_
|
||||
|
||||
#define EB_BE_FL_BADBITS 0xfe /* bits currently undefined */
|
||||
|
||||
/*
|
||||
AtheOS 'At' extra-field layout:
|
||||
(same structure as the BeOS 'Be' e.f. layout, only signature and internal
|
||||
conventions of the file attribute data are different...)
|
||||
|
||||
'At' - signature
|
||||
ef_size - size of data in this EF (little-endian unsigned short)
|
||||
full_size - uncompressed data size (little-endian unsigned long)
|
||||
flag - flags (byte)
|
||||
flags & EB_BE_FL_UNCMPR = the data is not compressed
|
||||
flags & EB_BE_FL_BADBITS = the data is corrupted or we
|
||||
can't handle it properly
|
||||
data - compressed or uncompressed file attribute data
|
||||
|
||||
If flag & EB_BE_FL_UNCMPR, the data is not compressed; this optimisation is
|
||||
necessary to prevent wasted space for files with small attributes. In this
|
||||
case, there should be (ef_size - EB_BEOS_HLEN) bytes of data, and full_size
|
||||
should equal (ef_size - EB_BEOS_HLEN).
|
||||
|
||||
If the data is compressed, there will be (ef_size - EB_BEOS_HLEN) bytes of
|
||||
compressed data, and full_size bytes of uncompressed data.
|
||||
|
||||
If a file has absolutely no attributes, there will not be a 'At' extra field.
|
||||
|
||||
The uncompressed data is arranged like this:
|
||||
|
||||
attr_name\0 - C string
|
||||
struct attr_info (fields in little-endian format)
|
||||
attr_data (length in attr_info.ai_size)
|
||||
*/
|
||||
|
||||
#endif /* _ATHEOS_H_ */
|
15
programs/fs/unzip60/beos/Contents
Normal file
15
programs/fs/unzip60/beos/Contents
Normal file
@ -0,0 +1,15 @@
|
||||
Contents of the "beos" sub-directory for UnZip 5.52 and later:
|
||||
|
||||
Contents this file
|
||||
README notes from the author of the BeOS port
|
||||
Makefile makefile for building UnZip (sorry, no project files)
|
||||
beocfg.h BeOS-specific configuration settings
|
||||
beos.c BeOS-specific routines (similar to the Unix ones)
|
||||
beos.h structures for the BeOS extra field
|
||||
beosmain.cpp BeOS-specific C++ routines
|
||||
unzip.rsc BeOS resources for UnZip
|
||||
unzipsfx.rsc BeOS resources for UnZipSFX
|
||||
|
||||
This port supports both Metrowerks CodeWarrior (PowerPC and x86) and GNU C.
|
||||
|
||||
- Chris Herborth (chrish@qnx.com)
|
427
programs/fs/unzip60/beos/Makefile
Normal file
427
programs/fs/unzip60/beos/Makefile
Normal file
@ -0,0 +1,427 @@
|
||||
######################################################################
|
||||
#
|
||||
# Makefile for Info-ZIP's unzip, unzipsfx, and funzip on BeOS
|
||||
#
|
||||
# Copyright (c) 1998-2006 Info-ZIP
|
||||
# Chris Herborth (chrish@qnx.com)
|
||||
#
|
||||
# This is the new New and Improved Makefile for BeOS; it will:
|
||||
#
|
||||
# 1) automatically detect your platform (PowerPC or x86) if none is
|
||||
# specified; the default compiler is CodeWarrior for PowerPC, or
|
||||
# gcc for x86
|
||||
#
|
||||
# 2) let you cross-compile for the other platform (PowerPC or x86), in
|
||||
# theory
|
||||
#
|
||||
# 3) let you use Metrowerks CodeWarrior (default) or GNU C to build with
|
||||
# for either platfor, in theory
|
||||
#
|
||||
# To choose a specific architecture, define the ARCH environment
|
||||
# variable on the make command-line:
|
||||
#
|
||||
# ARCH=what make -f beos/Makefile
|
||||
#
|
||||
# where "what" can be "powerpc" or "x86".
|
||||
#
|
||||
# To choose a specific compiler, define the CC environment variable on
|
||||
# the make command-line:
|
||||
#
|
||||
# CC=compiler make -f beos/Makefile
|
||||
#
|
||||
# where "compiler" can be "mwcc" or "x86".
|
||||
#
|
||||
# Of course, you can combine these two:
|
||||
#
|
||||
# ARCH=powerpc CC=mwcc make -f beos/Makefile
|
||||
#
|
||||
# or:
|
||||
#
|
||||
# CC=gcc ARCH=x86 make -f beos/Makefile
|
||||
#
|
||||
# To automatically install the fresh new unzip, use the "install" target:
|
||||
#
|
||||
# make -f beos/Makefile install
|
||||
|
||||
######################################################################
|
||||
# Things that don't change:
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
# Punish those of you not running on SMP hardware...
|
||||
MAKE = make -j 4 -f beos/Makefile
|
||||
|
||||
LOC=$(LOCAL_UNZIP) -DPASSWD_FROM_STDIN
|
||||
AF=$(LOC)
|
||||
|
||||
# UnZipSfx flags
|
||||
SL = -o unzipsfx
|
||||
SL2 = $(LF2)
|
||||
|
||||
# fUnZip flags
|
||||
FL = -o funzip
|
||||
FL2 = $(LF2)
|
||||
|
||||
# general-purpose stuff
|
||||
CP = cp
|
||||
RM = rm -f
|
||||
LN = ln -sf
|
||||
E =
|
||||
O = .o
|
||||
M = beos
|
||||
|
||||
# defaults for crc32 stuff and system-dependent headers
|
||||
CRCA_O =
|
||||
OSDEP_H = beos/beocfg.h
|
||||
|
||||
# object files
|
||||
OBJS1 = unzip$O crc32$O crypt$O envargs$O explode$O
|
||||
OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
|
||||
OBJS3 = process$O ttyio$O ubz2err$O unreduce$O unshrink$O zipinfo$O
|
||||
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O $(BEOS_MAIN)
|
||||
LOBJS = $(OBJS)
|
||||
OBJSDLL = $(OBJS) api$O
|
||||
OBJX = unzipsfx$O crc32_$O crypt_$O extract_$O fileio_$O globals_$O \
|
||||
inflate_$O match_$O process_$O ttyio_$O ubz2err_$O $M_$O $(BEOS_MAIN)
|
||||
LOBJX = $(OBJX)
|
||||
OBJF = funzip$O crc32f$O cryptf$O globalsf$O inflatef$O ttyiof$O
|
||||
UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)
|
||||
|
||||
# installation
|
||||
INSTALL = install
|
||||
# on some systems, manext=l and MANDIR=/usr/man/man$(manext) may be appropriate
|
||||
manext = 1
|
||||
prefix = /boot/home/config
|
||||
BINDIR = $(prefix)/bin# where to install executables
|
||||
MANDIR = $(prefix)/man/man$(manext)# where to install man pages
|
||||
INSTALLEDBIN = $(BINDIR)/funzip$E $(BINDIR)/zipinfo$E $(BINDIR)/unzipsfx$E \
|
||||
$(BINDIR)/unzip$E
|
||||
INSTALLEDMAN = $(MANDIR)/unzip.$(manext) $(MANDIR)/funzip.$(manext) \
|
||||
$(MANDIR)/unzipsfx.$(manext) $(MANDIR)/zipinfo.$(manext)
|
||||
#
|
||||
UNZIPS = unzip$E funzip$E unzipsfx$E zipinfo$E
|
||||
# this is a little ugly...well, no, it's a lot ugly:
|
||||
MANS = man/unzip.1 man/unzipsfx.1 man/zipinfo.1 man/funzip.1 man/zipgrep.1
|
||||
DOCS = unzip.txt unzipsfx.txt zipinfo.txt funzip.txt zipgrep.txt
|
||||
|
||||
######################################################################
|
||||
# Things that change:
|
||||
|
||||
# Select an architecture:
|
||||
ifndef ARCH
|
||||
MACHINE=$(shell uname -m)
|
||||
ifeq "$(MACHINE)" "BePC"
|
||||
ARCH=x86
|
||||
CC=gcc
|
||||
else
|
||||
ARCH=powerpc
|
||||
CC=mwcc
|
||||
endif
|
||||
endif
|
||||
|
||||
# Now select compiler flags and whatnot based on the ARCH and CC:
|
||||
WHAT=$(ARCH)-$(CC)
|
||||
|
||||
ifeq "$(WHAT)" "powerpc-mwcc"
|
||||
CC=mwccppc
|
||||
LD=mwccppc
|
||||
CF=-w9 -O7 -opt schedule604 -rostr -I. $(LOC)
|
||||
LF=-o unzip
|
||||
LF2=-warn -L/boot/develop/lib/ppc -lbe -lroot
|
||||
BEOS_MAIN=beosmain$O
|
||||
TARGET=$(UNZIPS)
|
||||
endif
|
||||
|
||||
ifeq "$(WHAT)" "powerpc-gcc"
|
||||
CC=gcc
|
||||
LD=gcc
|
||||
CF=-O3 -mcpu=604 -Wall -ansi -I. -I/boot/develop/headers/be/support \
|
||||
-I/boot/develop/headers/be/storage $(LOC)
|
||||
LF=-o unzip
|
||||
LF2=-L/boot/develop/lib/ppc -lbe -lroot
|
||||
BEOS_MAIN=beosmain$O
|
||||
TARGET=$(UNZIPS)
|
||||
endif
|
||||
|
||||
# This isn't likely to happen for R4 or later...
|
||||
ifeq "$(WHAT)" "x86-mwcc"
|
||||
CC=mwccx86
|
||||
LD=mwccx86
|
||||
CF=-O2 -w9 -I. $(LOC)
|
||||
LF=-o unzip
|
||||
LF2=-warn -L/boot/develop/lib/x86 -lbe -lroot
|
||||
BEOS_MAIN=beosmain$O
|
||||
TARGET=$(UNZIPS)
|
||||
endif
|
||||
|
||||
ifeq "$(WHAT)" "x86-gcc"
|
||||
CC=gcc
|
||||
LD=gcc
|
||||
CF=-O3 -mpentiumpro \
|
||||
-Wall -Wno-multichar -Wno-trigraphs \
|
||||
-ansi -I. -I/boot/develop/headers/be/support \
|
||||
-I/boot/develop/headers/be/storage $(LOC)
|
||||
LF=-o unzip
|
||||
LF2=-L/boot/develop/lib/x86 -lbe -lroot
|
||||
BEOS_MAIN=beosmain$O
|
||||
TARGET=$(UNZIPS)
|
||||
endif
|
||||
|
||||
ifndef TARGET
|
||||
TARGET=help
|
||||
endif
|
||||
|
||||
######################################################################
|
||||
# Helpful targets
|
||||
all:
|
||||
@echo 'TARGET = $(TARGET)'
|
||||
@echo 'ARCH = $(ARCH)'
|
||||
@echo 'CC = $(CC)'
|
||||
if [ -n "$(TARGET)" ] ; then \
|
||||
$(MAKE) CC=$(CC) CF="$(CF)" LD="$(LD)" \
|
||||
LF="$(LF)" LF2="$(LF2)" CCPP="$(CC)" CPPF="$(CF)" \
|
||||
OBJS="$(OBJS)" LOBJS="$(LOBJS)" OBJX="$(OBJX)" \
|
||||
LOBJX="$(LOBJX)" $(TARGET) ; \
|
||||
else \
|
||||
$(MAKE) help ; \
|
||||
fi
|
||||
|
||||
help:
|
||||
@echo ''
|
||||
@echo "This Makefile lets you build Info-ZIP's zip."
|
||||
@echo ''
|
||||
@echo 'To build zip for this computer using the default compiler, just do:'
|
||||
@echo ''
|
||||
@echo ' make -f beos/Makefile'
|
||||
@echo ''
|
||||
@echo 'To build zip for a specific architecture using a specific'
|
||||
@echo 'compiler, do:'
|
||||
@echo ''
|
||||
@echo ' ARCH=cpu CC=compiler make -f beos/Makefile'
|
||||
@echo ''
|
||||
@echo 'Where:'
|
||||
@echo ' cpu is either "powerpc" or "x86"'
|
||||
@echo ' compiler is either "mwcc" or "gcc"'
|
||||
@echo ''
|
||||
|
||||
######################################################################
|
||||
# Basic compile instructions and dependencies
|
||||
|
||||
# this is for GNU make; comment out and notify zip-bugs if it causes errors
|
||||
.SUFFIXES: .c .o
|
||||
|
||||
# default for compiling C files
|
||||
.c.o:
|
||||
$(CC) -c $(CF) $*.c
|
||||
|
||||
|
||||
unzips: $(UNZIPS)
|
||||
objs: $(OBJS)
|
||||
objsdll: $(OBJSDLL)
|
||||
docs: $(DOCS)
|
||||
unzipsman: unzips docs
|
||||
unzipsdocs: unzips docs
|
||||
|
||||
|
||||
unzip$E: $(OBJS) beos/unzip.rsc
|
||||
$(LD) $(LF) $(LOBJS) $(LF2)
|
||||
chmod +x unzip$E
|
||||
xres -o unzip$E beos/unzip.rsc
|
||||
mimeset -f -all unzip$E
|
||||
|
||||
unzipsfx$E: $(OBJX) beos/unzipsfx.rsc
|
||||
$(LD) $(SL) $(LOBJX) $(SL2)
|
||||
chmod +x unzipsfx$E
|
||||
xres -o unzipsfx$E beos/unzipsfx.rsc
|
||||
mimeset -f -all unzipsfx
|
||||
|
||||
funzip$E: $(OBJF)
|
||||
$(LD) $(FL) $(OBJF) $(FL2)
|
||||
chmod +x funzip$E
|
||||
|
||||
zipinfo$E: unzip$E
|
||||
$(LN) unzip$E zipinfo$E
|
||||
|
||||
|
||||
crc32$O: crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
crypt$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
envargs$O: envargs.c $(UNZIP_H)
|
||||
explode$O: explode.c $(UNZIP_H)
|
||||
extract$O: extract.c $(UNZIP_H) crc32.h crypt.h
|
||||
fileio$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
|
||||
funzip$O: funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
|
||||
globals$O: globals.c $(UNZIP_H)
|
||||
inflate$O: inflate.c inflate.h $(UNZIP_H)
|
||||
list$O: list.c $(UNZIP_H)
|
||||
match$O: match.c $(UNZIP_H)
|
||||
process$O: process.c $(UNZIP_H)
|
||||
ttyio$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
ubz2err$O: ubz2err.c $(UNZIP_H)
|
||||
unreduce$O: unreduce.c $(UNZIP_H)
|
||||
unshrink$O: unshrink.c $(UNZIP_H)
|
||||
unzip$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
|
||||
zipinfo$O: zipinfo.c $(UNZIP_H)
|
||||
|
||||
# unzipsfx compilation section
|
||||
unzipsfx$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
|
||||
$(CP) unzip.c unzipsfx.c
|
||||
$(CC) -c $(CF) -DSFX unzipsfx.c
|
||||
$(RM) unzipsfx.c
|
||||
|
||||
crc32_$O: crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
$(CP) crc32.c crc32_.c
|
||||
$(CC) -c $(CF) -DSFX crc32_.c
|
||||
$(RM) crc32_.c
|
||||
|
||||
crypt_$O: crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
$(CP) crypt.c crypt_.c
|
||||
$(CC) -c $(CF) -DSFX crypt_.c
|
||||
$(RM) crypt_.c
|
||||
|
||||
extract_$O: extract.c $(UNZIP_H) crc32.h crypt.h
|
||||
$(CP) extract.c extract_.c
|
||||
$(CC) -c $(CF) -DSFX extract_.c
|
||||
$(RM) extract_.c
|
||||
|
||||
fileio_$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
|
||||
$(CP) fileio.c fileio_.c
|
||||
$(CC) -c $(CF) -DSFX fileio_.c
|
||||
$(RM) fileio_.c
|
||||
|
||||
globals_$O: globals.c $(UNZIP_H)
|
||||
$(CP) globals.c globals_.c
|
||||
$(CC) -c $(CF) -DSFX globals_.c
|
||||
$(RM) globals_.c
|
||||
|
||||
inflate_$O: inflate.c inflate.h $(UNZIP_H) crypt.h
|
||||
$(CP) inflate.c inflate_.c
|
||||
$(CC) -c $(CF) -DSFX inflate_.c
|
||||
$(RM) inflate_.c
|
||||
|
||||
process_$O: process.c $(UNZIP_H) crc32.h
|
||||
$(CP) process.c process_.c
|
||||
$(CC) -c $(CF) -DSFX process_.c
|
||||
$(RM) process_.c
|
||||
|
||||
ttyio_$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
$(CP) ttyio.c ttyio_.c
|
||||
$(CC) -c $(CF) -DSFX ttyio_.c
|
||||
$(RM) ttyio_.c
|
||||
|
||||
ubz2err$O: ubz2err.c $(UNZIP_H)
|
||||
$(CP) ubz2err.c ubz2err_.c
|
||||
$(CC) -c $(CF) -DSFX ubz2err_.c
|
||||
$(RM) ubz2err_.c
|
||||
|
||||
# funzip compilation section
|
||||
crc32f$O: crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
$(CP) crc32.c crc32f.c
|
||||
$(CC) -c $(CF) -DFUNZIP crc32f.c
|
||||
$(RM) crc32f.c
|
||||
|
||||
cryptf$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
|
||||
$(CP) crypt.c cryptf.c
|
||||
$(CC) -c $(CF) -DFUNZIP cryptf.c
|
||||
$(RM) cryptf.c
|
||||
|
||||
globalsf$O: globals.c $(UNZIP_H)
|
||||
$(CP) globals.c globalsf.c
|
||||
$(CC) -c $(CF) -DFUNZIP globalsf.c
|
||||
$(RM) globalsf.c
|
||||
|
||||
inflatef$O: inflate.c inflate.h $(UNZIP_H) crypt.h
|
||||
$(CP) inflate.c inflatef.c
|
||||
$(CC) -c $(CF) -DFUNZIP inflatef.c
|
||||
$(RM) inflatef.c
|
||||
|
||||
ttyiof$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
|
||||
$(CP) ttyio.c ttyiof.c
|
||||
$(CC) -c $(CF) -DFUNZIP ttyiof.c
|
||||
$(RM) ttyiof.c
|
||||
|
||||
# BeOS specific code
|
||||
beos$O: beos/beos.c $(UNZIP_H) unzvers.h beos/beos.h
|
||||
$(CC) -c $(CF) beos/beos.c
|
||||
|
||||
beosmain$O: beos/beosmain.cpp $(UNZIP_H) unzvers.h
|
||||
$(CCPP) -c $(CPPF) beos/beosmain.cpp
|
||||
|
||||
# version() not used by unzipsfx, so no unzvers.h dependency
|
||||
beos_$O: beos/beos.c $(UNZIP_H) beos/beos.h # unzipsfx only
|
||||
$(CP) beos/beos.c beos_.c
|
||||
$(CC) -c $(CF) -Ibeos -DSFX beos_.c
|
||||
$(RM) beos_.c
|
||||
|
||||
beosmain_$O: beos/beosmain.cpp $(UNZIP_H) # unzipsfx only
|
||||
$(CP) beos/beosmain.cpp beosmain_.cpp
|
||||
$(CCPP) -c $(CPPF) -Ibeos -DSFX beosmain_.cpp
|
||||
$(RM) beosmain_.cpp
|
||||
|
||||
|
||||
# this really only works for Unix targets, unless E and O specified on cmd line
|
||||
clean:
|
||||
-rm -f $(UNZIPS) $(OBJS) $(OBJF) $(OBJX) api$O apihelp$O crc_gcc$O \
|
||||
unzipstb$O beosmain.o beosmain_.o
|
||||
|
||||
install: all
|
||||
$(INSTALL) -m 755 $(UNZIPS) $(BINDIR)
|
||||
mimeset -f -all $(BINDIR)/unzip
|
||||
mimeset -f -all $(BINDIR)/unzipsfx
|
||||
$(RM) $(BINDIR)/zipinfo$E
|
||||
$(LN) unzip$E $(BINDIR)/zipinfo$E
|
||||
$(RM) $(BINDIR)/zipgrep$E
|
||||
$(INSTALL) -m 755 unix/zipgrep $(BINDIR)/zipgrep$E
|
||||
$(INSTALL) -m 644 man/unzip.1 $(MANDIR)/unzip.$(manext)
|
||||
$(INSTALL) -m 644 man/unzipsfx.1 $(MANDIR)/unzipsfx.$(manext)
|
||||
$(INSTALL) -m 644 man/zipinfo.1 $(MANDIR)/zipinfo.$(manext)
|
||||
$(INSTALL) -m 644 man/funzip.1 $(MANDIR)/funzip.$(manext)
|
||||
$(INSTALL) -m 644 man/zipgrep.1 $(MANDIR)/zipgrep.$(manext)
|
||||
$(INSTALL) -m 644 $(DOCS) $(MANDIR)
|
||||
|
||||
# alternatively, could use zip method: -cd $(BINDIR); rm -f $(UNZIPS) [etc.]
|
||||
uninstall:
|
||||
rm -f $(INSTALLEDBIN) $(INSTALLEDMAN)
|
||||
|
||||
|
||||
TESTZIP = testmake.zip # the test zipfile
|
||||
|
||||
# test some basic features of the build
|
||||
test: check
|
||||
|
||||
check: unzips
|
||||
@echo ' This is a Unix-specific target. (Just so you know.)'
|
||||
@echo ' (Should work ok on BeOS... [cjh])'
|
||||
if test ! -f $(TESTZIP); then \
|
||||
echo " error: can't find test file $(TESTZIP)"; exit 1; fi
|
||||
#
|
||||
echo " testing extraction"
|
||||
./unzip -b $(TESTZIP) testmake.zipinfo
|
||||
if test $? ; then \
|
||||
echo " error: file extraction from $(TESTZIP) failed"; exit 1; fi
|
||||
#
|
||||
echo ' testing zipinfo (unzip -Z)'
|
||||
./unzip -Z $(TESTZIP) > testmake.unzip-Z
|
||||
if diff testmake.unzip-Z testmake.zipinfo; then ;; else \
|
||||
echo ' error: zipinfo output doesn't match stored version'; fi
|
||||
$(RM) testmake.unzip-Z testmake.zipinfo
|
||||
#
|
||||
echo ' testing unzip -d exdir option'
|
||||
./unzip -b $(TESTZIP) -d testun
|
||||
cat testun/notes
|
||||
#
|
||||
echo ' testing unzip -o and funzip (ignore funzip warning)'
|
||||
./unzip -boq $(TESTZIP) notes -d testun
|
||||
./funzip < $(TESTZIP) > testun/notes2
|
||||
if diff testun/notes testun/notes2; then ;; else \
|
||||
echo 'error: funzip output disagrees with unzip'; fi
|
||||
#
|
||||
echo ' testing unzipsfx (self-extractor)'
|
||||
cat unzipsfx $(TESTZIP) > testsfx
|
||||
$(CHMOD) 0700 testsfx
|
||||
./testsfx -b notes
|
||||
if diff notes testun/notes; then ;; else \
|
||||
echo ' error: unzipsfx file disagrees with unzip'; fi
|
||||
$(RM) testsfx notes testun/notes testun/notes2
|
||||
rmdir testun
|
||||
#
|
||||
echo ' testing complete.'
|
77
programs/fs/unzip60/beos/README
Normal file
77
programs/fs/unzip60/beos/README
Normal file
@ -0,0 +1,77 @@
|
||||
UnZip 5.4 for BeOS
|
||||
|
||||
NOTE:
|
||||
|
||||
If you want to build UnZip 5.4 or later from the source, you'll need to
|
||||
have the "xres" tool installed (unless you remove the "xres" lines in the
|
||||
beos/Makefile). This will cease to be a problem when BeOS R4 ships this
|
||||
fall. Until then, you can get xres from
|
||||
ftp://ftp.be.com/pub/experimental/tools/xres-102.zip.
|
||||
|
||||
HISTORY
|
||||
|
||||
UnZip 5.30 was the first official release of Info-ZIP's UnZip to support
|
||||
the filesystem in BeOS.
|
||||
|
||||
UnZip 5.31 added support for the new filesystem that appeared in the
|
||||
Advanced Access Preview (aka DR9) Release of BeOS.
|
||||
|
||||
UnZip 5.32 added several important bug fixes.
|
||||
|
||||
UnZip 5.4:
|
||||
|
||||
- supports BeOS on x86 hardware (and cross-compiling, if a compiler is
|
||||
present)
|
||||
|
||||
- ask the Registrar to assign a file type to files that don't have one
|
||||
|
||||
- adds a new -J option on BeOS; this lets you extract the data for a file
|
||||
without restoring its file attributes (handy if you stumble on really
|
||||
old BeOS ZIP archives... from before BeOS Preview Release)
|
||||
|
||||
- will restore attributes properly on symbolic links (you'll need
|
||||
zip 2.21 or later to create ZIP files that store attributes for
|
||||
symbolic links)
|
||||
|
||||
*** WARNING ***
|
||||
You may find some extremely old BeOS zip archives that store their
|
||||
file attributes differently; these will be from DR8 and earlier (when
|
||||
BeOS copied the MacOS type/creator fields instead of using the current
|
||||
extremely flexible scheme).
|
||||
|
||||
You can still unpack the _data_ in older zip files, but you won't be
|
||||
able to recover the file attributes in those archives. Use the -J option
|
||||
with these files or you'll get "compressed EA data missing" and "zipfile
|
||||
probably corrupt" errors, even though the data is intact!
|
||||
|
||||
The new scheme makes handling BeOS file attributes much more robust, and
|
||||
allows for possible future expansion without another round of
|
||||
incompatibilities.
|
||||
|
||||
That's life on the edge!
|
||||
*** WARNING ***
|
||||
|
||||
The new filesystem allows for huge files (up to several terabytes!) with
|
||||
huge amounts of meta-data (up to several terabytes!). The existing ZIP
|
||||
format was designed when this much data on a personal computer was
|
||||
science fiction; as a result, it's quite possible that large amounts of file
|
||||
attributes (more than maybe 100+K bytes) could be truncated. Zip and UnZip
|
||||
try to deal with this in a fairly sensible way, working on the assumption
|
||||
that the data in the file is more important than the data in the file
|
||||
attributes.
|
||||
|
||||
One way to run into this problem is to mount an HFS volume and zip
|
||||
some Mac files that have large resources attached to them. This
|
||||
happens more often than you'd expect; I've seen several 0-byte files that
|
||||
had over four megabytes of resources. Even more stupid, these resources
|
||||
were _data_ (sound for a game), and could have been easily stored as
|
||||
data...
|
||||
|
||||
KNOWN BUGS
|
||||
|
||||
None! Yahoo!
|
||||
|
||||
Please report any bugs to Zip-Bugs@lists.wku.edu.
|
||||
|
||||
- Chris Herborth (chrish@qnx.com)
|
||||
November 2/1998
|
61
programs/fs/unzip60/beos/beocfg.h
Normal file
61
programs/fs/unzip60/beos/beocfg.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2009-Jan-02 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/*---------------------------------------------------------------------------
|
||||
BeOS specific configuration section:
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __beocfg_h
|
||||
#define __beocfg_h
|
||||
|
||||
#include <sys/types.h> /* [cjh]: This is pretty much a generic */
|
||||
#include <sys/stat.h> /* POSIX 1003.1 system; see beos/ for */
|
||||
#include <fcntl.h> /* extra code to deal with our extra file */
|
||||
#include <sys/param.h> /* attributes. */
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
#define GOT_UTIMBUF
|
||||
#define DIRENT
|
||||
#include <time.h>
|
||||
#ifndef DATE_FORMAT
|
||||
# define DATE_FORMAT DF_MDY /* GRR: customize with locale.h somehow? */
|
||||
#endif
|
||||
#define lenEOL 1
|
||||
#define PutNativeEOL *q++ = native(LF);
|
||||
#define SCREENSIZE(ttrows, ttcols) screensize(ttrows, ttcols)
|
||||
#define SCREENWIDTH 80
|
||||
#if (!defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME))
|
||||
# define USE_EF_UT_TIME
|
||||
#endif
|
||||
#define SET_SYMLINK_ATTRIBS
|
||||
#define SET_DIR_ATTRIB
|
||||
#if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))
|
||||
# define TIMESTAMP
|
||||
#endif
|
||||
#define RESTORE_UIDGID
|
||||
#define NO_STRNICMP /* not in the x86 headers at least */
|
||||
#define INT_SPRINTF
|
||||
#define SYMLINKS
|
||||
#define MAIN main_stub /* now that we're using a wrapper... */
|
||||
|
||||
/* Static variables that we have to add to Uz_Globs: */
|
||||
#define SYSTEM_SPECIFIC_GLOBALS \
|
||||
int created_dir, renamed_fullpath;\
|
||||
char *rootpath, *buildpath, *end;\
|
||||
ZCONST char *wildname;\
|
||||
char *dirname, matchname[FILNAMSIZ];\
|
||||
int rootlen, have_dirname, dirnamelen, notfirstcall;\
|
||||
zvoid *wild_dir;
|
||||
|
||||
/* created_dir, and renamed_fullpath are used by both mapname() and */
|
||||
/* checkdir(). */
|
||||
/* rootlen, rootpath, buildpath and end are used by checkdir(). */
|
||||
/* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */
|
||||
/* and notfirstcall are used by do_wild(). */
|
||||
|
||||
#endif /* !__beocfg_h */
|
1544
programs/fs/unzip60/beos/beos.c
Normal file
1544
programs/fs/unzip60/beos/beos.c
Normal file
File diff suppressed because it is too large
Load Diff
46
programs/fs/unzip60/beos/beos.h
Normal file
46
programs/fs/unzip60/beos/beos.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright (c) 1990-2004 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/* beos.h -- A few handy things for the BeOS port. */
|
||||
/* (c) 1997 Chris Herborth (chrish@qnx.com) */
|
||||
/* This is covered under the usual Info-ZIP copyright. */
|
||||
|
||||
/* "#define EF_BE_FL_UNCMPR 0x01" has been moved into unzpriv.h */
|
||||
#define EB_BE_FL_BADBITS 0xfe /* bits currently undefined */
|
||||
|
||||
#define BEOS_ASSIGN_FILETYPE 1 /* call update_mime_info() */
|
||||
|
||||
/*
|
||||
DR9 'Be' extra-field layout:
|
||||
|
||||
'Be' - signature
|
||||
ef_size - size of data in this EF (little-endian unsigned short)
|
||||
full_size - uncompressed data size (little-endian unsigned long)
|
||||
flag - flags (byte)
|
||||
flags & EB_BE_FL_UNCMPR = the data is not compressed
|
||||
flags & EB_BE_FL_BADBITS = the data is corrupted or we
|
||||
can't handle it properly
|
||||
data - compressed or uncompressed file attribute data
|
||||
|
||||
If flag & EB_BE_FL_UNCMPR, the data is not compressed; this optimisation is
|
||||
necessary to prevent wasted space for files with small attributes (which
|
||||
appears to be quite common on the Advanced Access DR9 release). In this
|
||||
case, there should be ( ef_size - EB_BEOS_HLEN ) bytes of data, and full_size
|
||||
should equal ( ef_size - EB_BEOS_HLEN ).
|
||||
|
||||
If the data is compressed, there will be ( ef_size - EB_BEOS_HLEN ) bytes of
|
||||
compressed data, and full_size bytes of uncompressed data.
|
||||
|
||||
If a file has absolutely no attributes, there will not be a 'Be' extra field.
|
||||
|
||||
The uncompressed data is arranged like this:
|
||||
|
||||
attr_name\0 - C string
|
||||
struct attr_info (fields in big-endian format)
|
||||
attr_data (length in attr_info.size)
|
||||
*/
|
44
programs/fs/unzip60/beos/beosmain.cpp
Normal file
44
programs/fs/unzip60/beos/beosmain.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
// -*- C++ -*-
|
||||
/*
|
||||
Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
//
|
||||
// WARNING: This is C++, not C! GNU C is not supported here!
|
||||
//
|
||||
// beos_init.cpp
|
||||
//
|
||||
// BeOS-specific C++ routines for use with Info-ZIP's UnZip 5.30 or later.
|
||||
//
|
||||
// This is necessary because we need to have an app_server connection to be
|
||||
// able to ask the system to assign a MIME type to an un-typed file. Strange
|
||||
// but true (the update_mime_info() call needs to send/receive messages).
|
||||
//
|
||||
// If you're writing your own Zip application, you probably DO NOT want to
|
||||
// include this file!
|
||||
|
||||
#include <app/Application.h>
|
||||
|
||||
#ifdef SFX
|
||||
const static char *unzip_signature = "application/x-vnd.Info-ZIP.UnZipSFX";
|
||||
#else
|
||||
const static char *unzip_signature = "application/x-vnd.Info-ZIP.UnZip";
|
||||
#endif
|
||||
|
||||
extern "C" int main_stub( int argc, char *argv[] );
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
BApplication app( unzip_signature );
|
||||
|
||||
int retval = main_stub( argc, argv );
|
||||
|
||||
app.PostMessage( B_QUIT_REQUESTED );
|
||||
app.Run();
|
||||
|
||||
return retval;
|
||||
}
|
BIN
programs/fs/unzip60/beos/unzip.rsc
Normal file
BIN
programs/fs/unzip60/beos/unzip.rsc
Normal file
Binary file not shown.
BIN
programs/fs/unzip60/beos/unzipsfx.rsc
Normal file
BIN
programs/fs/unzip60/beos/unzipsfx.rsc
Normal file
Binary file not shown.
9
programs/fs/unzip60/bzip2/00README.IZ
Normal file
9
programs/fs/unzip60/bzip2/00README.IZ
Normal file
@ -0,0 +1,9 @@
|
||||
This folder is the root folder for the externally supplied bzip2 source code.
|
||||
Additionally, this folder contains the following Info-ZIP-specific files:
|
||||
|
||||
00README.IZ this file
|
||||
Makebz2.iz "generic" make script for the base bzip2 lib used in UnZip
|
||||
makbz2iz.msc make script for the bzip2 support, win32 port, MS VC++
|
||||
makbz2iz.wat make script for bzip2 support, msdos & win32, OpenWatcom C++
|
||||
descrbz2.mms MMS/MMK make script for OpenVMS
|
||||
buildbz2.com OpenVMS DCL procedure to build the base bz2 lib used in UnZip
|
54
programs/fs/unzip60/bzip2/Makebz2.iz
Normal file
54
programs/fs/unzip60/bzip2/Makebz2.iz
Normal file
@ -0,0 +1,54 @@
|
||||
# Makefile for UnZip's bzip2 support library
|
||||
# Unix, and other ports using sufficiently unix-compatible
|
||||
# library naming conventions (e.g. misc. GCC ports)
|
||||
#
|
||||
# (c) 2006-2007 Info-ZIP
|
||||
# Last revision: Christian Spieler, 2007-Mar-31
|
||||
#
|
||||
# This Makefile is intended to be called from UnZip's main make procedure.
|
||||
|
||||
SHELL=/bin/sh
|
||||
|
||||
# To assist in cross-compiling
|
||||
CC=gcc
|
||||
AR=ar
|
||||
RANLIB=ranlib
|
||||
RM=rm -f
|
||||
LDFLAGS=
|
||||
O=.o
|
||||
|
||||
CFLAGS=-Wall -Winline -O2 -g
|
||||
CCBZ2DEFS=-DBZ_NO_STDIO
|
||||
|
||||
|
||||
OBJS= blocksort$(O) \
|
||||
huffman$(O) \
|
||||
crctable$(O) \
|
||||
randtable$(O) \
|
||||
compress$(O) \
|
||||
decompress$(O) \
|
||||
bzlib$(O)
|
||||
|
||||
# How to compile sources
|
||||
.c$(O):
|
||||
$(CC) $(CFLAGS) $(CCBZ2DEFS) -o $@ -c $<
|
||||
|
||||
all: libbz2.a
|
||||
|
||||
libbz2.a: $(OBJS)
|
||||
-@$(RM) libbz2.a
|
||||
$(AR) cq libbz2.a $(OBJS)
|
||||
-$(RANLIB) libbz2.a
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) libbz2.a
|
||||
|
||||
$(OBJS): bzlib.h bzlib_private.h
|
||||
|
||||
blocksort$(O): blocksort.c
|
||||
huffman$(O): huffman.c
|
||||
crctable$(O): crctable.c
|
||||
randtable$(O): randtable.c
|
||||
compress$(O): compress.c
|
||||
decompress$(O): decompress.c
|
||||
bzlib$(O): bzlib.c
|
277
programs/fs/unzip60/bzip2/buildbz2.com
Normal file
277
programs/fs/unzip60/bzip2/buildbz2.com
Normal file
@ -0,0 +1,277 @@
|
||||
$! BUILDBZ2.COM
|
||||
$!
|
||||
$! Build procedure for LIBBZ2_NS support library used with the
|
||||
$! VMS versions of UnZip/ZipInfo and UnZipSFX
|
||||
$!
|
||||
$! Last revised: 2007-12-29 CS.
|
||||
$!
|
||||
$! Command args:
|
||||
$! - select compiler environment: "VAXC", "DECC", "GNUC"
|
||||
$! - select compiler listings: "LIST" Note that the whole argument
|
||||
$! is added to the compiler command, so more elaborate options
|
||||
$! like "LIST/SHOW=ALL" (quoted or space-free) may be specified.
|
||||
$! - supply additional compiler options: "CCOPTS=xxx" Allows the
|
||||
$! user to add compiler command options like /ARCHITECTURE or
|
||||
$! /[NO]OPTIMIZE. For example, CCOPTS=/ARCH=HOST/OPTI=TUNE=HOST
|
||||
$! or CCOPTS=/DEBUG/NOOPTI. These options must be quoted or
|
||||
$! space-free.
|
||||
$!
|
||||
$! To specify additional options, define the symbol LOCAL_BZIP2
|
||||
$! as a comma-separated list of the C macros to be defined, and
|
||||
$! then run BUILDBZ2.COM. For example:
|
||||
$!
|
||||
$! $ LOCAL_BZIP2 = "RETURN_CODES"
|
||||
$! $ @ []BUILDBZ2.COM
|
||||
$!
|
||||
$! If you edit this procedure to set LOCAL_BZIP2 here, be sure to
|
||||
$! use only one "=", to avoid affecting other procedures.
|
||||
$!
|
||||
$!
|
||||
$ on error then goto error
|
||||
$ on control_y then goto error
|
||||
$ OLD_VERIFY = f$verify(0)
|
||||
$!
|
||||
$ edit := edit ! override customized edit commands
|
||||
$ say := write sys$output
|
||||
$!
|
||||
$!##################### Read settings from environment ########################
|
||||
$!
|
||||
$ if (f$type(LOCAL_BZIP2) .eqs. "")
|
||||
$ then
|
||||
$ local_bzip2 = ""
|
||||
$ else ! Trim blanks and append comma if missing
|
||||
$ local_bzip2 = f$edit(local_bzip2, "TRIM")
|
||||
$ if (f$extract((f$length(local_bzip2) - 1), 1, local_bzip2) .nes. ",")
|
||||
$ then
|
||||
$ local_bzip2 = local_bzip2 + ", "
|
||||
$ endif
|
||||
$ endif
|
||||
$!
|
||||
$!##################### Customizing section #############################
|
||||
$!
|
||||
$ unzx_unx = "UNZIP"
|
||||
$ unzx_cli = "UNZIP_CLI"
|
||||
$ unzsfx_unx = "UNZIPSFX"
|
||||
$ unzsfx_cli = "UNZIPSFX_CLI"
|
||||
$!
|
||||
$ CCOPTS = ""
|
||||
$ LINKOPTS = "/notraceback"
|
||||
$ LISTING = " /nolist"
|
||||
$ MAY_USE_DECC = 1
|
||||
$ MAY_USE_GNUC = 0
|
||||
$!
|
||||
$! Process command line parameters requesting optional features.
|
||||
$!
|
||||
$ arg_cnt = 1
|
||||
$ argloop:
|
||||
$ current_arg_name = "P''arg_cnt'"
|
||||
$ curr_arg = f$edit( 'current_arg_name', "UPCASE")
|
||||
$ if (curr_arg .eqs. "") then goto argloop_out
|
||||
$!
|
||||
$ if (f$extract( 0, 5, curr_arg) .eqs. "CCOPT")
|
||||
$ then
|
||||
$ opts = f$edit( curr_arg, "COLLAPSE")
|
||||
$ eq = f$locate( "=", opts)
|
||||
$ CCOPTS = f$extract( (eq+ 1), 1000, opts)
|
||||
$ goto argloop_end
|
||||
$ endif
|
||||
$!
|
||||
$ if (f$extract( 0, 4, curr_arg) .eqs. "LIST")
|
||||
$ then
|
||||
$ LISTING = "/''curr_arg'" ! But see below for mods.
|
||||
$ goto argloop_end
|
||||
$ endif
|
||||
$!
|
||||
$ if (curr_arg .eqs. "VAXC")
|
||||
$ then
|
||||
$ MAY_USE_DECC = 0
|
||||
$ MAY_USE_GNUC = 0
|
||||
$ goto argloop_end
|
||||
$ endif
|
||||
$!
|
||||
$ if (curr_arg .eqs. "DECC")
|
||||
$ then
|
||||
$ MAY_USE_DECC = 1
|
||||
$ MAY_USE_GNUC = 0
|
||||
$ goto argloop_end
|
||||
$ endif
|
||||
$!
|
||||
$ if (curr_arg .eqs. "GNUC")
|
||||
$ then
|
||||
$ MAY_USE_DECC = 0
|
||||
$ MAY_USE_GNUC = 1
|
||||
$ goto argloop_end
|
||||
$ endif
|
||||
$!
|
||||
$ say "Unrecognized command-line option: ''curr_arg'"
|
||||
$ goto error
|
||||
$!
|
||||
$ argloop_end:
|
||||
$ arg_cnt = arg_cnt + 1
|
||||
$ goto argloop
|
||||
$ argloop_out:
|
||||
$!
|
||||
$!#######################################################################
|
||||
$!
|
||||
$! Find out current disk, directory, compiler and options
|
||||
$!
|
||||
$ workdir = f$environment("default")
|
||||
$ here = f$parse(workdir, , , "device") + f$parse(workdir, , , "directory")
|
||||
$!
|
||||
$! Sense the host architecture (Alpha, Itanium, or VAX).
|
||||
$!
|
||||
$ if (f$getsyi("HW_MODEL") .lt. 1024)
|
||||
$ then
|
||||
$ arch = "VAX"
|
||||
$ else
|
||||
$ if (f$getsyi("ARCH_TYPE") .eq. 2)
|
||||
$ then
|
||||
$ arch = "ALPHA"
|
||||
$ else
|
||||
$ if (f$getsyi("ARCH_TYPE") .eq. 3)
|
||||
$ then
|
||||
$ arch = "IA64"
|
||||
$ else
|
||||
$ arch = "unknown_arch"
|
||||
$ endif
|
||||
$ endif
|
||||
$ endif
|
||||
$!
|
||||
$ dest = arch
|
||||
$ cmpl = "DEC/Compaq/HP C"
|
||||
$ opts = ""
|
||||
$ if (arch .nes. "VAX")
|
||||
$ then
|
||||
$ HAVE_DECC_VAX = 0
|
||||
$ USE_DECC_VAX = 0
|
||||
$!
|
||||
$ if (MAY_USE_GNUC)
|
||||
$ then
|
||||
$ say "GNU C is not supported for ''arch'."
|
||||
$ say "You must use DEC/Compaq/HP C to build UnZip."
|
||||
$ goto error
|
||||
$ endif
|
||||
$!
|
||||
$ if (.not. MAY_USE_DECC)
|
||||
$ then
|
||||
$ say "VAX C is not supported for ''arch'."
|
||||
$ say "You must use DEC/Compaq/HP C to build UnZip."
|
||||
$ goto error
|
||||
$ endif
|
||||
$!
|
||||
$ cc = "cc /standard=relax /prefix=all /ansi /names=(as_is)"
|
||||
$ defs = "''local_bzip2'"
|
||||
$ else
|
||||
$ HAVE_DECC_VAX = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "")
|
||||
$ HAVE_VAXC_VAX = (f$search("SYS$SYSTEM:VAXC.EXE") .nes. "")
|
||||
$ MAY_HAVE_GNUC = (f$trnlnm("GNU_CC") .nes. "")
|
||||
$ if (HAVE_DECC_VAX .and. MAY_USE_DECC)
|
||||
$ then
|
||||
$ ! We use DECC:
|
||||
$ USE_DECC_VAX = 1
|
||||
$ cc = "cc /decc /prefix=all /names=(as_is)"
|
||||
$ defs = "''local_bzip2'"
|
||||
$ else
|
||||
$ ! We use VAXC (or GNU C):
|
||||
$ USE_DECC_VAX = 0
|
||||
$ defs = "''local_bzip2'"
|
||||
$ if ((.not. HAVE_VAXC_VAX .and. MAY_HAVE_GNUC) .or. MAY_USE_GNUC)
|
||||
$ then
|
||||
$ cc = "gcc"
|
||||
$ dest = "''dest'G"
|
||||
$ cmpl = "GNU C"
|
||||
$ opts = "GNU_CC:[000000]GCCLIB.OLB /LIBRARY,"
|
||||
$ else
|
||||
$ if (HAVE_DECC_VAX)
|
||||
$ then
|
||||
$ cc = "cc /vaxc"
|
||||
$ else
|
||||
$ cc = "cc"
|
||||
$ endif
|
||||
$ dest = "''dest'V"
|
||||
$ cmpl = "VAX C"
|
||||
$ endif
|
||||
$ endif
|
||||
$ endif
|
||||
$!
|
||||
$! Reveal the plan. If compiling, set some compiler options.
|
||||
$!
|
||||
$ say "Compiling bzip2 on ''arch' using ''cmpl'."
|
||||
$!
|
||||
$ DEF_NS = "/define = (''defs'BZ_NO_STDIO, VMS)"
|
||||
$!
|
||||
$! If [.'dest'] does not exist, either complain (link-only) or make it.
|
||||
$!
|
||||
$ if (f$search("''dest'.dir;1") .eqs. "")
|
||||
$ then
|
||||
$ create /directory [.'dest']
|
||||
$ endif
|
||||
$!
|
||||
$! Arrange to get arch-specific list file placement, if listing, and if
|
||||
$! the user didn't specify a particular "/LIST =" destination.
|
||||
$!
|
||||
$ L = f$edit(LISTING, "COLLAPSE")
|
||||
$ if ((f$extract(0, 5, L) .eqs. "/LIST") .and. -
|
||||
(f$extract(4, 1, L) .nes. "="))
|
||||
$ then
|
||||
$ LISTING = " /LIST = [.''dest']" + f$extract(5, 1000, LISTING)
|
||||
$ endif
|
||||
$!
|
||||
$! Define compiler command.
|
||||
$!
|
||||
$ cc = cc + " /include = ([])" + LISTING + CCOPTS
|
||||
$!
|
||||
$! Show interesting facts.
|
||||
$!
|
||||
$ say " architecture = ''arch' (destination = [.''dest'])"
|
||||
$ say " cc = ''cc'"
|
||||
$ say ""
|
||||
$!
|
||||
$ tmp = f$verify( 1) ! Turn echo on to see what's happening.
|
||||
$!
|
||||
$!------------------------------- BZip2 section ------------------------------
|
||||
$!
|
||||
$! Compile the sources.
|
||||
$!
|
||||
$ cc 'DEF_NS' /object = [.'dest']blocksort.OBJ blocksort.c
|
||||
$ cc 'DEF_NS' /object = [.'dest']huffman.OBJ huffman.c
|
||||
$ cc 'DEF_NS' /object = [.'dest']crctable.OBJ crctable.c
|
||||
$ cc 'DEF_NS' /object = [.'dest']randtable.OBJ randtable.c
|
||||
$ cc 'DEF_NS' /object = [.'dest']compress.OBJ compress.c
|
||||
$ cc 'DEF_NS' /object = [.'dest']decompress.OBJ decompress.c
|
||||
$ cc 'DEF_NS' /object = [.'dest']bzlib.OBJ bzlib.c
|
||||
$!
|
||||
$! Create the object library.
|
||||
$!
|
||||
$ if (f$search( "[.''dest']LIBBZ2_NS.OLB") .eqs. "") then -
|
||||
libr /object /create [.'dest']LIBBZ2_NS.OLB
|
||||
$!
|
||||
$ libr /object /replace [.'dest']LIBBZ2_NS.OLB -
|
||||
[.'dest']blocksort.OBJ, -
|
||||
[.'dest']huffman.OBJ, -
|
||||
[.'dest']crctable.OBJ, -
|
||||
[.'dest']randtable.OBJ, -
|
||||
[.'dest']compress.OBJ, -
|
||||
[.'dest']decompress.OBJ, -
|
||||
[.'dest']bzlib.OBJ
|
||||
$!
|
||||
$! Restore the original default directory, deassign the temporary
|
||||
$! logical names, and restore the DCL verify status.
|
||||
$!
|
||||
$ error:
|
||||
$!
|
||||
$ if (f$type(here) .nes. "")
|
||||
$ then
|
||||
$ if (here .nes. "")
|
||||
$ then
|
||||
$ set default 'here'
|
||||
$ endif
|
||||
$ endif
|
||||
$!
|
||||
$ if (f$type(OLD_VERIFY) .nes. "")
|
||||
$ then
|
||||
$ tmp = f$verify(OLD_VERIFY)
|
||||
$ endif
|
||||
$!
|
||||
$ exit
|
||||
$!
|
285
programs/fs/unzip60/bzip2/descrbz2.mms
Normal file
285
programs/fs/unzip60/bzip2/descrbz2.mms
Normal file
@ -0,0 +1,285 @@
|
||||
!==========================================================================
|
||||
! MMS description file for bzip2 support in UnZip 6 2008-02-16
|
||||
!==========================================================================
|
||||
!
|
||||
! To build the LIBBZ2_NS library, edit the USER CUSTOMIZATION
|
||||
! lines below to taste, then do
|
||||
! mms
|
||||
! or
|
||||
! mmk
|
||||
! if you use Matt's Make (free MMS-compatible make utility).
|
||||
!
|
||||
! In all other cases where you want to explicitly specify a makefile target,
|
||||
! you have to specify your compiling environment, too. These are:
|
||||
!
|
||||
! $ MMS/MACRO=(__ALPHA__=1) ! Alpha AXP, (DEC C)
|
||||
! $ MMS/MACRO=(__IA64__=1) ! IA64, (DEC C)
|
||||
! $ MMS/MACRO=(__DECC__=1) ! VAX, using DEC C
|
||||
! $ MMS/MACRO=(__FORCE_VAXC__=1) ! VAX, prefering VAXC over DECC
|
||||
! $ MMS/MACRO=(__VAXC__=1) ! VAX, where VAXC is default
|
||||
! $ MMS/MACRO=(__GNUC__=1) ! VAX, using GNU C
|
||||
!
|
||||
|
||||
! To delete all .OBJ, .OLB, .EXE and .HLP files,
|
||||
! mms clean
|
||||
|
||||
## The "DO_THE_BUILD" target does no longer work with current
|
||||
## releases of the MMS tool, sigh.
|
||||
#DO_THE_BUILD :
|
||||
# @ decc = f$search("SYS$SYSTEM:DECC$COMPILER.EXE").nes.""
|
||||
# @ axp = (f$getsyi("HW_MODEL") .ge. 1024) .and. -
|
||||
# (f$getsyi("HW_MODEL") .lt. 4096)
|
||||
# @ i64 = f$getsyi("HW_MODEL") .ge. 4096
|
||||
# @ macro = "/MACRO=("
|
||||
#.IFDEF CCOPTS
|
||||
# @ macro = macro + """CCOPTS=$(CCOPTS)"","
|
||||
#.ENDIF
|
||||
# @ if decc then macro = macro + "__DECC__=1,"
|
||||
# @ if axp then macro = macro + "__ALPHA__=1,"
|
||||
# @ if i64 then macro = macro + "__IA64__=1,"
|
||||
# @ if .not.(axp .or. i64 .or. decc) then macro = macro + "__VAXC__=1,"
|
||||
# @ macro = f$extract(0,f$length(macro)-1,macro)+ ")"
|
||||
# $(MMS)$(MMSQUALIFIERS)'macro' DEFAULT
|
||||
|
||||
# Define MMK architecture macros when using MMS.
|
||||
|
||||
.IFDEF __MMK__ # __MMK__
|
||||
.ELSE # __MMK__
|
||||
ALPHA_X_ALPHA = 1
|
||||
IA64_X_IA64 = 1
|
||||
VAX_X_VAX = 1
|
||||
.IFDEF $(MMS$ARCH_NAME)_X_ALPHA # $(MMS$ARCH_NAME)_X_ALPHA
|
||||
__ALPHA__ = 1
|
||||
.ENDIF # $(MMS$ARCH_NAME)_X_ALPHA
|
||||
.IFDEF $(MMS$ARCH_NAME)_X_IA64 # $(MMS$ARCH_NAME)_X_IA64
|
||||
__IA64__ = 1
|
||||
.ENDIF # $(MMS$ARCH_NAME)_X_IA64
|
||||
.IFDEF $(MMS$ARCH_NAME)_X_VAX # $(MMS$ARCH_NAME)_X_VAX
|
||||
__VAX__ = 1
|
||||
.ENDIF # $(MMS$ARCH_NAME)_X_VAX
|
||||
.ENDIF # __MMK__
|
||||
|
||||
.IFDEF __ALPHA__ # __ALPHA__
|
||||
DEST = ALPHA
|
||||
#E = .AXP_EXE
|
||||
#O = .AXP_OBJ
|
||||
#A = .AXP_OLB
|
||||
.ELSE # __ALPHA__
|
||||
.IFDEF __IA64__ # __IA64__
|
||||
DEST = IA64
|
||||
#E = .I64_EXE
|
||||
#O = .I64_OBJ
|
||||
#A = .I64_OLB
|
||||
.ELSE # __IA64__
|
||||
.IFDEF __DECC__ # __DECC__
|
||||
DEST = VAX
|
||||
#E = .VAX_DECC_EXE
|
||||
#O = .VAX_DECC_OBJ
|
||||
#A = .VAX_DECC_OLB
|
||||
.ENDIF # __DECC__
|
||||
.IFDEF __FORCE_VAXC__ # __FORCE_VAXC__
|
||||
__VAXC__ = 1
|
||||
.ENDIF # __FORCE_VAXC__
|
||||
.IFDEF __VAXC__ # __VAXC__
|
||||
DEST = VAXV
|
||||
#E = .VAX_VAXC_EXE
|
||||
#O = .VAX_VAXC_OBJ
|
||||
#A = .VAX_VAXC_OLB
|
||||
.ENDIF # __VAXC__
|
||||
.IFDEF __GNUC__ # __GNUC__
|
||||
DEST = VAXG
|
||||
#E = .VAX_GNUC_EXE
|
||||
#O = .VAX_GNUC_OBJ
|
||||
#A = .VAX_GNUC_OLB
|
||||
.ENDIF # __GNUC__
|
||||
.ENDIF # __IA64__
|
||||
.ENDIF # __ALPHA__
|
||||
.IFDEF O # O
|
||||
.ELSE # O
|
||||
!If EXE and OBJ extensions aren't defined, define them
|
||||
E = .EXE
|
||||
O = .OBJ
|
||||
A = .OLB
|
||||
.ENDIF # O
|
||||
|
||||
.IFDEF SRCDIR
|
||||
.ELSE
|
||||
SRCDIR = []
|
||||
.ENDIF
|
||||
.IFDEF DSTDIR # DSTDIR
|
||||
.ELSE # DSTDIR
|
||||
.IFDEF DEST # DEST
|
||||
DSTDIR = [.$(DEST)]
|
||||
.ELSE # DEST
|
||||
DSTDIR = []
|
||||
.ENDIF # DEST
|
||||
.ENDIF # DSTDIR
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!! USER CUSTOMIZATION !!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! add any common optional preprocessor flags (macros) here
|
||||
! (do not forget a trailing comma!!):
|
||||
COMMON_DEFS =
|
||||
!!!!!!!!!!!!!!!!!!!!!!!! END OF USER CUSTOMIZATION !!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.IFDEF __GNUC__
|
||||
CC = gcc
|
||||
LIBS = ,GNU_CC:[000000]GCCLIB.OLB/LIB
|
||||
.ELSE
|
||||
CC = cc
|
||||
LIBS =
|
||||
.ENDIF
|
||||
|
||||
CFLAGS = /NOLIST
|
||||
|
||||
OPTFILE = sys$disk:[.vms]vaxcshr.opt
|
||||
|
||||
.IFDEF __ALPHA__ # __ALPHA__
|
||||
CC_OPTIONS = /STANDARD=RELAX/PREFIX=ALL/ANSI/NAMES=(AS_IS)
|
||||
CC_DEFS =
|
||||
.ELSE # __ALPHA__
|
||||
.IFDEF __IA64__ # __IA64__
|
||||
CC_OPTIONS = /STANDARD=RELAX/PREFIX=ALL/ANSI/NAMES=(AS_IS)
|
||||
CC_DEFS =
|
||||
.ELSE # __IA64__
|
||||
.IFDEF __DECC__ # __DECC__
|
||||
CC_OPTIONS = /DECC/STANDARD=RELAX/PREFIX=ALL/NAMES=(AS_IS)
|
||||
CC_DEFS =
|
||||
.ELSE # __DECC__
|
||||
.IFDEF __FORCE_VAXC__ # __FORCE_VAXC__
|
||||
!Select VAXC on systems where DEC C exists
|
||||
CC_OPTIONS = /VAXC
|
||||
.ELSE # __FORCE_VAXC__
|
||||
!No flag allowed/needed on a pure VAXC system
|
||||
CC_OPTIONS =
|
||||
.ENDIF # __FORCE_VAXC__
|
||||
CC_DEFS =
|
||||
.ENDIF # __DECC__
|
||||
.ENDIF # __IA64__
|
||||
.ENDIF # __ALPHA__
|
||||
|
||||
!
|
||||
! The .FIRST target is needed only if we're serious about building,
|
||||
! and then, only if BZIP2 support was requested.
|
||||
!
|
||||
.IFDEF MMSTARGETS # MMSTARGETS
|
||||
.FIRST
|
||||
@ write sys$output " Destination: $(DSTDIR)"
|
||||
@ write sys$output ""
|
||||
if ("$(DEST)" .nes. "") then -
|
||||
if (f$search("$(DEST).DIR;1") .eqs. "") then -
|
||||
create /directory $(DSTDIR)
|
||||
.ENDIF # MMSTARGETS
|
||||
CC_DEFS2 =
|
||||
CFLAGS_INCL = /INCLUDE = []
|
||||
|
||||
.IFDEF __DEBUG__
|
||||
CDEB = /DEBUG/NOOPTIMIZE
|
||||
.ELSE
|
||||
CDEB =
|
||||
.ENDIF
|
||||
|
||||
CFLAGS_ALL = $(CC_OPTIONS) $(CFLAGS) $(CDEB) $(CFLAGS_INCL) -
|
||||
/def=($(CC_DEFS) $(COMMON_DEFS) BZ_NO_STDIO, VMS) -
|
||||
$(CCOPTS)
|
||||
|
||||
|
||||
OBJBZ2LIB = \
|
||||
$(DSTDIR)blocksort$(O), \
|
||||
$(DSTDIR)huffman$(O), \
|
||||
$(DSTDIR)crctable$(O), \
|
||||
$(DSTDIR)randtable$(O), \
|
||||
$(DSTDIR)compress$(O), \
|
||||
$(DSTDIR)decompress$(O), \
|
||||
$(DSTDIR)bzlib$(O)
|
||||
|
||||
OLBBZ2 = $(DSTDIR)LIBBZ2_NS$(A)
|
||||
|
||||
BZIP2_H = $(SRCDIR)bzlib.h $(SRCDIR)bzlib_private.h
|
||||
|
||||
!!!!!!!!!!!!!!!!!!! override default rules: !!!!!!!!!!!!!!!!!!!
|
||||
.suffixes :
|
||||
.suffixes : .ANL $(E) $(A) .MLB .HLB .TLB .FLB $(O) -
|
||||
.FORM .BLI .B32 .C .c .COB -
|
||||
.FOR .BAS .B16 .PLI .PEN .PAS .MAC .MAR .M64 .CLD .MSG .COR .DBL -
|
||||
.RPG .SCN .IFDL .RBA .RC .RCO .RFO .RPA .SC .SCO .SFO .SPA .SPL -
|
||||
.SQLADA .SQLMOD .RGK .RGC .MEM .RNO .HLP .RNH .L32 .REQ .R32 -
|
||||
.L16 .R16 .TXT .H .FRM .MMS .DDL .COM .DAT .OPT .CDO .SDML .ADF -
|
||||
.GDF .LDF .MDF .RDF .TDF
|
||||
|
||||
$(O)$(A) :
|
||||
If "''F$Search("$(MMS$TARGET)")'" .EQS. "" Then $(LIBR)/Create $(MMS$TARGET)
|
||||
$(LIBR)$(LIBRFLAGS) $(MMS$TARGET) $(MMS$SOURCE)
|
||||
|
||||
.c$(O) :
|
||||
$(CC) $(CFLAGS_ALL) /OBJ=$(MMS$TARGET) $(MMS$SOURCE)
|
||||
|
||||
!!!!!!!!!!!!!!!!!! here starts the bzip2 specific part !!!!!!!!!!!
|
||||
|
||||
DEFAULT default : CHK_DESTDIR $(OLBBZ2)
|
||||
@ ! Do nothing.
|
||||
|
||||
CLEAN.COM clean.com :
|
||||
@ open/write tmp $(MMS$TARGET)
|
||||
@ write tmp "$!"
|
||||
@ write tmp "$! Clean.com -- procedure to delete files. It always returns success"
|
||||
@ write tmp "$! status despite any error or warnings. Also it extracts"
|
||||
@ write tmp "$! filename from MMS ""module=file"" format."
|
||||
@ write tmp "$!"
|
||||
@ write tmp "$ on control_y then goto ctly"
|
||||
@ write tmp "$ if p1.eqs."""" then exit 1"
|
||||
@ write tmp "$ i = -1"
|
||||
@ write tmp "$scan_list:"
|
||||
@ write tmp "$ i = i+1"
|
||||
@ write tmp "$ item = f$elem(i,"","",p1)"
|
||||
@ write tmp "$ if item.eqs."""" then goto scan_list"
|
||||
@ write tmp "$ if item.eqs."","" then goto done ! End of list"
|
||||
@ write tmp "$ item = f$edit(item,""trim"") ! Clean of blanks"
|
||||
@ write tmp "$ wild = f$elem(1,""="",item)"
|
||||
@ write tmp "$ show sym wild"
|
||||
@ write tmp "$ if wild.eqs.""="" then wild = f$elem(0,""="",item)"
|
||||
@ write tmp "$ vers = f$parse(wild,,,""version"",""syntax_only"")"
|
||||
@ write tmp "$ if vers.eqs."";"" then wild = wild - "";"" + "";*"""
|
||||
@ write tmp "$scan:"
|
||||
@ write tmp "$ f = f$search(wild)"
|
||||
@ write tmp "$ if f.eqs."""" then goto scan_list"
|
||||
@ write tmp "$ on error then goto err"
|
||||
@ write tmp "$ on warning then goto warn"
|
||||
@ write tmp "$ delete/log 'f'"
|
||||
@ write tmp "$warn:"
|
||||
@ write tmp "$err:"
|
||||
@ write tmp "$ goto scan"
|
||||
@ write tmp "$done:"
|
||||
@ write tmp "$ctly:"
|
||||
@ write tmp "$ exit 1"
|
||||
@ close tmp
|
||||
|
||||
CLEAN clean : clean.com
|
||||
@clean "$(OBJBZ2LIB)"
|
||||
@clean "$(OLBBZ2)"
|
||||
@- delete/noconfirm/nolog clean.com;*
|
||||
@- if ("$(DEST).dir" .nes. "") then -
|
||||
if (f$search("$(DEST).dir") .nes. "") then -
|
||||
set protect=w:d $(DEST).dir;*
|
||||
@- if ("$(DEST).dir" .nes. "") then -
|
||||
if (f$search("$(DEST).dir") .nes. "") then -
|
||||
delete/noconfirm $(DEST).dir;*
|
||||
|
||||
CHK_DESTDIR chk_destdir :
|
||||
@ If ("$(DEST)" .NES. "") Then -
|
||||
If "''F$Search("$(DEST).DIR;1")'" .EQS. "" Then -
|
||||
Create /directory $(DSTDIR)
|
||||
|
||||
$(OLBBZ2) : $(OBJBZ2LIB)
|
||||
If "''F$Search("$(MMS$TARGET)")'" .EQS. "" Then $(LIBR)/Create $(MMS$TARGET)
|
||||
$(LIBR)$(LIBRFLAGS) $(MMS$TARGET) $(MMS$CHANGED_LIST)
|
||||
@ write sys$output "$(MMS$TARGET) updated."
|
||||
|
||||
$(OBJBZ2LIB) : $(BZIP2_H)
|
||||
|
||||
$(DSTDIR)blocksort$(O) : $(SRCDIR)blocksort.c
|
||||
$(DSTDIR)huffman$(O) : $(SRCDIR)huffman.c
|
||||
$(DSTDIR)crctable$(O) : $(SRCDIR)crctable.c
|
||||
$(DSTDIR)randtable$(O) : $(SRCDIR)randtable.c
|
||||
$(DSTDIR)compress$(O) : $(SRCDIR)compress.c
|
||||
$(DSTDIR)decompress$(O) : $(SRCDIR)decompress.c
|
||||
$(DSTDIR)bzlib$(O) : $(SRCDIR)bzlib.c
|
62
programs/fs/unzip60/bzip2/makbz2iz.msc
Normal file
62
programs/fs/unzip60/bzip2/makbz2iz.msc
Normal file
@ -0,0 +1,62 @@
|
||||
# Makefile for UnZip's bzip2 support library
|
||||
# Win32 port, using Microsoft Visual C++ 6.0
|
||||
#
|
||||
# (c) 2006-2007 Info-ZIP
|
||||
# Last revision: Christian Spieler, 2007-Apr-03
|
||||
#
|
||||
# This Makefile is intended to be called from UnZip's main make procedure.
|
||||
|
||||
CC=cl
|
||||
AR=link -lib
|
||||
CFLSYS = -ML -O2 -nologo
|
||||
CFLAGS= -D_WIN32 -DBZ_NO_STDIO $(CFLSYS)
|
||||
!ifndef BZROOTDIR
|
||||
BZROOTDIR=.
|
||||
!endif
|
||||
BZROOT=$(BZROOTDIR)/
|
||||
!ifndef BZOBDIR
|
||||
BZOBDIR=.
|
||||
!endif
|
||||
BZOB=$(BZOBDIR)/
|
||||
O=.obj
|
||||
|
||||
|
||||
OBJS= $(BZOB)blocksort$(O) \
|
||||
$(BZOB)huffman$(O) \
|
||||
$(BZOB)crctable$(O) \
|
||||
$(BZOB)randtable$(O) \
|
||||
$(BZOB)compress$(O) \
|
||||
$(BZOB)decompress$(O) \
|
||||
$(BZOB)bzlib$(O)
|
||||
|
||||
izlib: $(BZOBDIR) $(BZOB)bz2.lib
|
||||
|
||||
$(BZOBDIR) :
|
||||
-mkdir $@
|
||||
|
||||
$(BZOB)bz2.lib: $(OBJS)
|
||||
$(AR) $(OBJS) -out:$(BZOB)bz2.lib
|
||||
|
||||
clean:
|
||||
-del $(BZOBDIR)\*$(O)
|
||||
-del $(BZOBDIR)\bz2.lib
|
||||
|
||||
.c$(O):
|
||||
$(CC) $(CFLAGS) -c -Fo$@ $<
|
||||
|
||||
$(OBJS) : $(BZROOT)bzlib.h $(BZROOT)bzlib_private.h
|
||||
|
||||
$(BZOB)blocksort$(O) : $(BZROOT)blocksort.c
|
||||
$(CC) $(CFLAGS) -c -Fo$@ $(BZROOT)blocksort.c
|
||||
$(BZOB)huffman$(O) : $(BZROOT)huffman.c
|
||||
$(CC) $(CFLAGS) -c -Fo$@ $(BZROOT)huffman.c
|
||||
$(BZOB)crctable$(O) : $(BZROOT)crctable.c
|
||||
$(CC) $(CFLAGS) -c -Fo$@ $(BZROOT)crctable.c
|
||||
$(BZOB)randtable$(O) : $(BZROOT)randtable.c
|
||||
$(CC) $(CFLAGS) -c -Fo$@ $(BZROOT)randtable.c
|
||||
$(BZOB)compress$(O) : $(BZROOT)compress.c
|
||||
$(CC) $(CFLAGS) -c -Fo$@ $(BZROOT)compress.c
|
||||
$(BZOB)decompress$(O) : $(BZROOT)decompress.c
|
||||
$(CC) $(CFLAGS) -c -Fo$@ $(BZROOT)decompress.c
|
||||
$(BZOB)bzlib$(O) : $(BZROOT)bzlib.c
|
||||
$(CC) $(CFLAGS) -c -Fo$@ $(BZROOT)bzlib.c
|
62
programs/fs/unzip60/bzip2/makbz2iz.wat
Normal file
62
programs/fs/unzip60/bzip2/makbz2iz.wat
Normal file
@ -0,0 +1,62 @@
|
||||
# Makefile for UnZip's bzip2 support library
|
||||
# MSDOS & Win32 ports, using OpenWatcom C++
|
||||
#
|
||||
# (c) 2006-2007 Info-ZIP
|
||||
# Last revision: Christian Spieler, 2007-Apr-03
|
||||
#
|
||||
# This Makefile is intended to be called from UnZip's main make procedure.
|
||||
|
||||
CC=wcc386
|
||||
AR=lib386
|
||||
CFLSYS = -6r -zt -zq -wx -s -obhikl+rt -oe100 -zp8 -q
|
||||
CFLAGS= $(CFLSYS) -DBZ_NO_STDIO
|
||||
!ifndef BZROOTDIR
|
||||
BZROOTDIR=.
|
||||
!endif
|
||||
BZROOT=$(BZROOTDIR)\
|
||||
!ifndef BZOBDIR
|
||||
BZOBDIR=.
|
||||
!endif
|
||||
BZOB=$(BZOBDIR)/
|
||||
O=.obj
|
||||
|
||||
|
||||
OBJS= $(BZOB)blocksort$(O) &
|
||||
$(BZOB)huffman$(O) &
|
||||
$(BZOB)crctable$(O) &
|
||||
$(BZOB)randtable$(O) &
|
||||
$(BZOB)compress$(O) &
|
||||
$(BZOB)decompress$(O) &
|
||||
$(BZOB)bzlib$(O)
|
||||
|
||||
izlib: $(BZOBDIR) $(BZOB)bz2.lib
|
||||
|
||||
$(BZOBDIR) :
|
||||
-mkdir $@
|
||||
|
||||
$(BZOB)bz2.lib: $(OBJS)
|
||||
$(AR) -nologo $(OBJS) -out:$(BZOB)bz2.lib
|
||||
|
||||
clean: .SYMBOLIC
|
||||
-del $(BZOBDIR)\*$(O)
|
||||
-del $(BZOBDIR)\bz2.lib
|
||||
|
||||
.c$(O):
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
|
||||
$(OBJS) : $(BZROOT)bzlib.h $(BZROOT)bzlib_private.h
|
||||
|
||||
$(BZOB)blocksort$(O) : $(BZROOT)blocksort.c
|
||||
$(CC) $(CFLAGS) -Fo=$@ $(BZROOT)blocksort.c
|
||||
$(BZOB)huffman$(O) : $(BZROOT)huffman.c
|
||||
$(CC) $(CFLAGS) -Fo=$@ $(BZROOT)huffman.c
|
||||
$(BZOB)crctable$(O) : $(BZROOT)crctable.c
|
||||
$(CC) $(CFLAGS) -Fo=$@ $(BZROOT)crctable.c
|
||||
$(BZOB)randtable$(O) : $(BZROOT)randtable.c
|
||||
$(CC) $(CFLAGS) -Fo=$@ $(BZROOT)randtable.c
|
||||
$(BZOB)compress$(O) : $(BZROOT)compress.c
|
||||
$(CC) $(CFLAGS) -Fo=$@ $(BZROOT)compress.c
|
||||
$(BZOB)decompress$(O) : $(BZROOT)decompress.c
|
||||
$(CC) $(CFLAGS) -Fo=$@ $(BZROOT)decompress.c
|
||||
$(BZOB)bzlib$(O) : $(BZROOT)bzlib.c
|
||||
$(CC) $(CFLAGS) -Fo=$@ $(BZROOT)bzlib.c
|
159
programs/fs/unzip60/cmsmvs/INSTALL.CMS
Normal file
159
programs/fs/unzip60/cmsmvs/INSTALL.CMS
Normal file
@ -0,0 +1,159 @@
|
||||
-----------------------------------------------------------------------
|
||||
[Installation notes for VM/CMS port of UNZIP 5.32 and ZIP 2.2]
|
||||
Additional notes from Ian E. Gorman (4/98):
|
||||
|
||||
I have not fully tested ZIP and UNZIP in VM (for example, I have not
|
||||
tried all the options), so ZIP 2.2 for VM and UNZIP 5.32 for VM
|
||||
should be regarded as beta versions. Try them out before you decide
|
||||
that you can depend on them.
|
||||
|
||||
Most of the work for the VM port has been done by others, but I have
|
||||
made some changes and compiled on a more recent version of VM/CMS. It
|
||||
is possible that I have introduced new problems or undone some of the
|
||||
solutions found by previous authors.
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
The executables are stored in CMS "PACK" format instead of being
|
||||
stored in ZIP archives. This format takes a little longer to
|
||||
download, but installation is slightly simpler.
|
||||
|
||||
|
||||
Installing UNZIP
|
||||
----------------
|
||||
|
||||
The UNZIP executable is supplied as the binary file UNZIP.MOD, in the
|
||||
CMS "PACK" format.
|
||||
|
||||
You must get the UNZIP.MOD file on to your system as a binary file in
|
||||
fixed recording mode, block size 1024.
|
||||
|
||||
If you are using FTP in CMS, you can get the file in the correct
|
||||
format with the LOCSITE and BINARY commands. Assuming that the UNZIP
|
||||
executable is stored on the remote site as unz532vm.mod, you could
|
||||
issue the following commands
|
||||
|
||||
FTP where.ever.com
|
||||
<enter user id and password and other stuff>
|
||||
BINARY
|
||||
LOCSITE FIX 1024
|
||||
GET unz532vm.mod
|
||||
QUIT
|
||||
|
||||
If you are using a 3270 terminal session to upload from a PC, you can
|
||||
upload the file in the correct format with the SEND command:
|
||||
|
||||
SEND unz532vm.mod A: unz532vm mod a1 (RECFM F LRECL 1024
|
||||
|
||||
If your 3270 emulator does not have the SEND command, but is a GUI
|
||||
application, it may allow you to upload from the menu bar. If so,
|
||||
set your options to binary, VM/CMS, fixed record length, and a length
|
||||
of 1024 before you upload.
|
||||
|
||||
When you get the PACKed file on your CMS minidisk, you convert it to
|
||||
an executable module by using the COPY command with the UNPACK option:
|
||||
|
||||
COPY unz532vm mod a unzip module a1 (UNPACK OLDDATE REPLACE
|
||||
|
||||
You can omit the OLDDATE and REPLACE options if you want to.
|
||||
|
||||
|
||||
Installing ZIP
|
||||
--------------
|
||||
|
||||
The ZIP executable is supplied as the binary file ZIP.MOD, in the CMS
|
||||
"PACK" format.
|
||||
|
||||
You must get the ZIP.MOD file on to your system as a binary file in
|
||||
fixed recording mode, block size 1024. Assuming that the file is
|
||||
stored as zip22vm.mod, you can get the file the same way you got the
|
||||
UNZIP.MOD file:
|
||||
|
||||
Using FTP:
|
||||
|
||||
FTP where.ever.com
|
||||
<enter user id and password and other stuff>
|
||||
BINARY
|
||||
LOCSITE FIX 1024
|
||||
GET zip22vm.mod
|
||||
QUIT
|
||||
|
||||
Using 3270 file transfer:
|
||||
|
||||
SEND unz532vm.mod A: unz532vm mod a1 (RECFM F LRECL 1024
|
||||
|
||||
When you get the PACKed file on your CMS minidisk, you convert it to
|
||||
an executable module by using the COPY command with the UNPACK option:
|
||||
|
||||
COPY zip22vm mod a zip module a1 (UNPACK OLDDATE REPLACE
|
||||
|
||||
|
||||
Installing Documentation
|
||||
------------------------
|
||||
|
||||
Once you have UNZIP running, you can use it to extract documentation
|
||||
from ZIP archives.
|
||||
|
||||
You can transfer the ZIP archives to VMV/CMS as a binary file with any
|
||||
record length. A record length of 1 will work fine:
|
||||
|
||||
via FTP:
|
||||
|
||||
FTP where.ever.com
|
||||
<enter user id and password and other stuff>
|
||||
BINARY
|
||||
LOCSITE FIX 1
|
||||
GET zip22vm.zip zipdoc.zip
|
||||
GET unz532vm.zip unzipdoc.zip
|
||||
QUIT
|
||||
|
||||
via 3270 session:
|
||||
|
||||
SEND zip22vm.zip A: unzipdoc zip a1 (RECFM F LRECL 1
|
||||
SEND unz532vm.zip A: zipdoc zip a1 (RECFM F LRECL 1
|
||||
|
||||
Once you have the ZIP archives, extract the documentation to the minidisk of
|
||||
your choice by using the -d option:
|
||||
|
||||
unzip -a -d A2 unzipdoc.zip
|
||||
unzip -a -d A2 zipdoc.zip
|
||||
|
||||
The "-a" option is required because the documents are archived as
|
||||
ASCII text files, but they must be converted to EBCDIC to read them
|
||||
in VM/CMS.
|
||||
|
||||
|
||||
Notes
|
||||
=====
|
||||
|
||||
Different EBCDIC Character Sets
|
||||
-------------------------------
|
||||
|
||||
The documentation may look strange on your system, because UNZIP
|
||||
translates from ASCII to "Open Systems" EBCDIC (IBM-1047). Unless
|
||||
you are a software developer, you are probably using a different
|
||||
kind of EBCDIC (like US EBCDIC, IBM-037). This causes some character
|
||||
codes to display as different characters. For example, the character
|
||||
codes that display as square brackets in IBM-1047 will display as
|
||||
e-acute and a-grave in IBM-037.
|
||||
|
||||
You can use the IBM ICONV utility to translate documents from one
|
||||
character set to another:
|
||||
|
||||
ICONV old doc a new doc a1 (FROMCODE IBM-1047 TOCODE IBM-037
|
||||
|
||||
|
||||
IND$FILE protocol
|
||||
-----------------
|
||||
|
||||
This is the method by which files are transferred via 3270 sessions
|
||||
between PC and mainframe.
|
||||
|
||||
If you know how to transfer files via 3270 session between PC and
|
||||
mainframe, you know as much as you need to know about IND$FILE.
|
||||
|
||||
If your mainframe has IND$FILE, and your 3270 emulator does file
|
||||
transfers, you can use your emulator to transfer files between PC
|
||||
and mainframe.
|
434
programs/fs/unzip60/cmsmvs/README.CMS
Normal file
434
programs/fs/unzip60/cmsmvs/README.CMS
Normal file
@ -0,0 +1,434 @@
|
||||
Using ZIP and UNZIP on VM/CMS
|
||||
=============================
|
||||
|
||||
|
||||
Installing executables
|
||||
----------------------
|
||||
|
||||
The following CMS MODULEs are available:
|
||||
ZIP
|
||||
ZIPNOTE
|
||||
ZIPCLOAK
|
||||
ZIPSPLIT
|
||||
UNZIP
|
||||
|
||||
In addition to these, each MODULE file also has an EXEC with the same
|
||||
name. These EXECs are front-ends to the MODULES that will attempt to
|
||||
set up the required runtime libraries before running the MODULE.
|
||||
All the EXECs are identical. Only their names are different.
|
||||
They are stored as plain text files.
|
||||
|
||||
The CMS MODULE files have been packed using the COPYFILE command to
|
||||
allow their file format to be properly restored, since variable length
|
||||
binary files will not currently unzip properly (see below for details).
|
||||
The MODULEs are shipped with a filetype or extension of CMO (for CMS
|
||||
MODULE). Their names may vary on the distribution disk to indicate
|
||||
their level, etc.
|
||||
|
||||
To restore them to executable MODULEs on CMS, do the following:
|
||||
1. Upload them to CMS with a Fixed record length with LRECL 1024.
|
||||
Example, from a DOS or OS/2 window, type this:
|
||||
SEND unzip.cmo A:unzip module a (RECFM F LRECL 1024
|
||||
|
||||
Example, using FTP from CMS, type this:
|
||||
BINARY FIXED 1024
|
||||
GET unzip.cmo unzip.module.a
|
||||
|
||||
Note: Replace "unzip.cmo" with the actual name.
|
||||
|
||||
2. Use COPYFILE to unpack the file.
|
||||
Example, in CMS type this:
|
||||
COPYFILE UNZIP MODULE A (UNPACK REPLACE OLDDATE
|
||||
|
||||
3. Repeat steps 1-2 for each of the programs.
|
||||
|
||||
4. Build the ZIPINFO module by typing this:
|
||||
COPYFILE UNZIP MODULE A ZIPINFO MODULE A (OLDDATE
|
||||
|
||||
5. Upload the EXECs to CMS as text files (with ASCII-to-EBCDIC
|
||||
translation).
|
||||
Example, from a DOS or OS/2 window, type this:
|
||||
SEND unzip.exc A:unzip exec a (CRLF
|
||||
|
||||
Example, using FTP from CMS, type this:
|
||||
GET unzip.exc unzip.exec.a
|
||||
|
||||
6. Repeat steps 4 for each of the EXECs.
|
||||
|
||||
|
||||
Preparing the environment
|
||||
-------------------------
|
||||
|
||||
The executables provided were compiled with IBM C 3.1.0 and
|
||||
require the the Language Environment (LE) runtime libraries.
|
||||
|
||||
To provide access to the runtime libraries:
|
||||
1. Link to the disk containing the Language Environment files,
|
||||
if necessary.
|
||||
|
||||
2. Use the command "GLOBAL LOADLIB SCEERUN"
|
||||
|
||||
These commands can be placed in your PROFILE EXEC.
|
||||
|
||||
Note: EXECs have been provided called ZIP, UNZIP, etc. that
|
||||
issue the GLOBAL LOADLIB statement. This was done to alleviate
|
||||
frustration of users that don't have the GLOBAL LOADLIB statement
|
||||
in their PROFILE EXEC. These EXECs may require changing for
|
||||
your system.
|
||||
|
||||
Unfortunately, there is no way, using IBM C, to produce a MODULE
|
||||
that doesn't require a runtime library.
|
||||
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
To test the MODULEs, just type ZIP or UNZIP. They should
|
||||
show help information on using the commands.
|
||||
|
||||
If you see something like this:
|
||||
DMSLIO201W The following names are undefined:
|
||||
CEEEV003
|
||||
DMSABE155T User abend 4093 called from 00DCD298 reason code 000003EB
|
||||
|
||||
Then you don't have access to the proper runtime libraries, as
|
||||
described above.
|
||||
|
||||
Here is additional information on the ZIP and UNZIP programs that
|
||||
may assist support personnel:
|
||||
- Compiled with IBM C V3R1M0 on VM/ESA 2.2.0 with
|
||||
CMS level 13 Service Level 702.
|
||||
|
||||
- Require the SCEERUN LOADLIB runtime library. This is
|
||||
part of the Language Environment (LE).
|
||||
|
||||
- Linked with options RMODE ANY AMODE ANY RLDSAVE.
|
||||
|
||||
If you continue to have trouble, report the problem to Zip-Bugs
|
||||
(see the bottom of this document).
|
||||
|
||||
|
||||
|
||||
Compiling the source on VM/CMS
|
||||
------------------------------
|
||||
|
||||
The source has been successfully compiled previously using
|
||||
C/370 2.1 and 2.2. The source has been recently compiled using
|
||||
IBM C 3.1.0 on VM/ESA 2.2.0 with CMS level 13. I don't have
|
||||
access to an MVS system so the code hasn't been tested there
|
||||
in a while.
|
||||
|
||||
1. Unzip the source files required for CMS. The root-level files
|
||||
inside the ZIP file and the files in the CMSMVS subdirectory are
|
||||
needed. Example (use both commands):
|
||||
unzip -aj zip23.zip -x */* -dc
|
||||
unzip -aj zip23.zip cmsmvs/* -dc
|
||||
|
||||
This example unzips the files to the C-disk, while translating
|
||||
character data and ignoring paths.
|
||||
|
||||
If you don't already have a working UNZIP MODULE on CMS you will
|
||||
have to unzip the files on another system and transport them
|
||||
to CMS. All the required files are plain text so they can
|
||||
be transferred with ASCII-to-EBCDIC translations.
|
||||
|
||||
2. Repeat step 1 with the zip file containing the UNZIP code.
|
||||
Unzip the files to a different disk than the disk used for the ZIP
|
||||
code.
|
||||
|
||||
3. To compile the ZIP code, run the supplied CCZIP EXEC.
|
||||
To compile the UNZIP code, run the supplied CCUNZIP EXEC.
|
||||
|
||||
NOTE:
|
||||
Some of the ZIP and UNZIP source files have the same name. It is
|
||||
recommended that you keep the source from each on separate disks and
|
||||
move the disk you are building from ahead of the other in the search
|
||||
order.
|
||||
|
||||
For example, you may have a 192 disk with the ZIP source code and
|
||||
a 193 disk with the UNZIP source code. To compile ZIP, access
|
||||
the 192 disk as B, then run CCZIP. This will create the following
|
||||
modules: ZIP, ZIPNOTE, ZIPSPLIT, ZIPCLOAK.
|
||||
|
||||
To compile UNZIP, access 193 as B, then run CCUNZIP. This will create
|
||||
the following modules: UNZIP, ZIPINFO (a copy of UNZIP).
|
||||
|
||||
|
||||
=========================================================================
|
||||
|
||||
|
||||
Using ZIP/UNZIP
|
||||
---------------
|
||||
|
||||
Documentation for the commands is in MANUAL NONAME (for ZIP) and in
|
||||
UNZIP DOC UNZIP. INFOZIP DOC describes the use of the -Z option of
|
||||
UNZIP.
|
||||
|
||||
The rest of this section explains special notes concerning the VM/CMS
|
||||
version of ZIP and UNZIP.
|
||||
|
||||
|
||||
Filenames and directories
|
||||
-------------------------
|
||||
|
||||
1. Specifying filenames
|
||||
|
||||
a. When specifying CMS files, use filename.filetype.filemode format
|
||||
(separate the three parts of the name with a period and use no
|
||||
spaces). Example: profile.exec.a
|
||||
|
||||
Unfortunately, this prevents you from using ZIP from
|
||||
FILELIST. To unzip a zip file, however, you can type something
|
||||
like this next to it in FILELIST:
|
||||
unzip /n -d c
|
||||
|
||||
This will unzip the contents of the current file to a C-disk.
|
||||
|
||||
b. It is possible to use DD names with ZIP and UNZIP on CMS, though
|
||||
it can be cumbersome. Example:
|
||||
filedef out disk myzip zip a
|
||||
zip dd:out file1.txt file2.txt
|
||||
|
||||
While you can also use a DD name for the input files, ZIP
|
||||
currently does not correctly resolve the filename and will
|
||||
store something like "dd:in" inside the ZIP file. A file stored
|
||||
in this manor cannot easily be unzipped, as "dd:in" is an invalid
|
||||
filename.
|
||||
|
||||
c. In places where a directory name would be used on a PC, such as
|
||||
for the ZIP -b (work path) option or the UNZIP -d (destination
|
||||
path) options, use a filemode letter for CMS. For example,
|
||||
to unzip files onto a C-disk, you might type something like this:
|
||||
unzip myzip.zip -d c
|
||||
|
||||
Currently, ZIP uses the A-disk for work files. When zipping
|
||||
large files, you may want to specify a larger disk for work files.
|
||||
This example will use a C-disk for work files.
|
||||
zip -b C myzip.zip.c test.dat.a
|
||||
|
||||
|
||||
2. Filename conversions
|
||||
|
||||
a. Filemode letters are never stored into the zip file or take from
|
||||
a zip file. Only the filename and filetype are used.
|
||||
ZIP removes the filemode when storing the filename into the
|
||||
zip file. UNZIP assumes "A" for the filemode unless the -d
|
||||
option is used.
|
||||
|
||||
b. When unzipping, any path names are removed from the fileid
|
||||
and the last two period-separated words are used as the
|
||||
filename and filetype. These are truncated to a maximum of
|
||||
eight characters, if necessary. If the filetype (extension)
|
||||
is missing, then UNZIP uses "NONAME" for the filetype.
|
||||
Any '(' or ')' characters are removed from the fileid.
|
||||
|
||||
c. All files are created in upper-case. Files in mixed-case
|
||||
cannot currently be stored into a ZIP file.
|
||||
|
||||
d. Shared File System (SFS) directories are not supported.
|
||||
Files are always accessed by fn.ft.fm. To use an SFS disk,
|
||||
Assign it a filemode, then it can be used.
|
||||
|
||||
|
||||
3. Wildcards in file names
|
||||
|
||||
a. Wildcards are not supported in the zip filename. The full
|
||||
filename of the zip file must be given (but the .zip is not
|
||||
necessary). So, you can't do this:
|
||||
unzip -t *.zip
|
||||
|
||||
b. Wildcards CAN be used with UNZIP to select (or exclude) files
|
||||
inside a zip file. Examples:
|
||||
unzip myzip *.c - Unzip all .c files.
|
||||
unzip myzip *.c -x z*.c - Unzip all .c files but those
|
||||
starting with Z.
|
||||
|
||||
c. Wildcards cannot currently be used to select files with ZIP.
|
||||
So, you can't do this:
|
||||
zip -a myzip *.exec
|
||||
|
||||
I expect to fix this for CMS in the future.
|
||||
|
||||
|
||||
4. File timestamps
|
||||
|
||||
a. The dates and times of files being zipped or unzipped are not
|
||||
currently read or set. When a file is zipped, the timestamp
|
||||
inside the zip file will always be the current system date and
|
||||
time. Likewise, when unzipping, the date and time of files
|
||||
being unzipped will always be the current system date/time.
|
||||
|
||||
b. Existing files are assumed to be newer than files inside a zip
|
||||
file when using the -f freshen option of UNZIP. This will prevent
|
||||
overwriting files that may be newer than the files inside the
|
||||
zip file, but also effectively prevents the -f option from working.
|
||||
|
||||
|
||||
5. ASCII, EBCDIC, and binary data
|
||||
|
||||
Background
|
||||
----------
|
||||
Most systems create data files as just a stream of bytes. Record
|
||||
breaks happen when certain characters (new line and/or carriage
|
||||
return characters) are encountered in the data. How to interpret
|
||||
the data in a file is up to the user. The system must be told
|
||||
to either notice new line characters in the data or to assume
|
||||
that the data in the file is binary data and should be read or
|
||||
written as-is.
|
||||
|
||||
CMS and MVS are record-based systems. All files are composed
|
||||
of data records. These can be stored in fixed-length files or
|
||||
in variable length files. With fixed-length files, each record
|
||||
is the same length. The record breaks are implied by the
|
||||
LRECL (logical record length) attribute associated with the file.
|
||||
With variable-length files, each record contains the length of
|
||||
that record. The separation of records are not part of the
|
||||
data, but part of the file structure.
|
||||
|
||||
This means you can store any type of data in either type of file
|
||||
structure without having to worry about the data being interpreted
|
||||
as a record break. Fixed-length files may have padding at the
|
||||
end of the file to make up a full record. Variable-length files
|
||||
have no padding, but require extra record length data be stored
|
||||
with the file data.
|
||||
|
||||
Storing fixed-length files into a zip file is simple, because all
|
||||
the data can just be dumped into the zip file and the record
|
||||
format (RECFM) and logical record length (LRECL) can be stored
|
||||
in the extra data area of the zip file so they can be restored
|
||||
when UNZIP is used.
|
||||
|
||||
Storing variable-length data is harder. There is no place to put
|
||||
the record length data needed for each record of the file. This
|
||||
data could be written to the zip file as the first two bytes of
|
||||
each record and interpreted that way by UNZIP. That would make
|
||||
the data unusable on systems other than CMS and MVS, though.
|
||||
|
||||
Currently, there isn't a solution to this problem. Each record is
|
||||
written to the zip file and the record length information is
|
||||
discarded. Binary data stored in variable-length files can't be put
|
||||
into a zip file then later unzipped back into the proper records.
|
||||
This is fine for binary data that will be read as a stream of bytes
|
||||
but not OK where the records matter, such as with CMS MODULEs.
|
||||
|
||||
If the data is text (character data), there is a solution.
|
||||
This data can be converted into ASCII when it's stored into
|
||||
a zip file. The end of each record is now marked in the file
|
||||
by new line characters. Another advantage of this method is
|
||||
that the data is now accessible to non-EBCDIC systems. When
|
||||
the data is unzipped on CMS or MVS, it is converted back into
|
||||
EBCDIC and the records are recreated into a variable-length file.
|
||||
|
||||
|
||||
So, here's what we have...
|
||||
|
||||
a. To store readable text data into a zip file that can be used
|
||||
on other platforms, use the -a option with ZIP to convert the
|
||||
data to ASCII. These files will unzip into variable-length
|
||||
files on CMS and should not contain binary data or corruption
|
||||
may occur.
|
||||
|
||||
b. Files that were zipped on an ASCII-based system will be
|
||||
automatically translated to EBCDIC when unzipped. To prevent
|
||||
this (to unzip binary data on CMS that was sent from an
|
||||
ASCII-based system), use the -B option with UNZIP to force Binary
|
||||
mode. To zip binary files on CMS, use the -B option with ZIP to
|
||||
force Binary mode. This will prevent any data conversions from
|
||||
taking place.
|
||||
|
||||
c. When using the ZIP program without specifying the "-a" or "-B"
|
||||
option, ZIP defaults to "native" (EBCDIC) mode and tries to
|
||||
preserve the file information (RECFM, LRECL, and BLKSIZE). So
|
||||
when you unzip a file zipped with ZIP under CMS or MVS, UNZIP
|
||||
restores the file info. The output will be fixed-length if the
|
||||
original was fixed and variable-length if the original was
|
||||
variable.
|
||||
|
||||
If UNZIP gives a "write error (disk full?)" message, you may be
|
||||
trying to unzip a binary file that was zipped as a text file
|
||||
(without using the -B option)
|
||||
|
||||
|
||||
Summary
|
||||
-------
|
||||
Here's how to ZIP the different types of files.
|
||||
|
||||
RECFM F text
|
||||
Use the -a option with ZIP to convert to ASCII for use with other
|
||||
platforms or no options for use on EBCDIC systems only.
|
||||
|
||||
RECFM V text
|
||||
Use the -a option with ZIP to convert to ASCII for use with other
|
||||
platforms or no options for use on EBCDIC systems only.
|
||||
|
||||
|
||||
RECFM F binary
|
||||
Use the -B option with ZIP (upper-case "B").
|
||||
|
||||
RECFM V binary
|
||||
Use the -B option with ZIP. Can be zipped OK but the record
|
||||
structure is destroyed when unzipped. This is OK for data files
|
||||
read as binary streams but not OK for files such as CMS MODULEs.
|
||||
|
||||
|
||||
6. Character Sets
|
||||
|
||||
If you are used to running UNZIP on systems like UNIX, DOS, OS/2 or
|
||||
Windows, you will may have some problems with differences in the
|
||||
character set.
|
||||
|
||||
There are a number of different EBCDIC code pages, like there are a
|
||||
number of different ASCII code pages. For example, there is a US
|
||||
EBCDIC, a German EBCDIC, and a Swedish EBCDIC. As long as you are
|
||||
working with other people who use the same EBCDIC code page, you
|
||||
will have no trouble. If you work with people who use ASCII, or who
|
||||
use a different EBCDIC code page, you may need to do some
|
||||
translation.
|
||||
|
||||
UNZIP translates ASCII text files to and from Open Systems EBCDIC
|
||||
(IBM-1047), which may not be the EBCDIC that you are using. For
|
||||
example, US EBCDIC (IBM-037) uses different character codes for
|
||||
square brackets. In such cases, you can use the ICONV utility
|
||||
(supplied with IBM C) to translate between your EBCDIC character set
|
||||
and IBM-1047.
|
||||
|
||||
If your installation does not use IBM-1047 EBCDIC, messages from
|
||||
UNZIP may look a little odd. For example, in a US EBCDIC
|
||||
installation, an opening square bracket will become an i-acute and a
|
||||
closing square bracket will become a u-grave.
|
||||
|
||||
The supplied ZIP and UNZIP EXECs attempt to correct this by setting
|
||||
CMS INPUT and OUTPUT translations to adjust the display of left and
|
||||
right brackets. You may need to change this if brackets don't
|
||||
display correctly on your system.
|
||||
|
||||
|
||||
7. You can unzip using VM/CMS PIPELINES so unzip can be used as
|
||||
a pipeline filter. Example:
|
||||
'PIPE COMMAND UNZIP -p test.zip george.test | Count Lines | Cons'
|
||||
|
||||
|
||||
|
||||
|
||||
Please report all bugs and problems to:
|
||||
Zip-Bugs@lists.wku.edu
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
Original CMS/MVS port by George Petrov.
|
||||
e-mail: c888090@nlevdpsb.snads.philips.nl
|
||||
tel: +31-40-781155
|
||||
|
||||
Philips C&P
|
||||
Eindhoven
|
||||
The Netherlands
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
Additional fixes and README re-write (4/98) by Greg Hartwig.
|
||||
e-mail: ghartwig@ix.netcom.com
|
||||
ghartwig@vnet.ibm.com
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
Additional notes from Ian E. Gorman.
|
||||
e-mail: ian@iosphere.net
|
||||
|
169
programs/fs/unzip60/cmsmvs/README.MVS
Normal file
169
programs/fs/unzip60/cmsmvs/README.MVS
Normal file
@ -0,0 +1,169 @@
|
||||
Thank you for trying this port of UNZIP for VM/CMS and MVS!
|
||||
|
||||
Using under MVS:
|
||||
-------------------------
|
||||
|
||||
1. To use the Info-ZIP's UNZIP under MVS you need:
|
||||
|
||||
- C/370 ver 2.1 compiler or another compatible compiler supporting
|
||||
long names for function/variable names.
|
||||
|
||||
2. To compile the program under MVS do :
|
||||
|
||||
- unzip all the files from unz54vm.zip file. They are stored as
|
||||
ASCII format so you have to unzip them first on PC or other
|
||||
system that already have UNZIP, and then upload them to the
|
||||
mainframe with ASCII to EBCDIC conversion.
|
||||
|
||||
- Copy all the .C files in the PDS called USERID.UNZIP.C
|
||||
|
||||
- Copy all the .H files in the PDS called USERID.UNZIP.H
|
||||
|
||||
- adjust the job UNZMVSC.JOB to work on your site. Change USERID
|
||||
to your userid. You might need to change the CEE dataset names
|
||||
to match your OS/390 system.
|
||||
|
||||
- Preallocate PDS datasets named: USERID.UNZIP.OBJ and
|
||||
USERID.UNZIP.LOAD
|
||||
|
||||
- execute the job UNZMVSC to compile and link all the sources.
|
||||
|
||||
- if everything is ok you will get an UNZIP MODULE
|
||||
|
||||
3. Using UNZIP
|
||||
|
||||
- Just read the UNZIP.TXT
|
||||
|
||||
- A few exceptions concerning MVS
|
||||
|
||||
3.0. There are different ways to invoke UNZIP.
|
||||
|
||||
- allocating UNZIP.LOAD dataset to your ISPLLIB if you
|
||||
want to invoke UNZIP under ISPF.
|
||||
Then just type UNZIP ...parms... to get it work
|
||||
|
||||
- You can also call it directly with :
|
||||
TSO CALL 'userid.UNZIP.LOAD(UNZIP)' '...parms...'
|
||||
(notice to quotes!)
|
||||
|
||||
- You can even call it from a batch job like:
|
||||
|
||||
//MYZIP JOB (account)
|
||||
//STEP1 EXEC PGM=UNZIP,PARM='-l mytestz.zip *.c'
|
||||
//STEPLIB DD DSN=userid.UNZIP.LOAD,DISP=SHR
|
||||
//SYSPRINT DD SYSOUT=*
|
||||
|
||||
This will list all the .c files from the zip file mytestz.zip
|
||||
|
||||
3.1. If the ZIP file has been zipped on an ASCII based system
|
||||
it will be automatically translated to EBCDIC
|
||||
( I hope I got all those translation tables OK :-).
|
||||
You can force ASCII to EBCDIC conversion with the -a flag.
|
||||
|
||||
3.2. The date/time of the output files is set to the
|
||||
current system date/time - not according the date/time in
|
||||
the zip file.
|
||||
|
||||
3.3. You can even unzip using TSO/E PIPELINES
|
||||
so unzip can be used as pipeline filter:
|
||||
|
||||
'pipe cms unzip -p test.zip george.test | count lines | cons'
|
||||
( we do also a lot of pipethinking here ;-)
|
||||
|
||||
3.4. If you got also the ZIP program (see ZIP21VM.ZIP) you can
|
||||
do zipping and unzipping without translating to ASCII
|
||||
the ZIP also preserves the file informations (LRECL,BLKSIZE..)
|
||||
So when you UNZIP a file zipped with ZIP under MVS it
|
||||
restores the file info.
|
||||
|
||||
There currently some problems with file with RECFM=V*
|
||||
I don't save the length of each record yet :-)
|
||||
|
||||
3.5. No wildcards are supported in the input zip name you have
|
||||
to give the real name (.zip is not necessary)
|
||||
|
||||
So you CAN'T use things like: unzip -t *.zip
|
||||
|
||||
3.6. But you CAN use wildcards as filename selection like:
|
||||
unzip -t myzip *.c - OK or even
|
||||
unzip -t myzip *.c -x z*.c - to exclude all files matching
|
||||
z*.c
|
||||
|
||||
3.7. You can unzip to a PDS using the -d parameter,
|
||||
for example:
|
||||
|
||||
unzip -dmyzip myzip *.c
|
||||
|
||||
This will unzip all .c files that are in the zip file in a
|
||||
PDS directory called MYZIP.C
|
||||
|
||||
BE AWARE that the extension of every files is being placed as
|
||||
last identifier on the PDS name, so if you have a file in the
|
||||
zipfile called 'testp.doc' and you use '-d mypds' the PDS
|
||||
name will become 'mypds.doc(testp)'
|
||||
|
||||
Depending on which options IBM chose for C this week, unzip
|
||||
may or may not prefix output files with your userid and/or
|
||||
TSO prefix. To prevent this, quote the filename to -d, for
|
||||
example
|
||||
|
||||
//UNZIP EXEC PGM=UNZIP,
|
||||
// PARM='/-a -o ''userid.zip'' -d ''hlq.test'' *'
|
||||
//STEPLIB DD DSN=USERID.UNZIP.LOAD,DISP=SHR
|
||||
//SYSPRINT DD SYSOUT=*
|
||||
//SYSOUT DD SYSOUT=*
|
||||
|
||||
The above JCL converts from ASCII to EBCDIC (-a), always
|
||||
overwrites existing members (-o), extracts from 'userid.zip',
|
||||
writes to files starting with 'hlq.test', all members (*).
|
||||
Note the double quotes because PARM= requires single quotes.
|
||||
|
||||
3.8. The rules for output DCBs are a little messy. If the output
|
||||
file already exists (remember the -d option) then unzip uses
|
||||
the existing DCB and space values.
|
||||
|
||||
If the output file does not exist and the input zip came from
|
||||
MVS then unzip makes its best attempt at preserving the
|
||||
original DCB. However there is not enough information stored
|
||||
in the zip file to do this correctly for all file types, some
|
||||
file types may be corrupted.
|
||||
|
||||
If the output file does not exist and the input zip does not
|
||||
contain MVS DCB information then unzip uses RECFM=U,
|
||||
LRECL=32760 for binary data, RECFM=V, LRECL=133 for text.
|
||||
Text includes ASCII to EBCDIC conversion. As soon as the
|
||||
output file is created, unzip uses the same output DCB for
|
||||
all following members, even if the input is a mixture of text
|
||||
and binary.
|
||||
|
||||
In all cases, unzip has no built in parameters for space.
|
||||
For a preallocated file this is not a problem. If unzip
|
||||
creates an output file you get a default space allocation
|
||||
which is site dependent.
|
||||
|
||||
It is far better to preallocate the output files with the
|
||||
correct space and DCB values then use the -d option to point
|
||||
to those files.
|
||||
|
||||
3.9. All '+','_' or '-' signs are skipped from the filenames
|
||||
|
||||
|
||||
Please repport all bugs and problems to :
|
||||
Zip-Bugs@lists.wku.edu
|
||||
|
||||
That's all for now.
|
||||
|
||||
Have fun!
|
||||
|
||||
|
||||
George Petrov
|
||||
e-mail: c888090@nlevdpsb.snads.philips.nl
|
||||
tel: +31-40-781155
|
||||
|
||||
Philips C&P
|
||||
Eindhoven
|
||||
The Netherlands
|
||||
|
||||
Updated by:
|
||||
|
||||
Keith Owens <kaos@ocs.com.au>
|
27
programs/fs/unzip60/cmsmvs/WHATSNEW.CMS
Normal file
27
programs/fs/unzip60/cmsmvs/WHATSNEW.CMS
Normal file
@ -0,0 +1,27 @@
|
||||
Important Changes made for ZIP 2.3b and UNZIP 5.33c executables:
|
||||
|
||||
1. WARNING: These executables have been compiled for the
|
||||
Language Environment (LE). You must now have access to the file
|
||||
SCEERUN LOADLIB in order to run ZIP and UNZIP on CMS. You no longer
|
||||
need access to EDCLINK LOADLIB. The provided ZIP and UNZIP EXECs
|
||||
have been changed to issue a new GLOBAL LOADLIB command. You may
|
||||
need to modify these EXECs for your installation. You may want to
|
||||
change any GLOBAL LOADLIB command you may have in your PROFILE EXEC.
|
||||
|
||||
Versions could be made available for the older EDCLINK LOADLIB
|
||||
runtimes upon request.
|
||||
|
||||
2. ZIP files will now be variable length files rather than fixed
|
||||
length files.
|
||||
|
||||
3. Help information for ZIP and UNZIP has been changed to show
|
||||
"fm" rather than "path" on CMS with certain options.
|
||||
|
||||
4. README CMS has been entirely rewritten. It now contains all
|
||||
information for ZIP and UNZIP.
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
Greg Hartwig, April 1998.
|
||||
e-mail: ghartwig@ix.netcom.com
|
||||
ghartwig@vnet.ibm.com
|
||||
|
77
programs/fs/unzip60/cmsmvs/ccunzip.exec
Normal file
77
programs/fs/unzip60/cmsmvs/ccunzip.exec
Normal file
@ -0,0 +1,77 @@
|
||||
/* CCUNZIP EXEC Compile unzip 5.4 for VM/CMS */
|
||||
/* Author: George Petrov, 11 Apr 1995 (VMCOMPIL EXEC) */
|
||||
/* Modified for IBM C V3R1 by Ian E. Gorman, 2 Nov 1998
|
||||
Facilities for compiling and testing were provided by
|
||||
OmniMark Technologies Corporation, Ottawa, Canada
|
||||
*/
|
||||
Address Command
|
||||
Signal On Error
|
||||
|
||||
/* Allow longnames, compile re-entrant code.
|
||||
global.c and vmmvs.c require EXTENDED features */
|
||||
CCopts = 'LONGNAME RENT LANGLVL(EXTENDED) NOEXECOPS'
|
||||
|
||||
/* UNZIP options -- VM_CMS, REENTRANT */
|
||||
CCopts = CCopts 'DEFINE(VM_CMS,REENTRANT)'
|
||||
|
||||
/* Link the load module to run in more or less than 16MB memory */
|
||||
LINKopts = 'AMODE ANY RMODE ANY RLDSAVE'
|
||||
|
||||
|
||||
'GLOBAL TXTLIB SCEELKED CMSLIB'
|
||||
'GLOBAL LOADLIB SCEERUN'
|
||||
|
||||
|
||||
/* produce the TEXT (object) files */
|
||||
linklist=''
|
||||
modname='UNZIP'
|
||||
Say 'Building' modname 'MODULE...'
|
||||
Call Compile 'UNZIP'
|
||||
Call Compile 'CRC32'
|
||||
Call Compile 'CRYPT'
|
||||
Call Compile 'ENVARGS'
|
||||
Call Compile 'EXPLODE'
|
||||
Call Compile 'EXTRACT'
|
||||
Call Compile 'FILEIO'
|
||||
Call Compile 'GLOBALS'
|
||||
Call Compile 'INFLATE'
|
||||
Call Compile 'PROCESS'
|
||||
Call Compile 'LIST'
|
||||
Call Compile 'MATCH'
|
||||
Call Compile 'TTYIO'
|
||||
Call Compile 'UNREDUCE'
|
||||
Call Compile 'UNSHRINK'
|
||||
Call Compile 'ZIPINFO'
|
||||
Call Compile 'VMMVS'
|
||||
|
||||
Say 'Linking...'
|
||||
'EXEC CMOD' linklist '(MODNAME' modname LINKopts
|
||||
Say modname 'built successfully.'
|
||||
|
||||
|
||||
/* Make ZIPINFO from UNZIP */
|
||||
modname = 'ZIPINFO'
|
||||
'COPYFILE UNZIP MODULE A ZIPINFO MODULE A (OLDDATE REPLACE'
|
||||
Say modname 'built successfully.'
|
||||
Say 'Done.'
|
||||
|
||||
Exit rc
|
||||
|
||||
|
||||
|
||||
error:
|
||||
Say 'Error' rc 'during compilation!'
|
||||
Say 'Error in line' sigl':'
|
||||
Say ' 'Sourceline(sigl)
|
||||
Exit rc
|
||||
|
||||
|
||||
|
||||
Compile: Procedure Expose CCopts LINKopts linklist
|
||||
Parse arg filename filetype filemode .
|
||||
If filetype='' Then filetype='C'
|
||||
linklist = linklist filename
|
||||
|
||||
Say 'Compiling' filename filetype filemode '...'
|
||||
'EXEC CC' filename filetype filemode '('CCopts
|
||||
Return rc
|
85
programs/fs/unzip60/cmsmvs/mc.exec
Normal file
85
programs/fs/unzip60/cmsmvs/mc.exec
Normal file
@ -0,0 +1,85 @@
|
||||
/* MAKECPIP EXEC Make program to build a C/370 module */
|
||||
/* Author: George Petrov, 29 Sep 1994 */
|
||||
|
||||
arg fn . '(' cparms /* Filter name */
|
||||
'pipe (end ?) < 'fn' makefile', /* get all source files from */
|
||||
'| frlab GLOBALS:'||,
|
||||
'| drop',
|
||||
'| strip',
|
||||
'| var globals'
|
||||
cparms = cparms globals
|
||||
say ''
|
||||
say 'Compile options : 'cparms
|
||||
say ''
|
||||
if pos('REB',cparms) > 0 then do
|
||||
parse var cparms cp1 'REB' . ' ' cp2 /* REBuild options specified ? */
|
||||
cparms = cp1||cp2
|
||||
pipe1=,
|
||||
'pipe (end ?) < 'fn' makefile', /* get all source files from */
|
||||
'| nfind *'||, /* the makefile and compile */
|
||||
'| frlab TEXT:'||, /* only the those who are */
|
||||
'| r: tolab MODULE:'||, /* changed or never compiled */
|
||||
'| drop',
|
||||
'| o: fanout',
|
||||
'| chop before str /(/',
|
||||
'| statew',
|
||||
'| c: fanout', /* compiled */
|
||||
'| specs /Compiling / 1 w1-3 n / .../ n',
|
||||
'| cons'
|
||||
end
|
||||
else do
|
||||
pipe1=,
|
||||
'pipe (end ?) < 'fn' makefile', /* get all source files from */
|
||||
'| nfind *'||, /* the makefile and compile */
|
||||
'| frlab TEXT:'||, /* only the those who are */
|
||||
'| r: tolab MODULE:'||, /* changed or never compiled */
|
||||
'| drop',
|
||||
'| o: fanout',
|
||||
'| specs w1 1 /C/ nw w3 nw write w1 1 /TEXT A/ nw',
|
||||
'| chop before str /(/',
|
||||
'| statew',
|
||||
'| change (57 66) / /0/',
|
||||
'| sort 1.8 d', /* sort the date and time */
|
||||
'| uniq 1-17 singles', /* if the first is a source */
|
||||
'| sort 1.8 d 64.2 d 57.2 d 60.2 d 66.8 d', /* sort the date */
|
||||
'| uniq 1-8 first', /* if the first is a source */
|
||||
'| locate 9.8 /C /', /* program then it has to be */
|
||||
'| c: fanout', /* compiled */
|
||||
'| specs /Compiling / 1 w1-3 n / .../ n',
|
||||
'| cons'
|
||||
end
|
||||
pipe2= '?',
|
||||
'r:',
|
||||
'| drop',
|
||||
'| specs w1 1', /* save the module name in var */
|
||||
'| var module',
|
||||
'?',
|
||||
'o:',
|
||||
'| specs w1 1',
|
||||
'| join * / /',
|
||||
'| var texts', /* save all the text file names */
|
||||
'?', /* for later include */
|
||||
'c:',
|
||||
'| specs /CC / 1 w1-3 n /(NOTERM 'cparms'/ nw', /* compile! */
|
||||
'| err: cms | cons',
|
||||
'?',
|
||||
'err:',
|
||||
'| nfind 0'||,
|
||||
'| var err',
|
||||
'| specs /----> Errors found! RC=/ 1 1-* n',
|
||||
'| cons'
|
||||
/* '| g: gate'*/
|
||||
pipe1 pipe2
|
||||
say ''
|
||||
if symbol('err') = 'VAR' & err ^= 0 then do
|
||||
say 'Errors found in source files - link aborted! RC = 'err
|
||||
exit err
|
||||
end
|
||||
say 'Generating module 'module
|
||||
'pipe cms cmod' fn texts' | > 'fn' LINK A'
|
||||
exit rc
|
||||
error:
|
||||
say 'Error in REXX detected!'
|
||||
Say 'Syntax error on line' Sigl':' Sourceline(Sigl)
|
||||
Say 'Error was:' Errortext(RC)
|
||||
return rc
|
151
programs/fs/unzip60/cmsmvs/mvs.mki
Normal file
151
programs/fs/unzip60/cmsmvs/mvs.mki
Normal file
@ -0,0 +1,151 @@
|
||||
# Makefile for the MVS (OS/390 Base) version of UNZIP 5.4
|
||||
# Produced for C/C++ V3R2 in OS/390 1.2.0 by Ian E. Gorman, 2 Nov 1998
|
||||
# Facilities for compiling and testing were made available by
|
||||
# OmniMark Technologies Corporation, Ottawa, Canada
|
||||
|
||||
# NOTES
|
||||
#
|
||||
# The only tabs in this file are in the first character of each recipe
|
||||
# line, where they are required by make.
|
||||
#
|
||||
# Run this makefile in OpenMVS (OS/390 POSIX) using source files in the
|
||||
# HFS file system. You can write the load module to either HFS file
|
||||
# system or to a PDS in the native MVS file system. The PDS must have
|
||||
# sufficient free space to hold the load module.
|
||||
#
|
||||
# To compile to a member of a PDS:
|
||||
# make
|
||||
# or
|
||||
# make unzip.mvs
|
||||
#
|
||||
# To compile a test version into the HFS file system:
|
||||
# make hfs
|
||||
|
||||
# UNZIP options -- MVS, REENTRANT
|
||||
ZIPOPTS=-DMVS
|
||||
|
||||
# directories
|
||||
|
||||
# generic source code
|
||||
SRC=..
|
||||
SRC_P=$(SRC)/
|
||||
|
||||
# source code for MVS
|
||||
CMSMVS=../cmsmvs
|
||||
CMSMVS_P=$(CMSMVS)/
|
||||
|
||||
# include files
|
||||
INCLS=-I$(SRC) -I$(CMSMVS)
|
||||
|
||||
# object files and load modules
|
||||
BLD_P=../mvs/
|
||||
|
||||
# Other options
|
||||
|
||||
# Suffixes (E and O must be different)
|
||||
E=
|
||||
O=.o
|
||||
|
||||
# Need EXTENDED features for global.c and vmvms.c, so not using c89
|
||||
CC=cc
|
||||
CFLAGS=-D_OPEN_SYS $(ZIPOPTS) $(INCLS)
|
||||
|
||||
LD=cc
|
||||
LDFLAGS=
|
||||
|
||||
# Files
|
||||
|
||||
# object (TEXT) files
|
||||
OBJECTS= $(BLD_P)unzip$(O) $(BLD_P)crc32$(O) \
|
||||
$(BLD_P)crypt$(O) $(BLD_P)envargs$(O) $(BLD_P)explode$(O) \
|
||||
$(BLD_P)extract$(O) $(BLD_P)fileio$(O) $(BLD_P)globals$(O) \
|
||||
$(BLD_P)inflate$(O) $(BLD_P)process$(O) $(BLD_P)list$(O) \
|
||||
$(BLD_P)match$(O) $(BLD_P)ttyio$(O) $(BLD_P)unreduce$(O) \
|
||||
$(BLD_P)unshrink$(O) $(BLD_P)zipinfo$(O) $(BLD_P)vmmvs$(O)
|
||||
|
||||
# Header files
|
||||
HFILES= $(SRC_P)consts.h $(SRC_P)crypt.h $(SRC_P)ebcdic.h \
|
||||
$(SRC_P)globals.h $(SRC_P)inflate.h \
|
||||
$(SRC_P)ttyio.h $(SRC_P)unzip.h $(SRC_P)unzpriv.h \
|
||||
$(SRC_P)unzvers.h $(SRC_P)zip.h $(CMSMVS_P)vmmvs.h \
|
||||
$(CMSMVS_P)vmstat.h
|
||||
|
||||
# Rules
|
||||
|
||||
all: $(BLD_P)unzip.mvs$(E)
|
||||
hfs: $(BLD_P)unzip$(E)
|
||||
|
||||
# link
|
||||
|
||||
$(BLD_P)unzip.mvs$(E): $(OBJECTS)
|
||||
$(LD) -o "//INFOZIP.LOAD(UNZIP)" $(LDFLAGS) $^
|
||||
echo "tso call \"infozip(unzip)\" \"'\"\"""$$""@""\"\"'\"" > $%
|
||||
chmod a+x $%
|
||||
|
||||
$(BLD_P)unzip$(E): $(OBJECTS)
|
||||
$(LD) -o $% $(LDFLAGS) $^
|
||||
|
||||
# compile
|
||||
|
||||
$(BLD_P)api$(O): $(SRC_P)api.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)api.c
|
||||
|
||||
$(BLD_P)apihelp$(O): $(SRC_P)apihelp.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)apihelp.c
|
||||
|
||||
$(BLD_P)crc32$(O): $(SRC_P)crc32.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)crc32.c
|
||||
|
||||
$(BLD_P)crypt$(O): $(SRC_P)crypt.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)crypt.c
|
||||
|
||||
$(BLD_P)envargs$(O): $(SRC_P)envargs.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)envargs.c
|
||||
|
||||
$(BLD_P)explode$(O): $(SRC_P)explode.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)explode.c
|
||||
|
||||
$(BLD_P)extract$(O): $(SRC_P)extract.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)extract.c
|
||||
|
||||
$(BLD_P)fileio$(O): $(SRC_P)fileio.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)fileio.c
|
||||
|
||||
$(BLD_P)funzip$(O): $(SRC_P)funzip.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)funzip.c
|
||||
|
||||
$(BLD_P)globals$(O): $(SRC_P)globals.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)globals.c
|
||||
|
||||
$(BLD_P)inflate$(O): $(SRC_P)inflate.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)inflate.c
|
||||
|
||||
$(BLD_P)list$(O): $(SRC_P)list.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)list.c
|
||||
|
||||
$(BLD_P)match$(O): $(SRC_P)match.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)match.c
|
||||
|
||||
$(BLD_P)process$(O): $(SRC_P)process.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)process.c
|
||||
|
||||
$(BLD_P)ttyio$(O): $(SRC_P)ttyio.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)ttyio.c
|
||||
|
||||
$(BLD_P)unreduce$(O): $(SRC_P)unreduce.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)unreduce.c
|
||||
|
||||
$(BLD_P)unshrink$(O): $(SRC_P)unshrink.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)unshrink.c
|
||||
|
||||
$(BLD_P)unzip$(O): $(SRC_P)unzip.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)unzip.c
|
||||
|
||||
$(BLD_P)unzipstb$(O): $(SRC_P)unzipstb.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)unzipstb.c
|
||||
|
||||
$(BLD_P)zipinfo$(O): $(SRC_P)zipinfo.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(SRC_P)zipinfo.c
|
||||
|
||||
$(BLD_P)vmmvs$(O): $(CMSMVS_P)vmmvs.c $(HFILES)
|
||||
$(CC) -c -o $% $(CFLAGS) $(CMSMVS_P)vmmvs.c
|
66
programs/fs/unzip60/cmsmvs/unzip.exec
Normal file
66
programs/fs/unzip60/cmsmvs/unzip.exec
Normal file
@ -0,0 +1,66 @@
|
||||
/***********************************************************************/
|
||||
/* */
|
||||
/* Front-end EXEC to set up linkage to the C runtime libraries */
|
||||
/* before executing a MODULE generated from C code. */
|
||||
/* */
|
||||
/* Copy this file as an EXEC with a filename matching the C MODULE. */
|
||||
/* */
|
||||
/* Greg Hartwig (ghartwig@vnet.ibm.com) 7/31/97, 4/24/98. */
|
||||
/* */
|
||||
/***********************************************************************/
|
||||
Address Command
|
||||
Parse Arg argstring
|
||||
Parse Source . . myname .
|
||||
|
||||
/* Set output and input character translation so brackets show up */
|
||||
'SET OUTPUT AD' 'BA'x
|
||||
'SET OUTPUT BD' 'BB'x
|
||||
'SET INPUT BA AD'
|
||||
'SET INPUT BB BD'
|
||||
|
||||
Call CLIB
|
||||
If rc<>0 Then Do
|
||||
Say 'The required C runtime libraries don''t appear to be available.'
|
||||
Say myname 'can not run.'
|
||||
Exit 12
|
||||
End
|
||||
|
||||
/* Run the command */
|
||||
myname argstring
|
||||
Exit rc
|
||||
|
||||
|
||||
|
||||
|
||||
/* Contents of the CLIB EXEC, modified for RC checking. */
|
||||
/* Removed TXTLIB setting. Only LOADLIB needed for execution. */
|
||||
CLIB:
|
||||
/***************************************************/
|
||||
/* SET UP LIBRARIES FOR LE for MVS & VM */
|
||||
/***************************************************/
|
||||
Address COMMAND
|
||||
|
||||
loadlib ='EDCLINK' /* C/370 runtime */
|
||||
loadlib ='SCEERUN' /* LE runtime */
|
||||
|
||||
|
||||
theirs=queued() /* old stack contentsM068*/
|
||||
'QUERY LOADLIB ( LIFO' /* old setting M068*/
|
||||
LoadlibList='' /* init list M068*/
|
||||
rc=0
|
||||
Do while queued()^=theirs /* all lines from cmdM068*/
|
||||
Parse upper pull 'LOADLIB' '=' Ltemp /* get one line M068*/
|
||||
LoadlibList= Ltemp Loadliblist /* was stacked LIFO M068*/
|
||||
End /*M068*/
|
||||
If loadlibList='NONE' ,
|
||||
Then Do
|
||||
'GLOBAL LOADLIB' Loadlib /* enforce what we need */
|
||||
End
|
||||
Else Do
|
||||
Do xx=1 to Words(loadlib)
|
||||
If Find(loadliblist,word(loadlib,xx)) = 0 ,
|
||||
then loadliblist = loadliblist word(loadlib,xx)
|
||||
End
|
||||
'GLOBAL LOADLIB' loadliblist /* enforce what we need */
|
||||
End
|
||||
Return
|
25
programs/fs/unzip60/cmsmvs/unzip.makefile
Normal file
25
programs/fs/unzip60/cmsmvs/unzip.makefile
Normal file
@ -0,0 +1,25 @@
|
||||
* This is a comment
|
||||
* this makefile compiles filter UNZIP
|
||||
|
||||
GLOBALS:
|
||||
long def(VM_CMS)
|
||||
TEXT:
|
||||
unzip c
|
||||
crc32 c
|
||||
crypt c
|
||||
envargs c
|
||||
explode c
|
||||
extract c
|
||||
fileio c
|
||||
globals c
|
||||
inflate c
|
||||
list c
|
||||
match c
|
||||
process c
|
||||
ttyio c
|
||||
unreduce c
|
||||
unshrink c
|
||||
zipinfo c
|
||||
vmmvs c
|
||||
MODULE:
|
||||
unzip module
|
130
programs/fs/unzip60/cmsmvs/unzmvsc.job
Normal file
130
programs/fs/unzip60/cmsmvs/unzmvsc.job
Normal file
@ -0,0 +1,130 @@
|
||||
//*
|
||||
//* LE COMPILE FOR UNZIP541.
|
||||
//* ALL STEPS SHOULD GET COND CODE 0 EXCEPT FOR PLINK.PLKED WHICH GETS 4.
|
||||
//*
|
||||
//CBC JCLLIB ORDER=CBC.SCBCPRC
|
||||
//UNZIP EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(UNZIP)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(UNZIP),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//CRC32 EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(CRC32)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(CRC32),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//CRYPT EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(CRYPT)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(CRYPT),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//ENVARGS EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(ENVARGS)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(ENVARGS),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//EXPLODE EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(EXPLODE)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(EXPLODE),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//EXTRACT EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(EXTRACT)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(EXTRACT),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//FILEIO EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(FILEIO)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(FILEIO),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//GLOBALS EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(GLOBALS)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(GLOBALS),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//INFLATE EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(INFLATE)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(INFLATE),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//LIST EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(LIST)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(LIST),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//MATCH EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(MATCH)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(MATCH),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//PROCESS EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(PROCESS)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(PROCESS),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//TTYIO EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(TTYIO)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(TTYIO),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//UNREDUCE EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(UNREDUCE)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(UNREDUCE),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//UNSHRINK EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(UNSHRINK)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(UNSHRINK),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//ZIPINFO EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(ZIPINFO)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(ZIPINFO),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//VMMVS EXEC EDCC,COND=(0,NE),CREGSIZ='0M',
|
||||
// INFILE='USERID.UNZIP.C(VMMVS)',
|
||||
// OUTFILE='USERID.UNZIP.OBJ(VMMVS),DISP=SHR',
|
||||
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
|
||||
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
|
||||
//COMPILE.USERLIB DD DSN=USERID.UNZIP.H,DISP=SHR
|
||||
//PLINK EXEC PROC=EDCPL,COND=(4,LT),
|
||||
// OUTFILE='USERID.UNZIP.LOAD(UNZIP),DISP=SHR',
|
||||
// PPARM='NONCAL,MAP,MEMORY',
|
||||
// LPARM='LIST,MAP,XREF'
|
||||
//SYSPRINT DD SYSOUT=*
|
||||
//PLKED.SYSIN DD DSN=USERID.UNZIP.OBJ(UNZIP),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(CRC32),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(CRYPT),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(ENVARGS),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(EXPLODE),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(EXTRACT),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(FILEIO),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(GLOBALS),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(INFLATE),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(LIST),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(MATCH),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(PROCESS),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(TTYIO),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(UNREDUCE),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(UNSHRINK),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(ZIPINFO),DISP=SHR
|
||||
// DD DSN=USERID.UNZIP.OBJ(VMMVS),DISP=SHR
|
||||
//LKED.SYSLIB DD DISP=SHR,DSN=CEE.SCEELKED
|
56
programs/fs/unzip60/cmsmvs/unzvmc.exec
Normal file
56
programs/fs/unzip60/cmsmvs/unzvmc.exec
Normal file
@ -0,0 +1,56 @@
|
||||
/* VMCOMPIL EXEC Unzip compile for VM/CMS */
|
||||
/* Author : George Petrov, 11 Apr 1995 */
|
||||
|
||||
signal on error
|
||||
|
||||
parms = '(long def(VM_CMS)'
|
||||
/* Add local options */
|
||||
/* "TARGET(COMPAT)" is required for V2.2 compiler */
|
||||
parms = parms 'TARGET(COMPAT) SOURCE'
|
||||
|
||||
|
||||
say 'Compiling UNZIP C...'
|
||||
'cc unzip c 'parms
|
||||
say 'Compiling CRC32 C...'
|
||||
'cc crc32 c 'parms
|
||||
say 'Compiling CRYPT C...'
|
||||
'cc crypt c 'parms
|
||||
say 'Compiling ENVARGS C...'
|
||||
'cc envargs c 'parms
|
||||
say 'Compiling EXPLODE C...'
|
||||
'cc explode c 'parms
|
||||
say 'Compiling EXTRACT C...'
|
||||
'cc extract c 'parms
|
||||
say 'Compiling FILEIO C...'
|
||||
'cc fileio c 'parms
|
||||
say 'Compiling GLOBALS C...'
|
||||
'cc globals c 'parms
|
||||
say 'Compiling INFLATE C...'
|
||||
'cc inflate c 'parms
|
||||
say 'Compiling PROCESS C...'
|
||||
'cc process c 'parms
|
||||
say 'Compiling LIST C...'
|
||||
'cc list c 'parms
|
||||
say 'Compiling MATCH C...'
|
||||
'cc match c 'parms
|
||||
say 'Compiling TTYIO C...'
|
||||
'cc ttyio c 'parms
|
||||
say 'Compiling UNREDUCE C...'
|
||||
'cc unreduce c 'parms
|
||||
say 'Compiling UNSHRINK C...'
|
||||
'cc unshrink c 'parms
|
||||
say 'Compiling ZIPINFO C...'
|
||||
'cc zipinfo c 'parms
|
||||
say 'Compiling VMMVS C...'
|
||||
'cc vmmvs c 'parms
|
||||
|
||||
say 'Linking all files...'
|
||||
'cmod unzip unzip crc32 crypt envargs explode extract fileio globals',
|
||||
'inflate list match process ttyio unreduce unshrink zipinfo vmmvs'
|
||||
say 'All Done!'
|
||||
say "To run enter : UNZIP parms"
|
||||
exit rc
|
||||
|
||||
error:
|
||||
say 'Error during compilation!'
|
||||
exit rc
|
683
programs/fs/unzip60/cmsmvs/vmmvs.c
Normal file
683
programs/fs/unzip60/cmsmvs/vmmvs.c
Normal file
@ -0,0 +1,683 @@
|
||||
/*
|
||||
Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
vmmvs.c (for both VM/CMS and MVS)
|
||||
|
||||
Contains: vmmvs_open_infile()
|
||||
open_outfile()
|
||||
close_outfile()
|
||||
close_infile()
|
||||
getVMMVSexfield()
|
||||
do_wild()
|
||||
mapattr()
|
||||
mapname()
|
||||
checkdir()
|
||||
check_for_newer()
|
||||
stat()
|
||||
version()
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#define __VMMVS_C /* identifies this source module */
|
||||
#define UNZIP_INTERNAL
|
||||
#include "unzip.h"
|
||||
|
||||
|
||||
/********************************/
|
||||
/* Function vmmvs_open_infile() */
|
||||
/********************************/
|
||||
|
||||
FILE *vmmvs_open_infile(__G)
|
||||
__GDEF
|
||||
{
|
||||
FILE *fzip;
|
||||
|
||||
G.tempfn = NULL;
|
||||
|
||||
fzip = fopen(G.zipfn, FOPR);
|
||||
|
||||
#if 0
|
||||
/* Let's try it without the convert for a while -- RG Hartwig */
|
||||
|
||||
if ((fzip = fopen(G.zipfn,"rb,recfm=fb")) == NULL) {
|
||||
size_t cnt;
|
||||
char *buf;
|
||||
FILE *in, *out;
|
||||
|
||||
if ((buf = (char *)malloc(32768)) == NULL) return NULL;
|
||||
if ((G.tempfn = tmpnam(NULL)) == NULL) return NULL;
|
||||
if ((in = fopen(G.zipfn,"rb")) != NULL &&
|
||||
(out = fopen(G.tempfn,"wb,recfm=fb,lrecl=1")) != NULL) {
|
||||
Trace((stdout,"Converting ZIP file to fixed record format...\n"));
|
||||
while (!feof(in)) {
|
||||
cnt = fread(buf,1,32768,in);
|
||||
if (cnt) fwrite(buf,1,cnt,out);
|
||||
}
|
||||
}
|
||||
else {
|
||||
free(buf);
|
||||
fclose(out);
|
||||
fclose(in);
|
||||
return NULL;
|
||||
}
|
||||
free(buf);
|
||||
fclose(out);
|
||||
fclose(in);
|
||||
|
||||
fzip = fopen(G.tempfn,"rb,recfm=fb");
|
||||
if (fzip == NULL) return NULL;
|
||||
|
||||
/* Update the G.ziplen value since it might have changed after
|
||||
the reformatting copy. */
|
||||
fseek(fzip,0L,SEEK_SET);
|
||||
fseek(fzip,0L,SEEK_END);
|
||||
G.ziplen = ftell(fzip);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return fzip;
|
||||
}
|
||||
|
||||
|
||||
/***************************/
|
||||
/* Function open_outfile() */
|
||||
/***************************/
|
||||
|
||||
int open_outfile(__G) /* return 1 if fail */
|
||||
__GDEF
|
||||
{
|
||||
char type[100];
|
||||
char *mode = NULL;
|
||||
#ifdef MVS
|
||||
/* Check if the output file already exists and do not overwrite its DCB */
|
||||
char basefilename[PATH_MAX], *p;
|
||||
FILE *exists;
|
||||
|
||||
/* Get the base file name, without any member name */
|
||||
strcpy(basefilename, G.filename);
|
||||
if ((p = strchr(basefilename, '(')) != NULL) {
|
||||
if (basefilename[0] == '\'')
|
||||
*p++ = '\'';
|
||||
*p = '\0';
|
||||
}
|
||||
exists = fopen(basefilename, FOPR);
|
||||
if (exists) {
|
||||
if (G.pInfo->textmode)
|
||||
mode = FOPWTE; /* Text file, existing */
|
||||
else
|
||||
mode = FOPWE; /* Binary file, existing */
|
||||
fclose(exists);
|
||||
}
|
||||
else /* continued on next line */
|
||||
#endif /* MVS */
|
||||
if (G.pInfo->textmode) {
|
||||
if (mode == NULL)
|
||||
mode = FOPWT;
|
||||
} else if (G.lrec.extra_field_length > 0 && G.extra_field != NULL) {
|
||||
unsigned lef_len = (unsigned)(G.lrec.extra_field_length);
|
||||
uch *lef_buf = G.extra_field;
|
||||
|
||||
while (lef_len > EB_HEADSIZE) {
|
||||
unsigned eb_id = makeword(&lef_buf[EB_ID]);
|
||||
unsigned eb_dlen = makeword(&lef_buf[EB_LEN]);
|
||||
|
||||
if (eb_dlen > (lef_len - EB_HEADSIZE)) {
|
||||
/* Discovered some extra field inconsistency! */
|
||||
TTrace((stderr,
|
||||
"open_outfile: block length %u > rest lef_size %u\n",
|
||||
eb_dlen, lef_len - EB_HEADSIZE));
|
||||
break;
|
||||
}
|
||||
|
||||
if ((eb_id == EF_VMCMS || eb_id == EF_MVS) &&
|
||||
(getVMMVSexfield(type, lef_buf, eb_dlen) > 0)) {
|
||||
mode = type;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Skip this extra field block */
|
||||
lef_buf += (eb_dlen + EB_HEADSIZE);
|
||||
lef_len -= (eb_dlen + EB_HEADSIZE);
|
||||
}
|
||||
}
|
||||
if (mode == NULL) mode = FOPW;
|
||||
|
||||
Trace((stderr, "Output file='%s' opening with '%s'\n", G.filename, mode));
|
||||
if ((G.outfile = fopen(G.filename, mode)) == NULL) {
|
||||
Info(slide, 0x401, ((char *)slide, "\nerror: cannot create %s\n",
|
||||
FnFilter1(G.filename)));
|
||||
Trace((stderr, "error %d: '%s'\n", errno, strerror(errno)));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* end function open_outfile() */
|
||||
|
||||
|
||||
/****************************/
|
||||
/* Function close_outfile() */
|
||||
/****************************/
|
||||
|
||||
void close_outfile(__G)
|
||||
__GDEF
|
||||
{
|
||||
fclose(G.outfile);
|
||||
} /* end function close_outfile() */
|
||||
|
||||
|
||||
/***************************/
|
||||
/* Function close_infile() */
|
||||
/***************************/
|
||||
|
||||
void close_infile(__G)
|
||||
__GDEF
|
||||
{
|
||||
fclose(G.zipfd);
|
||||
|
||||
/* If we're working from a temp file, erase it now */
|
||||
if (G.tempfn)
|
||||
remove(G.tempfn);
|
||||
|
||||
} /* end function close_infile() */
|
||||
|
||||
|
||||
|
||||
/******************************/
|
||||
/* Function getVMMVSexfield() */
|
||||
/******************************/
|
||||
|
||||
extent getVMMVSexfield(type, ef_block, datalen)
|
||||
char *type;
|
||||
uch *ef_block;
|
||||
unsigned datalen;
|
||||
{
|
||||
fldata_t *fdata = (fldata_t *) &ef_block[4];
|
||||
|
||||
if (datalen < sizeof(fldata_t))
|
||||
return 0;
|
||||
|
||||
strcpy(type, "w");
|
||||
strcat(type, fdata->__openmode == __TEXT ? ""
|
||||
:fdata->__openmode == __BINARY ? "b"
|
||||
:fdata->__openmode == __RECORD ? "b,type=record"
|
||||
: "");
|
||||
strcat(type, ",recfm=");
|
||||
strcat(type, fdata->__recfmF? "F"
|
||||
:fdata->__recfmV? "V"
|
||||
:fdata->__recfmU? "U"
|
||||
: "?");
|
||||
if (fdata->__recfmBlk) strcat(type, "B");
|
||||
if (fdata->__recfmS) strcat(type, "S");
|
||||
if (fdata->__recfmASA) strcat(type, "A");
|
||||
if (fdata->__recfmM) strcat(type, "M");
|
||||
sprintf(type+strlen(type), ",lrecl=%ld", fdata->__recfmV
|
||||
? fdata->__maxreclen+4
|
||||
: fdata->__maxreclen);
|
||||
#ifdef VM_CMS
|
||||
/* For CMS, use blocksize for FB files only */
|
||||
if (fdata->__recfmBlk)
|
||||
sprintf(type+strlen(type), ",blksize=%ld", fdata->__blksize);
|
||||
#else
|
||||
/* For MVS, always use blocksize */
|
||||
sprintf(type+strlen(type), ",blksize=%ld", fdata->__blksize);
|
||||
#endif
|
||||
|
||||
return strlen(type);
|
||||
} /* end function getVMMVSexfield() */
|
||||
|
||||
|
||||
|
||||
#ifndef SFX
|
||||
|
||||
/**********************/
|
||||
/* Function do_wild() */ /* for porting: dir separator; match(ignore_case) */
|
||||
/**********************/
|
||||
|
||||
char *do_wild(__G__ wld)
|
||||
__GDEF
|
||||
ZCONST char *wld; /* only used first time on a given dir */
|
||||
{
|
||||
static int First = 0;
|
||||
static char filename[256];
|
||||
|
||||
if (First == 0) {
|
||||
First = 1;
|
||||
strncpy(filename, wld, sizeof(filename));
|
||||
filename[sizeof(filename)-1] = '\0';
|
||||
return filename;
|
||||
}
|
||||
else
|
||||
return (char *)NULL;
|
||||
|
||||
} /* end function do_wild() */
|
||||
|
||||
#endif /* !SFX */
|
||||
|
||||
|
||||
|
||||
/************************/
|
||||
/* Function mapattr() */
|
||||
/************************/
|
||||
|
||||
int mapattr(__G)
|
||||
__GDEF
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/************************/
|
||||
/* Function mapname() */
|
||||
/************************/
|
||||
|
||||
int mapname(__G__ renamed)
|
||||
__GDEF
|
||||
int renamed;
|
||||
/*
|
||||
* returns:
|
||||
* MPN_OK - no problem detected
|
||||
* MPN_INF_TRUNC - caution (truncated filename)
|
||||
* MPN_INF_SKIP - info "skip entry" (dir doesn't exist)
|
||||
* MPN_ERR_SKIP - error -> skip entry
|
||||
* MPN_ERR_TOOLONG - error -> path is too long
|
||||
* MPN_NOMEM - error (memory allocation failed) -> skip entry
|
||||
* [also MPN_VOL_LABEL, MPN_CREATED_DIR]
|
||||
*/
|
||||
{
|
||||
char newname[FILNAMSIZ], *lbar;
|
||||
#ifdef MVS
|
||||
char *pmember;
|
||||
#endif
|
||||
int name_changed = MPN_OK;
|
||||
|
||||
if (G.pInfo->vollabel)
|
||||
return MPN_VOL_LABEL; /* can't set disk volume labels in CMS_MVS */
|
||||
|
||||
#ifdef MVS
|
||||
/* Remove bad characters for MVS from the filename */
|
||||
while ((lbar = strpbrk(G.filename, "_+-")) != NULL) {
|
||||
/* Must use memmove() here because data overlaps. */
|
||||
/* strcpy() gives undefined behavior in this case. */
|
||||
memmove(lbar, lbar+1, strlen(lbar));
|
||||
name_changed = MPN_INF_TRUNC;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove bad characters for MVS/CMS from the filename */
|
||||
while ((lbar = strpbrk(G.filename, "()")) != NULL) {
|
||||
memmove(lbar, lbar+1, strlen(lbar));
|
||||
name_changed = MPN_INF_TRUNC;
|
||||
}
|
||||
|
||||
#ifdef VM_CMS
|
||||
if ((lbar = strrchr(G.filename, '/')) != NULL) {
|
||||
strcpy(newname, lbar+1);
|
||||
Trace((stderr, "File '%s' renamed to '%s'\n", G.filename, newname));
|
||||
strcpy(G.filename, newname);
|
||||
name_changed = MPN_INF_TRUNC;
|
||||
}
|
||||
#else /* MVS */
|
||||
if ((pmember = strrchr(G.filename, '/')) == NULL)
|
||||
pmember = G.filename;
|
||||
else
|
||||
pmember++;
|
||||
|
||||
/* search for extension in file name */
|
||||
if ((lbar = strrchr(pmember, '.')) != NULL) {
|
||||
*lbar++ = '\0';
|
||||
strcpy(newname, pmember);
|
||||
strcpy(pmember, lbar);
|
||||
strcat(pmember, "(");
|
||||
strcat(pmember, newname);
|
||||
strcat(pmember, ")");
|
||||
}
|
||||
|
||||
/* Remove all 'internal' dots '.', to prevent false consideration as
|
||||
* MVS path delimiters! */
|
||||
while ((lbar = strrchr(G.filename, '.')) != NULL) {
|
||||
memmove(lbar, lbar+1, strlen(lbar));
|
||||
name_changed = MPN_INF_TRUNC;
|
||||
}
|
||||
|
||||
/* Finally, convert path delimiters from internal '/' to external '.' */
|
||||
while ((lbar = strchr(G.filename, '/')) != NULL)
|
||||
*lbar = '.';
|
||||
#endif /* ?VM_CMS */
|
||||
|
||||
#ifndef MVS
|
||||
if ((lbar = strchr(G.filename, '.')) == NULL) {
|
||||
printf("WARNING: file '%s' has no extension - renamed to '%s.NONAME'\n"\
|
||||
,G.filename, G.filename);
|
||||
strcat(G.filename, ".NONAME");
|
||||
name_changed = MPN_INF_TRUNC;
|
||||
}
|
||||
#endif
|
||||
checkdir(__G__ G.filename, GETPATH);
|
||||
|
||||
return name_changed;
|
||||
|
||||
} /* end function mapname() */
|
||||
|
||||
|
||||
int checkdir(__G__ pathcomp, flag)
|
||||
__GDEF
|
||||
char *pathcomp;
|
||||
int flag;
|
||||
/*
|
||||
* returns:
|
||||
* MPN_OK - no problem detected
|
||||
* MPN_INF_TRUNC - (on APPEND_NAME) truncated filename
|
||||
* MPN_INF_SKIP - path doesn't exist, not allowed to create
|
||||
* MPN_ERR_SKIP - path doesn't exist, tried to create and failed; or path
|
||||
* exists and is not a directory, but is supposed to be
|
||||
* MPN_ERR_TOOLONG - path is too long
|
||||
* MPN_NOMEM - can't allocate memory for filename buffers
|
||||
*/
|
||||
{
|
||||
static int rootlen = 0; /* length of rootpath */
|
||||
static char *rootpath; /* user's "extract-to" directory */
|
||||
|
||||
# define FN_MASK 7
|
||||
# define FUNCTION (flag & FN_MASK)
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
ROOT: if appropriate, store the path in rootpath and create it if neces-
|
||||
sary; else assume it's a zipfile member and return. This path segment
|
||||
gets used in extracting all members from every zipfile specified on the
|
||||
command line. Note that under OS/2 and MS-DOS, if a candidate extract-to
|
||||
directory specification includes a drive letter (leading "x:"), it is
|
||||
treated just as if it had a trailing '/'--that is, one directory level
|
||||
will be created if the path doesn't exist, unless this is otherwise pro-
|
||||
hibited (e.g., freshening).
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#if (!defined(SFX) || defined(SFX_EXDIR))
|
||||
if (FUNCTION == ROOT) {
|
||||
Trace((stderr, "initializing root path to [%s]\n",
|
||||
FnFilter1(pathcomp)));
|
||||
if (pathcomp == (char *)NULL) {
|
||||
rootlen = 0;
|
||||
}
|
||||
else if ((rootlen = strlen(pathcomp)) > 0) {
|
||||
if ((rootpath = (char *)malloc(rootlen+1)) == NULL) {
|
||||
rootlen = 0;
|
||||
return MPN_NOMEM;
|
||||
}
|
||||
strcpy(rootpath, pathcomp);
|
||||
Trace((stderr, "rootpath now = [%s]\n", rootpath));
|
||||
}
|
||||
return MPN_OK;
|
||||
}
|
||||
#endif /* !SFX || SFX_EXDIR */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
GETPATH: copy full path to the string pointed at by pathcomp, and free
|
||||
buildpath.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (FUNCTION == GETPATH) {
|
||||
if (rootlen > 0) {
|
||||
#ifdef VM_CMS /* put the exdir after the filename */
|
||||
strcat(pathcomp, "."); /* used as minidisk to be save on */
|
||||
strcat(pathcomp, rootpath);
|
||||
#else /* MVS */
|
||||
char newfilename[PATH_MAX];
|
||||
char *start_fname;
|
||||
int quoted = 0;
|
||||
|
||||
strcpy(newfilename, rootpath);
|
||||
if (newfilename[0] == '\'') {
|
||||
quoted = strlen(newfilename) - 1;
|
||||
if (newfilename[quoted] == '\'')
|
||||
newfilename[quoted] = '\0';
|
||||
else
|
||||
quoted = 0;
|
||||
}
|
||||
if (strchr(pathcomp, '(') == NULL) {
|
||||
if ((start_fname = strrchr(pathcomp, '.')) == NULL) {
|
||||
start_fname = pathcomp;
|
||||
}
|
||||
else {
|
||||
*start_fname++ = '\0';
|
||||
strcat(newfilename, ".");
|
||||
strcat(newfilename, pathcomp);
|
||||
}
|
||||
strcat(newfilename, "(");
|
||||
strcat(newfilename, start_fname);
|
||||
strcat(newfilename, ")");
|
||||
}
|
||||
else {
|
||||
strcat(newfilename, ".");
|
||||
strcat(newfilename, pathcomp);
|
||||
}
|
||||
if (quoted)
|
||||
strcat(newfilename, "'");
|
||||
Trace((stdout, "new dataset : %s\n", newfilename));
|
||||
strcpy(pathcomp, newfilename);
|
||||
#endif /* ?VM_CMS */
|
||||
}
|
||||
return MPN_OK;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
END: free rootpath, immediately prior to program exit.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (FUNCTION == END) {
|
||||
Trace((stderr, "freeing rootpath\n"));
|
||||
if (rootlen > 0) {
|
||||
free(rootpath);
|
||||
rootlen = 0;
|
||||
}
|
||||
return MPN_OK;
|
||||
}
|
||||
|
||||
return MPN_INVALID; /* should never reach */
|
||||
|
||||
} /* end function checkdir() */
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************/
|
||||
/* Function check_for_newer() */ /* used for overwriting/freshening/updating */
|
||||
/******************************/
|
||||
|
||||
int check_for_newer(__G__ filename) /* return 1 if existing file is newer */
|
||||
__GDEF /* or equal; 0 if older; -1 if doesn't */
|
||||
char *filename; /* exist yet */
|
||||
{
|
||||
FILE *stream;
|
||||
|
||||
if ((stream = fopen(filename, FOPR)) != NULL) {
|
||||
fclose(stream);
|
||||
/* File exists, assume it is "newer" than archive entry. */
|
||||
return EXISTS_AND_NEWER;
|
||||
}
|
||||
/* File does not exist. */
|
||||
return DOES_NOT_EXIST;
|
||||
} /* end function check_for_newer() */
|
||||
|
||||
|
||||
/*********************/
|
||||
/* Function stat() */
|
||||
/*********************/
|
||||
|
||||
int stat(const char *path, struct stat *buf)
|
||||
{
|
||||
FILE *fp;
|
||||
char fname[PATH_MAX];
|
||||
time_t ltime;
|
||||
|
||||
if ((fp = fopen(path, FOPR)) != NULL) {
|
||||
fldata_t fdata;
|
||||
if (fldata( fp, fname, &fdata ) == 0) {
|
||||
buf->st_dev = fdata.__device;
|
||||
buf->st_mode = *(short *)(&fdata);
|
||||
}
|
||||
|
||||
/* Determine file size by seeking to EOF */
|
||||
fseek(fp,0L,SEEK_END);
|
||||
buf->st_size = ftell(fp);
|
||||
fclose(fp);
|
||||
|
||||
/* set time fields in stat buf to current time. */
|
||||
time(<ime);
|
||||
buf->st_atime =
|
||||
buf->st_mtime =
|
||||
buf->st_ctime = ltime;
|
||||
|
||||
/* File exists, return success */
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef STAND_ALONE
|
||||
/***************************/
|
||||
/* Function main_vmmvs() */
|
||||
/***************************/
|
||||
|
||||
/* This function is called as main() to parse arguments */
|
||||
/* into argc and argv. This is required for stand-alone */
|
||||
/* execution. This calls the "real" main() when done. */
|
||||
|
||||
int MAIN_VMMVS(void)
|
||||
{
|
||||
int argc=0;
|
||||
char *argv[50];
|
||||
|
||||
int iArgLen;
|
||||
char argstr[256];
|
||||
char **pEPLIST, *pCmdStart, *pArgStart, *pArgEnd;
|
||||
|
||||
/* Get address of extended parameter list from S/370 Register 0 */
|
||||
pEPLIST = (char **)__xregs(0);
|
||||
|
||||
/* Null-terminate the argument string */
|
||||
pCmdStart = *(pEPLIST+0);
|
||||
pArgStart = *(pEPLIST+1);
|
||||
pArgEnd = *(pEPLIST+2);
|
||||
iArgLen = pArgEnd - pCmdStart + 1;
|
||||
|
||||
/* Make a copy of the command string */
|
||||
memcpy(argstr, pCmdStart, iArgLen);
|
||||
argstr[iArgLen] = '\0'; /* Null-terminate */
|
||||
|
||||
/* Store first token (cmd) */
|
||||
argv[argc++] = strtok(argstr, " ");
|
||||
|
||||
/* Store the rest (args) */
|
||||
while (argv[argc-1])
|
||||
argv[argc++] = strtok(NULL, " ");
|
||||
argc--; /* Back off last NULL entry */
|
||||
|
||||
/* Call "real" main() function */
|
||||
return MAIN(argc, argv);
|
||||
}
|
||||
#endif /* STAND_ALONE */
|
||||
|
||||
|
||||
|
||||
#ifndef SFX
|
||||
|
||||
/************************/
|
||||
/* Function version() */
|
||||
/************************/
|
||||
|
||||
void version(__G)
|
||||
__GDEF
|
||||
{
|
||||
int len;
|
||||
char liblvlmsg [50+1];
|
||||
char *compiler = "?";
|
||||
char *platform = "?";
|
||||
char complevel[64];
|
||||
|
||||
/* Map the runtime library level information */
|
||||
union {
|
||||
unsigned int iVRM;
|
||||
struct {
|
||||
unsigned int pd:4; /* Product designation */
|
||||
unsigned int vv:4; /* Version */
|
||||
unsigned int rr:8; /* Release */
|
||||
unsigned int mm:16; /* Modification level */
|
||||
} xVRM;
|
||||
} VRM;
|
||||
|
||||
|
||||
/* Break down the runtime library level */
|
||||
VRM.iVRM = __librel();
|
||||
sprintf(liblvlmsg, "Using runtime library level %s V%dR%dM%d",
|
||||
(VRM.xVRM.pd==1 ? "LE" : "CE"),
|
||||
VRM.xVRM.vv, VRM.xVRM.rr, VRM.xVRM.mm);
|
||||
/* Note: LE = Language Environment, CE = Common Env. (C/370). */
|
||||
/* This refers ONLY to the current runtimes, not the compiler. */
|
||||
|
||||
|
||||
#ifdef VM_CMS
|
||||
platform = "VM/CMS";
|
||||
#ifdef __IBMC__
|
||||
compiler = "IBM C";
|
||||
#else
|
||||
compiler = "C/370";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MVS
|
||||
platform = "MVS";
|
||||
#ifdef __IBMC__
|
||||
compiler = "IBM C/C++";
|
||||
#else
|
||||
compiler = "C/370";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __COMPILER_VER__
|
||||
VRM.iVRM = __COMPILER_VER__;
|
||||
sprintf(complevel," V%dR%dM%d",
|
||||
VRM.xVRM.vv, VRM.xVRM.rr, VRM.xVRM.mm);
|
||||
#else
|
||||
#ifdef __IBMC__
|
||||
sprintf(complevel," V%dR%d", __IBMC__ / 100, (__IBMC__ % 100)/10);
|
||||
#else
|
||||
complevel[0] = '\0';
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Output is in the form "Compiled with %s%s for %s%s%s%s." */
|
||||
len = sprintf((char *)slide, LoadFarString(CompiledWith),
|
||||
|
||||
/* Add compiler name and level */
|
||||
compiler, complevel,
|
||||
|
||||
/* Add compile environment */
|
||||
platform,
|
||||
|
||||
/* Add timestamp */
|
||||
#ifdef __DATE__
|
||||
" on " __DATE__
|
||||
#ifdef __TIME__
|
||||
" at " __TIME__
|
||||
#endif
|
||||
#endif
|
||||
".\n", "",
|
||||
liblvlmsg
|
||||
);
|
||||
|
||||
(*G.message)((zvoid *)&G, slide, (ulg)len, 0);
|
||||
|
||||
} /* end function version() */
|
||||
|
||||
#endif /* !SFX */
|
96
programs/fs/unzip60/cmsmvs/vmmvs.h
Normal file
96
programs/fs/unzip60/cmsmvs/vmmvs.h
Normal file
@ -0,0 +1,96 @@
|
||||
/*
|
||||
Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2007-Mar-04 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/* vmmvs.h: include file for both VM/CMS and MVS ports of UnZip */
|
||||
#ifndef __vmmvs_h /* prevent multiple inclusions */
|
||||
#define __vmmvs_h
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL (zvoid *)0
|
||||
#endif
|
||||
|
||||
#ifdef MVS
|
||||
# define _POSIX_SOURCE /* tell MVS we want full definitions */
|
||||
# define NO_STRNICMP /* MVS has no strnicmp() */
|
||||
# include <features.h>
|
||||
/* MVS complains if a function has the same name as a csect. */
|
||||
# if defined(__UNZIP_C)
|
||||
# pragma csect(STATIC,"unzip_s")
|
||||
# elif defined(__CRC32_C)
|
||||
# pragma csect(STATIC,"crc32_s")
|
||||
# elif defined(__ENVARGS_C)
|
||||
# pragma csect(STATIC,"envarg_s")
|
||||
# elif defined(__EXPLODE_C)
|
||||
# pragma csect(STATIC,"explod_s")
|
||||
# elif defined(__INFLATE_C)
|
||||
# pragma csect(STATIC,"inflat_s")
|
||||
# elif defined(__MATCH_C)
|
||||
# pragma csect(STATIC,"match_s")
|
||||
# elif defined(__UNREDUCE_C)
|
||||
# pragma csect(STATIC,"unredu_s")
|
||||
# elif defined(__UNSHRINK_C)
|
||||
# pragma csect(STATIC,"unshri_s")
|
||||
# elif defined(__ZIPINFO_C)
|
||||
# pragma csect(STATIC,"zipinf_s")
|
||||
# endif
|
||||
#endif /* MVS */
|
||||
|
||||
#include <time.h> /* the usual non-BSD time functions */
|
||||
#ifdef VM_CMS
|
||||
# include "vmstat.h"
|
||||
#endif
|
||||
#ifdef MVS
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#define PASSWD_FROM_STDIN
|
||||
/* Kludge until we know how to open a non-echo tty channel */
|
||||
|
||||
#define EBCDIC
|
||||
/* In the context of Info-ZIP, a portable "text" mode file implies the use of
|
||||
an ASCII-compatible (ISO 8859-1, or other extended ASCII) code page. */
|
||||
|
||||
#ifdef MORE
|
||||
# undef MORE
|
||||
#endif
|
||||
|
||||
/* Workarounds for missing RTL functionality */
|
||||
#define isatty(t) 1
|
||||
|
||||
#ifdef UNZIP /* definitions for UNZIP */
|
||||
|
||||
#define INBUFSIZ 8192
|
||||
|
||||
#define USE_STRM_INPUT
|
||||
#define USE_FWRITE
|
||||
|
||||
#define PATH_MAX 128
|
||||
|
||||
#ifndef QUERY_TRNEWLN
|
||||
# define QUERY_TRNEWLN /* terminate interaction queries with '\n' */
|
||||
#endif
|
||||
|
||||
#ifndef DATE_FORMAT
|
||||
# define DATE_FORMAT DF_MDY
|
||||
#endif
|
||||
#define lenEOL 1
|
||||
/* The use of "ebcdic[LF]" is not reliable; VM/CMS C/370 uses the
|
||||
* EBCDIC specific "NL" ('NewLine') control character (and not the EBCDIC
|
||||
* equivalent of the ASCII "LF" ('LineFeed')) as line terminator!
|
||||
* To work around this problem, we explicitely emit the C compiler's native
|
||||
* '\n' line terminator.
|
||||
*/
|
||||
#if 0
|
||||
#define PutNativeEOL *q++ = native(LF);
|
||||
#else
|
||||
#define PutNativeEOL *q++ = '\n';
|
||||
#endif
|
||||
|
||||
#endif /* UNZIP */
|
||||
|
||||
#endif /* !__vmmvs_h */
|
57
programs/fs/unzip60/cmsmvs/vmstat.h
Normal file
57
programs/fs/unzip60/cmsmvs/vmstat.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
#ifndef __vmstat_h
|
||||
#define __vmstat_h
|
||||
|
||||
/* stat.h definitions */
|
||||
|
||||
#ifndef _INO_T_DEFINED
|
||||
typedef unsigned short ino_t; /* i-node number (not used on DOS) */
|
||||
#define _INO_T_DEFINED
|
||||
#endif
|
||||
|
||||
#ifndef _DEV_T_DEFINED
|
||||
typedef short dev_t; /* device code */
|
||||
#define _DEV_T_DEFINED
|
||||
#endif
|
||||
|
||||
#ifndef _OFF_T_DEFINED
|
||||
typedef long off_t; /* file offset value */
|
||||
#define _OFF_T_DEFINED
|
||||
#endif
|
||||
|
||||
#ifndef _STAT_DEFINED
|
||||
struct stat {
|
||||
dev_t st_dev;
|
||||
ino_t st_ino;
|
||||
short st_mode;
|
||||
short st_nlink;
|
||||
int st_uid;
|
||||
int st_gid;
|
||||
off_t st_size;
|
||||
time_t st_atime;
|
||||
time_t st_mtime;
|
||||
time_t st_ctime;
|
||||
};
|
||||
#define _STAT_DEFINED
|
||||
#endif
|
||||
|
||||
int stat(const char *path, struct stat *buf);
|
||||
int fstat(int fd, struct stat *buf);
|
||||
|
||||
#define S_IFMT 0xFFFF
|
||||
#define _FLDATA(m) (*(fldata_t *) &m)
|
||||
#define S_ISDIR(m) (_FLDATA(m).__dsorgPDSdir)
|
||||
#define S_ISREG(m) (_FLDATA(m).__dsorgPO | \
|
||||
_FLDATA(m).__dsorgPDSmem | \
|
||||
_FLDATA(m).__dsorgPS)
|
||||
#define S_ISBLK(m) (_FLDATA(m).__recfmBlk)
|
||||
#define S_ISMEM(m) (_FLDATA(m).__dsorgMem)
|
||||
|
||||
#endif /* __vmstat_h */
|
66
programs/fs/unzip60/cmsmvs/zipinfo.exec
Normal file
66
programs/fs/unzip60/cmsmvs/zipinfo.exec
Normal file
@ -0,0 +1,66 @@
|
||||
/***********************************************************************/
|
||||
/* */
|
||||
/* Front-end EXEC to set up linkage to the C runtime libraries */
|
||||
/* before executing a MODULE generated from C code. */
|
||||
/* */
|
||||
/* Copy this file as an EXEC with a filename matching the C MODULE. */
|
||||
/* */
|
||||
/* Greg Hartwig (ghartwig@vnet.ibm.com) 7/31/97, 4/24/98. */
|
||||
/* */
|
||||
/***********************************************************************/
|
||||
Address Command
|
||||
Parse Arg argstring
|
||||
Parse Source . . myname .
|
||||
|
||||
/* Set output and input character translation so brackets show up */
|
||||
'SET OUTPUT AD' 'BA'x
|
||||
'SET OUTPUT BD' 'BB'x
|
||||
'SET INPUT BA AD'
|
||||
'SET INPUT BB BD'
|
||||
|
||||
Call CLIB
|
||||
If rc<>0 Then Do
|
||||
Say 'The required C runtime libraries don''t appear to be available.'
|
||||
Say myname 'can not run.'
|
||||
Exit 12
|
||||
End
|
||||
|
||||
/* Run the command */
|
||||
myname argstring
|
||||
Exit rc
|
||||
|
||||
|
||||
|
||||
|
||||
/* Contents of the CLIB EXEC, modified for RC checking. */
|
||||
/* Removed TXTLIB setting. Only LOADLIB needed for execution. */
|
||||
CLIB:
|
||||
/***************************************************/
|
||||
/* SET UP LIBRARIES FOR LE for MVS & VM */
|
||||
/***************************************************/
|
||||
Address COMMAND
|
||||
|
||||
loadlib ='EDCLINK' /* C/370 runtime */
|
||||
loadlib ='SCEERUN' /* LE runtime */
|
||||
|
||||
|
||||
theirs=queued() /* old stack contentsM068*/
|
||||
'QUERY LOADLIB ( LIFO' /* old setting M068*/
|
||||
LoadlibList='' /* init list M068*/
|
||||
rc=0
|
||||
Do while queued()^=theirs /* all lines from cmdM068*/
|
||||
Parse upper pull 'LOADLIB' '=' Ltemp /* get one line M068*/
|
||||
LoadlibList= Ltemp Loadliblist /* was stacked LIFO M068*/
|
||||
End /*M068*/
|
||||
If loadlibList='NONE' ,
|
||||
Then Do
|
||||
'GLOBAL LOADLIB' Loadlib /* enforce what we need */
|
||||
End
|
||||
Else Do
|
||||
Do xx=1 to Words(loadlib)
|
||||
If Find(loadliblist,word(loadlib,xx)) = 0 ,
|
||||
then loadliblist = loadliblist word(loadlib,xx)
|
||||
End
|
||||
'GLOBAL LOADLIB' loadliblist /* enforce what we need */
|
||||
End
|
||||
Return
|
54
programs/fs/unzip60/consts.h
Normal file
54
programs/fs/unzip60/consts.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright (c) 1990-2001 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
consts.h
|
||||
|
||||
This file contains global, initialized variables that never change. It is
|
||||
included by unzip.c and windll/windll.c.
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/* And'ing with mask_bits[n] masks the lower n bits */
|
||||
ZCONST unsigned near mask_bits[17] = {
|
||||
0x0000,
|
||||
0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
|
||||
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
|
||||
};
|
||||
|
||||
ZCONST char Far VersionDate[] = UZ_VERSION_DATE; /* now defined in unzvers.h */
|
||||
|
||||
#ifndef SFX
|
||||
ZCONST char Far EndSigMsg[] =
|
||||
"\nnote: didn't find end-of-central-dir signature at end of central dir.\n";
|
||||
#endif
|
||||
|
||||
ZCONST char Far CentSigMsg[] =
|
||||
"error: expected central file header signature not found (file #%lu).\n";
|
||||
ZCONST char Far SeekMsg[] =
|
||||
"error [%s]: attempt to seek before beginning of zipfile\n%s";
|
||||
ZCONST char Far FilenameNotMatched[] = "caution: filename not matched: %s\n";
|
||||
ZCONST char Far ExclFilenameNotMatched[] =
|
||||
"caution: excluded filename not matched: %s\n";
|
||||
|
||||
#ifdef VMS
|
||||
ZCONST char Far ReportMsg[] = "\
|
||||
(please check that you have transferred or created the zipfile in the\n\
|
||||
appropriate BINARY mode--this includes ftp, Kermit, AND unzip'd zipfiles)\n";
|
||||
#else
|
||||
ZCONST char Far ReportMsg[] = "\
|
||||
(please check that you have transferred or created the zipfile in the\n\
|
||||
appropriate BINARY mode and that you have compiled UnZip properly)\n";
|
||||
#endif
|
||||
|
||||
#ifndef SFX
|
||||
ZCONST char Far Zipnfo[] = "zipinfo";
|
||||
ZCONST char Far CompiledWith[] = "Compiled with %s%s for %s%s%s%s.\n\n";
|
||||
#endif
|
732
programs/fs/unzip60/crc32.c
Normal file
732
programs/fs/unzip60/crc32.c
Normal file
@ -0,0 +1,732 @@
|
||||
/*
|
||||
Copyright (c) 1990-2007 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, all these files are missing, the Info-ZIP license
|
||||
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
|
||||
*/
|
||||
/* crc32.c -- compute the CRC-32 of a data stream
|
||||
* Copyright (C) 1995 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*
|
||||
* Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
|
||||
* CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
|
||||
* tables for updating the shift register in one step with three exclusive-ors
|
||||
* instead of four steps with four exclusive-ors. This results about a factor
|
||||
* of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
|
||||
*/
|
||||
|
||||
/* $Id: crc32.c,v 2.0 2007/01/07 05:20:36 spc Exp $ */
|
||||
|
||||
#define __CRC32_C /* identifies this source module */
|
||||
|
||||
#include "zip.h"
|
||||
|
||||
#if (!defined(USE_ZLIB) || defined(USE_OWN_CRCTAB))
|
||||
|
||||
#ifndef ZCONST
|
||||
# define ZCONST const
|
||||
#endif
|
||||
|
||||
#include "crc32.h"
|
||||
|
||||
/* When only the table of precomputed CRC values is needed, only the basic
|
||||
system-independent table containing 256 entries is created; any support
|
||||
for "unfolding" optimization is disabled.
|
||||
*/
|
||||
#if (defined(USE_ZLIB) || defined(CRC_TABLE_ONLY))
|
||||
# ifdef IZ_CRCOPTIM_UNFOLDTBL
|
||||
# undef IZ_CRCOPTIM_UNFOLDTBL
|
||||
# endif
|
||||
#endif /* (USE_ZLIB || CRC_TABLE_ONLY) */
|
||||
|
||||
#if defined(IZ_CRCOPTIM_UNFOLDTBL)
|
||||
# define CRC_TBLS 4
|
||||
#else
|
||||
# define CRC_TBLS 1
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
|
||||
x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
|
||||
|
||||
Polynomials over GF(2) are represented in binary, one bit per coefficient,
|
||||
with the lowest powers in the most significant bit. Then adding polynomials
|
||||
is just exclusive-or, and multiplying a polynomial by x is a right shift by
|
||||
one. If we call the above polynomial p, and represent a byte as the
|
||||
polynomial q, also with the lowest power in the most significant bit (so the
|
||||
byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
|
||||
where a mod b means the remainder after dividing a by b.
|
||||
|
||||
This calculation is done using the shift-register method of multiplying and
|
||||
taking the remainder. The register is initialized to zero, and for each
|
||||
incoming bit, x^32 is added mod p to the register if the bit is a one (where
|
||||
x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
|
||||
x (which is shifting right by one and adding x^32 mod p if the bit shifted
|
||||
out is a one). We start with the highest power (least significant bit) of
|
||||
q and repeat for all eight bits of q.
|
||||
|
||||
The first (or only) table is simply the CRC of all possible eight bit values.
|
||||
This is all the information needed to generate CRC's on data a byte-at-a-time
|
||||
for all combinations of CRC register values and incoming bytes.
|
||||
The remaining 3 tables (if IZ_CRCOPTIM_UNFOLDTBL is enabled) allow for
|
||||
word-at-a-time CRC calculation, where a word is four bytes.
|
||||
*/
|
||||
|
||||
#ifdef DYNAMIC_CRC_TABLE
|
||||
|
||||
/* =========================================================================
|
||||
* Make the crc table. This function is needed only if you want to compute
|
||||
* the table dynamically.
|
||||
*/
|
||||
|
||||
local void make_crc_table OF((void));
|
||||
|
||||
#if (defined(DYNALLOC_CRCTAB) && defined(REENTRANT))
|
||||
error: Dynamic allocation of CRC table not safe with reentrant code.
|
||||
#endif /* DYNALLOC_CRCTAB && REENTRANT */
|
||||
|
||||
#ifdef DYNALLOC_CRCTAB
|
||||
local ulg near *crc_table = NULL;
|
||||
# if 0 /* not used, since sizeof("near *") <= sizeof(int) */
|
||||
/* Use this section when access to a "local int" is faster than access to
|
||||
a "local pointer" (e.g.: i86 16bit code with far pointers). */
|
||||
local int crc_table_empty = 1;
|
||||
# define CRC_TABLE_IS_EMPTY (crc_table_empty != 0)
|
||||
# define MARK_CRCTAB_FILLED crc_table_empty = 0
|
||||
# define MARK_CRCTAB_EMPTY crc_table_empty = 1
|
||||
# else
|
||||
/* Use this section on systems where the size of pointers and ints is
|
||||
equal (e.g.: all 32bit systems). */
|
||||
# define CRC_TABLE_IS_EMPTY (crc_table == NULL)
|
||||
# define MARK_CRCTAB_FILLED crc_table = crctab_p
|
||||
# define MARK_CRCTAB_EMPTY crc_table = NULL
|
||||
# endif
|
||||
#else /* !DYNALLOC_CRCTAB */
|
||||
local ulg near crc_table[CRC_TBLS*256];
|
||||
local int crc_table_empty = 1;
|
||||
# define CRC_TABLE_IS_EMPTY (crc_table_empty != 0)
|
||||
# define MARK_CRCTAB_FILLED crc_table_empty = 0
|
||||
#endif /* ?DYNALLOC_CRCTAB */
|
||||
|
||||
|
||||
local void make_crc_table()
|
||||
{
|
||||
ulg c; /* crc shift register */
|
||||
int n; /* counter for all possible eight bit values */
|
||||
int k; /* byte being shifted into crc apparatus */
|
||||
#ifdef DYNALLOC_CRCTAB
|
||||
ulg near *crctab_p; /* temporary pointer to allocated crc_table area */
|
||||
#else /* !DYNALLOC_CRCTAB */
|
||||
# define crctab_p crc_table
|
||||
#endif /* DYNALLOC_CRCTAB */
|
||||
|
||||
#ifdef COMPUTE_XOR_PATTERN
|
||||
/* This piece of code has been left here to explain how the XOR pattern
|
||||
* used in the creation of the crc_table values can be recomputed.
|
||||
* For production versions of this function, it is more efficient to
|
||||
* supply the resultant pattern at compile time.
|
||||
*/
|
||||
ulg xor; /* polynomial exclusive-or pattern */
|
||||
/* terms of polynomial defining this crc (except x^32): */
|
||||
static ZCONST uch p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
|
||||
|
||||
/* make exclusive-or pattern from polynomial (0xedb88320L) */
|
||||
xor = 0L;
|
||||
for (n = 0; n < sizeof(p)/sizeof(uch); n++)
|
||||
xor |= 1L << (31 - p[n]);
|
||||
#else
|
||||
# define xor 0xedb88320L
|
||||
#endif
|
||||
|
||||
#ifdef DYNALLOC_CRCTAB
|
||||
crctab_p = (ulg near *) nearmalloc (CRC_TBLS*256*sizeof(ulg));
|
||||
if (crctab_p == NULL) {
|
||||
ziperr(ZE_MEM, "crc_table allocation");
|
||||
}
|
||||
#endif /* DYNALLOC_CRCTAB */
|
||||
|
||||
/* generate a crc for every 8-bit value */
|
||||
for (n = 0; n < 256; n++) {
|
||||
c = (ulg)n;
|
||||
for (k = 8; k; k--)
|
||||
c = c & 1 ? xor ^ (c >> 1) : c >> 1;
|
||||
crctab_p[n] = REV_BE(c);
|
||||
}
|
||||
|
||||
#ifdef IZ_CRCOPTIM_UNFOLDTBL
|
||||
/* generate crc for each value followed by one, two, and three zeros */
|
||||
for (n = 0; n < 256; n++) {
|
||||
c = crctab_p[n];
|
||||
for (k = 1; k < 4; k++) {
|
||||
c = CRC32(c, 0, crctab_p);
|
||||
crctab_p[k*256+n] = c;
|
||||
}
|
||||
}
|
||||
#endif /* IZ_CRCOPTIM_UNFOLDTBL */
|
||||
|
||||
MARK_CRCTAB_FILLED;
|
||||
}
|
||||
|
||||
#else /* !DYNAMIC_CRC_TABLE */
|
||||
|
||||
#ifdef DYNALLOC_CRCTAB
|
||||
error: Inconsistent flags, DYNALLOC_CRCTAB without DYNAMIC_CRC_TABLE.
|
||||
#endif
|
||||
|
||||
/* ========================================================================
|
||||
* Table of CRC-32's of all single-byte values (made by make_crc_table)
|
||||
*/
|
||||
local ZCONST ulg near crc_table[CRC_TBLS*256] = {
|
||||
# ifdef IZ_CRC_BE_OPTIMIZ
|
||||
0x00000000L, 0x96300777L, 0x2c610eeeL, 0xba510999L, 0x19c46d07L,
|
||||
0x8ff46a70L, 0x35a563e9L, 0xa395649eL, 0x3288db0eL, 0xa4b8dc79L,
|
||||
0x1ee9d5e0L, 0x88d9d297L, 0x2b4cb609L, 0xbd7cb17eL, 0x072db8e7L,
|
||||
0x911dbf90L, 0x6410b71dL, 0xf220b06aL, 0x4871b9f3L, 0xde41be84L,
|
||||
0x7dd4da1aL, 0xebe4dd6dL, 0x51b5d4f4L, 0xc785d383L, 0x56986c13L,
|
||||
0xc0a86b64L, 0x7af962fdL, 0xecc9658aL, 0x4f5c0114L, 0xd96c0663L,
|
||||
0x633d0ffaL, 0xf50d088dL, 0xc8206e3bL, 0x5e10694cL, 0xe44160d5L,
|
||||
0x727167a2L, 0xd1e4033cL, 0x47d4044bL, 0xfd850dd2L, 0x6bb50aa5L,
|
||||
0xfaa8b535L, 0x6c98b242L, 0xd6c9bbdbL, 0x40f9bcacL, 0xe36cd832L,
|
||||
0x755cdf45L, 0xcf0dd6dcL, 0x593dd1abL, 0xac30d926L, 0x3a00de51L,
|
||||
0x8051d7c8L, 0x1661d0bfL, 0xb5f4b421L, 0x23c4b356L, 0x9995bacfL,
|
||||
0x0fa5bdb8L, 0x9eb80228L, 0x0888055fL, 0xb2d90cc6L, 0x24e90bb1L,
|
||||
0x877c6f2fL, 0x114c6858L, 0xab1d61c1L, 0x3d2d66b6L, 0x9041dc76L,
|
||||
0x0671db01L, 0xbc20d298L, 0x2a10d5efL, 0x8985b171L, 0x1fb5b606L,
|
||||
0xa5e4bf9fL, 0x33d4b8e8L, 0xa2c90778L, 0x34f9000fL, 0x8ea80996L,
|
||||
0x18980ee1L, 0xbb0d6a7fL, 0x2d3d6d08L, 0x976c6491L, 0x015c63e6L,
|
||||
0xf4516b6bL, 0x62616c1cL, 0xd8306585L, 0x4e0062f2L, 0xed95066cL,
|
||||
0x7ba5011bL, 0xc1f40882L, 0x57c40ff5L, 0xc6d9b065L, 0x50e9b712L,
|
||||
0xeab8be8bL, 0x7c88b9fcL, 0xdf1ddd62L, 0x492dda15L, 0xf37cd38cL,
|
||||
0x654cd4fbL, 0x5861b24dL, 0xce51b53aL, 0x7400bca3L, 0xe230bbd4L,
|
||||
0x41a5df4aL, 0xd795d83dL, 0x6dc4d1a4L, 0xfbf4d6d3L, 0x6ae96943L,
|
||||
0xfcd96e34L, 0x468867adL, 0xd0b860daL, 0x732d0444L, 0xe51d0333L,
|
||||
0x5f4c0aaaL, 0xc97c0dddL, 0x3c710550L, 0xaa410227L, 0x10100bbeL,
|
||||
0x86200cc9L, 0x25b56857L, 0xb3856f20L, 0x09d466b9L, 0x9fe461ceL,
|
||||
0x0ef9de5eL, 0x98c9d929L, 0x2298d0b0L, 0xb4a8d7c7L, 0x173db359L,
|
||||
0x810db42eL, 0x3b5cbdb7L, 0xad6cbac0L, 0x2083b8edL, 0xb6b3bf9aL,
|
||||
0x0ce2b603L, 0x9ad2b174L, 0x3947d5eaL, 0xaf77d29dL, 0x1526db04L,
|
||||
0x8316dc73L, 0x120b63e3L, 0x843b6494L, 0x3e6a6d0dL, 0xa85a6a7aL,
|
||||
0x0bcf0ee4L, 0x9dff0993L, 0x27ae000aL, 0xb19e077dL, 0x44930ff0L,
|
||||
0xd2a30887L, 0x68f2011eL, 0xfec20669L, 0x5d5762f7L, 0xcb676580L,
|
||||
0x71366c19L, 0xe7066b6eL, 0x761bd4feL, 0xe02bd389L, 0x5a7ada10L,
|
||||
0xcc4add67L, 0x6fdfb9f9L, 0xf9efbe8eL, 0x43beb717L, 0xd58eb060L,
|
||||
0xe8a3d6d6L, 0x7e93d1a1L, 0xc4c2d838L, 0x52f2df4fL, 0xf167bbd1L,
|
||||
0x6757bca6L, 0xdd06b53fL, 0x4b36b248L, 0xda2b0dd8L, 0x4c1b0aafL,
|
||||
0xf64a0336L, 0x607a0441L, 0xc3ef60dfL, 0x55df67a8L, 0xef8e6e31L,
|
||||
0x79be6946L, 0x8cb361cbL, 0x1a8366bcL, 0xa0d26f25L, 0x36e26852L,
|
||||
0x95770cccL, 0x03470bbbL, 0xb9160222L, 0x2f260555L, 0xbe3bbac5L,
|
||||
0x280bbdb2L, 0x925ab42bL, 0x046ab35cL, 0xa7ffd7c2L, 0x31cfd0b5L,
|
||||
0x8b9ed92cL, 0x1daede5bL, 0xb0c2649bL, 0x26f263ecL, 0x9ca36a75L,
|
||||
0x0a936d02L, 0xa906099cL, 0x3f360eebL, 0x85670772L, 0x13570005L,
|
||||
0x824abf95L, 0x147ab8e2L, 0xae2bb17bL, 0x381bb60cL, 0x9b8ed292L,
|
||||
0x0dbed5e5L, 0xb7efdc7cL, 0x21dfdb0bL, 0xd4d2d386L, 0x42e2d4f1L,
|
||||
0xf8b3dd68L, 0x6e83da1fL, 0xcd16be81L, 0x5b26b9f6L, 0xe177b06fL,
|
||||
0x7747b718L, 0xe65a0888L, 0x706a0fffL, 0xca3b0666L, 0x5c0b0111L,
|
||||
0xff9e658fL, 0x69ae62f8L, 0xd3ff6b61L, 0x45cf6c16L, 0x78e20aa0L,
|
||||
0xeed20dd7L, 0x5483044eL, 0xc2b30339L, 0x612667a7L, 0xf71660d0L,
|
||||
0x4d476949L, 0xdb776e3eL, 0x4a6ad1aeL, 0xdc5ad6d9L, 0x660bdf40L,
|
||||
0xf03bd837L, 0x53aebca9L, 0xc59ebbdeL, 0x7fcfb247L, 0xe9ffb530L,
|
||||
0x1cf2bdbdL, 0x8ac2bacaL, 0x3093b353L, 0xa6a3b424L, 0x0536d0baL,
|
||||
0x9306d7cdL, 0x2957de54L, 0xbf67d923L, 0x2e7a66b3L, 0xb84a61c4L,
|
||||
0x021b685dL, 0x942b6f2aL, 0x37be0bb4L, 0xa18e0cc3L, 0x1bdf055aL,
|
||||
0x8def022dL
|
||||
# ifdef IZ_CRCOPTIM_UNFOLDTBL
|
||||
,
|
||||
0x00000000L, 0x41311b19L, 0x82623632L, 0xc3532d2bL, 0x04c56c64L,
|
||||
0x45f4777dL, 0x86a75a56L, 0xc796414fL, 0x088ad9c8L, 0x49bbc2d1L,
|
||||
0x8ae8effaL, 0xcbd9f4e3L, 0x0c4fb5acL, 0x4d7eaeb5L, 0x8e2d839eL,
|
||||
0xcf1c9887L, 0x5112c24aL, 0x1023d953L, 0xd370f478L, 0x9241ef61L,
|
||||
0x55d7ae2eL, 0x14e6b537L, 0xd7b5981cL, 0x96848305L, 0x59981b82L,
|
||||
0x18a9009bL, 0xdbfa2db0L, 0x9acb36a9L, 0x5d5d77e6L, 0x1c6c6cffL,
|
||||
0xdf3f41d4L, 0x9e0e5acdL, 0xa2248495L, 0xe3159f8cL, 0x2046b2a7L,
|
||||
0x6177a9beL, 0xa6e1e8f1L, 0xe7d0f3e8L, 0x2483dec3L, 0x65b2c5daL,
|
||||
0xaaae5d5dL, 0xeb9f4644L, 0x28cc6b6fL, 0x69fd7076L, 0xae6b3139L,
|
||||
0xef5a2a20L, 0x2c09070bL, 0x6d381c12L, 0xf33646dfL, 0xb2075dc6L,
|
||||
0x715470edL, 0x30656bf4L, 0xf7f32abbL, 0xb6c231a2L, 0x75911c89L,
|
||||
0x34a00790L, 0xfbbc9f17L, 0xba8d840eL, 0x79dea925L, 0x38efb23cL,
|
||||
0xff79f373L, 0xbe48e86aL, 0x7d1bc541L, 0x3c2ade58L, 0x054f79f0L,
|
||||
0x447e62e9L, 0x872d4fc2L, 0xc61c54dbL, 0x018a1594L, 0x40bb0e8dL,
|
||||
0x83e823a6L, 0xc2d938bfL, 0x0dc5a038L, 0x4cf4bb21L, 0x8fa7960aL,
|
||||
0xce968d13L, 0x0900cc5cL, 0x4831d745L, 0x8b62fa6eL, 0xca53e177L,
|
||||
0x545dbbbaL, 0x156ca0a3L, 0xd63f8d88L, 0x970e9691L, 0x5098d7deL,
|
||||
0x11a9ccc7L, 0xd2fae1ecL, 0x93cbfaf5L, 0x5cd76272L, 0x1de6796bL,
|
||||
0xdeb55440L, 0x9f844f59L, 0x58120e16L, 0x1923150fL, 0xda703824L,
|
||||
0x9b41233dL, 0xa76bfd65L, 0xe65ae67cL, 0x2509cb57L, 0x6438d04eL,
|
||||
0xa3ae9101L, 0xe29f8a18L, 0x21cca733L, 0x60fdbc2aL, 0xafe124adL,
|
||||
0xeed03fb4L, 0x2d83129fL, 0x6cb20986L, 0xab2448c9L, 0xea1553d0L,
|
||||
0x29467efbL, 0x687765e2L, 0xf6793f2fL, 0xb7482436L, 0x741b091dL,
|
||||
0x352a1204L, 0xf2bc534bL, 0xb38d4852L, 0x70de6579L, 0x31ef7e60L,
|
||||
0xfef3e6e7L, 0xbfc2fdfeL, 0x7c91d0d5L, 0x3da0cbccL, 0xfa368a83L,
|
||||
0xbb07919aL, 0x7854bcb1L, 0x3965a7a8L, 0x4b98833bL, 0x0aa99822L,
|
||||
0xc9fab509L, 0x88cbae10L, 0x4f5def5fL, 0x0e6cf446L, 0xcd3fd96dL,
|
||||
0x8c0ec274L, 0x43125af3L, 0x022341eaL, 0xc1706cc1L, 0x804177d8L,
|
||||
0x47d73697L, 0x06e62d8eL, 0xc5b500a5L, 0x84841bbcL, 0x1a8a4171L,
|
||||
0x5bbb5a68L, 0x98e87743L, 0xd9d96c5aL, 0x1e4f2d15L, 0x5f7e360cL,
|
||||
0x9c2d1b27L, 0xdd1c003eL, 0x120098b9L, 0x533183a0L, 0x9062ae8bL,
|
||||
0xd153b592L, 0x16c5f4ddL, 0x57f4efc4L, 0x94a7c2efL, 0xd596d9f6L,
|
||||
0xe9bc07aeL, 0xa88d1cb7L, 0x6bde319cL, 0x2aef2a85L, 0xed796bcaL,
|
||||
0xac4870d3L, 0x6f1b5df8L, 0x2e2a46e1L, 0xe136de66L, 0xa007c57fL,
|
||||
0x6354e854L, 0x2265f34dL, 0xe5f3b202L, 0xa4c2a91bL, 0x67918430L,
|
||||
0x26a09f29L, 0xb8aec5e4L, 0xf99fdefdL, 0x3accf3d6L, 0x7bfde8cfL,
|
||||
0xbc6ba980L, 0xfd5ab299L, 0x3e099fb2L, 0x7f3884abL, 0xb0241c2cL,
|
||||
0xf1150735L, 0x32462a1eL, 0x73773107L, 0xb4e17048L, 0xf5d06b51L,
|
||||
0x3683467aL, 0x77b25d63L, 0x4ed7facbL, 0x0fe6e1d2L, 0xccb5ccf9L,
|
||||
0x8d84d7e0L, 0x4a1296afL, 0x0b238db6L, 0xc870a09dL, 0x8941bb84L,
|
||||
0x465d2303L, 0x076c381aL, 0xc43f1531L, 0x850e0e28L, 0x42984f67L,
|
||||
0x03a9547eL, 0xc0fa7955L, 0x81cb624cL, 0x1fc53881L, 0x5ef42398L,
|
||||
0x9da70eb3L, 0xdc9615aaL, 0x1b0054e5L, 0x5a314ffcL, 0x996262d7L,
|
||||
0xd85379ceL, 0x174fe149L, 0x567efa50L, 0x952dd77bL, 0xd41ccc62L,
|
||||
0x138a8d2dL, 0x52bb9634L, 0x91e8bb1fL, 0xd0d9a006L, 0xecf37e5eL,
|
||||
0xadc26547L, 0x6e91486cL, 0x2fa05375L, 0xe836123aL, 0xa9070923L,
|
||||
0x6a542408L, 0x2b653f11L, 0xe479a796L, 0xa548bc8fL, 0x661b91a4L,
|
||||
0x272a8abdL, 0xe0bccbf2L, 0xa18dd0ebL, 0x62defdc0L, 0x23efe6d9L,
|
||||
0xbde1bc14L, 0xfcd0a70dL, 0x3f838a26L, 0x7eb2913fL, 0xb924d070L,
|
||||
0xf815cb69L, 0x3b46e642L, 0x7a77fd5bL, 0xb56b65dcL, 0xf45a7ec5L,
|
||||
0x370953eeL, 0x763848f7L, 0xb1ae09b8L, 0xf09f12a1L, 0x33cc3f8aL,
|
||||
0x72fd2493L
|
||||
,
|
||||
0x00000000L, 0x376ac201L, 0x6ed48403L, 0x59be4602L, 0xdca80907L,
|
||||
0xebc2cb06L, 0xb27c8d04L, 0x85164f05L, 0xb851130eL, 0x8f3bd10fL,
|
||||
0xd685970dL, 0xe1ef550cL, 0x64f91a09L, 0x5393d808L, 0x0a2d9e0aL,
|
||||
0x3d475c0bL, 0x70a3261cL, 0x47c9e41dL, 0x1e77a21fL, 0x291d601eL,
|
||||
0xac0b2f1bL, 0x9b61ed1aL, 0xc2dfab18L, 0xf5b56919L, 0xc8f23512L,
|
||||
0xff98f713L, 0xa626b111L, 0x914c7310L, 0x145a3c15L, 0x2330fe14L,
|
||||
0x7a8eb816L, 0x4de47a17L, 0xe0464d38L, 0xd72c8f39L, 0x8e92c93bL,
|
||||
0xb9f80b3aL, 0x3cee443fL, 0x0b84863eL, 0x523ac03cL, 0x6550023dL,
|
||||
0x58175e36L, 0x6f7d9c37L, 0x36c3da35L, 0x01a91834L, 0x84bf5731L,
|
||||
0xb3d59530L, 0xea6bd332L, 0xdd011133L, 0x90e56b24L, 0xa78fa925L,
|
||||
0xfe31ef27L, 0xc95b2d26L, 0x4c4d6223L, 0x7b27a022L, 0x2299e620L,
|
||||
0x15f32421L, 0x28b4782aL, 0x1fdeba2bL, 0x4660fc29L, 0x710a3e28L,
|
||||
0xf41c712dL, 0xc376b32cL, 0x9ac8f52eL, 0xada2372fL, 0xc08d9a70L,
|
||||
0xf7e75871L, 0xae591e73L, 0x9933dc72L, 0x1c259377L, 0x2b4f5176L,
|
||||
0x72f11774L, 0x459bd575L, 0x78dc897eL, 0x4fb64b7fL, 0x16080d7dL,
|
||||
0x2162cf7cL, 0xa4748079L, 0x931e4278L, 0xcaa0047aL, 0xfdcac67bL,
|
||||
0xb02ebc6cL, 0x87447e6dL, 0xdefa386fL, 0xe990fa6eL, 0x6c86b56bL,
|
||||
0x5bec776aL, 0x02523168L, 0x3538f369L, 0x087faf62L, 0x3f156d63L,
|
||||
0x66ab2b61L, 0x51c1e960L, 0xd4d7a665L, 0xe3bd6464L, 0xba032266L,
|
||||
0x8d69e067L, 0x20cbd748L, 0x17a11549L, 0x4e1f534bL, 0x7975914aL,
|
||||
0xfc63de4fL, 0xcb091c4eL, 0x92b75a4cL, 0xa5dd984dL, 0x989ac446L,
|
||||
0xaff00647L, 0xf64e4045L, 0xc1248244L, 0x4432cd41L, 0x73580f40L,
|
||||
0x2ae64942L, 0x1d8c8b43L, 0x5068f154L, 0x67023355L, 0x3ebc7557L,
|
||||
0x09d6b756L, 0x8cc0f853L, 0xbbaa3a52L, 0xe2147c50L, 0xd57ebe51L,
|
||||
0xe839e25aL, 0xdf53205bL, 0x86ed6659L, 0xb187a458L, 0x3491eb5dL,
|
||||
0x03fb295cL, 0x5a456f5eL, 0x6d2fad5fL, 0x801b35e1L, 0xb771f7e0L,
|
||||
0xeecfb1e2L, 0xd9a573e3L, 0x5cb33ce6L, 0x6bd9fee7L, 0x3267b8e5L,
|
||||
0x050d7ae4L, 0x384a26efL, 0x0f20e4eeL, 0x569ea2ecL, 0x61f460edL,
|
||||
0xe4e22fe8L, 0xd388ede9L, 0x8a36abebL, 0xbd5c69eaL, 0xf0b813fdL,
|
||||
0xc7d2d1fcL, 0x9e6c97feL, 0xa90655ffL, 0x2c101afaL, 0x1b7ad8fbL,
|
||||
0x42c49ef9L, 0x75ae5cf8L, 0x48e900f3L, 0x7f83c2f2L, 0x263d84f0L,
|
||||
0x115746f1L, 0x944109f4L, 0xa32bcbf5L, 0xfa958df7L, 0xcdff4ff6L,
|
||||
0x605d78d9L, 0x5737bad8L, 0x0e89fcdaL, 0x39e33edbL, 0xbcf571deL,
|
||||
0x8b9fb3dfL, 0xd221f5ddL, 0xe54b37dcL, 0xd80c6bd7L, 0xef66a9d6L,
|
||||
0xb6d8efd4L, 0x81b22dd5L, 0x04a462d0L, 0x33cea0d1L, 0x6a70e6d3L,
|
||||
0x5d1a24d2L, 0x10fe5ec5L, 0x27949cc4L, 0x7e2adac6L, 0x494018c7L,
|
||||
0xcc5657c2L, 0xfb3c95c3L, 0xa282d3c1L, 0x95e811c0L, 0xa8af4dcbL,
|
||||
0x9fc58fcaL, 0xc67bc9c8L, 0xf1110bc9L, 0x740744ccL, 0x436d86cdL,
|
||||
0x1ad3c0cfL, 0x2db902ceL, 0x4096af91L, 0x77fc6d90L, 0x2e422b92L,
|
||||
0x1928e993L, 0x9c3ea696L, 0xab546497L, 0xf2ea2295L, 0xc580e094L,
|
||||
0xf8c7bc9fL, 0xcfad7e9eL, 0x9613389cL, 0xa179fa9dL, 0x246fb598L,
|
||||
0x13057799L, 0x4abb319bL, 0x7dd1f39aL, 0x3035898dL, 0x075f4b8cL,
|
||||
0x5ee10d8eL, 0x698bcf8fL, 0xec9d808aL, 0xdbf7428bL, 0x82490489L,
|
||||
0xb523c688L, 0x88649a83L, 0xbf0e5882L, 0xe6b01e80L, 0xd1dadc81L,
|
||||
0x54cc9384L, 0x63a65185L, 0x3a181787L, 0x0d72d586L, 0xa0d0e2a9L,
|
||||
0x97ba20a8L, 0xce0466aaL, 0xf96ea4abL, 0x7c78ebaeL, 0x4b1229afL,
|
||||
0x12ac6fadL, 0x25c6adacL, 0x1881f1a7L, 0x2feb33a6L, 0x765575a4L,
|
||||
0x413fb7a5L, 0xc429f8a0L, 0xf3433aa1L, 0xaafd7ca3L, 0x9d97bea2L,
|
||||
0xd073c4b5L, 0xe71906b4L, 0xbea740b6L, 0x89cd82b7L, 0x0cdbcdb2L,
|
||||
0x3bb10fb3L, 0x620f49b1L, 0x55658bb0L, 0x6822d7bbL, 0x5f4815baL,
|
||||
0x06f653b8L, 0x319c91b9L, 0xb48adebcL, 0x83e01cbdL, 0xda5e5abfL,
|
||||
0xed3498beL
|
||||
,
|
||||
0x00000000L, 0x6567bcb8L, 0x8bc809aaL, 0xeeafb512L, 0x5797628fL,
|
||||
0x32f0de37L, 0xdc5f6b25L, 0xb938d79dL, 0xef28b4c5L, 0x8a4f087dL,
|
||||
0x64e0bd6fL, 0x018701d7L, 0xb8bfd64aL, 0xddd86af2L, 0x3377dfe0L,
|
||||
0x56106358L, 0x9f571950L, 0xfa30a5e8L, 0x149f10faL, 0x71f8ac42L,
|
||||
0xc8c07bdfL, 0xada7c767L, 0x43087275L, 0x266fcecdL, 0x707fad95L,
|
||||
0x1518112dL, 0xfbb7a43fL, 0x9ed01887L, 0x27e8cf1aL, 0x428f73a2L,
|
||||
0xac20c6b0L, 0xc9477a08L, 0x3eaf32a0L, 0x5bc88e18L, 0xb5673b0aL,
|
||||
0xd00087b2L, 0x6938502fL, 0x0c5fec97L, 0xe2f05985L, 0x8797e53dL,
|
||||
0xd1878665L, 0xb4e03addL, 0x5a4f8fcfL, 0x3f283377L, 0x8610e4eaL,
|
||||
0xe3775852L, 0x0dd8ed40L, 0x68bf51f8L, 0xa1f82bf0L, 0xc49f9748L,
|
||||
0x2a30225aL, 0x4f579ee2L, 0xf66f497fL, 0x9308f5c7L, 0x7da740d5L,
|
||||
0x18c0fc6dL, 0x4ed09f35L, 0x2bb7238dL, 0xc518969fL, 0xa07f2a27L,
|
||||
0x1947fdbaL, 0x7c204102L, 0x928ff410L, 0xf7e848a8L, 0x3d58149bL,
|
||||
0x583fa823L, 0xb6901d31L, 0xd3f7a189L, 0x6acf7614L, 0x0fa8caacL,
|
||||
0xe1077fbeL, 0x8460c306L, 0xd270a05eL, 0xb7171ce6L, 0x59b8a9f4L,
|
||||
0x3cdf154cL, 0x85e7c2d1L, 0xe0807e69L, 0x0e2fcb7bL, 0x6b4877c3L,
|
||||
0xa20f0dcbL, 0xc768b173L, 0x29c70461L, 0x4ca0b8d9L, 0xf5986f44L,
|
||||
0x90ffd3fcL, 0x7e5066eeL, 0x1b37da56L, 0x4d27b90eL, 0x284005b6L,
|
||||
0xc6efb0a4L, 0xa3880c1cL, 0x1ab0db81L, 0x7fd76739L, 0x9178d22bL,
|
||||
0xf41f6e93L, 0x03f7263bL, 0x66909a83L, 0x883f2f91L, 0xed589329L,
|
||||
0x546044b4L, 0x3107f80cL, 0xdfa84d1eL, 0xbacff1a6L, 0xecdf92feL,
|
||||
0x89b82e46L, 0x67179b54L, 0x027027ecL, 0xbb48f071L, 0xde2f4cc9L,
|
||||
0x3080f9dbL, 0x55e74563L, 0x9ca03f6bL, 0xf9c783d3L, 0x176836c1L,
|
||||
0x720f8a79L, 0xcb375de4L, 0xae50e15cL, 0x40ff544eL, 0x2598e8f6L,
|
||||
0x73888baeL, 0x16ef3716L, 0xf8408204L, 0x9d273ebcL, 0x241fe921L,
|
||||
0x41785599L, 0xafd7e08bL, 0xcab05c33L, 0x3bb659edL, 0x5ed1e555L,
|
||||
0xb07e5047L, 0xd519ecffL, 0x6c213b62L, 0x094687daL, 0xe7e932c8L,
|
||||
0x828e8e70L, 0xd49eed28L, 0xb1f95190L, 0x5f56e482L, 0x3a31583aL,
|
||||
0x83098fa7L, 0xe66e331fL, 0x08c1860dL, 0x6da63ab5L, 0xa4e140bdL,
|
||||
0xc186fc05L, 0x2f294917L, 0x4a4ef5afL, 0xf3762232L, 0x96119e8aL,
|
||||
0x78be2b98L, 0x1dd99720L, 0x4bc9f478L, 0x2eae48c0L, 0xc001fdd2L,
|
||||
0xa566416aL, 0x1c5e96f7L, 0x79392a4fL, 0x97969f5dL, 0xf2f123e5L,
|
||||
0x05196b4dL, 0x607ed7f5L, 0x8ed162e7L, 0xebb6de5fL, 0x528e09c2L,
|
||||
0x37e9b57aL, 0xd9460068L, 0xbc21bcd0L, 0xea31df88L, 0x8f566330L,
|
||||
0x61f9d622L, 0x049e6a9aL, 0xbda6bd07L, 0xd8c101bfL, 0x366eb4adL,
|
||||
0x53090815L, 0x9a4e721dL, 0xff29cea5L, 0x11867bb7L, 0x74e1c70fL,
|
||||
0xcdd91092L, 0xa8beac2aL, 0x46111938L, 0x2376a580L, 0x7566c6d8L,
|
||||
0x10017a60L, 0xfeaecf72L, 0x9bc973caL, 0x22f1a457L, 0x479618efL,
|
||||
0xa939adfdL, 0xcc5e1145L, 0x06ee4d76L, 0x6389f1ceL, 0x8d2644dcL,
|
||||
0xe841f864L, 0x51792ff9L, 0x341e9341L, 0xdab12653L, 0xbfd69aebL,
|
||||
0xe9c6f9b3L, 0x8ca1450bL, 0x620ef019L, 0x07694ca1L, 0xbe519b3cL,
|
||||
0xdb362784L, 0x35999296L, 0x50fe2e2eL, 0x99b95426L, 0xfcdee89eL,
|
||||
0x12715d8cL, 0x7716e134L, 0xce2e36a9L, 0xab498a11L, 0x45e63f03L,
|
||||
0x208183bbL, 0x7691e0e3L, 0x13f65c5bL, 0xfd59e949L, 0x983e55f1L,
|
||||
0x2106826cL, 0x44613ed4L, 0xaace8bc6L, 0xcfa9377eL, 0x38417fd6L,
|
||||
0x5d26c36eL, 0xb389767cL, 0xd6eecac4L, 0x6fd61d59L, 0x0ab1a1e1L,
|
||||
0xe41e14f3L, 0x8179a84bL, 0xd769cb13L, 0xb20e77abL, 0x5ca1c2b9L,
|
||||
0x39c67e01L, 0x80fea99cL, 0xe5991524L, 0x0b36a036L, 0x6e511c8eL,
|
||||
0xa7166686L, 0xc271da3eL, 0x2cde6f2cL, 0x49b9d394L, 0xf0810409L,
|
||||
0x95e6b8b1L, 0x7b490da3L, 0x1e2eb11bL, 0x483ed243L, 0x2d596efbL,
|
||||
0xc3f6dbe9L, 0xa6916751L, 0x1fa9b0ccL, 0x7ace0c74L, 0x9461b966L,
|
||||
0xf10605deL
|
||||
# endif /* IZ_CRCOPTIM_UNFOLDTBL */
|
||||
# else /* !IZ_CRC_BE_OPTIMIZ */
|
||||
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
|
||||
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
|
||||
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
|
||||
0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
|
||||
0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
|
||||
0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
|
||||
0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
|
||||
0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
|
||||
0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
|
||||
0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
|
||||
0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
|
||||
0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
|
||||
0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
|
||||
0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
|
||||
0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
|
||||
0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
|
||||
0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
|
||||
0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
|
||||
0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
|
||||
0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
|
||||
0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
|
||||
0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
|
||||
0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
|
||||
0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
|
||||
0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
|
||||
0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
|
||||
0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
|
||||
0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
|
||||
0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
|
||||
0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
|
||||
0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
|
||||
0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
|
||||
0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
|
||||
0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
|
||||
0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
|
||||
0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
|
||||
0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
|
||||
0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
|
||||
0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
|
||||
0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
|
||||
0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
|
||||
0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
|
||||
0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
|
||||
0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
|
||||
0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
|
||||
0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
|
||||
0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
|
||||
0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
|
||||
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
|
||||
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
|
||||
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
|
||||
0x2d02ef8dL
|
||||
# ifdef IZ_CRCOPTIM_UNFOLDTBL
|
||||
,
|
||||
0x00000000L, 0x191b3141L, 0x32366282L, 0x2b2d53c3L, 0x646cc504L,
|
||||
0x7d77f445L, 0x565aa786L, 0x4f4196c7L, 0xc8d98a08L, 0xd1c2bb49L,
|
||||
0xfaefe88aL, 0xe3f4d9cbL, 0xacb54f0cL, 0xb5ae7e4dL, 0x9e832d8eL,
|
||||
0x87981ccfL, 0x4ac21251L, 0x53d92310L, 0x78f470d3L, 0x61ef4192L,
|
||||
0x2eaed755L, 0x37b5e614L, 0x1c98b5d7L, 0x05838496L, 0x821b9859L,
|
||||
0x9b00a918L, 0xb02dfadbL, 0xa936cb9aL, 0xe6775d5dL, 0xff6c6c1cL,
|
||||
0xd4413fdfL, 0xcd5a0e9eL, 0x958424a2L, 0x8c9f15e3L, 0xa7b24620L,
|
||||
0xbea97761L, 0xf1e8e1a6L, 0xe8f3d0e7L, 0xc3de8324L, 0xdac5b265L,
|
||||
0x5d5daeaaL, 0x44469febL, 0x6f6bcc28L, 0x7670fd69L, 0x39316baeL,
|
||||
0x202a5aefL, 0x0b07092cL, 0x121c386dL, 0xdf4636f3L, 0xc65d07b2L,
|
||||
0xed705471L, 0xf46b6530L, 0xbb2af3f7L, 0xa231c2b6L, 0x891c9175L,
|
||||
0x9007a034L, 0x179fbcfbL, 0x0e848dbaL, 0x25a9de79L, 0x3cb2ef38L,
|
||||
0x73f379ffL, 0x6ae848beL, 0x41c51b7dL, 0x58de2a3cL, 0xf0794f05L,
|
||||
0xe9627e44L, 0xc24f2d87L, 0xdb541cc6L, 0x94158a01L, 0x8d0ebb40L,
|
||||
0xa623e883L, 0xbf38d9c2L, 0x38a0c50dL, 0x21bbf44cL, 0x0a96a78fL,
|
||||
0x138d96ceL, 0x5ccc0009L, 0x45d73148L, 0x6efa628bL, 0x77e153caL,
|
||||
0xbabb5d54L, 0xa3a06c15L, 0x888d3fd6L, 0x91960e97L, 0xded79850L,
|
||||
0xc7cca911L, 0xece1fad2L, 0xf5facb93L, 0x7262d75cL, 0x6b79e61dL,
|
||||
0x4054b5deL, 0x594f849fL, 0x160e1258L, 0x0f152319L, 0x243870daL,
|
||||
0x3d23419bL, 0x65fd6ba7L, 0x7ce65ae6L, 0x57cb0925L, 0x4ed03864L,
|
||||
0x0191aea3L, 0x188a9fe2L, 0x33a7cc21L, 0x2abcfd60L, 0xad24e1afL,
|
||||
0xb43fd0eeL, 0x9f12832dL, 0x8609b26cL, 0xc94824abL, 0xd05315eaL,
|
||||
0xfb7e4629L, 0xe2657768L, 0x2f3f79f6L, 0x362448b7L, 0x1d091b74L,
|
||||
0x04122a35L, 0x4b53bcf2L, 0x52488db3L, 0x7965de70L, 0x607eef31L,
|
||||
0xe7e6f3feL, 0xfefdc2bfL, 0xd5d0917cL, 0xcccba03dL, 0x838a36faL,
|
||||
0x9a9107bbL, 0xb1bc5478L, 0xa8a76539L, 0x3b83984bL, 0x2298a90aL,
|
||||
0x09b5fac9L, 0x10aecb88L, 0x5fef5d4fL, 0x46f46c0eL, 0x6dd93fcdL,
|
||||
0x74c20e8cL, 0xf35a1243L, 0xea412302L, 0xc16c70c1L, 0xd8774180L,
|
||||
0x9736d747L, 0x8e2de606L, 0xa500b5c5L, 0xbc1b8484L, 0x71418a1aL,
|
||||
0x685abb5bL, 0x4377e898L, 0x5a6cd9d9L, 0x152d4f1eL, 0x0c367e5fL,
|
||||
0x271b2d9cL, 0x3e001cddL, 0xb9980012L, 0xa0833153L, 0x8bae6290L,
|
||||
0x92b553d1L, 0xddf4c516L, 0xc4eff457L, 0xefc2a794L, 0xf6d996d5L,
|
||||
0xae07bce9L, 0xb71c8da8L, 0x9c31de6bL, 0x852aef2aL, 0xca6b79edL,
|
||||
0xd37048acL, 0xf85d1b6fL, 0xe1462a2eL, 0x66de36e1L, 0x7fc507a0L,
|
||||
0x54e85463L, 0x4df36522L, 0x02b2f3e5L, 0x1ba9c2a4L, 0x30849167L,
|
||||
0x299fa026L, 0xe4c5aeb8L, 0xfdde9ff9L, 0xd6f3cc3aL, 0xcfe8fd7bL,
|
||||
0x80a96bbcL, 0x99b25afdL, 0xb29f093eL, 0xab84387fL, 0x2c1c24b0L,
|
||||
0x350715f1L, 0x1e2a4632L, 0x07317773L, 0x4870e1b4L, 0x516bd0f5L,
|
||||
0x7a468336L, 0x635db277L, 0xcbfad74eL, 0xd2e1e60fL, 0xf9ccb5ccL,
|
||||
0xe0d7848dL, 0xaf96124aL, 0xb68d230bL, 0x9da070c8L, 0x84bb4189L,
|
||||
0x03235d46L, 0x1a386c07L, 0x31153fc4L, 0x280e0e85L, 0x674f9842L,
|
||||
0x7e54a903L, 0x5579fac0L, 0x4c62cb81L, 0x8138c51fL, 0x9823f45eL,
|
||||
0xb30ea79dL, 0xaa1596dcL, 0xe554001bL, 0xfc4f315aL, 0xd7626299L,
|
||||
0xce7953d8L, 0x49e14f17L, 0x50fa7e56L, 0x7bd72d95L, 0x62cc1cd4L,
|
||||
0x2d8d8a13L, 0x3496bb52L, 0x1fbbe891L, 0x06a0d9d0L, 0x5e7ef3ecL,
|
||||
0x4765c2adL, 0x6c48916eL, 0x7553a02fL, 0x3a1236e8L, 0x230907a9L,
|
||||
0x0824546aL, 0x113f652bL, 0x96a779e4L, 0x8fbc48a5L, 0xa4911b66L,
|
||||
0xbd8a2a27L, 0xf2cbbce0L, 0xebd08da1L, 0xc0fdde62L, 0xd9e6ef23L,
|
||||
0x14bce1bdL, 0x0da7d0fcL, 0x268a833fL, 0x3f91b27eL, 0x70d024b9L,
|
||||
0x69cb15f8L, 0x42e6463bL, 0x5bfd777aL, 0xdc656bb5L, 0xc57e5af4L,
|
||||
0xee530937L, 0xf7483876L, 0xb809aeb1L, 0xa1129ff0L, 0x8a3fcc33L,
|
||||
0x9324fd72L
|
||||
,
|
||||
0x00000000L, 0x01c26a37L, 0x0384d46eL, 0x0246be59L, 0x0709a8dcL,
|
||||
0x06cbc2ebL, 0x048d7cb2L, 0x054f1685L, 0x0e1351b8L, 0x0fd13b8fL,
|
||||
0x0d9785d6L, 0x0c55efe1L, 0x091af964L, 0x08d89353L, 0x0a9e2d0aL,
|
||||
0x0b5c473dL, 0x1c26a370L, 0x1de4c947L, 0x1fa2771eL, 0x1e601d29L,
|
||||
0x1b2f0bacL, 0x1aed619bL, 0x18abdfc2L, 0x1969b5f5L, 0x1235f2c8L,
|
||||
0x13f798ffL, 0x11b126a6L, 0x10734c91L, 0x153c5a14L, 0x14fe3023L,
|
||||
0x16b88e7aL, 0x177ae44dL, 0x384d46e0L, 0x398f2cd7L, 0x3bc9928eL,
|
||||
0x3a0bf8b9L, 0x3f44ee3cL, 0x3e86840bL, 0x3cc03a52L, 0x3d025065L,
|
||||
0x365e1758L, 0x379c7d6fL, 0x35dac336L, 0x3418a901L, 0x3157bf84L,
|
||||
0x3095d5b3L, 0x32d36beaL, 0x331101ddL, 0x246be590L, 0x25a98fa7L,
|
||||
0x27ef31feL, 0x262d5bc9L, 0x23624d4cL, 0x22a0277bL, 0x20e69922L,
|
||||
0x2124f315L, 0x2a78b428L, 0x2bbade1fL, 0x29fc6046L, 0x283e0a71L,
|
||||
0x2d711cf4L, 0x2cb376c3L, 0x2ef5c89aL, 0x2f37a2adL, 0x709a8dc0L,
|
||||
0x7158e7f7L, 0x731e59aeL, 0x72dc3399L, 0x7793251cL, 0x76514f2bL,
|
||||
0x7417f172L, 0x75d59b45L, 0x7e89dc78L, 0x7f4bb64fL, 0x7d0d0816L,
|
||||
0x7ccf6221L, 0x798074a4L, 0x78421e93L, 0x7a04a0caL, 0x7bc6cafdL,
|
||||
0x6cbc2eb0L, 0x6d7e4487L, 0x6f38fadeL, 0x6efa90e9L, 0x6bb5866cL,
|
||||
0x6a77ec5bL, 0x68315202L, 0x69f33835L, 0x62af7f08L, 0x636d153fL,
|
||||
0x612bab66L, 0x60e9c151L, 0x65a6d7d4L, 0x6464bde3L, 0x662203baL,
|
||||
0x67e0698dL, 0x48d7cb20L, 0x4915a117L, 0x4b531f4eL, 0x4a917579L,
|
||||
0x4fde63fcL, 0x4e1c09cbL, 0x4c5ab792L, 0x4d98dda5L, 0x46c49a98L,
|
||||
0x4706f0afL, 0x45404ef6L, 0x448224c1L, 0x41cd3244L, 0x400f5873L,
|
||||
0x4249e62aL, 0x438b8c1dL, 0x54f16850L, 0x55330267L, 0x5775bc3eL,
|
||||
0x56b7d609L, 0x53f8c08cL, 0x523aaabbL, 0x507c14e2L, 0x51be7ed5L,
|
||||
0x5ae239e8L, 0x5b2053dfL, 0x5966ed86L, 0x58a487b1L, 0x5deb9134L,
|
||||
0x5c29fb03L, 0x5e6f455aL, 0x5fad2f6dL, 0xe1351b80L, 0xe0f771b7L,
|
||||
0xe2b1cfeeL, 0xe373a5d9L, 0xe63cb35cL, 0xe7fed96bL, 0xe5b86732L,
|
||||
0xe47a0d05L, 0xef264a38L, 0xeee4200fL, 0xeca29e56L, 0xed60f461L,
|
||||
0xe82fe2e4L, 0xe9ed88d3L, 0xebab368aL, 0xea695cbdL, 0xfd13b8f0L,
|
||||
0xfcd1d2c7L, 0xfe976c9eL, 0xff5506a9L, 0xfa1a102cL, 0xfbd87a1bL,
|
||||
0xf99ec442L, 0xf85cae75L, 0xf300e948L, 0xf2c2837fL, 0xf0843d26L,
|
||||
0xf1465711L, 0xf4094194L, 0xf5cb2ba3L, 0xf78d95faL, 0xf64fffcdL,
|
||||
0xd9785d60L, 0xd8ba3757L, 0xdafc890eL, 0xdb3ee339L, 0xde71f5bcL,
|
||||
0xdfb39f8bL, 0xddf521d2L, 0xdc374be5L, 0xd76b0cd8L, 0xd6a966efL,
|
||||
0xd4efd8b6L, 0xd52db281L, 0xd062a404L, 0xd1a0ce33L, 0xd3e6706aL,
|
||||
0xd2241a5dL, 0xc55efe10L, 0xc49c9427L, 0xc6da2a7eL, 0xc7184049L,
|
||||
0xc25756ccL, 0xc3953cfbL, 0xc1d382a2L, 0xc011e895L, 0xcb4dafa8L,
|
||||
0xca8fc59fL, 0xc8c97bc6L, 0xc90b11f1L, 0xcc440774L, 0xcd866d43L,
|
||||
0xcfc0d31aL, 0xce02b92dL, 0x91af9640L, 0x906dfc77L, 0x922b422eL,
|
||||
0x93e92819L, 0x96a63e9cL, 0x976454abL, 0x9522eaf2L, 0x94e080c5L,
|
||||
0x9fbcc7f8L, 0x9e7eadcfL, 0x9c381396L, 0x9dfa79a1L, 0x98b56f24L,
|
||||
0x99770513L, 0x9b31bb4aL, 0x9af3d17dL, 0x8d893530L, 0x8c4b5f07L,
|
||||
0x8e0de15eL, 0x8fcf8b69L, 0x8a809decL, 0x8b42f7dbL, 0x89044982L,
|
||||
0x88c623b5L, 0x839a6488L, 0x82580ebfL, 0x801eb0e6L, 0x81dcdad1L,
|
||||
0x8493cc54L, 0x8551a663L, 0x8717183aL, 0x86d5720dL, 0xa9e2d0a0L,
|
||||
0xa820ba97L, 0xaa6604ceL, 0xaba46ef9L, 0xaeeb787cL, 0xaf29124bL,
|
||||
0xad6fac12L, 0xacadc625L, 0xa7f18118L, 0xa633eb2fL, 0xa4755576L,
|
||||
0xa5b73f41L, 0xa0f829c4L, 0xa13a43f3L, 0xa37cfdaaL, 0xa2be979dL,
|
||||
0xb5c473d0L, 0xb40619e7L, 0xb640a7beL, 0xb782cd89L, 0xb2cddb0cL,
|
||||
0xb30fb13bL, 0xb1490f62L, 0xb08b6555L, 0xbbd72268L, 0xba15485fL,
|
||||
0xb853f606L, 0xb9919c31L, 0xbcde8ab4L, 0xbd1ce083L, 0xbf5a5edaL,
|
||||
0xbe9834edL
|
||||
,
|
||||
0x00000000L, 0xb8bc6765L, 0xaa09c88bL, 0x12b5afeeL, 0x8f629757L,
|
||||
0x37def032L, 0x256b5fdcL, 0x9dd738b9L, 0xc5b428efL, 0x7d084f8aL,
|
||||
0x6fbde064L, 0xd7018701L, 0x4ad6bfb8L, 0xf26ad8ddL, 0xe0df7733L,
|
||||
0x58631056L, 0x5019579fL, 0xe8a530faL, 0xfa109f14L, 0x42acf871L,
|
||||
0xdf7bc0c8L, 0x67c7a7adL, 0x75720843L, 0xcdce6f26L, 0x95ad7f70L,
|
||||
0x2d111815L, 0x3fa4b7fbL, 0x8718d09eL, 0x1acfe827L, 0xa2738f42L,
|
||||
0xb0c620acL, 0x087a47c9L, 0xa032af3eL, 0x188ec85bL, 0x0a3b67b5L,
|
||||
0xb28700d0L, 0x2f503869L, 0x97ec5f0cL, 0x8559f0e2L, 0x3de59787L,
|
||||
0x658687d1L, 0xdd3ae0b4L, 0xcf8f4f5aL, 0x7733283fL, 0xeae41086L,
|
||||
0x525877e3L, 0x40edd80dL, 0xf851bf68L, 0xf02bf8a1L, 0x48979fc4L,
|
||||
0x5a22302aL, 0xe29e574fL, 0x7f496ff6L, 0xc7f50893L, 0xd540a77dL,
|
||||
0x6dfcc018L, 0x359fd04eL, 0x8d23b72bL, 0x9f9618c5L, 0x272a7fa0L,
|
||||
0xbafd4719L, 0x0241207cL, 0x10f48f92L, 0xa848e8f7L, 0x9b14583dL,
|
||||
0x23a83f58L, 0x311d90b6L, 0x89a1f7d3L, 0x1476cf6aL, 0xaccaa80fL,
|
||||
0xbe7f07e1L, 0x06c36084L, 0x5ea070d2L, 0xe61c17b7L, 0xf4a9b859L,
|
||||
0x4c15df3cL, 0xd1c2e785L, 0x697e80e0L, 0x7bcb2f0eL, 0xc377486bL,
|
||||
0xcb0d0fa2L, 0x73b168c7L, 0x6104c729L, 0xd9b8a04cL, 0x446f98f5L,
|
||||
0xfcd3ff90L, 0xee66507eL, 0x56da371bL, 0x0eb9274dL, 0xb6054028L,
|
||||
0xa4b0efc6L, 0x1c0c88a3L, 0x81dbb01aL, 0x3967d77fL, 0x2bd27891L,
|
||||
0x936e1ff4L, 0x3b26f703L, 0x839a9066L, 0x912f3f88L, 0x299358edL,
|
||||
0xb4446054L, 0x0cf80731L, 0x1e4da8dfL, 0xa6f1cfbaL, 0xfe92dfecL,
|
||||
0x462eb889L, 0x549b1767L, 0xec277002L, 0x71f048bbL, 0xc94c2fdeL,
|
||||
0xdbf98030L, 0x6345e755L, 0x6b3fa09cL, 0xd383c7f9L, 0xc1366817L,
|
||||
0x798a0f72L, 0xe45d37cbL, 0x5ce150aeL, 0x4e54ff40L, 0xf6e89825L,
|
||||
0xae8b8873L, 0x1637ef16L, 0x048240f8L, 0xbc3e279dL, 0x21e91f24L,
|
||||
0x99557841L, 0x8be0d7afL, 0x335cb0caL, 0xed59b63bL, 0x55e5d15eL,
|
||||
0x47507eb0L, 0xffec19d5L, 0x623b216cL, 0xda874609L, 0xc832e9e7L,
|
||||
0x708e8e82L, 0x28ed9ed4L, 0x9051f9b1L, 0x82e4565fL, 0x3a58313aL,
|
||||
0xa78f0983L, 0x1f336ee6L, 0x0d86c108L, 0xb53aa66dL, 0xbd40e1a4L,
|
||||
0x05fc86c1L, 0x1749292fL, 0xaff54e4aL, 0x322276f3L, 0x8a9e1196L,
|
||||
0x982bbe78L, 0x2097d91dL, 0x78f4c94bL, 0xc048ae2eL, 0xd2fd01c0L,
|
||||
0x6a4166a5L, 0xf7965e1cL, 0x4f2a3979L, 0x5d9f9697L, 0xe523f1f2L,
|
||||
0x4d6b1905L, 0xf5d77e60L, 0xe762d18eL, 0x5fdeb6ebL, 0xc2098e52L,
|
||||
0x7ab5e937L, 0x680046d9L, 0xd0bc21bcL, 0x88df31eaL, 0x3063568fL,
|
||||
0x22d6f961L, 0x9a6a9e04L, 0x07bda6bdL, 0xbf01c1d8L, 0xadb46e36L,
|
||||
0x15080953L, 0x1d724e9aL, 0xa5ce29ffL, 0xb77b8611L, 0x0fc7e174L,
|
||||
0x9210d9cdL, 0x2aacbea8L, 0x38191146L, 0x80a57623L, 0xd8c66675L,
|
||||
0x607a0110L, 0x72cfaefeL, 0xca73c99bL, 0x57a4f122L, 0xef189647L,
|
||||
0xfdad39a9L, 0x45115eccL, 0x764dee06L, 0xcef18963L, 0xdc44268dL,
|
||||
0x64f841e8L, 0xf92f7951L, 0x41931e34L, 0x5326b1daL, 0xeb9ad6bfL,
|
||||
0xb3f9c6e9L, 0x0b45a18cL, 0x19f00e62L, 0xa14c6907L, 0x3c9b51beL,
|
||||
0x842736dbL, 0x96929935L, 0x2e2efe50L, 0x2654b999L, 0x9ee8defcL,
|
||||
0x8c5d7112L, 0x34e11677L, 0xa9362eceL, 0x118a49abL, 0x033fe645L,
|
||||
0xbb838120L, 0xe3e09176L, 0x5b5cf613L, 0x49e959fdL, 0xf1553e98L,
|
||||
0x6c820621L, 0xd43e6144L, 0xc68bceaaL, 0x7e37a9cfL, 0xd67f4138L,
|
||||
0x6ec3265dL, 0x7c7689b3L, 0xc4caeed6L, 0x591dd66fL, 0xe1a1b10aL,
|
||||
0xf3141ee4L, 0x4ba87981L, 0x13cb69d7L, 0xab770eb2L, 0xb9c2a15cL,
|
||||
0x017ec639L, 0x9ca9fe80L, 0x241599e5L, 0x36a0360bL, 0x8e1c516eL,
|
||||
0x866616a7L, 0x3eda71c2L, 0x2c6fde2cL, 0x94d3b949L, 0x090481f0L,
|
||||
0xb1b8e695L, 0xa30d497bL, 0x1bb12e1eL, 0x43d23e48L, 0xfb6e592dL,
|
||||
0xe9dbf6c3L, 0x516791a6L, 0xccb0a91fL, 0x740cce7aL, 0x66b96194L,
|
||||
0xde0506f1L
|
||||
# endif /* IZ_CRCOPTIM_UNFOLDTBL */
|
||||
# endif /* ? IZ_CRC_BE_OPTIMIZ */
|
||||
};
|
||||
#endif /* ?DYNAMIC_CRC_TABLE */
|
||||
|
||||
/* use "OF((void))" here to work around a Borland TC++ 1.0 problem */
|
||||
#ifdef USE_ZLIB
|
||||
ZCONST uLongf *get_crc_table OF((void))
|
||||
#else
|
||||
ZCONST ulg near *get_crc_table OF((void))
|
||||
#endif
|
||||
{
|
||||
#ifdef DYNAMIC_CRC_TABLE
|
||||
if (CRC_TABLE_IS_EMPTY)
|
||||
make_crc_table();
|
||||
#endif
|
||||
#ifdef USE_ZLIB
|
||||
return (ZCONST uLongf *)crc_table;
|
||||
#else
|
||||
return crc_table;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DYNALLOC_CRCTAB
|
||||
void free_crc_table()
|
||||
{
|
||||
if (!CRC_TABLE_IS_EMPTY)
|
||||
{
|
||||
nearfree((ulg near *)crc_table);
|
||||
MARK_CRCTAB_EMPTY;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef USE_ZLIB
|
||||
#ifndef CRC_TABLE_ONLY
|
||||
#ifndef ASM_CRC
|
||||
|
||||
#define DO1(crc, buf) crc = CRC32(crc, *buf++, crc_32_tab)
|
||||
#define DO2(crc, buf) DO1(crc, buf); DO1(crc, buf)
|
||||
#define DO4(crc, buf) DO2(crc, buf); DO2(crc, buf)
|
||||
#define DO8(crc, buf) DO4(crc, buf); DO4(crc, buf)
|
||||
|
||||
#if (defined(IZ_CRC_BE_OPTIMIZ) || defined(IZ_CRC_LE_OPTIMIZ))
|
||||
|
||||
# ifdef IZ_CRCOPTIM_UNFOLDTBL
|
||||
# ifdef IZ_CRC_BE_OPTIMIZ
|
||||
# define DO_OPT4(c, buf4) c ^= *(buf4)++; \
|
||||
c = crc_32_tab[c & 0xff] ^ crc_32_tab[256+((c>>8) & 0xff)] ^ \
|
||||
crc_32_tab[2*256+((c>>16) & 0xff)] ^ crc_32_tab[3*256+(c>>24)]
|
||||
# else /* !IZ_CRC_BE_OPTIMIZ */
|
||||
# define DO_OPT4(c, buf4) c ^= *(buf4)++; \
|
||||
c = crc_32_tab[3*256+(c & 0xff)] ^ crc_32_tab[2*256+((c>>8) & 0xff)] \
|
||||
^ crc_32_tab[256+((c>>16) & 0xff)] ^ crc_32_tab[c>>24]
|
||||
# endif /* ?IZ_CRC_BE_OPTIMIZ */
|
||||
# else /* !IZ_CRCOPTIM_UNFOLDTBL */
|
||||
# define DO_OPT4(c, buf4) c ^= *(buf4)++; \
|
||||
c = CRC32UPD(c, crc_32_tab); \
|
||||
c = CRC32UPD(c, crc_32_tab); \
|
||||
c = CRC32UPD(c, crc_32_tab); \
|
||||
c = CRC32UPD(c, crc_32_tab)
|
||||
# endif /* ?IZ_CRCOPTIM_UNFOLDTBL */
|
||||
|
||||
# define DO_OPT16(crc, buf4) DO_OPT4(crc, buf4); DO_OPT4(crc, buf4); \
|
||||
DO_OPT4(crc, buf4); DO_OPT4(crc, buf4);
|
||||
|
||||
#endif /* (IZ_CRC_BE_OPTIMIZ || IZ_CRC_LE_OPTIMIZ) */
|
||||
|
||||
|
||||
/* ========================================================================= */
|
||||
ulg crc32(crc, buf, len)
|
||||
ulg crc; /* crc shift register */
|
||||
register ZCONST uch *buf; /* pointer to bytes to pump through */
|
||||
extent len; /* number of bytes in buf[] */
|
||||
/* Run a set of bytes through the crc shift register. If buf is a NULL
|
||||
pointer, then initialize the crc shift register contents instead.
|
||||
Return the current crc in either case. */
|
||||
{
|
||||
register z_uint4 c;
|
||||
register ZCONST ulg near *crc_32_tab;
|
||||
|
||||
if (buf == NULL) return 0L;
|
||||
|
||||
crc_32_tab = get_crc_table();
|
||||
|
||||
c = (REV_BE((z_uint4)crc) ^ 0xffffffffL);
|
||||
|
||||
#if (defined(IZ_CRC_BE_OPTIMIZ) || defined(IZ_CRC_LE_OPTIMIZ))
|
||||
/* Align buf pointer to next DWORD boundary. */
|
||||
while (len && ((ptrdiff_t)buf & 3)) {
|
||||
DO1(c, buf);
|
||||
len--;
|
||||
}
|
||||
{
|
||||
ZCONST z_uint4 *buf4 = (ZCONST z_uint4 *)buf;
|
||||
while (len >= 16) {
|
||||
DO_OPT16(c, buf4);
|
||||
len -= 16;
|
||||
}
|
||||
while (len >= 4) {
|
||||
DO_OPT4(c, buf4);
|
||||
len -= 4;
|
||||
}
|
||||
buf = (ZCONST uch *)buf4;
|
||||
}
|
||||
#else /* !(IZ_CRC_BE_OPTIMIZ || IZ_CRC_LE_OPTIMIZ) */
|
||||
#ifndef NO_UNROLLED_LOOPS
|
||||
while (len >= 8) {
|
||||
DO8(c, buf);
|
||||
len -= 8;
|
||||
}
|
||||
#endif /* !NO_UNROLLED_LOOPS */
|
||||
#endif /* ?(IZ_CRC_BE_OPTIMIZ || IZ_CRC_LE_OPTIMIZ) */
|
||||
if (len) do {
|
||||
DO1(c, buf);
|
||||
} while (--len);
|
||||
|
||||
return REV_BE(c) ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */
|
||||
}
|
||||
#endif /* !ASM_CRC */
|
||||
#endif /* !CRC_TABLE_ONLY */
|
||||
#endif /* !USE_ZLIB */
|
||||
#endif /* !USE_ZLIB || USE_OWN_CRCTAB */
|
60
programs/fs/unzip60/crc32.h
Normal file
60
programs/fs/unzip60/crc32.h
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright (c) 1990-2008 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
|
||||
*/
|
||||
/* crc32.h -- compute the CRC-32 of a data stream
|
||||
* Copyright (C) 1995 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
#ifndef __crc32_h
|
||||
#define __crc32_h /* identifies this source module */
|
||||
|
||||
/* This header should be read AFTER zip.h resp. unzip.h
|
||||
* (the latter with UNZIP_INTERNAL defined...).
|
||||
*/
|
||||
|
||||
#ifndef OF
|
||||
# define OF(a) a
|
||||
#endif
|
||||
#ifndef ZCONST
|
||||
# define ZCONST const
|
||||
#endif
|
||||
|
||||
#ifdef DYNALLOC_CRCTAB
|
||||
void free_crc_table OF((void));
|
||||
#endif
|
||||
#ifndef USE_ZLIB
|
||||
ZCONST ulg near *get_crc_table OF((void));
|
||||
#endif
|
||||
#if (defined(USE_ZLIB) || defined(CRC_TABLE_ONLY))
|
||||
# ifdef IZ_CRC_BE_OPTIMIZ
|
||||
# undef IZ_CRC_BE_OPTIMIZ
|
||||
# endif
|
||||
#else /* !(USE_ZLIB || CRC_TABLE_ONLY) */
|
||||
ulg crc32 OF((ulg crc, ZCONST uch *buf, extent len));
|
||||
#endif /* ?(USE_ZLIB || CRC_TABLE_ONLY) */
|
||||
|
||||
#ifndef CRC_32_TAB
|
||||
# define CRC_32_TAB crc_32_tab
|
||||
#endif
|
||||
|
||||
#ifdef CRC32
|
||||
# undef CRC32
|
||||
#endif
|
||||
#ifdef IZ_CRC_BE_OPTIMIZ
|
||||
# define CRC32UPD(c, crctab) (crctab[((c) >> 24)] ^ ((c) << 8))
|
||||
# define CRC32(c, b, crctab) (crctab[(((int)(c) >> 24) ^ (b))] ^ ((c) << 8))
|
||||
# define REV_BE(w) (((w)>>24)+(((w)>>8)&0xff00)+ \
|
||||
(((w)&0xff00)<<8)+(((w)&0xff)<<24))
|
||||
#else
|
||||
# define CRC32UPD(c, crctab) (crctab[((int)(c)) & 0xff] ^ ((c) >> 8))
|
||||
# define CRC32(c, b, crctab) (crctab[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8))
|
||||
# define REV_BE(w) w
|
||||
#endif
|
||||
|
||||
#endif /* !__crc32_h */
|
304
programs/fs/unzip60/crc_i386.S
Normal file
304
programs/fs/unzip60/crc_i386.S
Normal file
@ -0,0 +1,304 @@
|
||||
/*
|
||||
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 */
|
653
programs/fs/unzip60/crypt.c
Normal file
653
programs/fs/unzip60/crypt.c
Normal file
@ -0,0 +1,653 @@
|
||||
/*
|
||||
Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2005-Feb-10 or later
|
||||
(the contents of which are also included in (un)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
|
||||
*/
|
||||
/*
|
||||
crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h]
|
||||
|
||||
The main encryption/decryption source code for Info-Zip software was
|
||||
originally written in Europe. To the best of our knowledge, it can
|
||||
be freely distributed in both source and object forms from any country,
|
||||
including the USA under License Exception TSU of the U.S. Export
|
||||
Administration Regulations (section 740.13(e)) of 6 June 2002.
|
||||
|
||||
NOTE on copyright history:
|
||||
Previous versions of this source package (up to version 2.8) were
|
||||
not copyrighted and put in the public domain. If you cannot comply
|
||||
with the Info-Zip LICENSE, you may want to look for one of those
|
||||
public domain versions.
|
||||
*/
|
||||
|
||||
/*
|
||||
This encryption code is a direct transcription of the algorithm from
|
||||
Roger Schlafly, described by Phil Katz in the file appnote.txt. This
|
||||
file (appnote.txt) is distributed with the PKZIP program (even in the
|
||||
version without encryption capabilities).
|
||||
*/
|
||||
|
||||
#define ZCRYPT_INTERNAL
|
||||
#include "zip.h"
|
||||
#include "crypt.h"
|
||||
#include "ttyio.h"
|
||||
|
||||
#if CRYPT
|
||||
|
||||
#ifndef FALSE
|
||||
# define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifdef ZIP
|
||||
/* For the encoding task used in Zip (and ZipCloak), we want to initialize
|
||||
the crypt algorithm with some reasonably unpredictable bytes, see
|
||||
the crypthead() function. The standard rand() library function is
|
||||
used to supply these `random' bytes, which in turn is initialized by
|
||||
a srand() call. The srand() function takes an "unsigned" (at least 16bit)
|
||||
seed value as argument to determine the starting point of the rand()
|
||||
pseudo-random number generator.
|
||||
This seed number is constructed as "Seed = Seed1 .XOR. Seed2" with
|
||||
Seed1 supplied by the current time (= "(unsigned)time()") and Seed2
|
||||
as some (hopefully) nondeterministic bitmask. On many (most) systems,
|
||||
we use some "process specific" number, as the PID or something similar,
|
||||
but when nothing unpredictable is available, a fixed number may be
|
||||
sufficient.
|
||||
NOTE:
|
||||
1.) This implementation requires the availability of the following
|
||||
standard UNIX C runtime library functions: time(), rand(), srand().
|
||||
On systems where some of them are missing, the environment that
|
||||
incorporates the crypt routines must supply suitable replacement
|
||||
functions.
|
||||
2.) It is a very bad idea to use a second call to time() to set the
|
||||
"Seed2" number! In this case, both "Seed1" and "Seed2" would be
|
||||
(almost) identical, resulting in a (mostly) "zero" constant seed
|
||||
number passed to srand().
|
||||
|
||||
The implementation environment defined in the "zip.h" header should
|
||||
supply a reasonable definition for ZCR_SEED2 (an unsigned number; for
|
||||
most implementations of rand() and srand(), only the lower 16 bits are
|
||||
significant!). An example that works on many systems would be
|
||||
"#define ZCR_SEED2 (unsigned)getpid()".
|
||||
The default definition for ZCR_SEED2 supplied below should be regarded
|
||||
as a fallback to allow successful compilation in "beta state"
|
||||
environments.
|
||||
*/
|
||||
# include <time.h> /* time() function supplies first part of crypt seed */
|
||||
/* "last resort" source for second part of crypt seed pattern */
|
||||
# ifndef ZCR_SEED2
|
||||
# define ZCR_SEED2 (unsigned)3141592654L /* use PI as default pattern */
|
||||
# endif
|
||||
# ifdef GLOBAL /* used in Amiga system headers, maybe others too */
|
||||
# undef GLOBAL
|
||||
# endif
|
||||
# define GLOBAL(g) g
|
||||
#else /* !ZIP */
|
||||
# define GLOBAL(g) G.g
|
||||
#endif /* ?ZIP */
|
||||
|
||||
|
||||
#ifdef UNZIP
|
||||
/* char *key = (char *)NULL; moved to globals.h */
|
||||
# ifndef FUNZIP
|
||||
local int testp OF((__GPRO__ ZCONST uch *h));
|
||||
local int testkey OF((__GPRO__ ZCONST uch *h, ZCONST char *key));
|
||||
# endif
|
||||
#endif /* UNZIP */
|
||||
|
||||
#ifndef UNZIP /* moved to globals.h for UnZip */
|
||||
# ifndef Z_UINT4_DEFINED
|
||||
# if !defined(NO_LIMITS_H)
|
||||
# if (defined(UINT_MAX) && (UINT_MAX == 0xffffffffUL))
|
||||
typedef unsigned int z_uint4;
|
||||
# define Z_UINT4_DEFINED
|
||||
# else
|
||||
# if (defined(ULONG_MAX) && (ULONG_MAX == 0xffffffffUL))
|
||||
typedef unsigned long z_uint4;
|
||||
# define Z_UINT4_DEFINED
|
||||
# else
|
||||
# if (defined(USHRT_MAX) && (USHRT_MAX == 0xffffffffUL))
|
||||
typedef unsigned short z_uint4;
|
||||
# define Z_UINT4_DEFINED
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif /* !NO_LIMITS_H */
|
||||
# endif /* !Z_UINT4_DEFINED */
|
||||
# ifndef Z_UINT4_DEFINED
|
||||
typedef ulg z_uint4;
|
||||
# define Z_UINT4_DEFINED
|
||||
# endif
|
||||
local z_uint4 keys[3]; /* keys defining the pseudo-random sequence */
|
||||
#endif /* !UNZIP */
|
||||
|
||||
#ifndef Trace
|
||||
# ifdef CRYPT_DEBUG
|
||||
# define Trace(x) fprintf x
|
||||
# else
|
||||
# define Trace(x)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "crc32.h"
|
||||
|
||||
#ifdef IZ_CRC_BE_OPTIMIZ
|
||||
local z_uint4 near crycrctab[256];
|
||||
local z_uint4 near *cry_crctb_p = NULL;
|
||||
local z_uint4 near *crytab_init OF((__GPRO));
|
||||
# define CRY_CRC_TAB cry_crctb_p
|
||||
# undef CRC32
|
||||
# define CRC32(c, b, crctab) (crctab[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8))
|
||||
#else
|
||||
# define CRY_CRC_TAB CRC_32_TAB
|
||||
#endif /* ?IZ_CRC_BE_OPTIMIZ */
|
||||
|
||||
/***********************************************************************
|
||||
* Return the next byte in the pseudo-random sequence
|
||||
*/
|
||||
int decrypt_byte(__G)
|
||||
__GDEF
|
||||
{
|
||||
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
|
||||
* unpredictable manner on 16-bit systems; not a problem
|
||||
* with any known compiler so far, though */
|
||||
|
||||
temp = ((unsigned)GLOBAL(keys[2]) & 0xffff) | 2;
|
||||
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Update the encryption keys with the next byte of plain text
|
||||
*/
|
||||
int update_keys(__G__ c)
|
||||
__GDEF
|
||||
int c; /* byte of plain text */
|
||||
{
|
||||
GLOBAL(keys[0]) = CRC32(GLOBAL(keys[0]), c, CRY_CRC_TAB);
|
||||
GLOBAL(keys[1]) = (GLOBAL(keys[1])
|
||||
+ (GLOBAL(keys[0]) & 0xff))
|
||||
* 134775813L + 1;
|
||||
{
|
||||
register int keyshift = (int)(GLOBAL(keys[1]) >> 24);
|
||||
GLOBAL(keys[2]) = CRC32(GLOBAL(keys[2]), keyshift, CRY_CRC_TAB);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* Initialize the encryption keys and the random header according to
|
||||
* the given password.
|
||||
*/
|
||||
void init_keys(__G__ passwd)
|
||||
__GDEF
|
||||
ZCONST char *passwd; /* password string with which to modify keys */
|
||||
{
|
||||
#ifdef IZ_CRC_BE_OPTIMIZ
|
||||
if (cry_crctb_p == NULL) {
|
||||
cry_crctb_p = crytab_init(__G);
|
||||
}
|
||||
#endif
|
||||
GLOBAL(keys[0]) = 305419896L;
|
||||
GLOBAL(keys[1]) = 591751049L;
|
||||
GLOBAL(keys[2]) = 878082192L;
|
||||
while (*passwd != '\0') {
|
||||
update_keys(__G__ (int)*passwd);
|
||||
passwd++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* Initialize the local copy of the table of precomputed crc32 values.
|
||||
* Whereas the public crc32-table is optimized for crc32 calculations
|
||||
* on arrays of bytes, the crypt code needs the crc32 values in an
|
||||
* byte-order-independent form as 32-bit unsigned numbers. On systems
|
||||
* with Big-Endian byte order using the optimized crc32 code, this
|
||||
* requires inverting the byte-order of the values in the
|
||||
* crypt-crc32-table.
|
||||
*/
|
||||
#ifdef IZ_CRC_BE_OPTIMIZ
|
||||
local z_uint4 near *crytab_init(__G)
|
||||
__GDEF
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
crycrctab[i] = REV_BE(CRC_32_TAB[i]);
|
||||
}
|
||||
return crycrctab;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ZIP
|
||||
|
||||
/***********************************************************************
|
||||
* Write encryption header to file zfile using the password passwd
|
||||
* and the cyclic redundancy check crc.
|
||||
*/
|
||||
void crypthead(passwd, crc, zfile)
|
||||
ZCONST char *passwd; /* password string */
|
||||
ulg crc; /* crc of file being encrypted */
|
||||
FILE *zfile; /* where to write header */
|
||||
{
|
||||
int n; /* index in random header */
|
||||
int t; /* temporary */
|
||||
int c; /* random byte */
|
||||
uch header[RAND_HEAD_LEN]; /* random header */
|
||||
static unsigned calls = 0; /* ensure different random header each time */
|
||||
|
||||
/* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
|
||||
* output of rand() to get less predictability, since rand() is
|
||||
* often poorly implemented.
|
||||
*/
|
||||
if (++calls == 1) {
|
||||
srand((unsigned)time(NULL) ^ ZCR_SEED2);
|
||||
}
|
||||
init_keys(passwd);
|
||||
for (n = 0; n < RAND_HEAD_LEN-2; n++) {
|
||||
c = (rand() >> 7) & 0xff;
|
||||
header[n] = (uch)zencode(c, t);
|
||||
}
|
||||
/* Encrypt random header (last two bytes is high word of crc) */
|
||||
init_keys(passwd);
|
||||
for (n = 0; n < RAND_HEAD_LEN-2; n++) {
|
||||
header[n] = (uch)zencode(header[n], t);
|
||||
}
|
||||
header[RAND_HEAD_LEN-2] = (uch)zencode((int)(crc >> 16) & 0xff, t);
|
||||
header[RAND_HEAD_LEN-1] = (uch)zencode((int)(crc >> 24) & 0xff, t);
|
||||
fwrite(header, 1, RAND_HEAD_LEN, f);
|
||||
}
|
||||
|
||||
|
||||
#ifdef UTIL
|
||||
|
||||
/***********************************************************************
|
||||
* Encrypt the zip entry described by z from file source to file dest
|
||||
* using the password passwd. Return an error code in the ZE_ class.
|
||||
*/
|
||||
int zipcloak(z, source, dest, passwd)
|
||||
struct zlist far *z; /* zip entry to encrypt */
|
||||
FILE *source, *dest; /* source and destination files */
|
||||
ZCONST char *passwd; /* password string */
|
||||
{
|
||||
int c; /* input byte */
|
||||
int res; /* result code */
|
||||
ulg n; /* holds offset and counts size */
|
||||
ush flag; /* previous flags */
|
||||
int t; /* temporary */
|
||||
int ztemp; /* temporary storage for zencode value */
|
||||
|
||||
/* Set encrypted bit, clear extended local header bit and write local
|
||||
header to output file */
|
||||
if ((n = (ulg)ftell(dest)) == (ulg)-1L) return ZE_TEMP;
|
||||
z->off = n;
|
||||
flag = z->flg;
|
||||
z->flg |= 1, z->flg &= ~8;
|
||||
z->lflg |= 1, z->lflg &= ~8;
|
||||
z->siz += RAND_HEAD_LEN;
|
||||
if ((res = putlocal(z, dest)) != ZE_OK) return res;
|
||||
|
||||
/* Initialize keys with password and write random header */
|
||||
crypthead(passwd, z->crc, dest);
|
||||
|
||||
/* Skip local header in input file */
|
||||
if (fseek(source, (long)((4 + LOCHEAD) + (ulg)z->nam + (ulg)z->ext),
|
||||
SEEK_CUR)) {
|
||||
return ferror(source) ? ZE_READ : ZE_EOF;
|
||||
}
|
||||
|
||||
/* Encrypt data */
|
||||
for (n = z->siz - RAND_HEAD_LEN; n; n--) {
|
||||
if ((c = getc(source)) == EOF) {
|
||||
return ferror(source) ? ZE_READ : ZE_EOF;
|
||||
}
|
||||
ztemp = zencode(c, t);
|
||||
putc(ztemp, dest);
|
||||
}
|
||||
/* Skip extended local header in input file if there is one */
|
||||
if ((flag & 8) != 0 && fseek(source, 16L, SEEK_CUR)) {
|
||||
return ferror(source) ? ZE_READ : ZE_EOF;
|
||||
}
|
||||
if (fflush(dest) == EOF) return ZE_TEMP;
|
||||
|
||||
/* Update number of bytes written to output file */
|
||||
tempzn += (4 + LOCHEAD) + z->nam + z->ext + z->siz;
|
||||
|
||||
return ZE_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Decrypt the zip entry described by z from file source to file dest
|
||||
* using the password passwd. Return an error code in the ZE_ class.
|
||||
*/
|
||||
int zipbare(z, source, dest, passwd)
|
||||
struct zlist far *z; /* zip entry to encrypt */
|
||||
FILE *source, *dest; /* source and destination files */
|
||||
ZCONST char *passwd; /* password string */
|
||||
{
|
||||
#ifdef ZIP10
|
||||
int c0 /* byte preceding the last input byte */
|
||||
#endif
|
||||
int c1; /* last input byte */
|
||||
ulg offset; /* used for file offsets */
|
||||
ulg size; /* size of input data */
|
||||
int r; /* size of encryption header */
|
||||
int res; /* return code */
|
||||
ush flag; /* previous flags */
|
||||
|
||||
/* Save position and skip local header in input file */
|
||||
if ((offset = (ulg)ftell(source)) == (ulg)-1L ||
|
||||
fseek(source, (long)((4 + LOCHEAD) + (ulg)z->nam + (ulg)z->ext),
|
||||
SEEK_CUR)) {
|
||||
return ferror(source) ? ZE_READ : ZE_EOF;
|
||||
}
|
||||
/* Initialize keys with password */
|
||||
init_keys(passwd);
|
||||
|
||||
/* Decrypt encryption header, save last two bytes */
|
||||
c1 = 0;
|
||||
for (r = RAND_HEAD_LEN; r; r--) {
|
||||
#ifdef ZIP10
|
||||
c0 = c1;
|
||||
#endif
|
||||
if ((c1 = getc(source)) == EOF) {
|
||||
return ferror(source) ? ZE_READ : ZE_EOF;
|
||||
}
|
||||
Trace((stdout, " (%02x)", c1));
|
||||
zdecode(c1);
|
||||
Trace((stdout, " %02x", c1));
|
||||
}
|
||||
Trace((stdout, "\n"));
|
||||
|
||||
/* If last two bytes of header don't match crc (or file time in the
|
||||
* case of an extended local header), back up and just copy. For
|
||||
* pkzip 2.0, the check has been reduced to one byte only.
|
||||
*/
|
||||
#ifdef ZIP10
|
||||
if ((ush)(c0 | (c1<<8)) !=
|
||||
(z->flg & 8 ? (ush) z->tim & 0xffff : (ush)(z->crc >> 16))) {
|
||||
#else
|
||||
if ((ush)c1 != (z->flg & 8 ? (ush) z->tim >> 8 : (ush)(z->crc >> 24))) {
|
||||
#endif
|
||||
if (fseek(source, offset, SEEK_SET)) {
|
||||
return ferror(source) ? ZE_READ : ZE_EOF;
|
||||
}
|
||||
if ((res = zipcopy(z, source, dest)) != ZE_OK) return res;
|
||||
return ZE_MISS;
|
||||
}
|
||||
|
||||
/* Clear encrypted bit and local header bit, and write local header to
|
||||
output file */
|
||||
if ((offset = (ulg)ftell(dest)) == (ulg)-1L) return ZE_TEMP;
|
||||
z->off = offset;
|
||||
flag = z->flg;
|
||||
z->flg &= ~9;
|
||||
z->lflg &= ~9;
|
||||
z->siz -= RAND_HEAD_LEN;
|
||||
if ((res = putlocal(z, dest)) != ZE_OK) return res;
|
||||
|
||||
/* Decrypt data */
|
||||
for (size = z->siz; size; size--) {
|
||||
if ((c1 = getc(source)) == EOF) {
|
||||
return ferror(source) ? ZE_READ : ZE_EOF;
|
||||
}
|
||||
zdecode(c1);
|
||||
putc(c1, dest);
|
||||
}
|
||||
/* Skip extended local header in input file if there is one */
|
||||
if ((flag & 8) != 0 && fseek(source, 16L, SEEK_CUR)) {
|
||||
return ferror(source) ? ZE_READ : ZE_EOF;
|
||||
}
|
||||
if (fflush(dest) == EOF) return ZE_TEMP;
|
||||
|
||||
/* Update number of bytes written to output file */
|
||||
tempzn += (4 + LOCHEAD) + z->nam + z->ext + z->siz;
|
||||
|
||||
return ZE_OK;
|
||||
}
|
||||
|
||||
|
||||
#else /* !UTIL */
|
||||
|
||||
/***********************************************************************
|
||||
* If requested, encrypt the data in buf, and in any case call fwrite()
|
||||
* with the arguments to zfwrite(). Return what fwrite() returns.
|
||||
*
|
||||
* A bug has been found when encrypting large files. See trees.c
|
||||
* for details and the fix.
|
||||
*/
|
||||
unsigned zfwrite(buf, item_size, nb, f)
|
||||
zvoid *buf; /* data buffer */
|
||||
extent item_size; /* size of each item in bytes */
|
||||
extent nb; /* number of items */
|
||||
FILE *f; /* file to write to */
|
||||
{
|
||||
int t; /* temporary */
|
||||
|
||||
if (key != (char *)NULL) { /* key is the global password pointer */
|
||||
ulg size; /* buffer size */
|
||||
char *p = (char*)buf; /* steps through buffer */
|
||||
|
||||
/* Encrypt data in buffer */
|
||||
for (size = item_size*(ulg)nb; size != 0; p++, size--) {
|
||||
*p = (char)zencode(*p, t);
|
||||
}
|
||||
}
|
||||
/* Write the buffer out */
|
||||
return fwrite(buf, item_size, nb, f);
|
||||
}
|
||||
|
||||
#endif /* ?UTIL */
|
||||
#endif /* ZIP */
|
||||
|
||||
|
||||
#if (defined(UNZIP) && !defined(FUNZIP))
|
||||
|
||||
/***********************************************************************
|
||||
* Get the password and set up keys for current zipfile member.
|
||||
* Return PK_ class error.
|
||||
*/
|
||||
int decrypt(__G__ passwrd)
|
||||
__GDEF
|
||||
ZCONST char *passwrd;
|
||||
{
|
||||
ush b;
|
||||
int n, r;
|
||||
uch h[RAND_HEAD_LEN];
|
||||
|
||||
Trace((stdout, "\n[incnt = %d]: ", GLOBAL(incnt)));
|
||||
|
||||
/* get header once (turn off "encrypted" flag temporarily so we don't
|
||||
* try to decrypt the same data twice) */
|
||||
GLOBAL(pInfo->encrypted) = FALSE;
|
||||
defer_leftover_input(__G);
|
||||
for (n = 0; n < RAND_HEAD_LEN; n++) {
|
||||
b = NEXTBYTE;
|
||||
h[n] = (uch)b;
|
||||
Trace((stdout, " (%02x)", h[n]));
|
||||
}
|
||||
undefer_input(__G);
|
||||
GLOBAL(pInfo->encrypted) = TRUE;
|
||||
|
||||
if (GLOBAL(newzip)) { /* this is first encrypted member in this zipfile */
|
||||
GLOBAL(newzip) = FALSE;
|
||||
if (passwrd != (char *)NULL) { /* user gave password on command line */
|
||||
if (!GLOBAL(key)) {
|
||||
if ((GLOBAL(key) = (char *)malloc(strlen(passwrd)+1)) ==
|
||||
(char *)NULL)
|
||||
return PK_MEM2;
|
||||
strcpy(GLOBAL(key), passwrd);
|
||||
GLOBAL(nopwd) = TRUE; /* inhibit password prompting! */
|
||||
}
|
||||
} else if (GLOBAL(key)) { /* get rid of previous zipfile's key */
|
||||
free(GLOBAL(key));
|
||||
GLOBAL(key) = (char *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* if have key already, test it; else allocate memory for it */
|
||||
if (GLOBAL(key)) {
|
||||
if (!testp(__G__ h))
|
||||
return PK_COOL; /* existing password OK (else prompt for new) */
|
||||
else if (GLOBAL(nopwd))
|
||||
return PK_WARN; /* user indicated no more prompting */
|
||||
} else if ((GLOBAL(key) = (char *)malloc(IZ_PWLEN+1)) == (char *)NULL)
|
||||
return PK_MEM2;
|
||||
|
||||
/* try a few keys */
|
||||
n = 0;
|
||||
do {
|
||||
r = (*G.decr_passwd)((zvoid *)&G, &n, GLOBAL(key), IZ_PWLEN+1,
|
||||
GLOBAL(zipfn), GLOBAL(filename));
|
||||
if (r == IZ_PW_ERROR) { /* internal error in fetch of PW */
|
||||
free (GLOBAL(key));
|
||||
GLOBAL(key) = NULL;
|
||||
return PK_MEM2;
|
||||
}
|
||||
if (r != IZ_PW_ENTERED) { /* user replied "skip" or "skip all" */
|
||||
*GLOBAL(key) = '\0'; /* We try the NIL password, ... */
|
||||
n = 0; /* and cancel fetch for this item. */
|
||||
}
|
||||
if (!testp(__G__ h))
|
||||
return PK_COOL;
|
||||
if (r == IZ_PW_CANCELALL) /* User replied "Skip all" */
|
||||
GLOBAL(nopwd) = TRUE; /* inhibit any further PW prompt! */
|
||||
} while (n > 0);
|
||||
|
||||
return PK_WARN;
|
||||
|
||||
} /* end function decrypt() */
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* Test the password. Return -1 if bad, 0 if OK.
|
||||
*/
|
||||
local int testp(__G__ h)
|
||||
__GDEF
|
||||
ZCONST uch *h;
|
||||
{
|
||||
int r;
|
||||
char *key_translated;
|
||||
|
||||
/* On systems with "obscure" native character coding (e.g., EBCDIC),
|
||||
* the first test translates the password to the "main standard"
|
||||
* character coding. */
|
||||
|
||||
#ifdef STR_TO_CP1
|
||||
/* allocate buffer for translated password */
|
||||
if ((key_translated = malloc(strlen(GLOBAL(key)) + 1)) == (char *)NULL)
|
||||
return -1;
|
||||
/* first try, test password translated "standard" charset */
|
||||
r = testkey(__G__ h, STR_TO_CP1(key_translated, GLOBAL(key)));
|
||||
#else /* !STR_TO_CP1 */
|
||||
/* first try, test password as supplied on the extractor's host */
|
||||
r = testkey(__G__ h, GLOBAL(key));
|
||||
#endif /* ?STR_TO_CP1 */
|
||||
|
||||
#ifdef STR_TO_CP2
|
||||
if (r != 0) {
|
||||
#ifndef STR_TO_CP1
|
||||
/* now prepare for second (and maybe third) test with translated pwd */
|
||||
if ((key_translated = malloc(strlen(GLOBAL(key)) + 1)) == (char *)NULL)
|
||||
return -1;
|
||||
#endif
|
||||
/* second try, password translated to alternate ("standard") charset */
|
||||
r = testkey(__G__ h, STR_TO_CP2(key_translated, GLOBAL(key)));
|
||||
#ifdef STR_TO_CP3
|
||||
if (r != 0)
|
||||
/* third try, password translated to another "standard" charset */
|
||||
r = testkey(__G__ h, STR_TO_CP3(key_translated, GLOBAL(key)));
|
||||
#endif
|
||||
#ifndef STR_TO_CP1
|
||||
free(key_translated);
|
||||
#endif
|
||||
}
|
||||
#endif /* STR_TO_CP2 */
|
||||
|
||||
#ifdef STR_TO_CP1
|
||||
free(key_translated);
|
||||
if (r != 0) {
|
||||
/* last resort, test password as supplied on the extractor's host */
|
||||
r = testkey(__G__ h, GLOBAL(key));
|
||||
}
|
||||
#endif /* STR_TO_CP1 */
|
||||
|
||||
return r;
|
||||
|
||||
} /* end function testp() */
|
||||
|
||||
|
||||
local int testkey(__G__ h, key)
|
||||
__GDEF
|
||||
ZCONST uch *h; /* decrypted header */
|
||||
ZCONST char *key; /* decryption password to test */
|
||||
{
|
||||
ush b;
|
||||
#ifdef ZIP10
|
||||
ush c;
|
||||
#endif
|
||||
int n;
|
||||
uch *p;
|
||||
uch hh[RAND_HEAD_LEN]; /* decrypted header */
|
||||
|
||||
/* set keys and save the encrypted header */
|
||||
init_keys(__G__ key);
|
||||
memcpy(hh, h, RAND_HEAD_LEN);
|
||||
|
||||
/* check password */
|
||||
for (n = 0; n < RAND_HEAD_LEN; n++) {
|
||||
zdecode(hh[n]);
|
||||
Trace((stdout, " %02x", hh[n]));
|
||||
}
|
||||
|
||||
Trace((stdout,
|
||||
"\n lrec.crc= %08lx crec.crc= %08lx pInfo->ExtLocHdr= %s\n",
|
||||
GLOBAL(lrec.crc32), GLOBAL(pInfo->crc),
|
||||
GLOBAL(pInfo->ExtLocHdr) ? "true":"false"));
|
||||
Trace((stdout, " incnt = %d unzip offset into zipfile = %ld\n",
|
||||
GLOBAL(incnt),
|
||||
GLOBAL(cur_zipfile_bufstart)+(GLOBAL(inptr)-GLOBAL(inbuf))));
|
||||
|
||||
/* same test as in zipbare(): */
|
||||
|
||||
#ifdef ZIP10 /* check two bytes */
|
||||
c = hh[RAND_HEAD_LEN-2], b = hh[RAND_HEAD_LEN-1];
|
||||
Trace((stdout,
|
||||
" (c | (b<<8)) = %04x (crc >> 16) = %04x lrec.time = %04x\n",
|
||||
(ush)(c | (b<<8)), (ush)(GLOBAL(lrec.crc32) >> 16),
|
||||
((ush)GLOBAL(lrec.last_mod_dos_datetime) & 0xffff))));
|
||||
if ((ush)(c | (b<<8)) != (GLOBAL(pInfo->ExtLocHdr) ?
|
||||
((ush)GLOBAL(lrec.last_mod_dos_datetime) & 0xffff) :
|
||||
(ush)(GLOBAL(lrec.crc32) >> 16)))
|
||||
return -1; /* bad */
|
||||
#else
|
||||
b = hh[RAND_HEAD_LEN-1];
|
||||
Trace((stdout, " b = %02x (crc >> 24) = %02x (lrec.time >> 8) = %02x\n",
|
||||
b, (ush)(GLOBAL(lrec.crc32) >> 24),
|
||||
((ush)GLOBAL(lrec.last_mod_dos_datetime) >> 8) & 0xff));
|
||||
if (b != (GLOBAL(pInfo->ExtLocHdr) ?
|
||||
((ush)GLOBAL(lrec.last_mod_dos_datetime) >> 8) & 0xff :
|
||||
(ush)(GLOBAL(lrec.crc32) >> 24)))
|
||||
return -1; /* bad */
|
||||
#endif
|
||||
/* password OK: decrypt current buffer contents before leaving */
|
||||
for (n = (long)GLOBAL(incnt) > GLOBAL(csize) ?
|
||||
(int)GLOBAL(csize) : GLOBAL(incnt),
|
||||
p = GLOBAL(inptr); n--; p++)
|
||||
zdecode(*p);
|
||||
return 0; /* OK */
|
||||
|
||||
} /* end function testkey() */
|
||||
|
||||
#endif /* UNZIP && !FUNZIP */
|
||||
|
||||
#else /* !CRYPT */
|
||||
|
||||
/* something "externally visible" to shut up compiler/linker warnings */
|
||||
int zcr_dummy;
|
||||
|
||||
#endif /* ?CRYPT */
|
169
programs/fs/unzip60/crypt.h
Normal file
169
programs/fs/unzip60/crypt.h
Normal file
@ -0,0 +1,169 @@
|
||||
/*
|
||||
Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2005-Feb-10 or later
|
||||
(the contents of which are also included in (un)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
|
||||
*/
|
||||
/*
|
||||
crypt.h (full version) by Info-ZIP. Last revised: [see CR_VERSION_DATE]
|
||||
|
||||
The main encryption/decryption source code for Info-Zip software was
|
||||
originally written in Europe. To the best of our knowledge, it can
|
||||
be freely distributed in both source and object forms from any country,
|
||||
including the USA under License Exception TSU of the U.S. Export
|
||||
Administration Regulations (section 740.13(e)) of 6 June 2002.
|
||||
|
||||
NOTE on copyright history:
|
||||
Previous versions of this source package (up to version 2.8) were
|
||||
not copyrighted and put in the public domain. If you cannot comply
|
||||
with the Info-Zip LICENSE, you may want to look for one of those
|
||||
public domain versions.
|
||||
*/
|
||||
|
||||
#ifndef __crypt_h /* don't include more than once */
|
||||
#define __crypt_h
|
||||
|
||||
#ifdef CRYPT
|
||||
# undef CRYPT
|
||||
#endif
|
||||
/*
|
||||
Logic of selecting "full crypt" code:
|
||||
a) default behaviour:
|
||||
- dummy crypt code when compiling UnZipSFX stub, to minimize size
|
||||
- full crypt code when used to compile Zip, UnZip and fUnZip
|
||||
b) USE_CRYPT defined:
|
||||
- always full crypt code
|
||||
c) NO_CRYPT defined:
|
||||
- never full crypt code
|
||||
NO_CRYPT takes precedence over USE_CRYPT
|
||||
*/
|
||||
#if defined(NO_CRYPT)
|
||||
# define CRYPT 0 /* dummy version */
|
||||
#else
|
||||
#if defined(USE_CRYPT)
|
||||
# define CRYPT 1 /* full version */
|
||||
#else
|
||||
#if !defined(SFX)
|
||||
# define CRYPT 1 /* full version for zip and main unzip */
|
||||
#else
|
||||
# define CRYPT 0 /* dummy version for unzip sfx */
|
||||
#endif
|
||||
#endif /* ?USE_CRYPT */
|
||||
#endif /* ?NO_CRYPT */
|
||||
|
||||
#if CRYPT
|
||||
/* full version */
|
||||
|
||||
#ifdef CR_BETA
|
||||
# undef CR_BETA /* this is not a beta release */
|
||||
#endif
|
||||
|
||||
#define CR_MAJORVER 2
|
||||
#define CR_MINORVER 11
|
||||
#ifdef CR_BETA
|
||||
# define CR_BETA_VER "c BETA"
|
||||
# define CR_VERSION_DATE "05 Jan 2007" /* last real code change */
|
||||
#else
|
||||
# define CR_BETA_VER ""
|
||||
# define CR_VERSION_DATE "05 Jan 2007" /* last public release date */
|
||||
# define CR_RELEASE
|
||||
#endif
|
||||
|
||||
#ifndef __G /* UnZip only, for now (DLL stuff) */
|
||||
# define __G
|
||||
# define __G__
|
||||
# define __GDEF
|
||||
# define __GPRO void
|
||||
# define __GPRO__
|
||||
#endif
|
||||
|
||||
#if defined(MSDOS) || defined(OS2) || defined(WIN32)
|
||||
# ifndef DOS_OS2_W32
|
||||
# define DOS_OS2_W32
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(DOS_OS2_W32) || defined(__human68k__)
|
||||
# ifndef DOS_H68_OS2_W32
|
||||
# define DOS_H68_OS2_W32
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(VM_CMS) || defined(MVS)
|
||||
# ifndef CMS_MVS
|
||||
# define CMS_MVS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* To allow combining of Zip and UnZip static libraries in a single binary,
|
||||
* the Zip and UnZip versions of the crypt core functions have to be named
|
||||
* differently.
|
||||
*/
|
||||
#ifdef ZIP
|
||||
# ifdef REALLY_SHORT_SYMS
|
||||
# define decrypt_byte zdcrby
|
||||
# else
|
||||
# define decrypt_byte zp_decrypt_byte
|
||||
# endif
|
||||
# define update_keys zp_update_keys
|
||||
# define init_keys zp_init_keys
|
||||
#else /* !ZIP */
|
||||
# ifdef REALLY_SHORT_SYMS
|
||||
# define decrypt_byte dcrbyt
|
||||
# endif
|
||||
#endif /* ?ZIP */
|
||||
|
||||
#define IZ_PWLEN 80 /* input buffer size for reading encryption key */
|
||||
#ifndef PWLEN /* for compatibility with previous zcrypt release... */
|
||||
# define PWLEN IZ_PWLEN
|
||||
#endif
|
||||
#define RAND_HEAD_LEN 12 /* length of encryption random header */
|
||||
|
||||
/* the crc_32_tab array has to be provided externally for the crypt calculus */
|
||||
|
||||
/* encode byte c, using temp t. Warning: c must not have side effects. */
|
||||
#define zencode(c,t) (t=decrypt_byte(__G), update_keys(c), t^(c))
|
||||
|
||||
/* decode byte c in place */
|
||||
#define zdecode(c) update_keys(__G__ c ^= decrypt_byte(__G))
|
||||
|
||||
int decrypt_byte OF((__GPRO));
|
||||
int update_keys OF((__GPRO__ int c));
|
||||
void init_keys OF((__GPRO__ ZCONST char *passwd));
|
||||
|
||||
#ifdef ZIP
|
||||
void crypthead OF((ZCONST char *, ulg, FILE *));
|
||||
# ifdef UTIL
|
||||
int zipcloak OF((struct zlist far *, FILE *, FILE *, ZCONST char *));
|
||||
int zipbare OF((struct zlist far *, FILE *, FILE *, ZCONST char *));
|
||||
# else
|
||||
unsigned zfwrite OF((zvoid *, extent, extent, FILE *));
|
||||
extern char *key;
|
||||
# endif
|
||||
#endif /* ZIP */
|
||||
|
||||
#if (defined(UNZIP) && !defined(FUNZIP))
|
||||
int decrypt OF((__GPRO__ ZCONST char *passwrd));
|
||||
#endif
|
||||
|
||||
#ifdef FUNZIP
|
||||
extern int encrypted;
|
||||
# ifdef NEXTBYTE
|
||||
# undef NEXTBYTE
|
||||
# endif
|
||||
# define NEXTBYTE \
|
||||
(encrypted? update_keys(__G__ getc(G.in)^decrypt_byte(__G)) : getc(G.in))
|
||||
#endif /* FUNZIP */
|
||||
|
||||
#else /* !CRYPT */
|
||||
/* dummy version */
|
||||
|
||||
#define zencode
|
||||
#define zdecode
|
||||
|
||||
#define zfwrite fwrite
|
||||
|
||||
#endif /* ?CRYPT */
|
||||
#endif /* !__crypt_h */
|
301
programs/fs/unzip60/ebcdic.h
Normal file
301
programs/fs/unzip60/ebcdic.h
Normal file
@ -0,0 +1,301 @@
|
||||
/*
|
||||
Copyright (c) 1990-2008 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
|
||||
*/
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
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
|
||||
ZCONST uch Far iso2oem_850[] = {
|
||||
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 /* IZ_ISO2OEM_ARRAY */
|
||||
|
||||
#ifdef IZ_OEM2ISO_ARRAY
|
||||
ZCONST uch Far oem2iso_850[] = {
|
||||
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 /* IZ_OEM2ISO_ARRAY */
|
||||
|
||||
/* The following pointers to the OEM<-->ISO translation tables are used
|
||||
by the translation code portions. They may get initialized at program
|
||||
startup to point to the matching static translation tables, or to NULL
|
||||
to disable OEM-ISO translation.
|
||||
The compile-time initialization used here provides the backward compatible
|
||||
setting, as can be found in UnZip 5.52 and earlier.
|
||||
In case this mechanism will ever get used on a multithreading system that
|
||||
allows different codepage setups for concurrently running threads, these
|
||||
pointers should get moved into UnZip's thread-safe global data structure.
|
||||
*/
|
||||
#ifdef IZ_ISO2OEM_ARRAY
|
||||
ZCONST uch Far *iso2oem = iso2oem_850; /* backward compatibility default */
|
||||
#endif /* IZ_ISO2OEM_ARRAY */
|
||||
#ifdef IZ_OEM2ISO_ARRAY
|
||||
ZCONST uch Far *oem2iso = oem2iso_850; /* backward compatibility default */
|
||||
#endif /* IZ_OEM2ISO_ARRAY */
|
||||
|
||||
#if defined(THEOS) || defined(THEOS_SUPPORT)
|
||||
# include "theos/charconv.h"
|
||||
#endif
|
||||
|
||||
#endif /* __ebcdic_h */
|
317
programs/fs/unzip60/envargs.c
Normal file
317
programs/fs/unzip60/envargs.c
Normal file
@ -0,0 +1,317 @@
|
||||
/*
|
||||
Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/*----------------------------------------------------------------*
|
||||
| envargs - add default options from environment to command line
|
||||
|----------------------------------------------------------------
|
||||
| Author: Bill Davidsen, original 10/13/91, revised 23 Oct 1991.
|
||||
| This program is in the public domain.
|
||||
|----------------------------------------------------------------
|
||||
| Minor program notes:
|
||||
| 1. Yes, the indirection is a tad complex
|
||||
| 2. Parentheses were added where not needed in some cases
|
||||
| to make the action of the code less obscure.
|
||||
|----------------------------------------------------------------
|
||||
| UnZip notes: 24 May 92 ("v1.4"):
|
||||
| 1. #include "unzip.h" for prototypes (24 May 92)
|
||||
| 2. changed ch to type char (24 May 92)
|
||||
| 3. added an ifdef to avoid Borland warnings (24 May 92)
|
||||
| 4. included Rich Wales' mksargs() routine (for MS-DOS, maybe
|
||||
| OS/2? NT?) (4 Dec 93)
|
||||
| 5. added alternate-variable string envstr2 (21 Apr 94)
|
||||
| 6. added support for quoted arguments (6 Jul 96)
|
||||
*----------------------------------------------------------------*/
|
||||
|
||||
|
||||
#define __ENVARGS_C /* identifies this source module */
|
||||
#define UNZIP_INTERNAL
|
||||
#include "unzip.h"
|
||||
|
||||
#ifdef __EMX__ /* emx isspace() returns TRUE on extended ASCII !! */
|
||||
# define ISspace(c) ((c) & 0x80 ? 0 : isspace((unsigned)c))
|
||||
#else
|
||||
# define ISspace(c) isspace((unsigned)c)
|
||||
#endif /* ?__EMX__ */
|
||||
|
||||
#if (!defined(RISCOS) && (!defined(MODERN) || defined(NO_STDLIB_H)))
|
||||
extern char *getenv();
|
||||
#endif
|
||||
static int count_args OF((ZCONST char *));
|
||||
|
||||
|
||||
/* envargs() returns PK-style error code */
|
||||
|
||||
int envargs(Pargc, Pargv, envstr, envstr2)
|
||||
int *Pargc;
|
||||
char ***Pargv;
|
||||
ZCONST char *envstr, *envstr2;
|
||||
{
|
||||
char *envptr; /* value returned by getenv */
|
||||
char *bufptr; /* copy of env info */
|
||||
int argc = 0; /* internal arg count */
|
||||
register int ch; /* spare temp value */
|
||||
char **argv; /* internal arg vector */
|
||||
char **argvect; /* copy of vector address */
|
||||
|
||||
/* see if anything in the environment */
|
||||
if ((envptr = getenv(envstr)) != (char *)NULL) /* usual var */
|
||||
while (ISspace(*envptr)) /* must discard leading spaces */
|
||||
envptr++;
|
||||
if (envptr == (char *)NULL || *envptr == '\0')
|
||||
if ((envptr = getenv(envstr2)) != (char *)NULL) /* alternate var */
|
||||
while (ISspace(*envptr))
|
||||
envptr++;
|
||||
if (envptr == (char *)NULL || *envptr == '\0')
|
||||
return PK_OK;
|
||||
|
||||
bufptr = malloc(1 + strlen(envptr));
|
||||
if (bufptr == (char *)NULL)
|
||||
return PK_MEM;
|
||||
#if ((defined(WIN32) || defined(WINDLL)) && !defined(_WIN32_WCE))
|
||||
# ifdef WIN32
|
||||
if (IsWinNT()) {
|
||||
/* SPC: don't know codepage of 'real' WinNT console */
|
||||
strcpy(bufptr, envptr);
|
||||
} else {
|
||||
/* Win95 environment is DOS and uses OEM character coding */
|
||||
OEM_TO_INTERN(envptr, bufptr);
|
||||
}
|
||||
# else /* !WIN32 */
|
||||
/* DOS (Win 3.x) environment uses OEM codepage */
|
||||
OEM_TO_INTERN(envptr, bufptr);
|
||||
# endif
|
||||
#else /* !((WIN32 || WINDLL) && !_WIN32_WCE) */
|
||||
strcpy(bufptr, envptr);
|
||||
#endif /* ?((WIN32 || WINDLL) && !_WIN32_WCE) */
|
||||
|
||||
/* count the args so we can allocate room for them */
|
||||
argc = count_args(bufptr);
|
||||
/* allocate a vector large enough for all args */
|
||||
argv = (char **)malloc((argc + *Pargc + 1) * sizeof(char *));
|
||||
if (argv == (char **)NULL) {
|
||||
free(bufptr);
|
||||
return PK_MEM;
|
||||
}
|
||||
argvect = argv;
|
||||
|
||||
/* copy the program name first, that's always true */
|
||||
*(argv++) = *((*Pargv)++);
|
||||
|
||||
/* copy the environment args next, may be changed */
|
||||
do {
|
||||
#if defined(AMIGA) || defined(UNIX)
|
||||
if (*bufptr == '"') {
|
||||
char *argstart = ++bufptr;
|
||||
|
||||
*(argv++) = argstart;
|
||||
for (ch = *bufptr; ch != '\0' && ch != '\"';
|
||||
ch = *PREINCSTR(bufptr))
|
||||
if (ch == '\\' && bufptr[1] != '\0')
|
||||
++bufptr; /* advance to char after backslash */
|
||||
if (ch != '\0')
|
||||
*(bufptr++) = '\0'; /* overwrite trailing " */
|
||||
|
||||
/* remove escape characters */
|
||||
while ((argstart = MBSCHR(argstart, '\\')) != (char *)NULL) {
|
||||
strcpy(argstart, argstart + 1);
|
||||
if (*argstart)
|
||||
++argstart;
|
||||
}
|
||||
} else {
|
||||
*(argv++) = bufptr;
|
||||
while ((ch = *bufptr) != '\0' && !ISspace(ch))
|
||||
INCSTR(bufptr);
|
||||
if (ch != '\0')
|
||||
*(bufptr++) = '\0';
|
||||
}
|
||||
#else
|
||||
#ifdef DOS_FLX_NLM_OS2_W32
|
||||
/* we do not support backslash-quoting of quotes in quoted
|
||||
* strings under DOS_FLX_NLM_OS2_W32, because backslashes are
|
||||
* directory separators and double quotes are illegal in filenames */
|
||||
if (*bufptr == '"') {
|
||||
*(argv++) = ++bufptr;
|
||||
while ((ch = *bufptr) != '\0' && ch != '\"')
|
||||
INCSTR(bufptr);
|
||||
if (ch != '\0')
|
||||
*(bufptr++) = '\0';
|
||||
} else {
|
||||
*(argv++) = bufptr;
|
||||
while ((ch = *bufptr) != '\0' && !ISspace(ch))
|
||||
INCSTR(bufptr);
|
||||
if (ch != '\0')
|
||||
*(bufptr++) = '\0';
|
||||
}
|
||||
#else
|
||||
*(argv++) = bufptr;
|
||||
while ((ch = *bufptr) != '\0' && !ISspace(ch))
|
||||
INCSTR(bufptr);
|
||||
if (ch != '\0')
|
||||
*(bufptr++) = '\0';
|
||||
#endif /* ?DOS_FLX_NLM_OS2_W32 */
|
||||
#endif /* ?(AMIGA || UNIX) */
|
||||
while ((ch = *bufptr) != '\0' && ISspace(ch))
|
||||
INCSTR(bufptr);
|
||||
} while (ch);
|
||||
|
||||
/* now save old argc and copy in the old args */
|
||||
argc += *Pargc;
|
||||
while (--(*Pargc))
|
||||
*(argv++) = *((*Pargv)++);
|
||||
|
||||
/* finally, add a NULL after the last arg, like Unix */
|
||||
*argv = (char *)NULL;
|
||||
|
||||
/* save the values and return, indicating succes */
|
||||
*Pargv = argvect;
|
||||
*Pargc = argc;
|
||||
|
||||
return PK_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int count_args(s)
|
||||
ZCONST char *s;
|
||||
{
|
||||
int count = 0;
|
||||
char ch;
|
||||
|
||||
do {
|
||||
/* count and skip args */
|
||||
++count;
|
||||
#if defined(AMIGA) || defined(UNIX)
|
||||
if (*s == '\"') {
|
||||
for (ch = *PREINCSTR(s); ch != '\0' && ch != '\"';
|
||||
ch = *PREINCSTR(s))
|
||||
if (ch == '\\' && s[1] != '\0')
|
||||
++s;
|
||||
if (*s)
|
||||
++s; /* trailing quote */
|
||||
} else
|
||||
#else
|
||||
#ifdef DOS_FLX_NLM_OS2_W32
|
||||
if (*s == '\"') {
|
||||
++s; /* leading quote */
|
||||
while ((ch = *s) != '\0' && ch != '\"')
|
||||
INCSTR(s);
|
||||
if (*s)
|
||||
++s; /* trailing quote */
|
||||
} else
|
||||
#endif /* DOS_FLX_NLM_OS2_W32 */
|
||||
#endif /* ?(AMIGA || UNIX) */
|
||||
while ((ch = *s) != '\0' && !ISspace(ch)) /* note else-clauses above */
|
||||
INCSTR(s);
|
||||
while ((ch = *s) != '\0' && ISspace(ch))
|
||||
INCSTR(s);
|
||||
} while (ch);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
int main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int err;
|
||||
|
||||
printf("Orig argv: %p\n", argv);
|
||||
dump_args(argc, argv);
|
||||
if ((err = envargs(&argc, &argv, "ENVTEST")) != PK_OK) {
|
||||
perror("envargs: cannot get memory for arguments");
|
||||
EXIT(err);
|
||||
}
|
||||
printf(" New argv: %p\n", argv);
|
||||
dump_args(argc, argv);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void dump_args(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("\nDump %d args:\n", argc);
|
||||
for (i = 0; i < argc; ++i)
|
||||
printf("%3d %s\n", i, argv[i]);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
||||
|
||||
|
||||
|
||||
#ifdef MSDOS /* DOS_OS2? DOS_OS2_W32? */
|
||||
|
||||
/*
|
||||
* void mksargs(int *argcp, char ***argvp)
|
||||
*
|
||||
* Substitutes the extended command line argument list produced by
|
||||
* the MKS Korn Shell in place of the command line info from DOS.
|
||||
*
|
||||
* The MKS shell gets around DOS's 128-byte limit on the length of
|
||||
* a command line by passing the "real" command line in the envi-
|
||||
* ronment. The "real" arguments are flagged by prepending a tilde
|
||||
* (~) to each one.
|
||||
*
|
||||
* This "mksargs" routine creates a new argument list by scanning
|
||||
* the environment from the beginning, looking for strings begin-
|
||||
* ning with a tilde character. The new list replaces the original
|
||||
* "argv" (pointed to by "argvp"), and the number of arguments
|
||||
* in the new list replaces the original "argc" (pointed to by
|
||||
* "argcp").
|
||||
*
|
||||
* Rich Wales
|
||||
*/
|
||||
void mksargs(argcp, argvp)
|
||||
int *argcp;
|
||||
char ***argvp;
|
||||
{
|
||||
#ifndef MSC /* declared differently in MSC 7.0 headers, at least */
|
||||
#ifndef __WATCOMC__
|
||||
extern char **environ; /* environment */
|
||||
#endif
|
||||
#endif
|
||||
char **envp; /* pointer into environment */
|
||||
char **newargv; /* new argument list */
|
||||
char **argp; /* pointer into new arg list */
|
||||
int newargc; /* new argument count */
|
||||
|
||||
/* sanity check */
|
||||
if (environ == NULL || argcp == NULL || argvp == NULL || *argvp == NULL)
|
||||
return;
|
||||
|
||||
/* find out how many environment arguments there are */
|
||||
for (envp = environ, newargc = 0;
|
||||
*envp != NULL && (*envp)[0] == '~';
|
||||
envp++, newargc++)
|
||||
;
|
||||
if (newargc == 0)
|
||||
return; /* no environment arguments */
|
||||
|
||||
/* set up new argument list */
|
||||
newargv = (char **) malloc(sizeof(char **) * (newargc+1));
|
||||
if (newargv == NULL)
|
||||
return; /* malloc failed */
|
||||
|
||||
for (argp = newargv, envp = environ; *envp != NULL && (*envp)[0] == '~';
|
||||
*argp++ = &(*envp++)[1])
|
||||
;
|
||||
*argp = NULL; /* null-terminate the list */
|
||||
|
||||
/* substitute new argument list in place of old one */
|
||||
*argcp = newargc;
|
||||
*argvp = newargv;
|
||||
}
|
||||
|
||||
#endif /* MSDOS */
|
618
programs/fs/unzip60/explode.c
Normal file
618
programs/fs/unzip60/explode.c
Normal file
@ -0,0 +1,618 @@
|
||||
/*
|
||||
Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2007-Mar-04 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/* explode.c -- by Mark Adler
|
||||
version c17d, 01 December 2007 */
|
||||
|
||||
|
||||
/* Copyright history:
|
||||
- Starting with UnZip 5.41 of 16-April-2000, this source file
|
||||
is covered by the Info-Zip LICENSE cited above.
|
||||
- Prior versions of this source file, found in UnZip source packages
|
||||
up to UnZip 5.40, were put in the public domain.
|
||||
The original copyright note by Mark Adler was:
|
||||
"You can do whatever you like with this source file,
|
||||
though I would prefer that if you modify it and
|
||||
redistribute it that you include comments to that effect
|
||||
with your name and the date. Thank you."
|
||||
|
||||
History:
|
||||
vers date who what
|
||||
---- --------- -------------- ------------------------------------
|
||||
c1 30 Mar 92 M. Adler explode that uses huft_build from inflate
|
||||
(this gives over a 70% speed improvement
|
||||
over the original unimplode.c, which
|
||||
decoded a bit at a time)
|
||||
c2 4 Apr 92 M. Adler fixed bug for file sizes a multiple of 32k.
|
||||
c3 10 Apr 92 M. Adler added a little memory tracking if DEBUG
|
||||
c4 11 Apr 92 M. Adler added NOMEMCPY do kill use of memcpy()
|
||||
c5 21 Apr 92 M. Adler added the WSIZE #define to allow reducing
|
||||
the 32K window size for specialized
|
||||
applications.
|
||||
c6 31 May 92 M. Adler added typecasts to eliminate some warnings
|
||||
c7 27 Jun 92 G. Roelofs added more typecasts.
|
||||
c8 17 Oct 92 G. Roelofs changed ULONG/UWORD/byte to ulg/ush/uch.
|
||||
c9 19 Jul 93 J. Bush added more typecasts (to return values);
|
||||
made l[256] array static for Amiga.
|
||||
c10 8 Oct 93 G. Roelofs added used_csize for diagnostics; added
|
||||
buf and unshrink arguments to flush();
|
||||
undef'd various macros at end for Turbo C;
|
||||
removed NEXTBYTE macro (now in unzip.h)
|
||||
and bytebuf variable (not used); changed
|
||||
memset() to memzero().
|
||||
c11 9 Jan 94 M. Adler fixed incorrect used_csize calculation.
|
||||
c12 9 Apr 94 G. Roelofs fixed split comments on preprocessor lines
|
||||
to avoid bug in Encore compiler.
|
||||
c13 25 Aug 94 M. Adler fixed distance-length comment (orig c9 fix)
|
||||
c14 22 Nov 95 S. Maxwell removed unnecessary "static" on auto array
|
||||
c15 6 Jul 96 W. Haidinger added ulg typecasts to flush() calls.
|
||||
c16 8 Feb 98 C. Spieler added ZCONST modifiers to const tables
|
||||
and #ifdef DEBUG around debugging code.
|
||||
c16b 25 Mar 98 C. Spieler modified DLL code for slide redirection.
|
||||
c16d 05 Jul 99 C. Spieler take care of flush() return values and
|
||||
stop processing in case of errors
|
||||
c17 04 Feb 01 C. Spieler reorganized code to reduce repetitions
|
||||
of large code parts; adapted huft decoding
|
||||
to the changes in inflate's huft_build()
|
||||
due to support of deflate64; fixed memory
|
||||
leaks (huft tables were not free'd when
|
||||
get_tree() failed).
|
||||
c17b 16 Feb 02 C. Spieler changed type of the "extra lengths" array
|
||||
"extra" from ush into uch (to save space)
|
||||
c17c 10 Aug 04 NN file sizes use zoff_t.
|
||||
c17d 01 Dec 07 C. Spieler type for file sizes changed from zoff_t
|
||||
into zusz_t.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Explode imploded (PKZIP method 6 compressed) data. This compression
|
||||
method searches for as much of the current string of bytes (up to a length
|
||||
of ~320) in the previous 4K or 8K bytes. If it doesn't find any matches
|
||||
(of at least length 2 or 3), it codes the next byte. Otherwise, it codes
|
||||
the length of the matched string and its distance backwards from the
|
||||
current position. Single bytes ("literals") are preceded by a one (a
|
||||
single bit) and are either uncoded (the eight bits go directly into the
|
||||
compressed stream for a total of nine bits) or Huffman coded with a
|
||||
supplied literal code tree. If literals are coded, then the minimum match
|
||||
length is three, otherwise it is two.
|
||||
|
||||
There are therefore four kinds of imploded streams: 8K search with coded
|
||||
literals (min match = 3), 4K search with coded literals (min match = 3),
|
||||
8K with uncoded literals (min match = 2), and 4K with uncoded literals
|
||||
(min match = 2). The kind of stream is identified in two bits of a
|
||||
general purpose bit flag that is outside of the compressed stream.
|
||||
|
||||
Distance-length pairs for matched strings are preceded by a zero bit (to
|
||||
distinguish them from literals) and are always coded. The distance comes
|
||||
first and is either the low six (4K) or low seven (8K) bits of the
|
||||
distance (uncoded), followed by the high six bits of the distance coded.
|
||||
Then the length is six bits coded (0..63 + min match length), and if the
|
||||
maximum such length is coded, then it's followed by another eight bits
|
||||
(uncoded) to be added to the coded length. This gives a match length
|
||||
range of 2..320 or 3..321 bytes.
|
||||
|
||||
The literal, length, and distance codes are all represented in a slightly
|
||||
compressed form themselves. What is sent are the lengths of the codes for
|
||||
each value, which is sufficient to construct the codes. Each byte of the
|
||||
code representation is the code length (the low four bits representing
|
||||
1..16), and the number of values sequentially with that length (the high
|
||||
four bits also representing 1..16). There are 256 literal code values (if
|
||||
literals are coded), 64 length code values, and 64 distance code values,
|
||||
in that order at the beginning of the compressed stream. Each set of code
|
||||
values is preceded (redundantly) with a byte indicating how many bytes are
|
||||
in the code description that follows, in the range 1..256.
|
||||
|
||||
The codes themselves are decoded using tables made by huft_build() from
|
||||
the bit lengths. That routine and its comments are in the inflate.c
|
||||
module.
|
||||
*/
|
||||
|
||||
#define __EXPLODE_C /* identifies this source module */
|
||||
#define UNZIP_INTERNAL
|
||||
#include "unzip.h" /* must supply slide[] (uch) array and NEXTBYTE macro */
|
||||
|
||||
#ifndef WSIZE
|
||||
# define WSIZE 0x8000 /* window size--must be a power of two, and */
|
||||
#endif /* at least 8K for zip's implode method */
|
||||
|
||||
#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
|
||||
# define wszimpl (unsigned)(G._wsize)
|
||||
#else
|
||||
# if defined(USE_DEFLATE64) && defined(INT_16BIT)
|
||||
# define wszimpl (unsigned)(WSIZE>>1)
|
||||
# else /* !(USE_DEFLATE64 && INT_16BIT) */
|
||||
# define wszimpl WSIZE
|
||||
# endif /* !(USE_DEFLATE64 && INT_16BIT) */
|
||||
#endif
|
||||
|
||||
/* routines here */
|
||||
static int get_tree OF((__GPRO__ unsigned *l, unsigned n));
|
||||
static int explode_lit OF((__GPRO__ struct huft *tb, struct huft *tl,
|
||||
struct huft *td, unsigned bb, unsigned bl,
|
||||
unsigned bd, unsigned bdl));
|
||||
static int explode_nolit OF((__GPRO__ struct huft *tl, struct huft *td,
|
||||
unsigned bl, unsigned bd, unsigned bdl));
|
||||
int explode OF((__GPRO));
|
||||
|
||||
|
||||
/* The implode algorithm uses a sliding 4K or 8K byte window on the
|
||||
uncompressed stream to find repeated byte strings. This is implemented
|
||||
here as a circular buffer. The index is updated simply by incrementing
|
||||
and then and'ing with 0x0fff (4K-1) or 0x1fff (8K-1). Here, the 32K
|
||||
buffer of inflate is used, and it works just as well to always have
|
||||
a 32K circular buffer, so the index is anded with 0x7fff. This is
|
||||
done to allow the window to also be used as the output buffer. */
|
||||
/* This must be supplied in an external module useable like "uch slide[8192];"
|
||||
or "uch *slide;", where the latter would be malloc'ed. In unzip, slide[]
|
||||
is actually a 32K area for use by inflate, which uses a 32K sliding window.
|
||||
*/
|
||||
|
||||
|
||||
#define INVALID_CODE 99
|
||||
#define IS_INVALID_CODE(c) ((c) == INVALID_CODE)
|
||||
|
||||
/* Tables for length and distance */
|
||||
static ZCONST ush cplen2[] =
|
||||
{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
|
||||
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
||||
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
|
||||
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65};
|
||||
static ZCONST ush cplen3[] =
|
||||
{3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
||||
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
|
||||
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
|
||||
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66};
|
||||
static ZCONST uch extra[] =
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
8};
|
||||
static ZCONST ush cpdist4[] =
|
||||
{1, 65, 129, 193, 257, 321, 385, 449, 513, 577, 641, 705,
|
||||
769, 833, 897, 961, 1025, 1089, 1153, 1217, 1281, 1345, 1409, 1473,
|
||||
1537, 1601, 1665, 1729, 1793, 1857, 1921, 1985, 2049, 2113, 2177,
|
||||
2241, 2305, 2369, 2433, 2497, 2561, 2625, 2689, 2753, 2817, 2881,
|
||||
2945, 3009, 3073, 3137, 3201, 3265, 3329, 3393, 3457, 3521, 3585,
|
||||
3649, 3713, 3777, 3841, 3905, 3969, 4033};
|
||||
static ZCONST ush cpdist8[] =
|
||||
{1, 129, 257, 385, 513, 641, 769, 897, 1025, 1153, 1281,
|
||||
1409, 1537, 1665, 1793, 1921, 2049, 2177, 2305, 2433, 2561, 2689,
|
||||
2817, 2945, 3073, 3201, 3329, 3457, 3585, 3713, 3841, 3969, 4097,
|
||||
4225, 4353, 4481, 4609, 4737, 4865, 4993, 5121, 5249, 5377, 5505,
|
||||
5633, 5761, 5889, 6017, 6145, 6273, 6401, 6529, 6657, 6785, 6913,
|
||||
7041, 7169, 7297, 7425, 7553, 7681, 7809, 7937, 8065};
|
||||
|
||||
|
||||
/* Macros for inflate() bit peeking and grabbing.
|
||||
The usage is:
|
||||
|
||||
NEEDBITS(j)
|
||||
x = b & mask_bits[j];
|
||||
DUMPBITS(j)
|
||||
|
||||
where NEEDBITS makes sure that b has at least j bits in it, and
|
||||
DUMPBITS removes the bits from b. The macros use the variable k
|
||||
for the number of bits in b. Normally, b and k are register
|
||||
variables for speed.
|
||||
*/
|
||||
|
||||
#define NEEDBITS(n) {while(k<(n)){b|=((ulg)NEXTBYTE)<<k;k+=8;}}
|
||||
#define DUMPBITS(n) {b>>=(n);k-=(n);}
|
||||
|
||||
#define DECODEHUFT(htab, bits, mask) {\
|
||||
NEEDBITS((unsigned)(bits))\
|
||||
t = (htab) + ((~(unsigned)b)&(mask));\
|
||||
while (1) {\
|
||||
DUMPBITS(t->b)\
|
||||
if ((e=t->e) <= 32) break;\
|
||||
if (IS_INVALID_CODE(e)) return 1;\
|
||||
e &= 31;\
|
||||
NEEDBITS(e)\
|
||||
t = t->v.t + ((~(unsigned)b)&mask_bits[e]);\
|
||||
}\
|
||||
}
|
||||
|
||||
|
||||
static int get_tree(__G__ l, n)
|
||||
__GDEF
|
||||
unsigned *l; /* bit lengths */
|
||||
unsigned n; /* number expected */
|
||||
/* Get the bit lengths for a code representation from the compressed
|
||||
stream. If get_tree() returns 4, then there is an error in the data.
|
||||
Otherwise zero is returned. */
|
||||
{
|
||||
unsigned i; /* bytes remaining in list */
|
||||
unsigned k; /* lengths entered */
|
||||
unsigned j; /* number of codes */
|
||||
unsigned b; /* bit length for those codes */
|
||||
|
||||
|
||||
/* get bit lengths */
|
||||
i = NEXTBYTE + 1; /* length/count pairs to read */
|
||||
k = 0; /* next code */
|
||||
do {
|
||||
b = ((j = NEXTBYTE) & 0xf) + 1; /* bits in code (1..16) */
|
||||
j = ((j & 0xf0) >> 4) + 1; /* codes with those bits (1..16) */
|
||||
if (k + j > n)
|
||||
return 4; /* don't overflow l[] */
|
||||
do {
|
||||
l[k++] = b;
|
||||
} while (--j);
|
||||
} while (--i);
|
||||
return k != n ? 4 : 0; /* should have read n of them */
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int explode_lit(__G__ tb, tl, td, bb, bl, bd, bdl)
|
||||
__GDEF
|
||||
struct huft *tb, *tl, *td; /* literal, length, and distance tables */
|
||||
unsigned bb, bl, bd; /* number of bits decoded by those */
|
||||
unsigned bdl; /* number of distance low bits */
|
||||
/* Decompress the imploded data using coded literals and a sliding
|
||||
window (of size 2^(6+bdl) bytes). */
|
||||
{
|
||||
zusz_t s; /* bytes to decompress */
|
||||
register unsigned e; /* table entry flag/number of extra bits */
|
||||
unsigned n, d; /* length and index for copy */
|
||||
unsigned w; /* current window position */
|
||||
struct huft *t; /* pointer to table entry */
|
||||
unsigned mb, ml, md; /* masks for bb, bl, and bd bits */
|
||||
unsigned mdl; /* mask for bdl (distance lower) bits */
|
||||
register ulg b; /* bit buffer */
|
||||
register unsigned k; /* number of bits in bit buffer */
|
||||
unsigned u; /* true if unflushed */
|
||||
int retval = 0; /* error code returned: initialized to "no error" */
|
||||
|
||||
|
||||
/* explode the coded data */
|
||||
b = k = w = 0; /* initialize bit buffer, window */
|
||||
u = 1; /* buffer unflushed */
|
||||
mb = mask_bits[bb]; /* precompute masks for speed */
|
||||
ml = mask_bits[bl];
|
||||
md = mask_bits[bd];
|
||||
mdl = mask_bits[bdl];
|
||||
s = G.lrec.ucsize;
|
||||
while (s > 0) /* do until ucsize bytes uncompressed */
|
||||
{
|
||||
NEEDBITS(1)
|
||||
if (b & 1) /* then literal--decode it */
|
||||
{
|
||||
DUMPBITS(1)
|
||||
s--;
|
||||
DECODEHUFT(tb, bb, mb) /* get coded literal */
|
||||
redirSlide[w++] = (uch)t->v.n;
|
||||
if (w == wszimpl)
|
||||
{
|
||||
if ((retval = flush(__G__ redirSlide, (ulg)w, 0)) != 0)
|
||||
return retval;
|
||||
w = u = 0;
|
||||
}
|
||||
}
|
||||
else /* else distance/length */
|
||||
{
|
||||
DUMPBITS(1)
|
||||
NEEDBITS(bdl) /* get distance low bits */
|
||||
d = (unsigned)b & mdl;
|
||||
DUMPBITS(bdl)
|
||||
DECODEHUFT(td, bd, md) /* get coded distance high bits */
|
||||
d = w - d - t->v.n; /* construct offset */
|
||||
DECODEHUFT(tl, bl, ml) /* get coded length */
|
||||
n = t->v.n;
|
||||
if (e) /* get length extra bits */
|
||||
{
|
||||
NEEDBITS(8)
|
||||
n += (unsigned)b & 0xff;
|
||||
DUMPBITS(8)
|
||||
}
|
||||
|
||||
/* do the copy */
|
||||
s = (s > (zusz_t)n ? s - (zusz_t)n : 0);
|
||||
do {
|
||||
#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
|
||||
if (G.redirect_slide) {
|
||||
/* &= w/ wszimpl not needed and wrong if redirect */
|
||||
if (d >= wszimpl)
|
||||
return 1;
|
||||
e = wszimpl - (d > w ? d : w);
|
||||
} else
|
||||
#endif
|
||||
e = wszimpl - ((d &= wszimpl-1) > w ? d : w);
|
||||
if (e > n) e = n;
|
||||
n -= e;
|
||||
if (u && w <= d)
|
||||
{
|
||||
memzero(redirSlide + w, e);
|
||||
w += e;
|
||||
d += e;
|
||||
}
|
||||
else
|
||||
#ifndef NOMEMCPY
|
||||
if (w - d >= e) /* (this test assumes unsigned comparison) */
|
||||
{
|
||||
memcpy(redirSlide + w, redirSlide + d, e);
|
||||
w += e;
|
||||
d += e;
|
||||
}
|
||||
else /* do it slow to avoid memcpy() overlap */
|
||||
#endif /* !NOMEMCPY */
|
||||
do {
|
||||
redirSlide[w++] = redirSlide[d++];
|
||||
} while (--e);
|
||||
if (w == wszimpl)
|
||||
{
|
||||
if ((retval = flush(__G__ redirSlide, (ulg)w, 0)) != 0)
|
||||
return retval;
|
||||
w = u = 0;
|
||||
}
|
||||
} while (n);
|
||||
}
|
||||
}
|
||||
|
||||
/* flush out redirSlide */
|
||||
if ((retval = flush(__G__ redirSlide, (ulg)w, 0)) != 0)
|
||||
return retval;
|
||||
if (G.csize + G.incnt + (k >> 3)) /* should have read csize bytes, but */
|
||||
{ /* sometimes read one too many: k>>3 compensates */
|
||||
G.used_csize = G.lrec.csize - G.csize - G.incnt - (k >> 3);
|
||||
return 5;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int explode_nolit(__G__ tl, td, bl, bd, bdl)
|
||||
__GDEF
|
||||
struct huft *tl, *td; /* length and distance decoder tables */
|
||||
unsigned bl, bd; /* number of bits decoded by tl[] and td[] */
|
||||
unsigned bdl; /* number of distance low bits */
|
||||
/* Decompress the imploded data using uncoded literals and a sliding
|
||||
window (of size 2^(6+bdl) bytes). */
|
||||
{
|
||||
zusz_t s; /* bytes to decompress */
|
||||
register unsigned e; /* table entry flag/number of extra bits */
|
||||
unsigned n, d; /* length and index for copy */
|
||||
unsigned w; /* current window position */
|
||||
struct huft *t; /* pointer to table entry */
|
||||
unsigned ml, md; /* masks for bl and bd bits */
|
||||
unsigned mdl; /* mask for bdl (distance lower) bits */
|
||||
register ulg b; /* bit buffer */
|
||||
register unsigned k; /* number of bits in bit buffer */
|
||||
unsigned u; /* true if unflushed */
|
||||
int retval = 0; /* error code returned: initialized to "no error" */
|
||||
|
||||
|
||||
/* explode the coded data */
|
||||
b = k = w = 0; /* initialize bit buffer, window */
|
||||
u = 1; /* buffer unflushed */
|
||||
ml = mask_bits[bl]; /* precompute masks for speed */
|
||||
md = mask_bits[bd];
|
||||
mdl = mask_bits[bdl];
|
||||
s = G.lrec.ucsize;
|
||||
while (s > 0) /* do until ucsize bytes uncompressed */
|
||||
{
|
||||
NEEDBITS(1)
|
||||
if (b & 1) /* then literal--get eight bits */
|
||||
{
|
||||
DUMPBITS(1)
|
||||
s--;
|
||||
NEEDBITS(8)
|
||||
redirSlide[w++] = (uch)b;
|
||||
if (w == wszimpl)
|
||||
{
|
||||
if ((retval = flush(__G__ redirSlide, (ulg)w, 0)) != 0)
|
||||
return retval;
|
||||
w = u = 0;
|
||||
}
|
||||
DUMPBITS(8)
|
||||
}
|
||||
else /* else distance/length */
|
||||
{
|
||||
DUMPBITS(1)
|
||||
NEEDBITS(bdl) /* get distance low bits */
|
||||
d = (unsigned)b & mdl;
|
||||
DUMPBITS(bdl)
|
||||
DECODEHUFT(td, bd, md) /* get coded distance high bits */
|
||||
d = w - d - t->v.n; /* construct offset */
|
||||
DECODEHUFT(tl, bl, ml) /* get coded length */
|
||||
n = t->v.n;
|
||||
if (e) /* get length extra bits */
|
||||
{
|
||||
NEEDBITS(8)
|
||||
n += (unsigned)b & 0xff;
|
||||
DUMPBITS(8)
|
||||
}
|
||||
|
||||
/* do the copy */
|
||||
s = (s > (zusz_t)n ? s - (zusz_t)n : 0);
|
||||
do {
|
||||
#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
|
||||
if (G.redirect_slide) {
|
||||
/* &= w/ wszimpl not needed and wrong if redirect */
|
||||
if (d >= wszimpl)
|
||||
return 1;
|
||||
e = wszimpl - (d > w ? d : w);
|
||||
} else
|
||||
#endif
|
||||
e = wszimpl - ((d &= wszimpl-1) > w ? d : w);
|
||||
if (e > n) e = n;
|
||||
n -= e;
|
||||
if (u && w <= d)
|
||||
{
|
||||
memzero(redirSlide + w, e);
|
||||
w += e;
|
||||
d += e;
|
||||
}
|
||||
else
|
||||
#ifndef NOMEMCPY
|
||||
if (w - d >= e) /* (this test assumes unsigned comparison) */
|
||||
{
|
||||
memcpy(redirSlide + w, redirSlide + d, e);
|
||||
w += e;
|
||||
d += e;
|
||||
}
|
||||
else /* do it slow to avoid memcpy() overlap */
|
||||
#endif /* !NOMEMCPY */
|
||||
do {
|
||||
redirSlide[w++] = redirSlide[d++];
|
||||
} while (--e);
|
||||
if (w == wszimpl)
|
||||
{
|
||||
if ((retval = flush(__G__ redirSlide, (ulg)w, 0)) != 0)
|
||||
return retval;
|
||||
w = u = 0;
|
||||
}
|
||||
} while (n);
|
||||
}
|
||||
}
|
||||
|
||||
/* flush out redirSlide */
|
||||
if ((retval = flush(__G__ redirSlide, (ulg)w, 0)) != 0)
|
||||
return retval;
|
||||
if (G.csize + G.incnt + (k >> 3)) /* should have read csize bytes, but */
|
||||
{ /* sometimes read one too many: k>>3 compensates */
|
||||
G.used_csize = G.lrec.csize - G.csize - G.incnt - (k >> 3);
|
||||
return 5;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int explode(__G)
|
||||
__GDEF
|
||||
/* Explode an imploded compressed stream. Based on the general purpose
|
||||
bit flag, decide on coded or uncoded literals, and an 8K or 4K sliding
|
||||
window. Construct the literal (if any), length, and distance codes and
|
||||
the tables needed to decode them (using huft_build() from inflate.c),
|
||||
and call the appropriate routine for the type of data in the remainder
|
||||
of the stream. The four routines are nearly identical, differing only
|
||||
in whether the literal is decoded or simply read in, and in how many
|
||||
bits are read in, uncoded, for the low distance bits. */
|
||||
{
|
||||
unsigned r; /* return codes */
|
||||
struct huft *tb; /* literal code table */
|
||||
struct huft *tl; /* length code table */
|
||||
struct huft *td; /* distance code table */
|
||||
unsigned bb; /* bits for tb */
|
||||
unsigned bl; /* bits for tl */
|
||||
unsigned bd; /* bits for td */
|
||||
unsigned bdl; /* number of uncoded lower distance bits */
|
||||
unsigned l[256]; /* bit lengths for codes */
|
||||
|
||||
#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
|
||||
if (G.redirect_slide)
|
||||
/* For 16-bit systems, it has already been checked at DLL entrance that
|
||||
* the buffer size in G.redirect_size does not exceed unsigned range.
|
||||
*/
|
||||
G._wsize = G.redirect_size, redirSlide = G.redirect_buffer;
|
||||
else
|
||||
#if defined(USE_DEFLATE64) && defined(INT_16BIT)
|
||||
/* For systems using 16-bit ints, reduce the used buffer size below
|
||||
* the limit of "unsigned int" numbers range.
|
||||
*/
|
||||
G._wsize = WSIZE>>1, redirSlide = slide;
|
||||
#else /* !(USE_DEFLATE64 && INT_16BIT) */
|
||||
G._wsize = WSIZE, redirSlide = slide;
|
||||
#endif /* !(USE_DEFLATE64 && INT_16BIT) */
|
||||
#endif /* DLL && !NO_SLIDE_REDIR */
|
||||
|
||||
/* Tune base table sizes. Note: I thought that to truly optimize speed,
|
||||
I would have to select different bl, bd, and bb values for different
|
||||
compressed file sizes. I was surprised to find out that the values of
|
||||
7, 7, and 9 worked best over a very wide range of sizes, except that
|
||||
bd = 8 worked marginally better for large compressed sizes. */
|
||||
bl = 7;
|
||||
bd = (G.csize + G.incnt) > 200000L ? 8 : 7;
|
||||
|
||||
#ifdef DEBUG
|
||||
G.hufts = 0; /* initialize huft's malloc'ed */
|
||||
#endif
|
||||
|
||||
if (G.lrec.general_purpose_bit_flag & 4)
|
||||
/* With literal tree--minimum match length is 3 */
|
||||
{
|
||||
bb = 9; /* base table size for literals */
|
||||
if ((r = get_tree(__G__ l, 256)) != 0)
|
||||
return (int)r;
|
||||
if ((r = huft_build(__G__ l, 256, 256, NULL, NULL, &tb, &bb)) != 0)
|
||||
{
|
||||
if (r == 1)
|
||||
huft_free(tb);
|
||||
return (int)r;
|
||||
}
|
||||
if ((r = get_tree(__G__ l, 64)) != 0) {
|
||||
huft_free(tb);
|
||||
return (int)r;
|
||||
}
|
||||
if ((r = huft_build(__G__ l, 64, 0, cplen3, extra, &tl, &bl)) != 0)
|
||||
{
|
||||
if (r == 1)
|
||||
huft_free(tl);
|
||||
huft_free(tb);
|
||||
return (int)r;
|
||||
}
|
||||
}
|
||||
else
|
||||
/* No literal tree--minimum match length is 2 */
|
||||
{
|
||||
tb = (struct huft *)NULL;
|
||||
if ((r = get_tree(__G__ l, 64)) != 0)
|
||||
return (int)r;
|
||||
if ((r = huft_build(__G__ l, 64, 0, cplen2, extra, &tl, &bl)) != 0)
|
||||
{
|
||||
if (r == 1)
|
||||
huft_free(tl);
|
||||
return (int)r;
|
||||
}
|
||||
}
|
||||
|
||||
if ((r = get_tree(__G__ l, 64)) != 0) {
|
||||
huft_free(tl);
|
||||
if (tb != (struct huft *)NULL) huft_free(tb);
|
||||
return (int)r;
|
||||
}
|
||||
if (G.lrec.general_purpose_bit_flag & 2) /* true if 8K */
|
||||
{
|
||||
bdl = 7;
|
||||
r = huft_build(__G__ l, 64, 0, cpdist8, extra, &td, &bd);
|
||||
}
|
||||
else /* else 4K */
|
||||
{
|
||||
bdl = 6;
|
||||
r = huft_build(__G__ l, 64, 0, cpdist4, extra, &td, &bd);
|
||||
}
|
||||
if (r != 0)
|
||||
{
|
||||
if (r == 1)
|
||||
huft_free(td);
|
||||
huft_free(tl);
|
||||
if (tb != (struct huft *)NULL) huft_free(tb);
|
||||
return (int)r;
|
||||
}
|
||||
|
||||
if (tb != NULL) {
|
||||
r = explode_lit(__G__ tb, tl, td, bb, bl, bd, bdl);
|
||||
huft_free(tb);
|
||||
} else {
|
||||
r = explode_nolit(__G__ tl, td, bl, bd, bdl);
|
||||
}
|
||||
|
||||
huft_free(td);
|
||||
huft_free(tl);
|
||||
Trace((stderr, "<%u > ", G.hufts));
|
||||
return (int)r;
|
||||
}
|
||||
|
||||
/* so explode.c and inflate.c can be compiled together into one object: */
|
||||
#undef DECODEHUFT
|
||||
#undef NEEDBITS
|
||||
#undef DUMPBITS
|
||||
#undef wszimpl
|
2820
programs/fs/unzip60/extract.c
Normal file
2820
programs/fs/unzip60/extract.c
Normal file
File diff suppressed because it is too large
Load Diff
10
programs/fs/unzip60/file_id.diz
Normal file
10
programs/fs/unzip60/file_id.diz
Normal file
@ -0,0 +1,10 @@
|
||||
Info-ZIP's UnZip 6.0: generic C sources
|
||||
Complete C source code for Info-ZIP's
|
||||
PKUNZIP-compatible .zip extractor, for
|
||||
all supported compilers and platforms
|
||||
(Unix, OS/2, MS-DOS, NT, VMS, Amiga,
|
||||
Atari, Mac, Acorn, VM/CMS, etc.), plus
|
||||
lots of pretty decent documentation.
|
||||
This is FREE (but copyrighted) software.
|
||||
See LICENSE for details on distribution
|
||||
and reuse.
|
2855
programs/fs/unzip60/fileio.c
Normal file
2855
programs/fs/unzip60/fileio.c
Normal file
File diff suppressed because it is too large
Load Diff
8
programs/fs/unzip60/flexos/Contents
Normal file
8
programs/fs/unzip60/flexos/Contents
Normal file
@ -0,0 +1,8 @@
|
||||
Contents of the "flexos" subdirectory for UnZip 5.32 and later:
|
||||
|
||||
Contents this file
|
||||
README notes about limitations and assumptions of the FlexOS port
|
||||
flexos.c OS-dependent UnZip routines for FlexOS
|
||||
flxcfg.h OS-dependent configuration, included by unzpriv.h
|
||||
hc.pro profile for MetaWare High C
|
||||
makefile makefile for MetaWare High C, PAMAKE
|
39
programs/fs/unzip60/flexos/README
Normal file
39
programs/fs/unzip60/flexos/README
Normal file
@ -0,0 +1,39 @@
|
||||
This should be considered an initial port - there will probably be some
|
||||
bugs and non-functioning features.
|
||||
|
||||
The only functionality that has had any real testing is "unzip filename",
|
||||
anything else is basically untested.
|
||||
|
||||
This has been cross-compiled from DOS using Metaware's High C compiler
|
||||
and the DOS version of pamake (v3.0). It should compile with the FlexOS
|
||||
hosted version of HighC, and the makefile could be converted to work
|
||||
with the native FlexOS make.
|
||||
|
||||
The following considerations apply:
|
||||
|
||||
)Compiled against and linked with portlib.
|
||||
)Used on FlexOS 286 v2.32
|
||||
)Volume labels are not supported - this is due to the way FlexOS decides
|
||||
if a drive has case-sensitive filenames based upon the contents of the
|
||||
volume label.
|
||||
)No special handling for case-sensitive media (see above).
|
||||
)Not using the PORTLIB wildarg routine (i.e., UnZip does its own globbing).
|
||||
)Based upon the MSDOS port.
|
||||
)Filenames are in FAT format.
|
||||
)The current version of getch is a cheat (simply using getchar()). I
|
||||
should interrogate stdin and if it's a FlexOS console use special code
|
||||
to turn off echo and just read one char.
|
||||
)Only the basic MSDOS FAT file attributes are saved/restored. There is
|
||||
currently no support for the FlexOS extended file attributes.
|
||||
)There is some code that should attempt to do the correct thing when a
|
||||
pathspec with a logical name definition is used (e.g., "system:path/to/it");
|
||||
however it again has not been stress-tested.
|
||||
)There is no special handling for floppy drives, there probably should
|
||||
be.
|
||||
)The dateformat is compiled in as DMY (shoot me I'm British), I'm not
|
||||
sure if there is actually a way to get locale info.
|
||||
)The assembler speedups haven't yet been ported to ASM86 (should simply
|
||||
be a change of syntax)
|
||||
|
||||
--
|
||||
D.Fawcus 17 July 1997
|
936
programs/fs/unzip60/flexos/flexos.c
Normal file
936
programs/fs/unzip60/flexos/flexos.c
Normal file
@ -0,0 +1,936 @@
|
||||
/*
|
||||
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 unzip.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
|
||||
*/
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
flexos.c
|
||||
|
||||
FlexOS-specific routines for use with Info-ZIP's UnZip 5.2 and later.
|
||||
|
||||
Based upon the MSDOS version of this file (msdos/msdos.c)
|
||||
|
||||
Contains: do_wild()
|
||||
mapattr()
|
||||
mapname()
|
||||
map2fat()
|
||||
checkdir()
|
||||
close_outfile()
|
||||
dateformat()
|
||||
version()
|
||||
_wildarg()
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
#define UNZIP_INTERNAL
|
||||
#include "unzip.h"
|
||||
|
||||
#include <flexif.h>
|
||||
|
||||
/* The following should really be a static declaration, but the compiler
|
||||
complains (crappy compiler can't cope with a static forward declaration).
|
||||
*/
|
||||
extern void map2fat OF((char *pathcomp, char *last_dot));
|
||||
|
||||
static int created_dir; /* used by mapname(), checkdir() */
|
||||
static int renamed_fullpath; /* ditto */
|
||||
|
||||
/*****************************/
|
||||
/* Strings used in flexos.c */
|
||||
/*****************************/
|
||||
|
||||
#ifndef SFX
|
||||
static ZCONST char Far CantAllocateWildcard[] =
|
||||
"warning: cannot allocate wildcard buffers\n";
|
||||
#endif
|
||||
static ZCONST char Far WarnDirTraversSkip[] =
|
||||
"warning: skipped \"../\" path component(s) in %s\n";
|
||||
static ZCONST char Far Creating[] = " creating: %s\n";
|
||||
static ZCONST char Far ConversionFailed[] =
|
||||
"mapname: conversion of %s failed\n";
|
||||
static ZCONST char Far PathTooLong[] = "checkdir error: path too long: %s\n";
|
||||
static ZCONST char Far CantCreateDir[] = "checkdir error: cannot create %s\n\
|
||||
unable to process %s.\n";
|
||||
static ZCONST char Far DirIsntDirectory[] =
|
||||
"checkdir error: %s exists but is not directory\n\
|
||||
unable to process %s.\n";
|
||||
static ZCONST char Far PathTooLongTrunc[] =
|
||||
"checkdir warning: path too long; truncating\n %s\n\
|
||||
-> %s\n";
|
||||
#if (!defined(SFX) || defined(SFX_EXDIR))
|
||||
static ZCONST char Far CantCreateExtractDir[] =
|
||||
"checkdir: cannot create extraction directory: %s\n";
|
||||
#endif
|
||||
|
||||
#include <dirent.h>
|
||||
|
||||
#ifndef SFX
|
||||
|
||||
/************************/
|
||||
/* Function do_wild() */ /* identical to OS/2 version */
|
||||
/************************/
|
||||
|
||||
char *do_wild(__G__ wildspec)
|
||||
__GDEF
|
||||
ZCONST char *wildspec; /* only used first time on a given dir */
|
||||
{
|
||||
static DIR *wild_dir = (DIR *)NULL;
|
||||
static ZCONST char *wildname;
|
||||
static char *dirname, matchname[FILNAMSIZ];
|
||||
static int notfirstcall=FALSE, have_dirname, dirnamelen;
|
||||
char *fnamestart;
|
||||
struct dirent *file;
|
||||
|
||||
/* Even when we're just returning wildspec, we *always* do so in
|
||||
* matchname[]--calling routine is allowed to append four characters
|
||||
* to the returned string, and wildspec may be a pointer to argv[].
|
||||
*/
|
||||
if (!notfirstcall) { /* first call: must initialize everything */
|
||||
notfirstcall = TRUE;
|
||||
|
||||
if (!iswild(wildspec)) {
|
||||
strncpy(matchname, wildspec, FILNAMSIZ);
|
||||
matchname[FILNAMSIZ-1] = '\0';
|
||||
have_dirname = FALSE;
|
||||
dir = NULL;
|
||||
return matchname;
|
||||
}
|
||||
|
||||
/* break the wildspec into a directory part and a wildcard filename */
|
||||
if ((wildname = strrchr(wildspec, '/')) == (ZCONST char *)NULL &&
|
||||
(wildname = strrchr(wildspec, ':')) == (ZCONST char *)NULL) {
|
||||
dirname = ".";
|
||||
dirnamelen = 1;
|
||||
have_dirname = FALSE;
|
||||
wildname = wildspec;
|
||||
} else {
|
||||
++wildname; /* point at character after '/' or ':' */
|
||||
dirnamelen = (int)(wildname - wildspec);
|
||||
if ((dirname = (char *)malloc(dirnamelen+1)) == (char *)NULL) {
|
||||
Info(slide, 1, ((char *)slide,
|
||||
LoadFarString(CantAllocateWildcard)));
|
||||
strncpy(matchname, wildspec, FILNAMSIZ);
|
||||
matchname[FILNAMSIZ-1] = '\0';
|
||||
return matchname; /* but maybe filespec was not a wildcard */
|
||||
}
|
||||
/* GRR: cannot strip trailing char for opendir since might be "d:/" or "d:"
|
||||
* (would have to check for "./" at end--let opendir handle it instead) */
|
||||
strncpy(dirname, wildspec, dirnamelen);
|
||||
dirname[dirnamelen] = '\0'; /* terminate for strcpy below */
|
||||
have_dirname = TRUE;
|
||||
}
|
||||
Trace((stderr, "do_wild: dirname = [%s]\n", FnFilter1(dirname)));
|
||||
|
||||
if ((wild_dir = opendir(dirname)) != (DIR *)NULL) {
|
||||
if (have_dirname) {
|
||||
strcpy(matchname, dirname);
|
||||
fnamestart = matchname + dirnamelen;
|
||||
} else
|
||||
fnamestart = matchname;
|
||||
while ((file = readdir(wild_dir)) != (struct dirent *)NULL) {
|
||||
Trace((stderr, "do_wild: readdir returns %s\n",
|
||||
FnFilter1(file->d_name)));
|
||||
strcpy(fnamestart, file->d_name);
|
||||
if (strrchr(fnamestart, '.') == (char *)NULL)
|
||||
strcat(fnamestart, ".");
|
||||
if (match(fnamestart, wildname, 1 WISEP) && /* 1=ignore case */
|
||||
/* skip "." and ".." directory entries */
|
||||
strcmp(fnamestart, ".") && strcmp(fnamestart, "..")) {
|
||||
Trace((stderr, "do_wild: match() succeeds\n"));
|
||||
/* remove trailing dot */
|
||||
fnamestart += strlen(fnamestart) - 1;
|
||||
if (*fnamestart == '.')
|
||||
*fnamestart = '\0';
|
||||
return matchname;
|
||||
}
|
||||
}
|
||||
/* if we get to here directory is exhausted, so close it */
|
||||
closedir(wild_dir);
|
||||
wild_dir = (DIR *)NULL;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
Trace((stderr, "do_wild: opendir(%s) returns NULL\n",
|
||||
FnFilter1(dirname)));
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
/* return the raw wildspec in case that works (e.g., directory not
|
||||
* searchable, but filespec was not wild and file is readable) */
|
||||
strncpy(matchname, wildspec, FILNAMSIZ);
|
||||
matchname[FILNAMSIZ-1] = '\0';
|
||||
return matchname;
|
||||
}
|
||||
|
||||
/* last time through, might have failed opendir but returned raw wildspec */
|
||||
if (wild_dir == (DIR *)NULL) {
|
||||
notfirstcall = FALSE; /* nothing left to try--reset for new wildspec */
|
||||
if (have_dirname)
|
||||
free(dirname);
|
||||
return (char *)NULL;
|
||||
}
|
||||
|
||||
/* If we've gotten this far, we've read and matched at least one entry
|
||||
* successfully (in a previous call), so dirname has been copied into
|
||||
* matchname already.
|
||||
*/
|
||||
if (have_dirname) {
|
||||
/* strcpy(matchname, dirname); */
|
||||
fnamestart = matchname + dirnamelen;
|
||||
} else
|
||||
fnamestart = matchname;
|
||||
while ((file = readdir(wild_dir)) != (struct dirent *)NULL) {
|
||||
Trace((stderr, "do_wild: readdir returns %s\n",
|
||||
FnFilter1(file->d_name)));
|
||||
strcpy(fnamestart, file->d_name);
|
||||
if (strrchr(fnamestart, '.') == (char *)NULL)
|
||||
strcat(fnamestart, ".");
|
||||
if (match(fnamestart, wildname, 1 WISEP)) { /* 1 == ignore case */
|
||||
Trace((stderr, "do_wild: match() succeeds\n"));
|
||||
/* remove trailing dot */
|
||||
fnamestart += strlen(fnamestart) - 1;
|
||||
if (*fnamestart == '.')
|
||||
*fnamestart = '\0';
|
||||
return matchname;
|
||||
}
|
||||
}
|
||||
|
||||
closedir(wild_dir); /* have read at least one entry; nothing left */
|
||||
wild_dir = (DIR *)NULL;
|
||||
notfirstcall = FALSE; /* reset for new wildspec */
|
||||
if (have_dirname)
|
||||
free(dirname);
|
||||
return (char *)NULL;
|
||||
|
||||
} /* end function do_wild() */
|
||||
|
||||
#endif /* !SFX */
|
||||
|
||||
|
||||
|
||||
/**********************/
|
||||
/* Function mapattr() */
|
||||
/**********************/
|
||||
|
||||
int mapattr(__G)
|
||||
__GDEF
|
||||
{
|
||||
/* set archive bit (file is not backed up): */
|
||||
G.pInfo->file_attr = (unsigned)(G.crec.external_file_attributes & 7) | 32;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************/
|
||||
/* Function mapname() */
|
||||
/**********************/
|
||||
|
||||
int mapname(__G__ renamed)
|
||||
__GDEF
|
||||
int renamed;
|
||||
/*
|
||||
* returns:
|
||||
* MPN_OK - no problem detected
|
||||
* MPN_INF_TRUNC - caution (truncated filename)
|
||||
* MPN_INF_SKIP - info "skip entry" (dir doesn't exist)
|
||||
* MPN_ERR_SKIP - error -> skip entry
|
||||
* MPN_ERR_TOOLONG - error -> path is too long
|
||||
* MPN_NOMEM - error (memory allocation failed) -> skip entry
|
||||
* [also MPN_VOL_LABEL, MPN_CREATED_DIR]
|
||||
*/
|
||||
{
|
||||
char pathcomp[FILNAMSIZ]; /* path-component buffer */
|
||||
char *pp, *cp=(char *)NULL; /* character pointers */
|
||||
char *lastsemi=(char *)NULL; /* pointer to last semi-colon in pathcomp */
|
||||
char *last_dot=(char *)NULL; /* last dot not converted to underscore */
|
||||
int dotname = FALSE; /* path component begins with dot? */
|
||||
int killed_ddot = FALSE; /* is set when skipping "../" pathcomp */
|
||||
int error = MPN_OK;
|
||||
register unsigned workch; /* hold the character being tested */
|
||||
|
||||
|
||||
if (G.pInfo->vollabel)
|
||||
return MPN_VOL_LABEL; /* Cannot set disk volume labels in FlexOS */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Initialize various pointers and counters and stuff.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
/* can create path as long as not just freshening, or if user told us */
|
||||
G.create_dirs = (!uO.fflag || renamed);
|
||||
|
||||
created_dir = FALSE; /* not yet */
|
||||
renamed_fullpath = FALSE;
|
||||
|
||||
if (renamed) {
|
||||
cp = G.filename - 1; /* point to beginning of renamed name... */
|
||||
while (*++cp)
|
||||
if (*cp == '\\') /* convert backslashes to forward */
|
||||
*cp = '/';
|
||||
cp = G.filename;
|
||||
/* use temporary rootpath if user gave full pathname */
|
||||
if (G.filename[0] == '/') {
|
||||
renamed_fullpath = TRUE;
|
||||
pathcomp[0] = '/'; /* copy the '/' and terminate */
|
||||
pathcomp[1] = '\0';
|
||||
++cp;
|
||||
} else if (isalpha((uch)G.filename[0]) && G.filename[1] == ':') {
|
||||
renamed_fullpath = TRUE;
|
||||
pp = pathcomp;
|
||||
*pp++ = *cp++; /* copy the "d:" (+ '/', possibly) */
|
||||
*pp++ = *cp++;
|
||||
if (*cp == '/')
|
||||
*pp++ = *cp++; /* otherwise add "./"? */
|
||||
*pp = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/* pathcomp is ignored unless renamed_fullpath is TRUE: */
|
||||
if ((error = checkdir(__G__ pathcomp, INIT)) != 0) /* initialize path buf */
|
||||
return error; /* ...unless no mem or vol label on hard disk */
|
||||
|
||||
*pathcomp = '\0'; /* initialize translation buffer */
|
||||
pp = pathcomp; /* point to translation buffer */
|
||||
if (!renamed) { /* cp already set if renamed */
|
||||
if (uO.jflag) /* junking directories */
|
||||
cp = (char *)strrchr(G.filename, '/');
|
||||
if (cp == (char *)NULL) /* no '/' or not junking dirs */
|
||||
cp = G.filename; /* point to internal zipfile-member pathname */
|
||||
else
|
||||
++cp; /* point to start of last component of path */
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Begin main loop through characters in filename.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
while ((workch = (uch)*cp++) != 0) {
|
||||
|
||||
switch (workch) {
|
||||
case '/': /* can assume -j flag not given */
|
||||
*pp = '\0';
|
||||
map2fat(pathcomp, last_dot); /* 8.3 truncation (in place) */
|
||||
last_dot = (char *)NULL;
|
||||
if (strcmp(pathcomp, ".") == 0) {
|
||||
/* don't bother appending "./" to the path */
|
||||
*pathcomp = '\0';
|
||||
} else if (!uO.ddotflag && strcmp(pathcomp, "..") == 0) {
|
||||
/* "../" dir traversal detected, skip over it */
|
||||
*pathcomp = '\0';
|
||||
killed_ddot = TRUE; /* set "show message" flag */
|
||||
}
|
||||
/* when path component is not empty, append it now */
|
||||
if (*pathcomp != '\0' &&
|
||||
((error = checkdir(__G__ pathcomp, APPEND_DIR))
|
||||
& MPN_MASK) > MPN_INF_TRUNC)
|
||||
return error;
|
||||
pp = pathcomp; /* reset conversion buffer for next piece */
|
||||
lastsemi = (char *)NULL; /* leave direct. semi-colons alone */
|
||||
break;
|
||||
|
||||
case '.':
|
||||
if (pp == pathcomp) { /* nothing appended yet... */
|
||||
if (*cp == '.' && cp[1] == '/') { /* "../" */
|
||||
*pp++ = '.'; /* add first dot, unchanged... */
|
||||
++cp; /* skip second dot, since it will */
|
||||
} else { /* be "added" at end of if-block */
|
||||
*pp++ = '_'; /* FAT doesn't allow null filename */
|
||||
dotname = TRUE; /* bodies, so map .exrc -> _.exrc */
|
||||
} /* (extra '_' now, "dot" below) */
|
||||
} else if (dotname) { /* found a second dot, but still */
|
||||
dotname = FALSE; /* have extra leading underscore: */
|
||||
*pp = '\0'; /* remove it by shifting chars */
|
||||
pp = pathcomp + 1; /* left one space (e.g., .p1.p2: */
|
||||
while (pp[1]) { /* __p1 -> _p1_p2 -> _p1.p2 when */
|
||||
*pp = pp[1]; /* finished) [opt.: since first */
|
||||
++pp; /* two chars are same, can start */
|
||||
} /* shifting at second position] */
|
||||
}
|
||||
last_dot = pp; /* point at last dot so far... */
|
||||
*pp++ = '_'; /* convert dot to underscore for now */
|
||||
break;
|
||||
|
||||
/* drive names are not stored in zipfile, so no colons allowed;
|
||||
* no brackets or most other punctuation either (all of which
|
||||
* can appear in Unix-created archives; backslash is particularly
|
||||
* bad unless all necessary directories exist) */
|
||||
case '[': /* these punctuation characters forbidden */
|
||||
case ']': /* only on plain FAT file systems */
|
||||
case '+':
|
||||
case ',':
|
||||
case '=':
|
||||
case ':': /* special shell characters of command.com */
|
||||
case '\\': /* (device and directory limiters, wildcard */
|
||||
case '"': /* characters, stdin/stdout redirection and */
|
||||
case '<': /* pipe indicators and the quote sign) are */
|
||||
case '>': /* never allowed in filenames on (V)FAT */
|
||||
case '|':
|
||||
case '*':
|
||||
case '?':
|
||||
*pp++ = '_';
|
||||
break;
|
||||
|
||||
case ';': /* start of VMS version? */
|
||||
lastsemi = pp;
|
||||
break;
|
||||
|
||||
case ' ': /* change spaces to underscores */
|
||||
if (uO.sflag) /* only if requested */
|
||||
*pp++ = '_';
|
||||
else
|
||||
*pp++ = (char)workch;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* allow ASCII 255 and European characters in filenames: */
|
||||
if (isprint(workch) || workch >= 127)
|
||||
*pp++ = (char)workch;
|
||||
|
||||
} /* end switch */
|
||||
} /* end while loop */
|
||||
|
||||
/* Show warning when stripping insecure "parent dir" path components */
|
||||
if (killed_ddot && QCOND2) {
|
||||
Info(slide, 0, ((char *)slide, LoadFarString(WarnDirTraversSkip),
|
||||
FnFilter1(G.filename)));
|
||||
if (!(error & ~MPN_MASK))
|
||||
error = (error & MPN_MASK) | PK_WARN;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Report if directory was created (and no file to create: filename ended
|
||||
in '/'), check name to be sure it exists, and combine path and name be-
|
||||
fore exiting.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (G.filename[strlen(G.filename) - 1] == '/') {
|
||||
checkdir(__G__ G.filename, GETPATH);
|
||||
if (created_dir) {
|
||||
if (QCOND2) {
|
||||
Info(slide, 0, ((char *)slide, LoadFarString(Creating),
|
||||
FnFilter1(G.filename)));
|
||||
}
|
||||
/* set dir time (note trailing '/') */
|
||||
return (error & ~MPN_MASK) | MPN_CREATED_DIR;
|
||||
}
|
||||
/* dir existed already; don't look for data to extract */
|
||||
return (error & ~MPN_MASK) | MPN_INF_SKIP;
|
||||
}
|
||||
|
||||
*pp = '\0'; /* done with pathcomp: terminate it */
|
||||
|
||||
/* if not saving them, remove VMS version numbers (appended ";###") */
|
||||
if (!uO.V_flag && lastsemi) {
|
||||
pp = lastsemi; /* semi-colon was omitted: expect all #'s */
|
||||
while (isdigit((uch)(*pp)))
|
||||
++pp;
|
||||
if (*pp == '\0') /* only digits between ';' and end: nuke */
|
||||
*lastsemi = '\0';
|
||||
}
|
||||
|
||||
map2fat(pathcomp, last_dot); /* 8.3 truncation (in place) */
|
||||
|
||||
if (*pathcomp == '\0') {
|
||||
Info(slide, 1, ((char *)slide, LoadFarString(ConversionFailed),
|
||||
FnFilter1(G.filename)));
|
||||
return (error & ~MPN_MASK) | MPN_ERR_SKIP;
|
||||
}
|
||||
|
||||
checkdir(__G__ pathcomp, APPEND_NAME); /* returns 1 if truncated: care? */
|
||||
checkdir(__G__ G.filename, GETPATH);
|
||||
|
||||
return error;
|
||||
|
||||
} /* end function mapname() */
|
||||
|
||||
|
||||
|
||||
|
||||
/**********************/
|
||||
/* Function map2fat() */
|
||||
/**********************/
|
||||
|
||||
static void map2fat(pathcomp, last_dot)
|
||||
char *pathcomp, *last_dot;
|
||||
{
|
||||
char *pEnd = pathcomp + strlen(pathcomp);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Case 1: filename has no dot, so figure out if we should add one. Note
|
||||
that the algorithm does not try to get too fancy: if there are no dots
|
||||
already, the name either gets truncated at 8 characters or the last un-
|
||||
derscore is converted to a dot (only if more characters are saved that
|
||||
way). In no case is a dot inserted between existing characters.
|
||||
|
||||
GRR: have problem if filename is volume label??
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
/* pEnd = pathcomp + strlen(pathcomp); */
|
||||
if (last_dot == (char *)NULL) { /* no dots: check for underscores... */
|
||||
char *plu = strrchr(pathcomp, '_'); /* pointer to last underscore */
|
||||
|
||||
if (plu == (char *)NULL) { /* no dots, no underscores: truncate at */
|
||||
if (pEnd > pathcomp+8) /* 8 chars (could insert '.' and keep 11) */
|
||||
*(pEnd = pathcomp+8) = '\0';
|
||||
} else if (MIN(plu - pathcomp, 8) + MIN(pEnd - plu - 1, 3) > 8) {
|
||||
last_dot = plu; /* be lazy: drop through to next if-block */
|
||||
} else if ((pEnd - pathcomp) > 8) /* more fits into just basename */
|
||||
pathcomp[8] = '\0'; /* than if convert last underscore to dot */
|
||||
/* else whole thing fits into 8 chars or less: no change */
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Case 2: filename has dot in it, so truncate first half at 8 chars (shift
|
||||
extension if necessary) and second half at three.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (last_dot != (char *)NULL) { /* one dot (or two, in the case of */
|
||||
*last_dot = '.'; /* "..") is OK: put it back in */
|
||||
|
||||
if ((last_dot - pathcomp) > 8) {
|
||||
char *p=last_dot, *q=pathcomp+8;
|
||||
int i;
|
||||
|
||||
for (i = 0; (i < 4) && *p; ++i) /* too many chars in basename: */
|
||||
*q++ = *p++; /* shift extension left and */
|
||||
*q = '\0'; /* truncate/terminate it */
|
||||
} else if ((pEnd - last_dot) > 4)
|
||||
last_dot[4] = '\0'; /* too many chars in extension */
|
||||
/* else filename is fine as is: no change */
|
||||
}
|
||||
} /* end function map2fat() */
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************/
|
||||
/* Function checkdir() */
|
||||
/***********************/
|
||||
|
||||
int checkdir(__G__ pathcomp, flag)
|
||||
__GDEF
|
||||
char *pathcomp;
|
||||
int flag;
|
||||
/*
|
||||
* returns:
|
||||
* MPN_OK - no problem detected
|
||||
* MPN_INF_TRUNC - (on APPEND_NAME) truncated filename
|
||||
* MPN_INF_SKIP - path doesn't exist, not allowed to create
|
||||
* MPN_ERR_SKIP - path doesn't exist, tried to create and failed; or path
|
||||
* exists and is not a directory, but is supposed to be
|
||||
* MPN_ERR_TOOLONG - path is too long
|
||||
* MPN_NOMEM - can't allocate memory for filename buffers
|
||||
*/
|
||||
{
|
||||
static int rootlen = 0; /* length of rootpath */
|
||||
static char *rootpath; /* user's "extract-to" directory */
|
||||
static char *buildpath; /* full path (so far) to extracted file */
|
||||
static char *end; /* pointer to end of buildpath ('\0') */
|
||||
|
||||
# define FN_MASK 7
|
||||
# define FUNCTION (flag & FN_MASK)
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
APPEND_DIR: append the path component to the path being built and check
|
||||
for its existence. If doesn't exist and we are creating directories, do
|
||||
so for this one; else signal success or error as appropriate.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (FUNCTION == APPEND_DIR) {
|
||||
int too_long = FALSE;
|
||||
|
||||
Trace((stderr, "appending dir segment [%s]\n", FnFilter1(pathcomp)));
|
||||
while ((*end = *pathcomp++) != '\0')
|
||||
++end;
|
||||
|
||||
/* GRR: could do better check, see if overrunning buffer as we go:
|
||||
* check end-buildpath after each append, set warning variable if
|
||||
* within 20 of FILNAMSIZ; then if var set, do careful check when
|
||||
* appending. Clear variable when begin new path. */
|
||||
|
||||
if ((end-buildpath) > FILNAMSIZ-3) /* need '/', one-char name, '\0' */
|
||||
too_long = TRUE; /* check if extracting directory? */
|
||||
if (stat(buildpath, &G.statbuf)) /* path doesn't exist */
|
||||
{
|
||||
if (!G.create_dirs) { /* told not to create (freshening) */
|
||||
free(buildpath);
|
||||
return MPN_INF_SKIP; /* path doesn't exist: nothing to do */
|
||||
}
|
||||
if (too_long) {
|
||||
Info(slide, 1, ((char *)slide, LoadFarString(PathTooLong),
|
||||
FnFilter1(buildpath)));
|
||||
free(buildpath);
|
||||
/* no room for filenames: fatal */
|
||||
return MPN_ERR_TOOLONG;
|
||||
}
|
||||
if (mkdir(buildpath, 0777) == -1) { /* create the directory */
|
||||
Info(slide, 1, ((char *)slide, LoadFarString(CantCreateDir),
|
||||
FnFilter2(buildpath), FnFilter1(G.filename)));
|
||||
free(buildpath);
|
||||
/* path didn't exist, tried to create, failed */
|
||||
return MPN_ERR_SKIP;
|
||||
}
|
||||
created_dir = TRUE;
|
||||
} else if (!S_ISDIR(G.statbuf.st_mode)) {
|
||||
Info(slide, 1, ((char *)slide, LoadFarString(DirIsntDirectory),
|
||||
FnFilter2(buildpath), FnFilter1(G.filename)));
|
||||
free(buildpath);
|
||||
/* path existed but wasn't dir */
|
||||
return MPN_ERR_SKIP;
|
||||
}
|
||||
if (too_long) {
|
||||
Info(slide, 1, ((char *)slide, LoadFarString(PathTooLong),
|
||||
FnFilter1(buildpath)));
|
||||
free(buildpath);
|
||||
/* no room for filenames: fatal */
|
||||
return MPN_ERR_TOOLONG;
|
||||
}
|
||||
*end++ = '/';
|
||||
*end = '\0';
|
||||
Trace((stderr, "buildpath now = [%s]\n", FnFilter1(buildpath)));
|
||||
return MPN_OK;
|
||||
|
||||
} /* end if (FUNCTION == APPEND_DIR) */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
GETPATH: copy full path to the string pointed at by pathcomp, and free
|
||||
buildpath.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (FUNCTION == GETPATH) {
|
||||
strcpy(pathcomp, buildpath);
|
||||
Trace((stderr, "getting and freeing path [%s]\n",
|
||||
FnFilter1(pathcomp)));
|
||||
free(buildpath);
|
||||
buildpath = end = (char *)NULL;
|
||||
return MPN_OK;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
APPEND_NAME: assume the path component is the filename; append it and
|
||||
return without checking for existence.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (FUNCTION == APPEND_NAME) {
|
||||
Trace((stderr, "appending filename [%s]\n", FnFilter1(pathcomp)));
|
||||
while ((*end = *pathcomp++) != '\0') {
|
||||
++end;
|
||||
if ((end-buildpath) >= FILNAMSIZ) {
|
||||
*--end = '\0';
|
||||
Info(slide, 1, ((char *)slide, LoadFarString(PathTooLongTrunc),
|
||||
FnFilter1(G.filename), FnFilter2(buildpath)));
|
||||
return MPN_INF_TRUNC; /* filename truncated */
|
||||
}
|
||||
}
|
||||
Trace((stderr, "buildpath now = [%s]\n", FnFilter1(buildpath)));
|
||||
/* could check for existence here, prompt for new name... */
|
||||
return MPN_OK;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
INIT: allocate and initialize buffer space for the file currently being
|
||||
extracted. If file was renamed with an absolute path, don't prepend the
|
||||
extract-to path.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (FUNCTION == INIT) {
|
||||
Trace((stderr, "initializing buildpath to "));
|
||||
/* allocate space for full filename, root path, and maybe "./" */
|
||||
if ((buildpath = (char *)malloc(strlen(G.filename)+rootlen+3)) ==
|
||||
(char *)NULL)
|
||||
return MPN_NOMEM;
|
||||
if (renamed_fullpath) { /* pathcomp = valid data */
|
||||
end = buildpath;
|
||||
while ((*end = *pathcomp++) != '\0')
|
||||
++end;
|
||||
} else if (rootlen > 0) {
|
||||
strcpy(buildpath, rootpath);
|
||||
end = buildpath + rootlen;
|
||||
} else {
|
||||
*buildpath = '\0';
|
||||
end = buildpath;
|
||||
}
|
||||
Trace((stderr, "[%s]\n", FnFilter1(buildpath)));
|
||||
return MPN_OK;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
ROOT: if appropriate, store the path in rootpath and create it if neces-
|
||||
sary; else assume it's a zipfile member and return. This path segment
|
||||
gets used in extracting all members from every zipfile specified on the
|
||||
command line. Note that under FlexOS, if a candidate extract-to
|
||||
directory specification includes a drive letter (leading "x:"), it is
|
||||
treated just as if it had a trailing '/'--that is, one directory level
|
||||
will be created if the path doesn't exist, unless this is otherwise pro-
|
||||
hibited (e.g., freshening).
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#if (!defined(SFX) || defined(SFX_EXDIR))
|
||||
if (FUNCTION == ROOT) {
|
||||
Trace((stderr, "initializing root path to [%s]\n",
|
||||
FnFilter1(pathcomp)));
|
||||
if (pathcomp == (char *)NULL) {
|
||||
rootlen = 0;
|
||||
return MPN_OK;
|
||||
}
|
||||
if (rootlen > 0) /* rootpath was already set, nothing to do */
|
||||
return MPN_OK;
|
||||
if ((rootlen = strlen(pathcomp)) > 0) {
|
||||
int had_trailing_pathsep=FALSE, add_dot=FALSE;
|
||||
char *tmproot;
|
||||
|
||||
if ((tmproot = (char *)malloc(rootlen+3)) == (char *)NULL) {
|
||||
rootlen = 0;
|
||||
return MPN_NOMEM;
|
||||
}
|
||||
strcpy(tmproot, pathcomp);
|
||||
if (tmproot[rootlen-1] == '/' || tmproot[rootlen-1] == '\\') {
|
||||
tmproot[--rootlen] = '\0';
|
||||
had_trailing_pathsep = TRUE;
|
||||
}
|
||||
if (tmproot[rootlen-1] == ':') {
|
||||
if (!had_trailing_pathsep) /* i.e., original wasn't "xxx:/" */
|
||||
add_dot = TRUE; /* relative path: add '.' before '/' */
|
||||
} else if (rootlen > 0) && /* need not check "xxx:." and "xxx:/" */
|
||||
(SSTAT(tmproot, &G.statbuf) ||
|
||||
!S_ISDIR(G.statbuf.st_mode))
|
||||
{
|
||||
/* path does not exist */
|
||||
if (!G.create_dirs /* || iswild(tmproot) */ ) {
|
||||
free(tmproot);
|
||||
rootlen = 0;
|
||||
/* treat as stored file */
|
||||
return MPN_INF_SKIP;
|
||||
}
|
||||
/* GRR: scan for wildcard characters? OS-dependent...
|
||||
* if find any, return MPN_INF_SKIP: treat as stored file(s) */
|
||||
/* create directory (could add loop here scanning tmproot
|
||||
* to create more than one level, but really necessary?) */
|
||||
if (mkdir(tmproot, 0777) == -1) {
|
||||
Info(slide, 1, ((char *)slide,
|
||||
LoadFarString(CantCreateExtractDir),
|
||||
FnFilter1(tmproot)));
|
||||
free(tmproot);
|
||||
rootlen = 0;
|
||||
/* path didn't exist, tried to create, and failed: */
|
||||
/* file exists, or 2+ subdir levels required */
|
||||
return MPN_ERR_SKIP;
|
||||
}
|
||||
}
|
||||
if (add_dot) /* had just "x:", make "x:." */
|
||||
tmproot[rootlen++] = '.';
|
||||
tmproot[rootlen++] = '/';
|
||||
tmproot[rootlen] = '\0';
|
||||
if ((rootpath = (char *)realloc(tmproot, rootlen+1)) == NULL) {
|
||||
free(tmproot);
|
||||
rootlen = 0;
|
||||
return MPN_NOMEM;
|
||||
}
|
||||
Trace((stderr, "rootpath now = [%s]\n", FnFilter1(rootpath)));
|
||||
}
|
||||
return MPN_OK;
|
||||
}
|
||||
#endif /* !SFX || SFX_EXDIR */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
END: free rootpath, immediately prior to program exit.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (FUNCTION == END) {
|
||||
Trace((stderr, "freeing rootpath\n"));
|
||||
if (rootlen > 0) {
|
||||
free(rootpath);
|
||||
rootlen = 0;
|
||||
}
|
||||
return MPN_OK;
|
||||
}
|
||||
|
||||
return MPN_INVALID; /* should never reach */
|
||||
|
||||
} /* end function checkdir() */
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************/
|
||||
/* Function close_outfile() */
|
||||
/****************************/
|
||||
|
||||
void close_outfile(__G)
|
||||
__GDEF
|
||||
/*
|
||||
* FlexOS VERSION
|
||||
*
|
||||
* Set the output file date/time stamp according to information from the
|
||||
* zipfile directory record for this member, then close the file and set
|
||||
* its permissions (archive, hidden, read-only, system). Aside from closing
|
||||
* the file, this routine is optional (but most compilers support it).
|
||||
*/
|
||||
{
|
||||
DISKFILE df;
|
||||
LONG fnum;
|
||||
|
||||
struct { /* date and time words */
|
||||
union { /* DOS file modification time word */
|
||||
ush ztime;
|
||||
struct {
|
||||
unsigned zt_se : 5;
|
||||
unsigned zt_mi : 6;
|
||||
unsigned zt_hr : 5;
|
||||
} _tf;
|
||||
} _t;
|
||||
union { /* DOS file modification date word */
|
||||
ush zdate;
|
||||
struct {
|
||||
unsigned zd_dy : 5;
|
||||
unsigned zd_mo : 4;
|
||||
unsigned zd_yr : 7;
|
||||
} _df;
|
||||
} _d;
|
||||
} zt;
|
||||
|
||||
#ifdef USE_EF_UT_TIME
|
||||
iztimes z_utime;
|
||||
struct tm *t;
|
||||
#endif /* ?USE_EF_UT_TIME */
|
||||
|
||||
fclose(G.outfile);
|
||||
|
||||
if ((fnum = s_open(A_SET, G.filename)) < 0) {
|
||||
Info(slide, 0x201, ((char *)slide,
|
||||
"warning: cannot open %s to set the time\n",
|
||||
FnFilter1(G.filename)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (s_get(T_FILE, fnum, &df, DSKFSIZE) < 0) {
|
||||
s_close(0, fnum);
|
||||
|
||||
Info(slide, 0x201, ((char *)slide,
|
||||
"warning: cannot get info on %s\n", FnFilter1(G.filename)));
|
||||
return;
|
||||
}
|
||||
|
||||
/* skip restoring time stamps on user's request */
|
||||
if (uO.D_flag <= 1) {
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Copy and/or convert time and date variables, if necessary; then fill in
|
||||
the file time/date.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef USE_EF_UT_TIME
|
||||
if (G.extra_field &&
|
||||
#ifdef IZ_CHECK_TZ
|
||||
G.tz_is_valid &&
|
||||
#endif
|
||||
(ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0,
|
||||
G.lrec.last_mod_dos_datetime, &z_utime, NULL) & EB_UT_FL_MTIME))
|
||||
{
|
||||
TTrace((stderr, "close_outfile: Unix e.f. modif. time = %ld\n",
|
||||
z_utime.mtime));
|
||||
t = localtime(&(z_utime.mtime));
|
||||
} else
|
||||
t = (struct tm *)NULL;
|
||||
if (t != (struct tm *)NULL) {
|
||||
if (t->tm_year < 80) {
|
||||
df.df_modyear = 1980;
|
||||
df.df_modmonth = 1;
|
||||
df.df_modday = 1;
|
||||
df.df_modhr = 0;
|
||||
df.df_modmin = 0;
|
||||
df.df_modsec = 0;
|
||||
} else {
|
||||
df.df_modyear = t->tm_year + 1900;
|
||||
df.df_modmonth = t->tm_mon + 1;
|
||||
df.df_modday = t->tm_mday;
|
||||
df.df_modhr = t->tm_hour;
|
||||
df.df_modmin = t->tm_min;
|
||||
df.df_modsec = t->tm_sec;
|
||||
}
|
||||
} else
|
||||
#endif /* ?USE_EF_UX_TIME */
|
||||
{
|
||||
zt._t.ztime = (ush)(G.lrec.last_mod_dos_datetime) & 0xffff;
|
||||
zt._d.zdate = (ush)(G.lrec.last_mod_dos_datetime >> 16);
|
||||
|
||||
df.df_modyear = 1980 + zt._d._df.zd_yr;
|
||||
df.df_modmonth = zt._d._df.zd_mo;
|
||||
df.df_modday = zt._d._df.zd_dy;
|
||||
df.df_modhr = zt._t._tf.zt_hr;
|
||||
df.df_modmin = zt._t._tf.zt_mi;
|
||||
df.df_modsec = zt._t._tf.zt_se << 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Fill in the file attributes.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
df.df_attr1 = (UBYTE)G.pInfo->file_attr;
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Now we try to set the attributes & date/time.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (s_set(T_FILE, fnum, &df, DSKFSIZE) < 0)
|
||||
Info(slide, 0x201, ((char *)slide,
|
||||
"warning: cannot set info for %s\n", FnFilter1(G.filename)));
|
||||
|
||||
s_close(0, fnum);
|
||||
} /* end function close_outfile() */
|
||||
|
||||
#ifndef SFX
|
||||
|
||||
/*************************/
|
||||
/* Function dateformat() */
|
||||
/*************************/
|
||||
|
||||
int dateformat()
|
||||
{
|
||||
return DF_DMY; /* default for systems without locale info */
|
||||
}
|
||||
|
||||
/************************/
|
||||
/* Function version() */
|
||||
/************************/
|
||||
|
||||
void version(__G)
|
||||
__GDEF
|
||||
{
|
||||
int len;
|
||||
|
||||
len = sprintf((char *)slide, LoadFarString(CompiledWith),
|
||||
"MetaWare High C",
|
||||
"",
|
||||
"FlexOS",
|
||||
" (16-bit, big)",
|
||||
|
||||
#ifdef __DATE__
|
||||
" on ", __DATE__
|
||||
#else
|
||||
"", ""
|
||||
#endif
|
||||
);
|
||||
|
||||
(*G.message)((zvoid *)&G, slide, (ulg)len, 0);
|
||||
}
|
||||
|
||||
#endif /* !SFX */
|
||||
|
||||
/************************/
|
||||
/* Function _wildarg() */
|
||||
/************************/
|
||||
|
||||
/* This prevents the PORTLIB startup code from preforming argument globbing */
|
||||
|
||||
_wildarg() {}
|
30
programs/fs/unzip60/flexos/flxcfg.h
Normal file
30
programs/fs/unzip60/flexos/flxcfg.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/*---------------------------------------------------------------------------
|
||||
FlexOS specific configuration section:
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __flxcfg_h
|
||||
#define __flxcfg_h
|
||||
|
||||
#define __16BIT__
|
||||
#define MED_MEM
|
||||
#define EXE_EXTENSION ".286"
|
||||
|
||||
#ifndef nearmalloc
|
||||
# define nearmalloc malloc
|
||||
# define nearfree free
|
||||
#endif
|
||||
|
||||
#define CRTL_CP_IS_OEM
|
||||
|
||||
#define near
|
||||
#define far
|
||||
|
||||
#endif /* !__flxcfg_h */
|
19
programs/fs/unzip60/flexos/hc.pro
Normal file
19
programs/fs/unzip60/flexos/hc.pro
Normal file
@ -0,0 +1,19 @@
|
||||
pragma Off(Floating_point);
|
||||
pragma On(286);
|
||||
pragma On(Literals_in_code);
|
||||
pragma On(Warn);
|
||||
pragma On(pointers_compatible);
|
||||
pragma On(Callee_pops_when_possible);
|
||||
|
||||
pragma On(Auto_reg_alloc);
|
||||
pragma On(Const_in_Code);
|
||||
pragma On(Read_only_strings);
|
||||
pragma On(Optimize_for_space);
|
||||
|
||||
pragma Off(Prototype_override_warnings);
|
||||
pragma Off(Quiet);
|
||||
pragma Off(Asm);
|
||||
pragma Off(flexview);
|
||||
|
||||
#define PORTLIB
|
||||
#define FLEXOS 1
|
199
programs/fs/unzip60/flexos/makefile
Normal file
199
programs/fs/unzip60/flexos/makefile
Normal file
@ -0,0 +1,199 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# Makefile for UnZip 5.53 and later Derek Fawcus
|
||||
# Version: MetaWare High C with PAMAKE 30 Dec 2005
|
||||
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
# Alter the first two macros to change the model
|
||||
#
|
||||
|
||||
MODEL = big
|
||||
M = b
|
||||
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
# These two sets of prefixes are changed when swapping between the master
|
||||
# and my machine.
|
||||
#
|
||||
|
||||
FL_PREFIX = d:/flexos # Where FlexOS is rooted
|
||||
#FL_PREFIX = c:/.
|
||||
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
# The following should not have to be changed - they should be automatic
|
||||
# given correct values for the above.
|
||||
#
|
||||
|
||||
HC_LIB = $(FL_PREFIX)/highc/$(MODEL)/hc$(M)e.l86
|
||||
PORT_LIB = $(FL_PREFIX)/usr/portlib/$(MODEL)/prtlbhc$(M).l86
|
||||
PORT_OBJ = $(FL_PREFIX)/usr/portlib/$(MODEL)/prtlbhc$(M).obj
|
||||
|
||||
HC_INC = $(FL_PREFIX)/highc/inc
|
||||
PORT_INC = $(FL_PREFIX)/usr/portlib/inc
|
||||
FLEX_INC = $(FL_PREFIX)/usr/inc
|
||||
|
||||
+IPATH = $(PORT_INC)/;$(FLEX_INC)/;
|
||||
#+IPATH = $(PORT_INC)/;$(HC_INC)/;$(FLEX_INC)/;
|
||||
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
# The programs to do the work.
|
||||
#
|
||||
|
||||
CC = hc
|
||||
AS = rasm86
|
||||
LD = link86
|
||||
|
||||
#HCOPTS=-mm $(MODEL) -debug -pr flexos/hc.pro
|
||||
HCOPTS=-mm $(MODEL) -pr flexos/hc.pro
|
||||
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
# The file extensions to build from
|
||||
#
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .h .a86
|
||||
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
|
||||
# Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc.
|
||||
CPU_TYP = 2
|
||||
|
||||
# Uncomment the following three macros to use the optimized CRC32 assembler
|
||||
# routine in UnZip and UnZipSFX:
|
||||
#ASMFLG = -DASM_CRC
|
||||
#ASMOBJS = crc_i86.obj
|
||||
#ASMOBJF = crc_i86_.obj
|
||||
|
||||
ASCPUFLAG = __$(CPU_TYP)86
|
||||
|
||||
UNZIP_H = unzip.h unzpriv.h globals.h flexos/flxcfg.h
|
||||
|
||||
default: unzip.286
|
||||
#default: unzip.286 funzip.286 unzipsfx.286
|
||||
|
||||
clean:
|
||||
del *.ob?
|
||||
del unzip.286
|
||||
del funzip.286
|
||||
del unzipsfx.*
|
||||
del *.map
|
||||
del *.lin
|
||||
del *.sym
|
||||
del *.dbg
|
||||
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
|
||||
.asm.obj:
|
||||
$(AS) $(ASFLAGS) -D$(ASUNMODEL) $*.asm
|
||||
|
||||
.c.obj:
|
||||
$(CC) $< $(HCOPTS) -ob $@
|
||||
|
||||
.c.obf:
|
||||
$(CC) $< $(HCOPTS) -def FUNZIP -ob $@
|
||||
|
||||
.c.obs:
|
||||
$(CC) $< $(HCOPTS) -def SFX -ob $@
|
||||
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
|
||||
crc_i86.obj: flexos/crc_i86.a86
|
||||
$(AS) $(ASFLAGS) -D$(ASUNMODEL) flexos/crc_i86.a86, $*.obj ;
|
||||
|
||||
#
|
||||
#########################################################################
|
||||
#
|
||||
# The objects to build from
|
||||
#
|
||||
|
||||
UNZIP_OBJS = unzip.obj crc32.obj crypt.obj envargs.obj \
|
||||
explode.obj extract.obj fileio.obj globals.obj inflate.obj \
|
||||
list.obj match.obj process.obj ttyio.obj unreduce.obj \
|
||||
unshrink.obj zipinfo.obj flexos.obj $(ASMOBJS)
|
||||
|
||||
unzip.286: $(UNZIP_OBJS)
|
||||
$(LD) $@[st[add[17e]]] = $-[input]
|
||||
$(PORT_OBJ),
|
||||
$+(${UNZIP_OBJS}),
|
||||
$(PORT_LIB),
|
||||
$(HC_LIB)
|
||||
<
|
||||
|
||||
UNZIPSFX_OBJS = unzip.obs crc32.obs crypt.obs extract.obs \
|
||||
fileio.obs globals.obs inflate.obs match.obs process.obs \
|
||||
ttyio.obs flexos.obs $(ASMOBJS)
|
||||
|
||||
unzipsfx.286: $(UNZIPSFX_OBJS)
|
||||
$(LD) $@[dbi,map[all],st[add[17e]]] = $-[input]
|
||||
$(PORT_OBJ),
|
||||
$+(${UNZIPSFX_OBJS}),
|
||||
$(PORT_LIB),
|
||||
$(HC_LIB)
|
||||
<
|
||||
|
||||
FUNZIP_OBJS = funzip.obj crc32.obf crypt.obf globals.obf inflate.obf \
|
||||
ttyio.obf $(ASMOBJF)
|
||||
|
||||
funzip.286: $(FUNZIP_OBJS)
|
||||
$(LD) $@[dbi,map[all],st[add[17e]]] = $-[input]
|
||||
$(PORT_OBJ),
|
||||
$+(${FUNZIP_OBJS}),
|
||||
$(PORT_LIB),
|
||||
$(HC_LIB)
|
||||
<
|
||||
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
|
||||
unreduce.obj: unreduce.c $(UNZIP_H)
|
||||
unshrink.obj: unshrink.c $(UNZIP_H)
|
||||
unzip.obj: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
|
||||
zipinfo.obj: zipinfo.c $(UNZIP_H)
|
||||
process.obj: process.c $(UNZIP_H) crc32.h
|
||||
list.obj: list.c $(UNZIP_H)
|
||||
match.obj: match.c $(UNZIP_H)
|
||||
fileio.obj: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
|
||||
envargs.obj: envargs.c $(UNZIP_H)
|
||||
explode.obj: explode.c $(UNZIP_H)
|
||||
extract.obj: extract.c $(UNZIP_H) crc32.h crypt.h
|
||||
crc32.obj: crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
|
||||
flexos.obj: flexos/flexos.c $(UNZIP_H)
|
||||
crc32.obj: crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
crypt.obj: crypt.c $(UNZIP_H) crc32.h crypt.h ttyio.h zip.h
|
||||
globals.obj: globals.c $(UNZIP_H)
|
||||
inflate.obj: inflate.c inflate.h $(UNZIP_H)
|
||||
ttyio.obj: ttyio.c $(UNZIP_H) crypt.h ttyio.h zip.h
|
||||
|
||||
funzip.obj: funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
|
||||
crc32.obf: crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
crypt.obf: crypt.c $(UNZIP_H) crypt.h ttyio.h zip.h
|
||||
globals.obf: globals.c $(UNZIP_H)
|
||||
inflate.obf: inflate.c inflate.h $(UNZIP_H) crypt.h
|
||||
ttyio.obf: ttyio.c $(UNZIP_H) crypt.h ttyio.h zip.h
|
||||
|
||||
flexos.obs: flexos/flexos.c $(UNZIP_H)
|
||||
crc32.obs: crc32.c $(UNZIP_H) zip.h crc32.h
|
||||
extract.obs: extract.c $(UNZIP_H) crc32.h crypt.h
|
||||
fileio.obs: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
|
||||
globals.obs: globals.c $(UNZIP_H)
|
||||
inflate.obs: inflate.c inflate.h $(UNZIP_H) crypt.h
|
||||
match.obs: match.c $(UNZIP_H)
|
||||
process.obs: process.c $(UNZIP_H) crc32.h
|
||||
ttyio.obs: ttyio.c $(UNZIP_H) crypt.h ttyio.h zip.h
|
||||
unzip.obs: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
|
547
programs/fs/unzip60/funzip.c
Normal file
547
programs/fs/unzip60/funzip.c
Normal file
@ -0,0 +1,547 @@
|
||||
/*
|
||||
Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2009-Jan-02 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/* funzip.c -- by Mark Adler */
|
||||
|
||||
#define VERSION "3.95 of 20 January 2009"
|
||||
|
||||
|
||||
/* Copyright history:
|
||||
- Starting with UnZip 5.41 of 16-April-2000, this source file
|
||||
is covered by the Info-Zip LICENSE cited above.
|
||||
- Prior versions of this source file, found in UnZip source packages
|
||||
up to UnZip 5.40, were put in the public domain.
|
||||
The original copyright note by Mark Adler was:
|
||||
"You can do whatever you like with this source file,
|
||||
though I would prefer that if you modify it and
|
||||
redistribute it that you include comments to that effect
|
||||
with your name and the date. Thank you."
|
||||
|
||||
History:
|
||||
vers date who what
|
||||
---- --------- -------------- ------------------------------------
|
||||
1.0 13 Aug 92 M. Adler really simple unzip filter.
|
||||
1.1 13 Aug 92 M. Adler cleaned up somewhat, give help if
|
||||
stdin not redirected, warn if more
|
||||
zip file entries after the first.
|
||||
1.2 15 Aug 92 M. Adler added check of lengths for stored
|
||||
entries, added more help.
|
||||
1.3 16 Aug 92 M. Adler removed redundant #define's, added
|
||||
decryption.
|
||||
1.4 27 Aug 92 G. Roelofs added exit(0).
|
||||
1.5 1 Sep 92 K. U. Rommel changed read/write modes for OS/2.
|
||||
1.6 6 Sep 92 G. Roelofs modified to use dummy crypt.c and
|
||||
crypt.h instead of -DCRYPT.
|
||||
1.7 23 Sep 92 G. Roelofs changed to use DOS_OS2; included
|
||||
crypt.c under MS-DOS.
|
||||
1.8 9 Oct 92 M. Adler improved inflation error msgs.
|
||||
1.9 17 Oct 92 G. Roelofs changed ULONG/UWORD/byte to ulg/ush/uch;
|
||||
renamed inflate_entry() to inflate();
|
||||
adapted to use new, in-place zdecode.
|
||||
2.0 22 Oct 92 M. Adler allow filename argument, prompt for
|
||||
passwords and don't echo, still allow
|
||||
command-line password entry, but as an
|
||||
option.
|
||||
2.1 23 Oct 92 J-l. Gailly fixed crypt/store bug,
|
||||
G. Roelofs removed crypt.c under MS-DOS, fixed
|
||||
decryption check to compare single byte.
|
||||
2.2 28 Oct 92 G. Roelofs removed declaration of key.
|
||||
2.3 14 Dec 92 M. Adler replaced fseek (fails on stdin for SCO
|
||||
Unix V.3.2.4). added quietflg for
|
||||
inflate.c.
|
||||
3.0 11 May 93 M. Adler added gzip support
|
||||
3.1 9 Jul 93 K. U. Rommel fixed OS/2 pipe bug (PIPE_ERROR)
|
||||
3.2 4 Sep 93 G. Roelofs moved crc_32_tab[] to tables.h; used FOPx
|
||||
from unzip.h; nuked OUTB macro and outbuf;
|
||||
replaced flush(); inlined FlushOutput();
|
||||
renamed decrypt to encrypted
|
||||
3.3 29 Sep 93 G. Roelofs replaced ReadByte() with NEXTBYTE macro;
|
||||
revised (restored?) flush(); added FUNZIP
|
||||
3.4 21 Oct 93 G. Roelofs renamed quietflg to qflag; changed outcnt,
|
||||
H. Gessau second updcrc() arg and flush() arg to ulg;
|
||||
added inflate_free(); added "g =" to null
|
||||
getc(in) to avoid compiler warnings
|
||||
3.5 31 Oct 93 H. Gessau changed DOS_OS2 to DOS_NT_OS2
|
||||
3.6 6 Dec 93 H. Gessau added "near" to mask_bits[]
|
||||
3.7 9 Dec 93 G. Roelofs added extent typecasts to fwrite() checks
|
||||
3.8 28 Jan 94 GRR/JlG initialized g variable in main() for gcc
|
||||
3.81 22 Feb 94 M. Hanning-Lee corrected usage message
|
||||
3.82 27 Feb 94 G. Roelofs added some typecasts to avoid warnings
|
||||
3.83 22 Jul 94 G. Roelofs changed fprintf to macro for DLLs
|
||||
- 2 Aug 94 - public release with UnZip 5.11
|
||||
- 28 Aug 94 - public release with UnZip 5.12
|
||||
3.84 1 Oct 94 K. U. Rommel changes for Metaware High C
|
||||
3.85 29 Oct 94 G. Roelofs changed fprintf macro to Info
|
||||
3.86 7 May 95 K. Davis RISCOS patches;
|
||||
P. Kienitz Amiga patches
|
||||
3.87 12 Aug 95 G. Roelofs inflate_free(), DESTROYGLOBALS fixes
|
||||
3.88 4 Sep 95 C. Spieler reordered macro to work around MSC 5.1 bug
|
||||
3.89 22 Nov 95 PK/CS ifdef'd out updcrc() for ASM_CRC
|
||||
3.9 17 Dec 95 G. Roelofs modified for USE_ZLIB (new fillinbuf())
|
||||
- 30 Apr 96 - public release with UnZip 5.2
|
||||
3.91 17 Aug 96 G. Roelofs main() -> return int (Peter Seebach)
|
||||
3.92 13 Apr 97 G. Roelofs minor cosmetic fixes to messages
|
||||
- 22 Apr 97 - public release with UnZip 5.3
|
||||
- 31 May 97 - public release with UnZip 5.31
|
||||
3.93 20 Sep 97 G. Roelofs minor cosmetic fixes to messages
|
||||
- 3 Nov 97 - public release with UnZip 5.32
|
||||
- 28 Nov 98 - public release with UnZip 5.4
|
||||
- 16 Apr 00 - public release with UnZip 5.41
|
||||
- 14 Jan 01 - public release with UnZip 5.42
|
||||
3.94 20 Feb 01 C. Spieler added support for Deflate64(tm)
|
||||
23 Mar 02 C. Spieler changed mask_bits[] type to "unsigned"
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
All funzip does is take a zipfile from stdin and decompress the
|
||||
first entry to stdout. The entry has to be either deflated or
|
||||
stored. If the entry is encrypted, then the decryption password
|
||||
must be supplied on the command line as the first argument.
|
||||
|
||||
funzip needs to be linked with inflate.o and crypt.o compiled from
|
||||
the unzip source. If decryption is desired, the full version of
|
||||
crypt.c (and crypt.h) from zcrypt28.zip or later must be used.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef FUNZIP
|
||||
# define FUNZIP
|
||||
#endif
|
||||
#define UNZIP_INTERNAL
|
||||
#include "unzip.h"
|
||||
#include "crc32.h"
|
||||
#include "crypt.h"
|
||||
#include "ttyio.h"
|
||||
|
||||
#ifdef EBCDIC
|
||||
# undef EBCDIC /* don't need ebcdic[] */
|
||||
#endif
|
||||
|
||||
#ifndef USE_ZLIB /* zlib's function is called inflate(), too */
|
||||
# define UZinflate inflate
|
||||
#endif
|
||||
|
||||
/* PKZIP header definitions */
|
||||
#define ZIPMAG 0x4b50 /* two-byte zip lead-in */
|
||||
#define LOCREM 0x0403 /* remaining two bytes in zip signature */
|
||||
#define LOCSIG 0x04034b50L /* full signature */
|
||||
#define LOCFLG 4 /* offset of bit flag */
|
||||
#define CRPFLG 1 /* bit for encrypted entry */
|
||||
#define EXTFLG 8 /* bit for extended local header */
|
||||
#define LOCHOW 6 /* offset of compression method */
|
||||
#define LOCTIM 8 /* file mod time (for decryption) */
|
||||
#define LOCCRC 12 /* offset of crc */
|
||||
#define LOCSIZ 16 /* offset of compressed size */
|
||||
#define LOCLEN 20 /* offset of uncompressed length */
|
||||
#define LOCFIL 24 /* offset of file name field length */
|
||||
#define LOCEXT 26 /* offset of extra field length */
|
||||
#define LOCHDR 28 /* size of local header, including LOCREM */
|
||||
#define EXTHDR 16 /* size of extended local header, inc sig */
|
||||
|
||||
/* GZIP header definitions */
|
||||
#define GZPMAG 0x8b1f /* two-byte gzip lead-in */
|
||||
#define GZPHOW 0 /* offset of method number */
|
||||
#define GZPFLG 1 /* offset of gzip flags */
|
||||
#define GZPMUL 2 /* bit for multiple-part gzip file */
|
||||
#define GZPISX 4 /* bit for extra field present */
|
||||
#define GZPISF 8 /* bit for filename present */
|
||||
#define GZPISC 16 /* bit for comment present */
|
||||
#define GZPISE 32 /* bit for encryption */
|
||||
#define GZPTIM 2 /* offset of Unix file modification time */
|
||||
#define GZPEXF 6 /* offset of extra flags */
|
||||
#define GZPCOS 7 /* offset of operating system compressed on */
|
||||
#define GZPHDR 8 /* length of minimal gzip header */
|
||||
|
||||
#ifdef THEOS
|
||||
/* Macros cause stack overflow in compiler */
|
||||
ush SH(uch* p) { return ((ush)(uch)((p)[0]) | ((ush)(uch)((p)[1]) << 8)); }
|
||||
ulg LG(uch* p) { return ((ulg)(SH(p)) | ((ulg)(SH((p)+2)) << 16)); }
|
||||
#else /* !THEOS */
|
||||
/* Macros for getting two-byte and four-byte header values */
|
||||
#define SH(p) ((ush)(uch)((p)[0]) | ((ush)(uch)((p)[1]) << 8))
|
||||
#define LG(p) ((ulg)(SH(p)) | ((ulg)(SH((p)+2)) << 16))
|
||||
#endif /* ?THEOS */
|
||||
|
||||
/* Function prototypes */
|
||||
static void err OF((int, char *));
|
||||
#if (defined(USE_DEFLATE64) && defined(__16BIT__))
|
||||
static int partflush OF((uch *rawbuf, unsigned w));
|
||||
#endif
|
||||
int main OF((int, char **));
|
||||
|
||||
/* Globals */
|
||||
FILE *out; /* output file (*in moved to G struct) */
|
||||
ulg outsiz; /* total bytes written to out */
|
||||
int encrypted; /* flag to turn on decryption */
|
||||
|
||||
/* Masks for inflate.c */
|
||||
ZCONST unsigned near mask_bits[17] = {
|
||||
0x0000,
|
||||
0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
|
||||
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
|
||||
};
|
||||
|
||||
|
||||
#ifdef USE_ZLIB
|
||||
|
||||
int fillinbuf(__G)
|
||||
__GDEF
|
||||
/* Fill input buffer for pull-model inflate() in zlib. Return the number of
|
||||
* bytes in inbuf. */
|
||||
{
|
||||
/* GRR: check return value from fread(): same as read()? check errno? */
|
||||
if ((G.incnt = fread((char *)G.inbuf, 1, INBUFSIZ, G.in)) <= 0)
|
||||
return 0;
|
||||
G.inptr = G.inbuf;
|
||||
|
||||
#if CRYPT
|
||||
if (encrypted) {
|
||||
uch *p;
|
||||
int n;
|
||||
|
||||
for (n = G.incnt, p = G.inptr; n--; p++)
|
||||
zdecode(*p);
|
||||
}
|
||||
#endif /* CRYPT */
|
||||
|
||||
return G.incnt;
|
||||
|
||||
}
|
||||
|
||||
#endif /* USE_ZLIB */
|
||||
|
||||
|
||||
static void err(n, m)
|
||||
int n;
|
||||
char *m;
|
||||
/* Exit on error with a message and a code */
|
||||
{
|
||||
Info(slide, 1, ((char *)slide, "funzip error: %s\n", m));
|
||||
DESTROYGLOBALS();
|
||||
EXIT(n);
|
||||
}
|
||||
|
||||
|
||||
#if (defined(USE_DEFLATE64) && defined(__16BIT__))
|
||||
|
||||
static int partflush(rawbuf, w)
|
||||
uch *rawbuf; /* start of buffer area to flush */
|
||||
extent w; /* number of bytes to flush */
|
||||
{
|
||||
G.crc32val = crc32(G.crc32val, rawbuf, (extent)w);
|
||||
if (fwrite((char *)rawbuf,1,(extent)w,out) != (extent)w && !PIPE_ERROR)
|
||||
err(9, "out of space on stdout");
|
||||
outsiz += w;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int flush(w) /* used by inflate.c (FLUSH macro) */
|
||||
ulg w; /* number of bytes to flush */
|
||||
{
|
||||
uch *rawbuf;
|
||||
int ret;
|
||||
|
||||
/* On 16-bit systems (MSDOS, OS/2 1.x), the standard C library functions
|
||||
* cannot handle writes of 64k blocks at once. For these systems, the
|
||||
* blocks to flush are split into pieces of 32k or less.
|
||||
*/
|
||||
rawbuf = slide;
|
||||
while (w > 0x8000L) {
|
||||
ret = partflush(rawbuf, 0x8000);
|
||||
if (ret != PK_OK)
|
||||
return ret;
|
||||
w -= 0x8000L;
|
||||
rawbuf += (unsigned)0x8000;
|
||||
}
|
||||
return partflush(rawbuf, (extent)w);
|
||||
} /* end function flush() */
|
||||
|
||||
#else /* !(USE_DEFLATE64 && __16BIT__) */
|
||||
|
||||
int flush(w) /* used by inflate.c (FLUSH macro) */
|
||||
ulg w; /* number of bytes to flush */
|
||||
{
|
||||
G.crc32val = crc32(G.crc32val, slide, (extent)w);
|
||||
if (fwrite((char *)slide,1,(extent)w,out) != (extent)w && !PIPE_ERROR)
|
||||
err(9, "out of space on stdout");
|
||||
outsiz += w;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* ?(USE_DEFLATE64 && __16BIT__) */
|
||||
|
||||
|
||||
int main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
/* Given a zipfile on stdin, decompress the first entry to stdout. */
|
||||
{
|
||||
ush n;
|
||||
uch h[LOCHDR]; /* first local header (GZPHDR < LOCHDR) */
|
||||
int g = 0; /* true if gzip format */
|
||||
unsigned method = 0; /* initialized here to shut up gcc warning */
|
||||
#if CRYPT
|
||||
char *s = " [-password]";
|
||||
char *p; /* password */
|
||||
#else /* !CRYPT */
|
||||
char *s = "";
|
||||
#endif /* ?CRYPT */
|
||||
CONSTRUCTGLOBALS();
|
||||
|
||||
/* skip executable name */
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
#if CRYPT
|
||||
/* get the command line password, if any */
|
||||
p = (char *)NULL;
|
||||
if (argc && **argv == '-')
|
||||
{
|
||||
argc--;
|
||||
p = 1 + *argv++;
|
||||
}
|
||||
#endif /* CRYPT */
|
||||
|
||||
#ifdef MALLOC_WORK
|
||||
/* The following expression is a cooked-down simplyfication of the
|
||||
calculation for the work area size of UnZip (see unzip.c). For
|
||||
fUnZip, the work area does not need to match the granularity
|
||||
of the complex unshrink structures, because it only supports
|
||||
inflation. But, like in UnZip, the zcalloc() wrapper function
|
||||
is needed for the allocation, to support the 64kByte buffer on
|
||||
16-bit systems.
|
||||
*/
|
||||
# define UZ_SLIDE_CHUNK (sizeof(shrint)+sizeof(uch)+sizeof(uch))
|
||||
# define UZ_NUMOF_CHUNKS (unsigned)( (WSIZE+UZ_SLIDE_CHUNK-1)/UZ_SLIDE_CHUNK )
|
||||
G.area.Slide = (uch *)zcalloc(UZ_NUMOF_CHUNKS, UZ_SLIDE_CHUNK);
|
||||
# undef UZ_SLIDE_CHUNK
|
||||
# undef UZ_NUMOF_CHUNKS
|
||||
#endif
|
||||
|
||||
/* if no file argument and stdin not redirected, give the user help */
|
||||
if (argc == 0 && isatty(0))
|
||||
{
|
||||
Info(slide, 1, ((char *)slide, "fUnZip (filter UnZip), version %s\n",
|
||||
VERSION));
|
||||
Info(slide, 1, ((char *)slide, "usage: ... | funzip%s | ...\n", s));
|
||||
Info(slide, 1, ((char *)slide, " ... | funzip%s > outfile\n", s));
|
||||
Info(slide, 1, ((char *)slide, " funzip%s infile.zip > outfile\n",s));
|
||||
Info(slide, 1, ((char *)slide, " funzip%s infile.gz > outfile\n", s));
|
||||
Info(slide, 1, ((char *)slide, "Extracts to stdout the gzip file or first\
|
||||
zip entry of stdin or the given file.\n"));
|
||||
DESTROYGLOBALS();
|
||||
EXIT(3);
|
||||
}
|
||||
|
||||
/* prepare to be a binary filter */
|
||||
if (argc)
|
||||
{
|
||||
if ((G.in = fopen(*argv, FOPR)) == (FILE *)NULL)
|
||||
err(2, "cannot find input file");
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DOS_FLX_NLM_OS2_W32
|
||||
#if (defined(__HIGHC__) && !defined(FLEXOS))
|
||||
setmode(stdin, _BINARY);
|
||||
#else
|
||||
setmode(0, O_BINARY); /* some buggy C libraries require BOTH setmode() */
|
||||
#endif /* call AND the fdopen() in binary mode :-( */
|
||||
#endif /* DOS_FLX_NLM_OS2_W32 */
|
||||
|
||||
#ifdef RISCOS
|
||||
G.in = stdin;
|
||||
#else
|
||||
if ((G.in = fdopen(0, FOPR)) == (FILE *)NULL)
|
||||
err(2, "cannot find stdin");
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DOS_FLX_H68_NLM_OS2_W32
|
||||
#if (defined(__HIGHC__) && !defined(FLEXOS))
|
||||
setmode(stdout, _BINARY);
|
||||
#else
|
||||
setmode(1, O_BINARY);
|
||||
#endif
|
||||
#endif /* DOS_FLX_H68_NLM_OS2_W32 */
|
||||
|
||||
#ifdef RISCOS
|
||||
out = stdout;
|
||||
#else
|
||||
if ((out = fdopen(1, FOPW)) == (FILE *)NULL)
|
||||
err(2, "cannot write to stdout");
|
||||
#endif
|
||||
|
||||
/* read local header, check validity, and skip name and extra fields */
|
||||
n = getc(G.in); n |= getc(G.in) << 8;
|
||||
if (n == ZIPMAG)
|
||||
{
|
||||
if (fread((char *)h, 1, LOCHDR, G.in) != LOCHDR || SH(h) != LOCREM)
|
||||
err(3, "invalid zipfile");
|
||||
switch (method = SH(h + LOCHOW)) {
|
||||
case STORED:
|
||||
case DEFLATED:
|
||||
#ifdef USE_DEFLATE64
|
||||
case ENHDEFLATED:
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
err(3, "first entry not deflated or stored--cannot unpack");
|
||||
break;
|
||||
}
|
||||
for (n = SH(h + LOCFIL); n--; ) g = getc(G.in);
|
||||
for (n = SH(h + LOCEXT); n--; ) g = getc(G.in);
|
||||
g = 0;
|
||||
encrypted = h[LOCFLG] & CRPFLG;
|
||||
}
|
||||
else if (n == GZPMAG)
|
||||
{
|
||||
if (fread((char *)h, 1, GZPHDR, G.in) != GZPHDR)
|
||||
err(3, "invalid gzip file");
|
||||
if ((method = h[GZPHOW]) != DEFLATED && method != ENHDEFLATED)
|
||||
err(3, "gzip file not deflated");
|
||||
if (h[GZPFLG] & GZPMUL)
|
||||
err(3, "cannot handle multi-part gzip files");
|
||||
if (h[GZPFLG] & GZPISX)
|
||||
{
|
||||
n = getc(G.in); n |= getc(G.in) << 8;
|
||||
while (n--) g = getc(G.in);
|
||||
}
|
||||
if (h[GZPFLG] & GZPISF)
|
||||
while ((g = getc(G.in)) != 0 && g != EOF) ;
|
||||
if (h[GZPFLG] & GZPISC)
|
||||
while ((g = getc(G.in)) != 0 && g != EOF) ;
|
||||
g = 1;
|
||||
encrypted = h[GZPFLG] & GZPISE;
|
||||
}
|
||||
else
|
||||
err(3, "input not a zip or gzip file");
|
||||
|
||||
/* if entry encrypted, decrypt and validate encryption header */
|
||||
if (encrypted)
|
||||
#if CRYPT
|
||||
{
|
||||
ush i, e;
|
||||
|
||||
if (p == (char *)NULL) {
|
||||
if ((p = (char *)malloc(IZ_PWLEN+1)) == (char *)NULL)
|
||||
err(1, "out of memory");
|
||||
else if ((p = getp("Enter password: ", p, IZ_PWLEN+1)) == (char *)NULL)
|
||||
err(1, "no tty to prompt for password");
|
||||
}
|
||||
/* initialize crc_32_tab pointer for decryption */
|
||||
CRC_32_TAB = get_crc_table();
|
||||
/* prepare the decryption keys for extraction and check the password */
|
||||
init_keys(p);
|
||||
for (i = 0; i < RAND_HEAD_LEN; i++)
|
||||
e = NEXTBYTE;
|
||||
if (e != (ush)(h[LOCFLG] & EXTFLG ? h[LOCTIM + 1] : h[LOCCRC + 3]))
|
||||
err(3, "incorrect password for first entry");
|
||||
}
|
||||
#else /* !CRYPT */
|
||||
err(3, "cannot decrypt entry (need to recompile with full crypt.c)");
|
||||
#endif /* ?CRYPT */
|
||||
|
||||
/* prepare output buffer and crc */
|
||||
G.outptr = slide;
|
||||
G.outcnt = 0L;
|
||||
outsiz = 0L;
|
||||
G.crc32val = CRCVAL_INITIAL;
|
||||
|
||||
/* decompress */
|
||||
if (g || h[LOCHOW])
|
||||
{ /* deflated entry */
|
||||
int r;
|
||||
|
||||
#ifdef USE_ZLIB
|
||||
/* need to allocate and prepare input buffer */
|
||||
if ((G.inbuf = (uch *)malloc(INBUFSIZ)) == (uch *)NULL)
|
||||
err(1, "out of memory");
|
||||
#endif /* USE_ZLIB */
|
||||
if ((r = UZinflate(__G__ (method == ENHDEFLATED))) != 0) {
|
||||
if (r == 3)
|
||||
err(1, "out of memory");
|
||||
else
|
||||
err(4, "invalid compressed data--format violated");
|
||||
}
|
||||
inflate_free(__G);
|
||||
}
|
||||
else
|
||||
{ /* stored entry */
|
||||
register ulg n;
|
||||
|
||||
n = LG(h + LOCLEN);
|
||||
#if CRYPT
|
||||
if (n != LG(h + LOCSIZ) - (encrypted ? RAND_HEAD_LEN : 0)) {
|
||||
#else
|
||||
if (n != LG(h + LOCSIZ)) {
|
||||
#endif
|
||||
Info(slide, 1, ((char *)slide, "len %ld, siz %ld\n", n, LG(h + LOCSIZ)));
|
||||
err(4, "invalid compressed data--length mismatch");
|
||||
}
|
||||
while (n--) {
|
||||
ush c = getc(G.in);
|
||||
#if CRYPT
|
||||
if (encrypted)
|
||||
zdecode(c);
|
||||
#endif
|
||||
*G.outptr++ = (uch)c;
|
||||
#if (defined(USE_DEFLATE64) && defined(__16BIT__))
|
||||
if (++G.outcnt == (WSIZE>>1)) /* do FlushOutput() */
|
||||
#else
|
||||
if (++G.outcnt == WSIZE) /* do FlushOutput() */
|
||||
#endif
|
||||
{
|
||||
G.crc32val = crc32(G.crc32val, slide, (extent)G.outcnt);
|
||||
if (fwrite((char *)slide, 1,(extent)G.outcnt,out) != (extent)G.outcnt
|
||||
&& !PIPE_ERROR)
|
||||
err(9, "out of space on stdout");
|
||||
outsiz += G.outcnt;
|
||||
G.outptr = slide;
|
||||
G.outcnt = 0L;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (G.outcnt) /* flush one last time; no need to reset G.outptr/outcnt */
|
||||
{
|
||||
G.crc32val = crc32(G.crc32val, slide, (extent)G.outcnt);
|
||||
if (fwrite((char *)slide, 1,(extent)G.outcnt,out) != (extent)G.outcnt
|
||||
&& !PIPE_ERROR)
|
||||
err(9, "out of space on stdout");
|
||||
outsiz += G.outcnt;
|
||||
}
|
||||
fflush(out);
|
||||
|
||||
/* if extended header, get it */
|
||||
if (g)
|
||||
{
|
||||
if (fread((char *)h + LOCCRC, 1, 8, G.in) != 8)
|
||||
err(3, "gzip file ended prematurely");
|
||||
}
|
||||
else
|
||||
if ((h[LOCFLG] & EXTFLG) &&
|
||||
fread((char *)h + LOCCRC - 4, 1, EXTHDR, G.in) != EXTHDR)
|
||||
err(3, "zipfile ended prematurely");
|
||||
|
||||
/* validate decompression */
|
||||
if (LG(h + LOCCRC) != G.crc32val)
|
||||
err(4, "invalid compressed data--crc error");
|
||||
if (LG((g ? (h + LOCSIZ) : (h + LOCLEN))) != outsiz)
|
||||
err(4, "invalid compressed data--length error");
|
||||
|
||||
/* check if there are more entries */
|
||||
if (!g && fread((char *)h, 1, 4, G.in) == 4 && LG(h) == LOCSIG)
|
||||
Info(slide, 1, ((char *)slide,
|
||||
"funzip warning: zipfile has more than one entry--rest ignored\n"));
|
||||
|
||||
DESTROYGLOBALS();
|
||||
RETURN (0);
|
||||
}
|
92
programs/fs/unzip60/funzip.txt
Normal file
92
programs/fs/unzip60/funzip.txt
Normal file
@ -0,0 +1,92 @@
|
||||
FUNZIP(1L) FUNZIP(1L)
|
||||
|
||||
NAME
|
||||
funzip - filter for extracting from a ZIP archive in a pipe
|
||||
|
||||
SYNOPSIS
|
||||
funzip [-password] [input[.zip|.gz]]
|
||||
|
||||
ARGUMENTS
|
||||
[-password]
|
||||
Optional password to be used if ZIP archive is encrypted.
|
||||
Decryption may not be supported at some sites. See DESCRIPTION
|
||||
for more details.
|
||||
|
||||
[input[.zip|.gz]]
|
||||
Optional input archive file specification. See DESCRIPTION for
|
||||
details.
|
||||
|
||||
DESCRIPTION
|
||||
funzip without a file argument acts as a filter; that is, it assumes
|
||||
that a ZIP archive (or a gzip'd(1) file) is being piped into standard
|
||||
input, and it extracts the first member from the archive to stdout.
|
||||
When stdin comes from a tty device, funzip assumes that this cannot be
|
||||
a stream of (binary) compressed data and shows a short help text,
|
||||
instead. If there is a file argument, then input is read from the
|
||||
specified file instead of from stdin.
|
||||
|
||||
A password for encrypted zip files can be specified on the command line
|
||||
(preceding the file name, if any) by prefixing the password with a
|
||||
dash. Note that this constitutes a security risk on many systems; cur-
|
||||
rently running processes are often visible via simple commands (e.g.,
|
||||
ps(1) under Unix), and command-line histories can be read. If the
|
||||
first entry of the zip file is encrypted and no password is specified
|
||||
on the command line, then the user is prompted for a password and the
|
||||
password is not echoed on the console.
|
||||
|
||||
Given the limitation on single-member extraction, funzip is most useful
|
||||
in conjunction with a secondary archiver program such as tar(1). The
|
||||
following section includes an example illustrating this usage in the
|
||||
case of disk backups to tape.
|
||||
|
||||
EXAMPLES
|
||||
To use funzip to extract the first member file of the archive test.zip
|
||||
and to pipe it into more(1):
|
||||
|
||||
funzip test.zip | more
|
||||
|
||||
To use funzip to test the first member file of test.zip (any errors
|
||||
will be reported on standard error):
|
||||
|
||||
funzip test.zip > /dev/null
|
||||
|
||||
To use zip and funzip in place of compress(1) and zcat(1) (or gzip(1L)
|
||||
and gzcat(1L)) for tape backups:
|
||||
|
||||
tar cf - . | zip -7 | dd of=/dev/nrst0 obs=8k
|
||||
dd if=/dev/nrst0 ibs=8k | funzip | tar xf -
|
||||
|
||||
(where, for example, nrst0 is a SCSI tape drive).
|
||||
|
||||
BUGS
|
||||
When piping an encrypted file into more and allowing funzip to prompt
|
||||
for password, the terminal may sometimes be reset to a non-echo mode.
|
||||
This is apparently due to a race condition between the two programs;
|
||||
funzip changes the terminal mode to non-echo before more reads its
|
||||
state, and more then ``restores'' the terminal to this mode before
|
||||
exiting. To recover, run funzip on the same file but redirect to
|
||||
/dev/null rather than piping into more; after prompting again for the
|
||||
password, funzip will reset the terminal properly.
|
||||
|
||||
There is presently no way to extract any member but the first from a
|
||||
ZIP archive. This would be useful in the case where a ZIP archive is
|
||||
included within another archive. In the case where the first member is
|
||||
a directory, funzip simply creates the directory and exits.
|
||||
|
||||
The functionality of funzip should be incorporated into unzip itself
|
||||
(future release).
|
||||
|
||||
SEE ALSO
|
||||
gzip(1L), unzip(1L), unzipsfx(1L), zip(1L), zipcloak(1L), zipinfo(1L),
|
||||
zipnote(1L), zipsplit(1L)
|
||||
|
||||
URL
|
||||
The Info-ZIP home page is currently at
|
||||
http://www.info-zip.org/pub/infozip/
|
||||
or
|
||||
ftp://ftp.info-zip.org/pub/infozip/ .
|
||||
|
||||
AUTHOR
|
||||
Mark Adler (Info-ZIP)
|
||||
|
||||
Info-ZIP 20 April 2009 (v3.95) FUNZIP(1L)
|
104
programs/fs/unzip60/gbloffs.c
Normal file
104
programs/fs/unzip60/gbloffs.c
Normal file
@ -0,0 +1,104 @@
|
||||
/*
|
||||
Copyright (c) 1990-2002 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2000-Apr-09 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/* Write out a fragment of assembly or C preprocessor source giving offsets
|
||||
* in "Uz_Globs" and "struct huft". Used by Amiga and Human68k ports.
|
||||
*/
|
||||
|
||||
#define UNZIP_INTERNAL
|
||||
#include "unzip.h"
|
||||
#include "crypt.h"
|
||||
|
||||
#ifndef REENTRANT
|
||||
Uz_Globs G;
|
||||
#endif
|
||||
|
||||
static int asm_setflag(const char *flagname);
|
||||
static int ccp_setflag(const char *flagname);
|
||||
|
||||
static int asm_setflag(const char *flagname)
|
||||
{
|
||||
static const char asm_flagdef[] = " IFND %s\n%-15s EQU 1\n ENDC\n";
|
||||
return printf(asm_flagdef, flagname, flagname);
|
||||
}
|
||||
static int ccp_setflag(const char *flagname)
|
||||
{
|
||||
static const char ccp_flagdef[] = "#ifndef %s\n# define %s\n#endif\n";
|
||||
return printf(ccp_flagdef, flagname, flagname);
|
||||
}
|
||||
|
||||
int main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
#ifdef REENTRANT
|
||||
Uz_Globs *pG = NULL;
|
||||
#endif
|
||||
struct huft *t = NULL;
|
||||
static const char asm_offsdef[] = "%-15s EQU %lu\n";
|
||||
static const char ccp_offsdef[] = "#define %-15s %lu\n";
|
||||
|
||||
const char *out_format;
|
||||
int (*set_flag)(const char *flagname);
|
||||
int ccp_select = 0;
|
||||
|
||||
if (argc > 1 && argv[1] != NULL && !strcmp(argv[1], "-ccp"))
|
||||
ccp_select = 1;
|
||||
|
||||
if (ccp_select) {
|
||||
out_format = ccp_offsdef;
|
||||
set_flag = ccp_setflag;
|
||||
} else {
|
||||
out_format = asm_offsdef;
|
||||
set_flag = asm_setflag;
|
||||
}
|
||||
|
||||
printf(out_format, "h_e", (ulg)&t->e - (ulg)t);
|
||||
printf(out_format, "h_b", (ulg)&t->b - (ulg)t);
|
||||
printf(out_format, "h_v_n", (ulg)&t->v.n - (ulg)t);
|
||||
printf(out_format, "h_v_t", (ulg)&t->v.t - (ulg)t);
|
||||
printf(out_format, "SIZEOF_huft", (ulg)sizeof(struct huft));
|
||||
|
||||
printf(out_format, "bb", (ulg)&G.bb - (ulg)&G);
|
||||
printf(out_format, "bk", (ulg)&G.bk - (ulg)&G);
|
||||
printf(out_format, "wp", (ulg)&G.wp - (ulg)&G);
|
||||
#ifdef FUNZIP
|
||||
printf(out_format, "in", (ulg)&G.in - (ulg)&G);
|
||||
#else
|
||||
printf(out_format, "incnt", (ulg)&G.incnt - (ulg)&G);
|
||||
printf(out_format, "inptr", (ulg)&G.inptr - (ulg)&G);
|
||||
printf(out_format, "csize", (ulg)&G.csize - (ulg)&G);
|
||||
printf(out_format, "mem_mode", (ulg)&G.mem_mode - (ulg)&G);
|
||||
#endif
|
||||
printf(out_format, "redirslide", (ulg)&redirSlide - (ulg)&G);
|
||||
printf(out_format, "SIZEOF_slide", (ulg)sizeof(redirSlide));
|
||||
#if (defined(DLL) && !defined(NO_SLIDE_REDIR))
|
||||
printf(out_format, "_wsize", (ulg)&G._wsize - (ulg)&G);
|
||||
#endif /* DLL && !NO_SLIDE_REDIR */
|
||||
printf(out_format, "CRYPT", (ulg)CRYPT);
|
||||
#ifdef FUNZIP
|
||||
(*set_flag)("FUNZIP");
|
||||
#endif
|
||||
#ifdef SFX
|
||||
(*set_flag)("SFX");
|
||||
#endif
|
||||
#ifdef REENTRANT
|
||||
(*set_flag)("REENTRANT");
|
||||
#endif
|
||||
#ifdef DLL
|
||||
(*set_flag)("DLL");
|
||||
# ifdef NO_SLIDE_REDIR
|
||||
(*set_flag)("NO_SLIDE_REDIR");
|
||||
# endif
|
||||
#endif
|
||||
#ifdef USE_DEFLATE64
|
||||
(*set_flag)("USE_DEFLATE64");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
222
programs/fs/unzip60/globals.c
Normal file
222
programs/fs/unzip60/globals.c
Normal file
@ -0,0 +1,222 @@
|
||||
/*
|
||||
Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
|
||||
|
||||
See the accompanying file LICENSE, version 2003-May-08 or later
|
||||
(the contents of which are also included in unzip.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
|
||||
*/
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
globals.c
|
||||
|
||||
Routines to allocate and initialize globals, with or without threads.
|
||||
|
||||
Contents: registerGlobalPointer()
|
||||
deregisterGlobalPointer()
|
||||
getGlobalPointer()
|
||||
globalsCtor()
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#define UNZIP_INTERNAL
|
||||
#include "unzip.h"
|
||||
|
||||
#ifndef FUNZIP
|
||||
/* initialization of sigs is completed at runtime so unzip(sfx) executable
|
||||
* won't look like a zipfile
|
||||
*/
|
||||
char central_hdr_sig[4] = {0, 0, 0x01, 0x02};
|
||||
char local_hdr_sig[4] = {0, 0, 0x03, 0x04};
|
||||
char end_central_sig[4] = {0, 0, 0x05, 0x06};
|
||||
char end_central64_sig[4] = {0, 0, 0x06, 0x06};
|
||||
char end_centloc64_sig[4] = {0, 0, 0x06, 0x07};
|
||||
/* extern char extd_local_sig[4] = {0, 0, 0x07, 0x08}; NOT USED YET */
|
||||
|
||||
ZCONST char *fnames[2] = {"*", NULL}; /* default filenames vector */
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef REENTRANT
|
||||
Uz_Globs G;
|
||||
#else /* REENTRANT */
|
||||
|
||||
# ifndef USETHREADID
|
||||
Uz_Globs *GG;
|
||||
# else /* USETHREADID */
|
||||
# define THREADID_ENTRIES 0x40
|
||||
|
||||
int lastScan;
|
||||
Uz_Globs *threadPtrTable[THREADID_ENTRIES];
|
||||
ulg threadIdTable [THREADID_ENTRIES] = {
|
||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
|
||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* Make sure there are */
|
||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, /* THREADID_ENTRIES 0s */
|
||||
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0
|
||||
};
|
||||
|
||||
static ZCONST char Far TooManyThreads[] =
|
||||
"error: more than %d simultaneous threads.\n\
|
||||
Some threads are probably not calling DESTROYTHREAD()\n";
|
||||
static ZCONST char Far EntryNotFound[] =
|
||||
"error: couldn't find global pointer in table.\n\
|
||||
Maybe somebody accidentally called DESTROYTHREAD() twice.\n";
|
||||
static ZCONST char Far GlobalPointerMismatch[] =
|
||||
"error: global pointer in table does not match pointer passed as\
|
||||
parameter\n";
|
||||
|
||||
static void registerGlobalPointer OF((__GPRO));
|
||||
|
||||
|
||||
|
||||
static void registerGlobalPointer(__G)
|
||||
__GDEF
|
||||
{
|
||||
int scan=0;
|
||||
ulg tid = GetThreadId();
|
||||
|
||||
while (threadIdTable[scan] && scan < THREADID_ENTRIES)
|
||||
scan++;
|
||||
|
||||
if (scan == THREADID_ENTRIES) {
|
||||
ZCONST char *tooMany = LoadFarString(TooManyThreads);
|
||||
Info(slide, 0x421, ((char *)slide, tooMany, THREADID_ENTRIES));
|
||||
free(pG);
|
||||
EXIT(PK_MEM); /* essentially memory error before we've started */
|
||||
}
|
||||
|
||||
threadIdTable [scan] = tid;
|
||||
threadPtrTable[scan] = pG;
|
||||
lastScan = scan;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void deregisterGlobalPointer(__G)
|
||||
__GDEF
|
||||
{
|
||||
int scan=0;
|
||||
ulg tid = GetThreadId();
|
||||
|
||||
|
||||
while (threadIdTable[scan] != tid && scan < THREADID_ENTRIES)
|
||||
scan++;
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
There are two things we can do if we can't find the entry: ignore it or
|
||||
scream. The most likely reason for it not to be here is the user calling
|
||||
this routine twice. Since this could cause BIG problems if any globals
|
||||
are accessed after the first call, we'd better scream.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (scan == THREADID_ENTRIES || threadPtrTable[scan] != pG) {
|
||||
ZCONST char *noEntry;
|
||||
if (scan == THREADID_ENTRIES)
|
||||
noEntry = LoadFarString(EntryNotFound);
|
||||
else
|
||||
noEntry = LoadFarString(GlobalPointerMismatch);
|
||||
Info(slide, 0x421, ((char *)slide, noEntry));
|
||||
EXIT(PK_WARN); /* programming error, but after we're all done */
|
||||
}
|
||||
|
||||
threadIdTable [scan] = 0;
|
||||
lastScan = scan;
|
||||
free(threadPtrTable[scan]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Uz_Globs *getGlobalPointer()
|
||||
{
|
||||
int scan=0;
|
||||
ulg tid = GetThreadId();
|
||||
|
||||
while (threadIdTable[scan] != tid && scan < THREADID_ENTRIES)
|
||||
scan++;
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
There are two things we can do if we can't find the entry: ignore it or
|
||||
scream. The most likely reason for it not to be here is the user calling
|
||||
this routine twice. Since this could cause BIG problems if any globals
|
||||
are accessed after the first call, we'd better scream.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (scan == THREADID_ENTRIES) {
|
||||
ZCONST char *noEntry = LoadFarString(EntryNotFound);
|
||||
fprintf(stderr, noEntry); /* can't use Info w/o a global pointer */
|
||||
EXIT(PK_ERR); /* programming error while still working */
|
||||
}
|
||||
|
||||
return threadPtrTable[scan];
|
||||
}
|
||||
|
||||
# endif /* ?USETHREADID */
|
||||
#endif /* ?REENTRANT */
|
||||
|
||||
|
||||
|
||||
Uz_Globs *globalsCtor()
|
||||
{
|
||||
#ifdef REENTRANT
|
||||
Uz_Globs *pG = (Uz_Globs *)malloc(sizeof(Uz_Globs));
|
||||
|
||||
if (!pG)
|
||||
return (Uz_Globs *)NULL;
|
||||
#endif /* REENTRANT */
|
||||
|
||||
/* for REENTRANT version, G is defined as (*pG) */
|
||||
|
||||
memzero(&G, sizeof(Uz_Globs));
|
||||
|
||||
#ifndef FUNZIP
|
||||
#ifdef CMS_MVS
|
||||
uO.aflag=1;
|
||||
uO.C_flag=1;
|
||||
#endif
|
||||
#ifdef TANDEM
|
||||
uO.aflag=1; /* default to '-a' auto create Text Files as type 101 */
|
||||
#endif
|
||||
#ifdef VMS
|
||||
# if (!defined(NO_TIMESTAMPS))
|
||||
uO.D_flag=1; /* default to '-D', no restoration of dir timestamps */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
uO.lflag=(-1);
|
||||
G.wildzipfn = "";
|
||||
G.pfnames = (char **)fnames;
|
||||
G.pxnames = (char **)&fnames[1];
|
||||
G.pInfo = G.info;
|
||||
G.sol = TRUE; /* at start of line */
|
||||
|
||||
G.message = UzpMessagePrnt;
|
||||
G.input = UzpInput; /* not used by anyone at the moment... */
|
||||
#if defined(WINDLL) || defined(MACOS)
|
||||
G.mpause = NULL; /* has scrollbars: no need for pausing */
|
||||
#else
|
||||
G.mpause = UzpMorePause;
|
||||
#endif
|
||||
G.decr_passwd = UzpPassword;
|
||||
#endif /* !FUNZIP */
|
||||
|
||||
#if (!defined(DOS_FLX_H68_NLM_OS2_W32) && !defined(AMIGA) && !defined(RISCOS))
|
||||
#if (!defined(MACOS) && !defined(ATARI) && !defined(VMS))
|
||||
G.echofd = -1;
|
||||
#endif /* !(MACOS || ATARI || VMS) */
|
||||
#endif /* !(DOS_FLX_H68_NLM_OS2_W32 || AMIGA || RISCOS) */
|
||||
|
||||
#ifdef SYSTEM_SPECIFIC_CTOR
|
||||
SYSTEM_SPECIFIC_CTOR(__G);
|
||||
#endif
|
||||
|
||||
#ifdef REENTRANT
|
||||
#ifdef USETHREADID
|
||||
registerGlobalPointer(__G);
|
||||
#else
|
||||
GG = &G;
|
||||
#endif /* ?USETHREADID */
|
||||
#endif /* REENTRANT */
|
||||
|
||||
return &G;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user