Get Info-ZIP's zip to build

* removed unnecessary files (like amiga/osdep.h)
* makefile has 4 targets: zip, zipnote, zipcloak, zipsplit
* added clang-format off at the start of all source files
* added necessary headers
This commit is contained in:
ahgamut 2021-06-10 05:30:58 +05:30 committed by Justine Tunney
parent 4ce5664c4b
commit 4d8f884e76
345 changed files with 298 additions and 77763 deletions

View file

@ -139,6 +139,7 @@ include third_party/lua/lua.mk
include third_party/sqlite3/sqlite3.mk
include third_party/quickjs/quickjs.mk
include third_party/lz4cli/lz4cli.mk
include third_party/infozip/infozip.mk
include tool/build/lib/buildlib.mk
include third_party/chibicc/chibicc.mk
include third_party/chibicc/test/test.mk

134
third_party/infozip/infozip.mk vendored Normal file
View file

@ -0,0 +1,134 @@
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
PKGS += THIRD_PARTY_ZIP
THIRD_PARTY_ZIP_FILES = $(wildcard third_party/infozip/zip/*) third_party/infozip/zip/unix/unix.c
THIRD_PARTY_ZIP_SRCS_C = $(filter %.c,$(THIRD_PARTY_ZIP_FILES))
THIRD_PARTY_ZIP = $(THIRD_PARTY_ZIP_COMS) $(THIRD_PARTY_ZIP_COMS:%=%.dbg)
THIRD_PARTY_ZIP_COMS = \
o/$(MODE)/third_party/infozip/zip.com \
o/$(MODE)/third_party/infozip/zipsplit.com \
o/$(MODE)/third_party/infozip/zipnote.com \
o/$(MODE)/third_party/infozip/zipcloak.com
THIRD_PARTY_ZIP_OBJS = $(sort \
$(THIRD_PARTY_ZIP_COM_OBJS) \
$(THIRD_PARTY_ZIPCLOAK_OBJS) \
$(THIRD_PARTY_ZIPNOTE_OBJS) \
$(THIRD_PARTY_ZIPSPLIT_OBJS) \
)
THIRD_PARTY_ZIP_UTIL_OBJS1 = \
o/$(MODE)/third_party/infozip/zip/globals.o \
o/$(MODE)/third_party/infozip/zip/unix/unix_.o \
o/$(MODE)/third_party/infozip/zip/zipfile_.o \
o/$(MODE)/third_party/infozip/zip/fileio_.o \
o/$(MODE)/third_party/infozip/zip/util_.o
THIRD_PARTY_ZIP_UTIL_OBJS2 = \
o/$(MODE)/third_party/infozip/zip/crypt_.o \
o/$(MODE)/third_party/infozip/zip/crc32_.o
THIRD_PARTY_ZIP_UTIL_OBJS = \
$(THIRD_PARTY_ZIP_UTIL_OBJS1) \
$(THIRD_PARTY_ZIP_UTIL_OBJS2)
THIRD_PARTY_ZIP_COM_OBJS = \
o/$(MODE)/third_party/infozip/zip/zip.o \
o/$(MODE)/third_party/infozip/zip/zipfile.o \
o/$(MODE)/third_party/infozip/zip/zipup.o \
o/$(MODE)/third_party/infozip/zip/fileio.o \
o/$(MODE)/third_party/infozip/zip/util.o \
o/$(MODE)/third_party/infozip/zip/globals.o \
o/$(MODE)/third_party/infozip/zip/crypt.o \
o/$(MODE)/third_party/infozip/zip/ttyio.o \
o/$(MODE)/third_party/infozip/zip/unix/unix.o \
o/$(MODE)/third_party/infozip/zip/crc32.o \
o/$(MODE)/third_party/infozip/zip/zbz2err.o \
o/$(MODE)/third_party/infozip/zip/deflate.o \
o/$(MODE)/third_party/infozip/zip/trees.o
THIRD_PARTY_ZIPSPLIT_OBJS = \
o/$(MODE)/third_party/infozip/zip/zipsplit.o \
$(THIRD_PARTY_ZIP_UTIL_OBJS1)
THIRD_PARTY_ZIPNOTE_OBJS = \
o/$(MODE)/third_party/infozip/zip/zipnote.o \
$(THIRD_PARTY_ZIP_UTIL_OBJS1)
THIRD_PARTY_ZIPCLOAK_OBJS = \
o/$(MODE)/third_party/infozip/zip/zipcloak.o \
o/$(MODE)/third_party/infozip/zip/ttyio.o \
$(THIRD_PARTY_ZIP_UTIL_OBJS1) \
$(THIRD_PARTY_ZIP_UTIL_OBJS2)
THIRD_PARTY_ZIP_LARGE_OBJS = \
o/$(MODE)/third_party/infozip/zip/zip.o \
o/$(MODE)/third_party/infozip/zip/zipsplit.o \
o/$(MODE)/third_party/infozip/zip/fileio.o \
o/$(MODE)/third_party/infozip/zip/fileio_.o
o/$(MODE)/third_party/infozip/zip/%_.o: third_party/infozip/zip/%.c
@$(COMPILE) -AOBJECTIFY.c $(OBJECTIFY.c) $(OUTPUT_OPTION) -DUTIL $<
$(THIRD_PARTY_ZIP_OBJS): \
OVERRIDE_CFLAGS += \
-DUNIX \
-DMMAP \
-DUNICODE_SUPPORT \
-DUSE_EF_UT_TIME \
-DLARGE_FILE_SUPPORT \
-DHAVE_DIRENT_H \
-DHAVE_TERMIOS_H \
-DNO_BZIP2_SUPPORT
$(THIRD_PARTY_ZIP_LARGE_OBJS): \
OVERRIDE_CFLAGS += -DSTACK_FRAME_UNLIMITED
THIRD_PARTY_ZIP_DIRECTDEPS = \
LIBC_ERRNO \
LIBC_LIMITS \
LIBC_ALG \
LIBC_FMT \
LIBC_STR \
LIBC_MEM \
LIBC_LOG \
LIBC_CALLS \
LIBC_STDIO \
LIBC_TIME \
LIBC_UNICODE
THIRD_PARTY_ZIP_DEPS := \
$(call uniq,$(foreach x,$(THIRD_PARTY_ZIP_DIRECTDEPS),$($(x))))
o/$(MODE)/third_party/infozip/zip.com.dbg: \
$(THIRD_PARTY_ZIP_DEPS) \
$(THIRD_PARTY_ZIP_COM_OBJS) \
$(CRT) \
$(APE)
@$(APELINK)
o/$(MODE)/third_party/infozip/zipsplit.com.dbg: \
$(THIRD_PARTY_ZIP_DEPS) \
$(THIRD_PARTY_ZIPSPLIT_OBJS) \
$(CRT) \
$(APE)
@$(APELINK)
o/$(MODE)/third_party/infozip/zipnote.com.dbg: \
$(THIRD_PARTY_ZIP_DEPS) \
$(THIRD_PARTY_ZIPNOTE_OBJS) \
$(CRT) \
$(APE)
@$(APELINK)
o/$(MODE)/third_party/infozip/zipcloak.com.dbg: \
$(THIRD_PARTY_ZIP_DEPS) \
$(THIRD_PARTY_ZIPCLOAK_OBJS) \
$(CRT) \
$(APE)
@$(APELINK)
.PHONY: o/$(MODE)/third_party/infozip
o/$(MODE)/third_party/infozip: $(THIRD_PARTY_ZIP)

View file

@ -1,17 +0,0 @@
Betas are works in progress. When a beta has a seemingly stable set
of features, we may post a public beta so outside developers can see
where the code is going and make contributions or comment.
A Release Candidate is a beta that we believe has the full feature
set that will be released. It's still being tested, and things can
still change, but we thought it close when we posted it.
We take suggestions, bug fixes, and patches at any time, so send them in.
We make no guarantees as to the state of betas so use at your own risk.
All code, including releases, are released under the Info-ZIP license.
Enjoy!
Ed Gordon
20 April 2008

View file

@ -1,130 +0,0 @@
# Makefile for Zip, ZipNote, ZipCloak and ZipSplit
# add -g to CC to debug
# add -d to BIND to debug
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 -DASMV
ASMFLAGS = -throwback -objasm -upper
LFLAGS1 =
LFLAGS2 = $(LIB)
# Uncomment the following line to enable support for Unix
# Extra Field (Timezone)
#CFLAGS = $(CFLAGS) -DUSE_EF_UT_TIME
# object file lists
OBJZ = o.zip o.zipfile o.zipup o.fileio o.util o.globals o.crc32 \
o.crypt o.ttyio o.riscos o.acornzip o.swiven
OBJI = o.deflate o.trees
OBJA = o.match o.sendbits
OBJU = o.zipfile_ o.fileio_ o.util_ o.globals o.riscos o.acornzip_ o.swiven
OBJN = o.zipnote $(OBJU)
OBJC = o.zipcloak $(OBJU) o.crc32_ o.crypt_ o.ttyio
OBJS = o.zipsplit $(OBJU)
ZIP_H = h.zip h.ziperr h.tailor acorn.h.osdep acorn.h.riscos acorn.h.swiven
all: zip zipnote zipsplit zipcloak
install: %.zip %.zipnote %.zipsplit %.zipcloak %.acorn.zipsfx \
zip zipnote zipsplit zipcloak acorn.zipsfx
$(SQUEEZE) zip %.zip
$(SQUEEZE) zipnote %.zipnote
$(SQUEEZE) zipsplit %.zipsplit
$(SQUEEZE) zipcloak %.zipcloak
copy acorn.zipsfx %.zipsfx ~CVF
# rules for zip, zipnote, zipcloak and zipsplit
o.api: c.api
$(CC) $(CFLAGS) -c c.api -o o.api
o.crc32: c.crc32 $(ZIP_H) h.crc32
$(CC) $(CFLAGS) -c c.crc32 -o o.crc32
o.crypt: c.crypt $(ZIP_H) h.crypt h.crc32 h.ttyio
$(CC) $(CFLAGS) -c c.crypt -o o.crypt
o.deflate: c.deflate $(ZIP_H)
$(CC) $(CFLAGS) -c c.deflate -o o.deflate
o.fileio: c.fileio $(ZIP_H) h.crc32
$(CC) $(CFLAGS) -c c.fileio -o o.fileio
o.globals: c.globals $(ZIP_H)
$(CC) $(CFLAGS) -c c.globals -o o.globals
o.mktime: c.mktime
$(CC) $(CFLAGS) -c c.mktime -o o.mktime
o.trees: c.trees $(ZIP_H)
$(CC) $(CFLAGS) -c c.trees -o o.trees
o.ttyio: c.ttyio $(ZIP_H) h.crypt
$(CC) $(CFLAGS) -c c.ttyio -o o.ttyio
o.util: c.util $(ZIP_H)
$(CC) $(CFLAGS) -c c.util -o o.util
o.zip: c.zip $(ZIP_H) h.crc32 h.crypt h.revision h.ttyio
$(CC) $(CFLAGS) -c c.zip -o o.zip
o.zipcloak: c.zipcloak $(ZIP_H) h.crc32 h.crypt h.revision h.ttyio
$(CC) $(CFLAGS) -c c.zipcloak -o o.zipcloak
o.zipfile: c.zipfile $(ZIP_H) h.crc32
$(CC) $(CFLAGS) -c c.zipfile -o o.zipfile
o.zipnote: c.zipnote $(ZIP_H) h.revision
$(CC) $(CFLAGS) -c c.zipnote -o o.zipnote
o.zipsplit: c.zipsplit $(ZIP_H) h.revision
$(CC) $(CFLAGS) -c c.zipsplit -o o.zipsplit
o.zipup: c.zipup $(ZIP_H) h.crc32 h.crypt h.revision
$(CC) $(CFLAGS) -c c.zipup -o o.zipup
o.crc32_: c.crc32 $(ZIP_H) h.crc32
$(CC) $(CFLAGS) -DUTIL -c c.crc32 -o o.crc32_
o.crypt_: c.crypt $(ZIP_H) h.crypt h.crc32 h.ttyio
$(CC) $(CFLAGS) -DUTIL -c c.crypt -o o.crypt_
o.util_: c.util $(ZIP_H)
$(CC) $(CFLAGS) -DUTIL -c c.util -o o.util_
o.fileio_: c.fileio $(ZIP_H) h.crc32
$(CC) $(CFLAGS) -DUTIL -c c.fileio -o o.fileio_
o.zipfile_: c.zipfile $(ZIP_H) h.crc32
$(CC) $(CFLAGS) -DUTIL -c c.zipfile -o o.zipfile_
o.acornzip_: acorn.c.acornzip $(ZIP_H)
$(CC) $(CFLAGS) -I@ -DUTIL -c acorn.c.acornzip -o o.acornzip_
o.riscos: acorn.c.riscos acorn.h.riscos $(ZIP_H)
$(CC) $(CFLAGS) -I@ -c acorn.c.riscos -o o.riscos
o.acornzip: acorn.c.acornzip $(ZIP_H)
$(CC) $(CFLAGS) -I@ -c acorn.c.acornzip -o o.acornzip
o.match: acorn.s.match
$(ASM) $(ASMFLAGS) -I@ acorn.s.match -o o.match
o.sendbits: acorn.s.sendbits
$(ASM) $(ASMFLAGS) -I@ acorn.s.sendbits -o o.sendbits
o.swiven: acorn.s.swiven
$(ASM) $(ASMFLAGS) -I@ acorn.s.swiven -o o.swiven
zip: $(OBJZ) $(OBJI) $(OBJA)
$(BIND) -o zip$(E) $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2)
zipnote: $(OBJN)
$(BIND) -o zipnote$(E) $(LFLAGS1) $(OBJN) $(LFLAGS2)
zipcloak: $(OBJC)
$(BIND) -o zipcloak$(E) $(LFLAGS1) $(OBJC) $(LFLAGS2)
zipsplit: $(OBJS)
$(BIND) -o zipsplit$(E) $(LFLAGS1) $(OBJS) $(LFLAGS2)
clean:
remove zip
remove zipcloak
remove zipsplit
remove zipnote
create o.!fake! 0
wipe o.* ~cf
# end of Makefile

View file

@ -1,85 +0,0 @@
Acorn-specific compile instructions
-----------------------------------
Use the "RunMe1st" file (it is an Obey file) to convert all the files from
"filename/[chs]" to "[chs].filename" (so that zip could be easily compiled
under RISC OS). It will also set the correct makefile.
To compile just set the CSD to the main zip 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 zip.
The default makefile is configured without the support for the
Extended Timestamp Extra Field. If you wan to enable it you have to
add "-DUSE_EF_UT_TIME" to CFLAGS (see makefile). Without the Extended
Timestamp Field support, zipfiles created by zip are identical to the
zipfiles created by SparkFS. However, the Extended Timestamp Field can
be useful if you are going to unzip your zipfiles on a non-RISC OS machine
since the correct time stamp will be preserved across different timezones.
Note that in this case, both the SparkFS Extra Field and the Extended
Timestamp Extra Field will be used, so the zipfiles will still be fully
compatible with SparkFS and with the RISC OS version of unzip.
The executables-only distributions will be compiled without the support for
the Extended Timestamp Extra Field. If you need it but you can't compile zip
yourself, you can contact the authors at the Info-ZIP address who will do it
for you.
Acorn-specific usage instructions
---------------------------------
An extra option ('I') has been added to the Acorn port: if it is specified
zip will not consider Image files (eg. DOS partitions or Spark archives when
SparkFS is loaded) as directories but will store them as single files. This
means that if you have, say, SparkFS loaded, zipping a Spark archive will
result in a zipfile containing a directory (and its content) while using the
'I' option will result in a zipfile containing a Spark archive. Obviously
this second case will also be obtained (without the 'I' option) if SparkFS
isn't loaded.
When adding files to a zipfile; to maintain FileCore compliance, all
files named "file/ext" will be added to the archive as "file.ext".
This presents no problem if you wish to use unzip to extract them on any
other machine, as the files are correctly named. This also presents no
problem if you use unzip for RISC OS, as the files are converted back to
"file/ext" format. The only problem appears when you use SparkFS to
decompress the files, as a file called "file.ext" will be extracted as
"file_ext", not what it was added as. You must be careful about this.
Case Specific. Depending on how you type the command, files will be added
exactly as named; in this example:
*zip new/zip newfile
*zip new/zip NewFile
*zip new/zip NEWFILE
will create an archive containing 3 copies of the same Risc OS file 'newfile'
called 'newfile', 'NewFile' and 'NEWFILE'. Please be careful.
The Acorn port conserves file attributes, including filetype, so if you
zip on an Acorn, and unzip on another Acorn, filetypes will be maintained
precisely as if you used uncompressed files. If you de-archive on another
machine (PC, Mac, Unix etc..), filetypes will be ignored, but the files
will be identical despite this. This feature is fully compatible with
SparkFS, so zipfiles created by zip will be correctly uncompressed (including
filetype, etc.) by SparkFS.
An additional feature went into this port to cope better with C-code
and extensions. This allows the acorn files "c.foo" to be added to the
archive as "foo/c", eventually appearing in the archive as "foo.c", allowing
for better handling of C or C++ code. Example:
*Set Zip$Exts "dir1:dir2:dir3"
*zip new/zip dir1.file
*zip new/zip dir2.help
*zip new/zip dir3.textfile
Creates a zipfile new/zip, with entries file.dir1, help.dir2, textfile.dir3.
The usual settings for Zip$Exts are "h:o:s:c", allowing C code to be added
to the archive in standard form.
A final note about the Acorn port regards the use of the 'n' option: this is
used to specify a list of suffixes that will not be compressed (eg. .ZIP,
since it is already a compressed file). Since RISC OS uses filetypes instead
of suffixes, this list of suffixes is actually considered as a list of
filetypes (3 hex digit format). By default, zip doesn't compress filetypes
DDC (Archive, Spark or Zip), D96 (CFS files) and 68E (PackDir).

View file

@ -1,16 +0,0 @@
GMakefile is for use with Acorn RISC OS and the forthcoming
post-Acorn RISC OS for the compilation of both the current release and
development versions of zip.
It is recommended that you use gcc 2.95.4 or higher and you will need a
suitable 'make' utility. Both are available from
<URL:http://hard-mofo.dsvr.net/gcc/>.
You will need the files gcc.zip and cc1.zip for the C compiler with the
documentation available in the gccdoc.zip archive. GNU make can be
found in the utils.zip archive, although most versions of 'make' should be
fine.
When using gcc, check RunMe1st for two lines which need uncommenting.

View file

@ -1,23 +0,0 @@
| This Obey file prepares the zip 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 zip 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
Copy <Obey$Dir>.makefile <Obey$Dir>.^.makefile ~C ~V F
| Uncomment the following lines if you're using gcc
|| Put the Makefile in its correct place and set the correct filetype
|Copy <Obey$Dir>.GMakefile <Obey$Dir>.^.makefile ~C~VF
SetType <Obey$Dir>.^.makefile FE1
SetType <Obey$Dir>.zipsfx Obey

View file

@ -1,592 +0,0 @@
/*
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
*/
#include <stdlib.h>
#include <string.h>
#include "zip.h"
#ifndef UTIL
#define PAD 0
#define PATH_END '/'
local int wild_recurse(char *whole, char *wildtail);
local int uxtime2acornftime(unsigned *pexadr, unsigned *pldadr, time_t ut);
extern char *label;
local ulg label_time = 0;
local ulg label_mode = 0;
local time_t label_utim = 0;
char *readd(DIR *d)
/* Return a pointer to the next name in the directory stream d, or NULL if
no more entries or an error occurs. */
{
struct dirent *e;
e = readdir(d);
return (e == NULL ? (char *) NULL : e->d_name);
}
/* What we have here is a mostly-generic routine using opend()/readd() and */
/* isshexp()/MATCH() to find all the files matching a multi-part filespec */
/* using the portable pattern syntax. It shouldn't take too much fiddling */
/* to make it usable for any other platform that has directory hierarchies */
/* but no shell-level pattern matching. It works for patterns throughout */
/* the pathname, such as "foo:*.?/source/x*.[ch]". */
/* whole is a pathname with wildcards, wildtail points somewhere in the */
/* middle of it. All wildcards to be expanded must come AFTER wildtail. */
local int wild_recurse(whole, wildtail) char *whole; char *wildtail;
{
DIR *dir;
char *subwild, *name, *newwhole = NULL, *glue = NULL, plug = 0, plug2;
ush newlen, amatch = 0;
struct stat statb;
int disk_not_mounted=0;
int e = ZE_MISS;
if (!isshexp(wildtail)) {
if (stat(whole,&statb)==0 && (statb.st_mode & S_IREAD)!=0) {
return procname(whole, 0);
} else
return ZE_MISS; /* woops, no wildcards! */
}
/* back up thru path components till existing dir found */
do {
name = wildtail + strlen(wildtail) - 1;
for (;;)
if (name-- <= wildtail || *name == '.') {
subwild = name + 1;
plug2 = *subwild;
*subwild = 0;
break;
}
if (glue)
*glue = plug;
glue = subwild;
plug = plug2;
dir = opendir(whole);
} while (!dir && !disk_not_mounted && subwild > wildtail);
wildtail = subwild; /* skip past non-wild components */
if ((subwild = strchr(wildtail + 1, '.')) != NULL) {
/* this "+ 1" dodges the ^^^ hole left by *glue == 0 */
*(subwild++) = 0; /* wildtail = one component pattern */
newlen = strlen(whole) + strlen(subwild) + 32;
} else
newlen = strlen(whole) + 31;
if (!dir || !(newwhole = malloc(newlen))) {
if (glue)
*glue = plug;
e = dir ? ZE_MEM : ZE_MISS;
goto ohforgetit;
}
strcpy(newwhole, whole);
newlen = strlen(newwhole);
if (glue)
*glue = plug; /* repair damage to whole */
if (!isshexp(wildtail)) {
e = ZE_MISS; /* non-wild name not found */
goto ohforgetit;
}
while (name = readd(dir)) {
if (MATCH(wildtail, name, 0)) {
strcpy(newwhole + newlen, name);
if (subwild) {
name = newwhole + strlen(newwhole);
*(name++) = '.';
strcpy(name, subwild);
e = wild_recurse(newwhole, name);
} else
e = procname(newwhole, 0);
newwhole[newlen] = 0;
if (e == ZE_OK)
amatch = 1;
else if (e != ZE_MISS)
break;
}
}
ohforgetit:
if (dir) closedir(dir);
if (subwild) *--subwild = '.';
if (newwhole) free(newwhole);
if (e == ZE_MISS && amatch)
e = ZE_OK;
return e;
}
int wild(p)
char *p;
{
char *path;
int toret;
/* special handling of stdin request */
if (strcmp(p, "-") == 0) /* if compressing stdin */
return newname(p, 0, 0);
path=p;
if (strchr(p, ':')==NULL && *p!='@') {
if (!(path=malloc(strlen(p)+3))) {
return ZE_MEM;
}
strcpy(path,"@.");
strcat(path,p);
}
toret=wild_recurse(path, path);
if (path!=p) {
free(path);
}
return toret;
}
int procname(n, caseflag)
char *n; /* name to process */
int caseflag; /* true to force case-sensitive match */
/* Process a name or sh expression to operate on (or exclude). Return
an error code in the ZE_ class. */
{
char *a; /* path and name for recursion */
DIR *d; /* directory stream from opendir() */
char *e; /* pointer to name from readd() */
int m; /* matched flag */
char *p; /* path for recursion */
struct stat s; /* result of stat() */
struct zlist far *z; /* steps through zfiles list */
if (strcmp(n, "-") == 0) /* if compressing stdin */
return newname(n, 0, caseflag);
else if (LSSTAT(n, &s))
{
/* Not a file or directory--search for shell expression in zip file */
p = ex2in(n, 0, (int *)NULL); /* shouldn't affect matching chars */
m = 1;
for (z = zfiles; z != NULL; z = z->nxt) {
if (MATCH(p, z->iname, caseflag))
{
z->mark = pcount ? filter(z->zname, caseflag) : 1;
if (verbose)
fprintf(mesg, "zip diagnostic: %scluding %s\n",
z->mark ? "in" : "ex", z->name);
m = 0;
}
}
free((zvoid *)p);
return m ? ZE_MISS : ZE_OK;
}
/* Live name--use if file, recurse if directory */
if ((s.st_mode & S_IFDIR) == 0)
{
/* add or remove name of file */
if ((m = newname(n, 0, caseflag)) != ZE_OK)
return m;
} else {
/* Add trailing / to the directory name */
if ((p = malloc(strlen(n)+2)) == NULL)
return ZE_MEM;
if (strcmp(n, ".") == 0) {
*p = '\0'; /* avoid "./" prefix and do not create zip entry */
} else {
strcpy(p, n);
a = p + strlen(p);
if (a[-1] != '.')
strcpy(a, ".");
if (dirnames && (m = newname(p, 1, caseflag)) != ZE_OK) {
free((zvoid *)p);
return m;
}
}
/* recurse into directory */
if (recurse && (d = opendir(n)) != NULL)
{
while ((e = readd(d)) != NULL) {
if (strcmp(e, ".") && strcmp(e, ".."))
{
if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL)
{
closedir(d);
free((zvoid *)p);
return ZE_MEM;
}
strcat(strcpy(a, p), e);
if ((m = procname(a, caseflag)) != ZE_OK) /* recurse on name */
{
if (m == ZE_MISS)
zipwarn("name not matched: ", a);
else
ziperr(m, a);
}
free((zvoid *)a);
}
}
closedir(d);
}
free((zvoid *)p);
} /* (s.st_mode & S_IFDIR) == 0) */
return ZE_OK;
}
char *ex2in(x, isdir, pdosflag)
char *x; /* external file name */
int isdir; /* input: x is a directory */
int *pdosflag; /* output: force MSDOS file attributes? */
/* Convert the external file name to a zip file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *n; /* internal file name (malloc'ed) */
char *t; /* shortened name */
char *tmp;
int dosflag;
char *lastlastdir=NULL; /* pointer to 2 dirs before... */
char *lastdir=NULL; /* pointer to last dir... */
/* Malloc space for internal name and copy it */
if ((tmp = malloc(strlen(x) + 1)) == NULL)
return NULL;
strcpy(tmp, x);
dosflag = dosify; /* default for non-DOS and non-OS/2 */
/* Find starting point in name before doing malloc */
for(t=tmp;*t;t++) {
if (*t=='/') {
*t='.';
}
else if (*t=='.') {
*t='/';
lastlastdir=lastdir;
lastdir=t+1;
}
}
t=strchr(tmp,'$'); /* skip FS name */
if (t!=NULL)
t+=2; /* skip '.' after '$' */
else
t=tmp;
if (*t=='@') /* skip @. at the beginning of filenames */
t+=2;
/* Make changes, if any, to the copied name (leave original intact) */
/* return a pointer to '\0' if the file is a directory with the same
same name as an extension to swap (eg. 'c', 'h', etc.) */
if (isdir && exts2swap!=NULL) {
if (lastlastdir==NULL)
lastlastdir=t;
if (checkext(lastlastdir)) {
free((void *)tmp);
n=malloc(1);
if (n!=NULL)
*n='\0';
return n;
}
}
if (exts2swap!=NULL && lastdir!=NULL) {
if (lastlastdir==NULL)
lastlastdir=t;
if (checkext(lastlastdir)) {
if (swapext(lastlastdir,lastdir-1)) {
free((void *)tmp);
return NULL;
}
}
}
if (!pathput)
t = last(t, PATH_END);
/* Malloc space for internal name and copy it */
if ((n = malloc(strlen(t) + 1)) == NULL) {
free((void *)tmp);
return NULL;
}
strcpy(n, t);
free((void *)tmp);
if (dosify)
msname(n);
/* Returned malloc'ed name */
if (pdosflag)
*pdosflag = dosflag;
return n;
}
char *in2ex(n)
char *n; /* internal file name */
/* Convert the zip file name to an external file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *x; /* external file name */
char *t; /* scans name */
char *lastext=NULL; /* pointer to last extension */
char *lastdir=NULL; /* pointer to last dir */
if ((x = malloc(strlen(n) + 1 + PAD)) == NULL)
return NULL;
strcpy(x, n);
for(t=x;*t;t++) {
if (*t=='.') {
*t='/';
lastext=t+1;
}
else if (*t=='/') {
*t='.';
lastdir=t+1;
}
}
if (exts2swap!=NULL && (int)lastext>(int)lastdir) {
if (lastdir==NULL)
lastdir=x;
if (checkext(lastext)) {
if (swapext(lastdir,lastext-1)) {
free((void *)x);
return NULL;
}
}
}
return x;
}
local 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 */
}
void stamp(f, d)
char *f; /* name of file to change */
ulg d; /* dos-style time to change it to */
/* Set last updated and accessed time of file f to the DOS time d. */
{
time_t m_time;
unsigned int loadaddr, execaddr;
int attr;
/* Convert DOS time to time_t format in m_time */
m_time = dos2unixtime(d);
/* set the file's modification time */
SWI_OS_File_5(f,NULL,&loadaddr,NULL,NULL,&attr);
if (uxtime2acornftime(&execaddr, &loadaddr, m_time) != 0)
return;
SWI_OS_File_1(f,loadaddr,execaddr,attr);
}
ulg filetime(f, a, n, t)
char *f; /* name of file to get info on */
ulg *a; /* return value: file attributes */
long *n; /* return value: file size */
iztimes *t; /* return value: access, modific. and creation times */
/* If file *f does not exist, return 0. Else, return the file's last
modified date and time as an MSDOS date and time. The date and
time is returned in a long with the date most significant to allow
unsigned integer comparison of absolute times. Also, if a is not
a NULL pointer, store the file attributes there, with the high two
bytes being the Unix attributes, and the low byte being a mapping
of that to DOS attributes. If n is not NULL, store the file size
there. If t is not NULL, the file's access, modification and creation
times are stored there as UNIX time_t values.
If f is "-", use standard input as the file. If f is a device, return
a file size of -1 */
{
struct stat s; /* results of stat() */
/* convert FNMAX to malloc - 11/8/04 EG */
char *name;
unsigned int len = strlen(f);
if (f == label) {
if (a != NULL)
*a = label_mode;
if (n != NULL)
*n = -2L; /* convention for a label name */
if (t != NULL)
t->atime = t->mtime = t->ctime = label_utim;
return label_time;
}
if ((name = malloc(len + 1)) == NULL) {
ZIPERR(ZE_MEM, "filetime");
}
strcpy(name, f);
if (name[len - 1] == '.')
name[len - 1] = '\0';
/* not all systems allow stat'ing a file with / appended */
if (strcmp(f, "-") == 0) {
/* forge stat values for stdin since Amiga and RISCOS have no fstat() */
s.st_mode = (S_IREAD|S_IWRITE|S_IFREG);
s.st_size = -1;
s.st_mtime = time(&s.st_mtime);
} else if (LSSTAT(name, &s) != 0) {
/* Accept about any file kind including directories
* (stored with trailing / with -r option)
*/
free(name);
return 0;
}
free(name);
if (a != NULL) {
*a = ((ulg)s.st_mode << 16) | !(s.st_mode & S_IWRITE);
if ((s.st_mode & S_IFDIR) != 0) {
*a |= MSDOS_DIR_ATTR;
}
}
if (n != NULL)
*n = (s.st_mode & S_IFMT) == S_IFREG ? s.st_size : -1L;
if (t != NULL) {
t->atime = s.st_atime;
t->mtime = s.st_mtime;
t->ctime = s.st_ctime;
}
return unix2dostime((time_t *) &s.st_mtime);
}
int set_extra_field(z, z_utim)
struct zlist far *z;
iztimes *z_utim;
{
#ifdef USE_EF_UT_TIME
char *eb_ptr;
#endif /* USE_EF_UT_TIME */
char *name;
extra_block *block;
#define EB_SPARK_LEN 20
#define EB_SPARK_SIZE (EB_HEADSIZE+EB_SPARK_LEN)
#ifdef USE_EF_UT_TIME
# ifdef IZ_CHECK_TZ
# define EB_UTTIME_SIZE (zp_tz_is_valid ? EB_HEADSIZE+EB_UT_LEN(1) : 0)
# else
# define EB_UTTIME_SIZE (EB_HEADSIZE+EB_UT_LEN(1))
# endif
#else
# define EB_UTTIME_SIZE 0
#endif
#define EF_SPARK_TOTALSIZE (EB_SPARK_SIZE + EB_UTTIME_SIZE)
if ((name=(char *)malloc(strlen(z->name)+1))==NULL) {
fprintf(stderr," set_extra_field: not enough memory for directory name\n");
return ZE_MEM;
}
strcpy(name,z->name);
if (name[strlen(name)-1]=='.') { /* remove the last '.' in directory names */
name[strlen(name)-1]=0;
}
z->extra=(char *)malloc(EF_SPARK_TOTALSIZE);
if (z->extra==NULL) {
fprintf(stderr," set_extra_field: not enough memory\n");
free(name);
return ZE_MEM;
}
z->cextra = z->extra;
z->cext = z->ext = EF_SPARK_TOTALSIZE;
block=(extra_block *)z->extra;
block->ID=SPARKID;
block->size=EB_SPARK_LEN;
block->ID_2=SPARKID_2;
block->zero=0;
if (SWI_OS_File_5(name,NULL,&block->loadaddr,&block->execaddr,
NULL,&block->attr) != NULL) {
fprintf(stderr," OS error while set_extra_field of %s\n",name);
}
free(name);
#ifdef USE_EF_UT_TIME
# ifdef IZ_CHECK_TZ
if (zp_tz_is_valid) {
# endif
eb_ptr = z->extra + EB_SPARK_SIZE;
eb_ptr[0] = 'U';
eb_ptr[1] = 'T';
eb_ptr[2] = EB_UT_LEN(1); /* length of data part of e.f. */
eb_ptr[3] = 0;
eb_ptr[4] = EB_UT_FL_MTIME;
eb_ptr[5] = (char)(z_utim->mtime);
eb_ptr[6] = (char)(z_utim->mtime >> 8);
eb_ptr[7] = (char)(z_utim->mtime >> 16);
eb_ptr[8] = (char)(z_utim->mtime >> 24);
# ifdef IZ_CHECK_TZ
}
# endif
#endif /* USE_EF_UT_TIME */
return ZE_OK;
}
#endif /* !UTIL */
/******************************/
/* Function version_local() */
/******************************/
void version_local()
{
static ZCONST char CompiledWith[] = "Compiled with %s%s for %s%s%s%s.\n\n";
printf(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
);
} /* end function version_local() */

View file

@ -1,115 +0,0 @@
# Makefile for Zip, ZipNote, ZipCloak and ZipSplit
# 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 -DASMV -apcs 3/26
CFLAGS = $(CBASE) -IC:,@.
ASMFLAGS = -Throwback -Stamp -NoCache -CloseExec -quit -apcs 3/26
LFLAGS1 =
LFLAGS2 = $(LIB) C:o.Stubs
# Uncomment the following line to enable support for Unix
# Extra Field (Timezone)
#CFLAGS = $(CFLAGS) -DUSE_EF_UT_TIME
# object file lists
OBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o crc32.o \
crypt.o ttyio.o riscos.o acornzip.o swiven.o
OBJI = deflate.o trees.o
OBJA = match.o sendbits.o
OBJU = zipfile_.o fileio_.o util_.o globals.o riscos.o acornzip_.o swiven.o
OBJN = zipnote.o $(OBJU)
OBJC = zipcloak.o $(OBJU) crc32_.o crypt_.o ttyio.o
OBJS = zipsplit.o $(OBJU)
ZIP_H = zip.h ziperr.h tailor.h acorn/osdep.h acorn/riscos.h acorn/swiven.h
all: zip zipnote zipsplit zipcloak
install: %.zip %.zipnote %.zipsplit %.zipcloak %.zipsfx \
zip zipnote zipsplit zipcloak zipsfx
$(SQUEEZE) zip %.zip
$(SQUEEZE) zipnote %.zipnote
$(SQUEEZE) zipsplit %.zipsplit
$(SQUEEZE) zipcloak %.zipcloak
copy acorn.zipsfx %.zipsfx ~CVF
# suffix rules
.SUFFIXES: _.o .o .c
.c_.o:
$(CC) $(CFLAGS) -DUTIL -c $*.c -o $*_.o
.c.o:
$(CC) $(CFLAGS) -c $<
.s.o:
$(ASM) $(ASMFLAGS) -from @*.s -to @*.o
# rules for zip, zipnote, zipcloak and zipsplit
$(OBJZ): $(ZIP_H)
$(OBJI): $(ZIP_H)
$(OBJN): $(ZIP_H)
$(OBJS): $(ZIP_H)
$(OBJC): $(ZIP_H)
zip.o crc32.o crypt.o fileio.o zipfile.o zipup.o: crc32.h
zipcloak.o crc32_.o crypt_.o fileio_.o zipfile_.o: crc32.h
zip.o zipup.o crypt.o ttyio.o zipcloak.o crypt_.o: crypt.h
zip.o zipup.o zipnote.o zipcloak.o zipsplit.o: revision.h
zip.o crypt.o ttyio.o zipcloak.o crypt_.o: ttyio.h
crc32_.o: crc32.c
$(CC) $(CFLAGS) -DUTIL -c c.crc32 -o o.crc32_
crypt_.o: crypt.c
$(CC) $(CFLAGS) -DUTIL -c c.crypt -o o.crypt_
util_.o: util.c
$(CC) $(CFLAGS) -DUTIL -c c.util -o o.util_
fileio_.o: fileio.c
$(CC) $(CFLAGS) -DUTIL -c c.fileio -o o.fileio_
zipfile_.o: zipfile.c
$(CC) $(CFLAGS) -DUTIL -c c.zipfile -o o.zipfile_
acornzip_.o: acorn/acornzip.c $(ZIP_H)
$(CC) $(CFLAGS) -DUTIL -c acorn/acornzip.c -o o.acornzip_
riscos.o: acorn/riscos.c acorn/riscos.h
$(CC) $(CFLAGS) -c acorn/riscos.c
acornzip.o: acorn/acornzip.c $(ZIP_H)
$(CC) $(CFLAGS) -c acorn/acornzip.c
match.o: acorn/match.s
$(ASM) $(ASMFLAGS) -from acorn.s.match -to o.match
sendbits.o: acorn/sendbits.s
$(ASM) $(ASMFLAGS) -from acorn.s.sendbits -to o.sendbits
swiven.o: acorn/swiven.s
$(ASM) $(ASMFLAGS) -from acorn.s.swiven -to o.swiven
zip: $(OBJZ) $(OBJI) $(OBJA)
$(BIND) -o zip$(E) $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2)
zipnote: $(OBJN)
$(BIND) -o zipnote$(E) $(LFLAGS1) $(OBJN) $(LFLAGS2)
zipcloak: $(OBJC)
$(BIND) -o zipcloak$(E) $(LFLAGS1) $(OBJC) $(LFLAGS2)
zipsplit: $(OBJS)
$(BIND) -o zipsplit$(E) $(LFLAGS1) $(OBJS) $(LFLAGS2)
clean: ;remove zip; remove zipcloak;
remove zipsplit; remove zipnote;
create o.!fake! 0
wipe o.* ~cf
# end of Makefile

View file

@ -1,217 +0,0 @@
;===========================================================================
; Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
;
; See the accompanying file LICENSE, version 1999-Oct-05 or later
; (the contents of which are also included in zip.h) for terms of use.
; If, for some reason, both of these files are missing, the Info-ZIP license
; also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
;===========================================================================
; match.s for ARM by Sergio Monesi.
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
sl RN 10
fp RN 11
ip RN 12
sp RN 13
lr RN 14
pc RN 15
MAX_DIST EQU 32506
WMASK EQU 32767
MAX_MATCH EQU 258
AREA |C$$code|, CODE, READONLY
; r1 = chain_lenght
; r2 = scan
; r3 = match
; r4 = len (tmp)
; r5 = best_len
; r6 = limit
; r7 = strend
; r8 = scan_end1
; r9 = scan_end
; lr = window
; fp = prev
|__max_chain_length|
IMPORT max_chain_length
DCD max_chain_length
|__window|
IMPORT window
DCD window
|__prev|
IMPORT prev
DCD prev
|__prev_length|
IMPORT prev_length
DCD prev_length
|__strstart|
IMPORT strstart
DCD strstart
|__good_match|
IMPORT good_match
DCD good_match
|__nice_match|
IMPORT nice_match
DCD nice_match
|__match_start|
IMPORT match_start
DCD match_start
DCB "longest_match"
DCB &00,&00,&00
DCD &ff000010
EXPORT longest_match
longest_match
STMFD sp!, {r4-r9,fp,lr}
LDR fp, [pc, #|__prev|-.-8]
LDR r1, [pc, #|__max_chain_length|-.-8]
LDR r1, [r1]
LDR lr, [pc, #|__window|-.-8]
LDR ip, [pc, #|__strstart|-.-8]
LDR ip, [ip]
ADD r2, lr, ip
LDR r5, [pc, #|__prev_length|-.-8]
LDR r5, [r5]
SUBS ip, ip, #MAX_DIST-250 ; if r6 > MAX_DIST
SUBCSS r6, ip, #250 ; r6 = r6 - MAXDIST
MOVLS r6, #0 ; else r6 = 0
ADD r7, r2, #MAX_MATCH-256
ADD r7, r7, #256 ; r7 = r2 + MAX_MATCH (=258);
SUB ip, r5, #1
LDRB r8, [r2, ip]
LDRB r9, [r2, r5]
LDR ip, [pc, #|__good_match|-.-8]
LDR ip, [ip]
CMP r5, ip
MOVCS r1, r1, LSR #2
cycle
ADD r3, lr, r0
LDRB ip, [r3, r5]
CMP ip, r9
BNE cycle_end
SUB ip, r5, #1
LDRB ip, [r3, ip]
CMP ip, r8
BNE cycle_end
LDRB ip, [r2]
LDRB r4, [r3]
CMP ip, r4
BNE cycle_end
LDRB ip, [r3, #1]
LDRB r4, [r2, #1]
CMP ip, r4
BNE cycle_end
ADD r2, r2, #2
ADD r3, r3, #2
inn_cycle
LDRB ip, [r2, #1]!
LDRB r4, [r3, #1]!
CMP ip, r4
BNE exit_inn_cycle
LDRB ip, [r2, #1]!
LDRB r4, [r3, #1]!
CMP ip, r4
BNE exit_inn_cycle
LDRB ip, [r2, #1]!
LDRB r4, [r3, #1]!
CMP ip, r4
BNE exit_inn_cycle
LDRB ip, [r2, #1]!
LDRB r4, [r3, #1]!
CMP ip, r4
BNE exit_inn_cycle
LDRB ip, [r2, #1]!
LDRB r4, [r3, #1]!
CMP ip, r4
BNE exit_inn_cycle
LDRB ip, [r2, #1]!
LDRB r4, [r3, #1]!
CMP ip, r4
BNE exit_inn_cycle
LDRB ip, [r2, #1]!
LDRB r4, [r3, #1]!
CMP ip, r4
BNE exit_inn_cycle
LDRB ip, [r2, #1]!
LDRB r4, [r3, #1]!
CMP ip, r4
BNE exit_inn_cycle
CMP r2, r7
BCC inn_cycle
exit_inn_cycle
SUB r4, r2, r7 ; len = MAX_MATCH - (int)(strend - scan);
ADD r4, r4, #MAX_MATCH-256
ADD r4, r4, #256
SUB r2, r2, r4 ; scan = strend - MAX_MATCH
CMP r4, r5 ; if (len > best_len) {
BLE cycle_end
LDR ip, [pc, #|__match_start|-.-8] ; match_start = cur_match;
STR r0, [ip]
MOV r5, r4 ; best_len = len;
LDR ip, [pc, #|__nice_match|-.-8] ; if (len >= nice_match)
LDR ip, [ip]
CMP r4, ip
BGE exit_match ; break;
SUB ip, r5, #1 ; scan_end1 = scan[best_len-1];
LDRB r8, [r2, ip]
LDRB r9, [r2, r5] ; scan_end = scan[best_len];
cycle_end
MOV ip, r0, LSL #17 ; cur_match & WMASK
MOV ip, ip, LSR #17
LDR r0, [fp, ip, ASL #1] ; cur_match = prev[cur_match & WMASK]
MOV r0, r0, ASL #16
MOV r0, r0, LSR #16
CMP r0, r6 ; cur_match > limit
BLS exit_match
SUBS r1, r1, #1 ; --chain_length
BNE cycle ; chain_length != 0
exit_match
MOV r0, r5
LDMFD sp!, {r4-r9,fp,pc}^
END

View file

@ -1,28 +0,0 @@
/*
Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 2007-Mar-4 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
#include "riscos.h"
#define RISCOS
#define NO_SYMLINKS
#define NO_FCNTL_H
#define NO_UNISTD_H
#define NO_MKTEMP
#define PROCNAME(n) (action == ADD || action == UPDATE ? wild(n) : \
procname(n, 1))
#define isatty(a) 1
#define fseek(f,o,t) riscos_fseek((f),(o),(t))
#define localtime riscos_localtime
#define gmtime riscos_gmtime
#ifdef ZCRYPT_INTERNAL
# define ZCR_SEED2 (unsigned)3141592654L /* use PI as seed pattern */
#endif

View file

@ -1,394 +0,0 @@
/*
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
*/
/* riscos.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zip.h"
#include "riscos.h"
#define MAXEXT 256
/* External globals */
extern int scanimage;
/* Local globals (!?!?) */
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 (scanimage)
res->st_mode |= S_IFDIR | 0700;
else
res->st_mode |= S_IFREG;
break;
}
if ((((unsigned int) load) >> 20) == 0xfff) { /* date stamped file */
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 && !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);
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 deletedir(char *d)
{
int objtype;
char *s;
int len;
os_error *er;
len = strlen(d);
if ((s = malloc(len + 1)) == NULL)
return -1;
strcpy(s,d);
if (s[len-1]=='.')
s[len-1]=0;
if (er=SWI_OS_File_5(s,&objtype,NULL,NULL,NULL,NULL),er!=NULL) {
free(s);
return -1;
}
if (objtype<2 || (!scanimage && objtype==3)) {
/* this is a file or it doesn't exist */
free(s);
return -1;
}
if (er=SWI_OS_File_6(s),er!=NULL) {
/* maybe this is a problem with the DDEUtils module, try to canonicalise the path */
char canon[256];
int size=255;
if (er=SWI_OS_FSControl_37(s,canon,&size),er!=NULL) {
free(s);
return -1;
}
if (er=SWI_OS_File_6(canon),er!=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;
register char *suffptr;
register int e,s;
if (extptr != NULL) 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;
}
int swapext(char *name, char *exptr)
{
char *ext;
char *p1=exptr;
char *p2;
int extchar=*exptr;
unsigned int i=0;
while(*++p1 && *p1!='.' && *p1!='/')
;
ext=malloc(i=p1-exptr);
if (!ext)
return 1;
memcpy(ext, exptr+1, i);
p2=exptr-1;
p1=exptr+i-1;
while(p2 >= name)
*p1--=*p2--;
strcpy(name,ext);
*p1=(extchar=='/'?'.':'/');
free(ext);
return 0;
}
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);
}
int riscos_fseek(FILE *fd, long offset, int whence)
{
int ret;
switch (whence)
{
case SEEK_END:
ret = (fseek) (fd, 0, SEEK_END);
if (ret)
return ret;
/* fall through */
case SEEK_CUR:
offset += ftell (fd);
/* fall through */
default: /* SEEK_SET */
return (fseek) (fd, offset < 0 ? 0 : offset, SEEK_SET);
}
}

View file

@ -1,119 +0,0 @@
/*
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
*/
/* riscos.h */
#ifndef __riscos_h
#define __riscos_h
#include <time.h>
#include <stdio.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;
#define dstrm 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;
#define SPARKID 0x4341 /* = "AC" */
#define SPARKID_2 0x30435241 /* = "ARC0" */
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
extern char *exts2swap; /* Extensions to swap */
int stat(char *filename,struct stat *res);
DIR *opendir(char *dirname);
struct dirent *readdir(DIR *d);
char *readd(DIR *d);
void closedir(DIR *d);
int unlink(char *f);
int chmod(char *file, int mode);
void setfiletype(char *fname,int ftype);
void getRISCOSexts(char *envstr);
int checkext(char *suff);
int 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);
int riscos_fseek(FILE *fd, long offset, int whence);
/* work around broken assumption that fseek() is OK with -ve file offsets */
#endif /* !__riscos_h */

View file

@ -1,105 +0,0 @@
;===========================================================================
; Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
;
; See the accompanying file LICENSE, version 1999-Oct-05 or later
; (the contents of which are also included in zip.h) for terms of use.
; If, for some reason, both of these files are missing, the Info-ZIP license
; also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
;===========================================================================
; sendbits.s for ARM by Sergio Monesi and Darren Salt.
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
sl RN 10
fp RN 11
ip RN 12
sp RN 13
lr RN 14
pc RN 15
AREA |Asm$$Code|, CODE, READONLY
= "send_bits",0
ALIGN
& &FF00000C
IMPORT __rt_stkovf_split_small
IMPORT flush_outbuf
IMPORT bi_valid
IMPORT bi_buf
IMPORT out_size
IMPORT out_offset
IMPORT out_buf
EXPORT send_bits
send_bits
MOV ip,sp
STMDB sp!,{r4,r5,fp,ip,lr,pc}
SUB fp,ip,#4
LDR r5,=bi_buf
LDR r3,=bi_valid
LDR r4,[r5]
LDR r2,[r3]
ORR r4,r4,r0,LSL r2 ; |= value<<bi_valid
ADD r2,r2,r1 ; += length
CMP r2,#&10
STRLE r2,[r3] ; short? store & return
STRLE r4,[r5]
LDMLEDB fp,{r4,r5,fp,sp,pc}^
SUB r2,r2,#&10 ; adjust bi_valid, bi_buf
MOV ip,r4,LSR #16 ; (done early, keeping the old bi_buf
STR r2,[r3] ; in R4 for later storage)
STR ip,[r5]
LDR r0,=out_size
LDR r1,=out_offset
LDR r0,[r0]
LDR r2,[r1]
SUB r0,r0,#1
CMP r2,r0 ; if out_offset >= out_size-1
LDRHS r0,=out_buf
LDRHS r0,[r0]
BLHS flush_outbuf ; then flush the buffer
LDR r0,=out_buf
LDR r1,=out_offset
LDR r0,[r0]
LDR r2,[r1]
MOV r5,r4,LSR #8
STRB r4,[r0,r2]! ; store 'old' bi_buf
STRB r5,[r0,#1]
ADD r2,r2,#2
STR r2,[r1]
LDMDB fp,{r4,r5,fp,sp,pc}^
ptr_bi & bi_valid
& bi_buf
= "bi_reverse",0
ALIGN
& &FF00000C
EXPORT bi_reverse
bi_reverse
MOV r2,#0
loop MOVS r0,r0,LSR #1
ADCS r2,r2,r2
SUBS r1,r1,#1
BNE loop
MOV r0,r2
MOVS pc,lr
END

Binary file not shown.

View file

@ -1,59 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/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_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) */
#endif /* !__swiven_h */

View file

@ -1,276 +0,0 @@
;===========================================================================
; Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
;
; See the accompanying file LICENSE, version 1999-Oct-05 or later
; (the contents of which are also included in zip.h) for terms of use.
; If, for some reason, both of these files are missing, the Info-ZIP license
; also may be found at: ftp://ftp.cdrom.com/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
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_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
END

View file

@ -1,9 +0,0 @@
| zipsfx 0.1
| Written by Darren Salt
| Assumes that unzipsfx is on Run$Path (eg. in !Boot.Library)
| Assumes that IfThere is available as either *command or utility
If "%1" = "" Then Error 220 Syntax: zipsfx |<archive> |<SEA>
If "%0" = "" Then Error 220 Syntax: zipsfx |<archive> |<SEA>
Copy Run:unzipsfx %1 A~C~D~F~L~N~R~S~T~V
Print %0 { >> %1 }

View file

@ -1,16 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#define fhow "r"
#define fbad (NULL)
typedef FILE *ftype;
#define zopen(n,p) fopen(n,p)
#define zread(f,b,n) fread((b),1,(n),(FILE*)(f))
#define zclose(f) fclose(f)
#define zerr(f) (k==(extent)(-1L))
#define zstdin 0

View file

@ -1,117 +0,0 @@
# Makefile for Zip, ZipNote, ZipCloak and ZipSplit, Amiga SAS/C 5.10b
# See the master Makefile under the top level Zip/Unzip source directory
# for more information on compiler macros and flags for this version.
# Last update: Jan 07, 2007
# -John Bush, <J.Bush@MD-B.Prime.COM>, <JBush@BIX.COM>
#######################
# MACROBE DEFINITIONS #
#######################
# Compiler and loader debug flags. Omit comments as req'd.
# Do not set when building production version.
# CDBG = -d3
# LDBG = ADDSYM
DEFINES = -DNO_MKTEMP
CC = lc
OPT = -O
CFLAGS = $(OPT) $(DEFINES) $(CDBG) -v -mat -cuisf -b0 -j85i86i87i100i
LD = blink
LDSTART = LIB:c.o
LDFLAGS = LIB LIB:lc.lib+LIB:amiga.lib
TMPFILE = ram:MakeZip.tmp
###############################################
# BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES #
###############################################
# default C rules
.c.o:
$(CC) $(CFLAGS) -o$@ $*.c
# Alternate rules for routines containing entries needed by utilities
.c.oo:
$(CC) $(CFLAGS) -DUTIL -o$*.oo $*.c
# object file macrough lists
HFILES = zip.h ziperr.h tailor.h revision.h crc32.h crypt.h ttyio.h \
amiga/amiga.h amiga/zipup.h amiga/osdep.h
OBJA = zipfile.o zipup.o fileio.o util.o globals.o crc32.o crypt.o \
timezone.o ttyio.o amiga.o amigazip.o filedate.o
OBJI = deflate.o trees.o
OBJU = zipfile.oo fileio.oo util.oo globals.o timezone.o \
amiga.o amigazip.oo filedate.o
OBJZ = zip.o $(OBJA) $(OBJI)
OBJN = zipnote.o $(OBJU)
OBJC = zipcloak.o $(OBJU) crc32.oo crypt.oo ttyio.o
OBJS = zipsplit.o $(OBJU)
ZIPS = zip zipnote zipcloak zipsplit
all: Message $(ZIPS)
Message:
-echo " "
-echo "WARNING: Lattice 5.x HAS NOT BEEN TESTED WITH THIS ZIP VERSION"
-echo "Report problems to <zip-bugs@lists.wku.edu>"
-echo " "
zip: $(OBJZ) $(HFILES)
-echo "$(OBJZ)" > $(TMPFILE)
$(LD) TO Zip FROM $(LDSTART) WITH $(TMPFILE) $(LDFLAGS) $(LDBG)
-delete $(TMPFILE) Zip.info
zipnote: $(OBJN) $(HFILES)
-echo "$(OBJN)" > $(TMPFILE)
$(LD) TO ZipNote FROM $(LDSTART) WITH $(TMPFILE) $(LDFLAGS) $(LDBG)
-delete $(TMPFILE) ZipNote.info
zipcloak: $(OBJC) $(HFILES)
-echo "$(OBJC)" > $(TMPFILE)
$(LD) TO ZipCloak FROM $(LDSTART) WITH $(TMPFILE) $(LDFLAGS) $(LDBG)
-delete $(TMPFILE) ZipCloak.info
zipsplit: $(OBJS) $(HFILES)
-echo "$(OBJS)" > $(TMPFILE)
$(LD) TO ZipSplit FROM $(LDSTART) WITH $(TMPFILE) $(LDFLAGS) $(LDBG)
-delete $(TMPFILE) ZipSplit.info
clean:
-delete $(OBJZ) all quiet force >nil:
-delete $(OBJU) all quiet force >nil:
-delete $(OBJA) all quiet force >nil:
-delete $(OBJI) all quiet force >nil:
-delete $(OBJN) all quiet force >nil:
-delete $(OBJC) all quiet force >nil:
-delete $(OBJS) all quiet force >nil:
zip.o: zip.c $(HFILES)
zipnote.o: zipnote.c $(HFILES)
zipcloak.o: zipcloak.c $(HFILES)
crypt.o: crypt.c $(HFILES)
ttyio.o: ttyio.c $(HFILES)
zipsplit.o: zipsplit.c $(HFILES)
deflate.o: deflate.c $(HFILES)
trees.o: trees.c $(HFILES)
zipfile.o: zipfile.c $(HFILES)
zipup.o: zipup.c $(HFILES)
fileio.o: fileio.c $(HFILES)
util.o: util.c $(HFILES)
timezone.o: timezone.c $(HFILES) timezone.h
crc32.o: crc32.c $(HFILES)
crctab.o: crctab.c $(HFILES)
globals.o: globals.c $(HFILES)
# Amiga specific objects
amiga.o: amiga/amiga.c $(HFILES)
amigazip.o: amiga/amigazip.c $(HFILES)
# end of Makefile

View file

@ -1 +0,0 @@
the -A option currently does not work for the amiga.

View file

@ -1,138 +0,0 @@
/*
Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 2005-Feb-10 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
*/
/* OS specific routines for AMIGA platform.
*
* John Bush <John.Bush@east.sun.com> BIX: jbush
* Paul Kienitz <kie@pacbell.net>
*
* History:
*
* Date DoBee Comments
* ------- -------- -----------------------------------------------
* 21Jan93 JBush Original coding.
* Incorporated filedate.c (existing routine).
*
* 31Jan93 JBush Made filedate.c include unconditional.
*
* 18Jul93 PaulK Moved Aztec _abort() here from stat.c because we
* can't share the same one between Zip and UnZip.
* Added close_leftover_open_dirs() call to it.
*
* 17Apr95 PaulK Added Amiga internal version string so that
* installer programs can compare the version being
* installed to see if the copy the user already has
* is older or newer. Added Prestart_Hook to support
* debug tracing in deflate.a.
*
* 6May95 PaulK Added GetComment() for filenote support.
*
* 12Nov95 PaulK Added #define ZIP in front of filedate.c, for
* new options in there; removed declare of set_con()
* since echon() no longer expands to it (or anything).
*
* 12Feb96 PaulK Removed call of echon() entirely.
*
* 12Jul97 PaulK Made both Aztec and SAS define USE_TIME_LIB for filedate.c
*
* 26Aug97 PaulK Added ClearIOErr_exit()
*
* 2Jan98 HWalt Adapted for SAS/C using stat.c replacement functions
*
* 6Jun00 PaulK Removed references to time_lib, since new filedate.c
* supercedes it
*/
#include <exec/memory.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>
#else
# include <proto/exec.h>
# include <proto/dos.h>
#endif
#include <stdlib.h>
#include "ziperr.h"
void ziperr(int c, const char *h);
#define ZIP
#if !defined(UTIL)
# define NO_MKTIME
#endif
#ifdef AZTEC_C
/* ============================================================= */
/* filedate.c is an external file, since it's shared with UnZip. */
/* Aztec includes it here, but SAS/C now compiles it separately. */
# include "amiga/filedate.c"
/* the same applies to stat.c */
# include "amiga/stat.c"
# define setenv BOGUS_INCOMPATIBLE_setenv
# include <fcntl.h>
# undef setenv
# ifdef DEBUG
# define PRESTART_HOOK
# endif
#endif
extern void close_leftover_open_dirs(void);
/* the following handles cleanup when a ^C interrupt happens: */
void _abort(void) /* called when ^C is pressed */
{
close_leftover_open_dirs();
ziperr(ZE_ABORT, "^C");
}
void ClearIOErr_exit(int e) /* EXIT is defined as this */
{
if (!e)
((struct Process *) FindTask(NULL))->pr_Result2 = 0;
/* we clear IoErr() since we are successful, in a 1.x-compatible way */
exit(e);
}
/* Make sure the version number here matches the number in revision.h */
/* as closely as possible in strict decimal "#.#" form: */
const char version_id[] = "\0$VER: Zip 2.3 ("
# include "env:VersionDate"
")\r\n";
/* call this with an arg of NULL to free storage: */
char *GetComment(char *filename)
{
BPTR lk;
static struct FileInfoBlock *fib = NULL;
if (!filename) {
if (fib) FreeMem(fib, sizeof(*fib));
fib = NULL;
return NULL;
}
if (!fib) {
if (!(fib = AllocMem(sizeof(*fib), MEMF_PUBLIC)))
ziperr(ZE_MEM, "was checking filenotes");
}
if (!(lk = Lock(filename, ACCESS_READ)))
return NULL;
if (!Examine(lk, fib))
fib->fib_Comment[0] = '\0';
UnLock(lk);
return fib->fib_Comment[0] ? &fib->fib_Comment[0] : NULL;
}

View file

@ -1,54 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#ifndef __amiga_amiga_h
#define __amiga_amiga_h
/* 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 version is for use with Zip. It is not globally included, but used
* only by functions in amiga/amigazip.c. Much material that was needed for
* UnZip is absent here.
*
*/
#include <fcntl.h> /* O_BINARY for open() w/o CR/LF translation */
#include "amiga/z-stat.h" /* substitute for <stat.h> and <dire(c|n)t.h> */
#define direct dirent
#ifndef MODERN
# define MODERN
#endif
#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
#endif /* AZTEC_C */
#ifdef __SASC
# include <dirent.h>
# include <dos.h>
# define disk_not_mounted 0
# if ( (!defined(O_BINARY)) && defined(O_RAW))
# define O_BINARY O_RAW
# endif
#endif /* SASC */
/* Funkshine Prough Toe Taipes */
LONG FileDate (char *, time_t[]);
#endif /* __amiga_amiga_h */

View file

@ -1,507 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#include "zip.h"
#include "amiga/amiga.h"
#ifndef UTIL /* the companion #endif is a bit of ways down ... */
#define utime FileDate
#define PAD 0
#define PATH_END '/'
/* Local globals (kinda like "military intelligence" or "broadcast quality") */
extern char *label; /* still declared in fileio.c */
local ulg label_time = 0;
local ulg label_mode = 0;
local time_t label_utim = 0;
/* Local functions */
local char *readd OF((DIR *));
local int wild_recurse OF((char *, char *));
local char *readd(d)
DIR *d; /* directory stream to read from */
/* Return a pointer to the next name in the directory stream d, or NULL if
no more entries or an error occurs. */
{
struct dirent *e = readdir(d);
return e == NULL ? (char *) NULL : e->d_name;
}
/* What we have here is a mostly-generic routine using opendir()/readd() and */
/* isshexp()/MATCH() to find all the files matching a multi-part filespec */
/* using the portable pattern syntax. It shouldn't take too much fiddling */
/* to make it usable for any other platform that has directory hierarchies */
/* but no shell-level pattern matching. It works for patterns throughout */
/* the pathname, such as "foo:*.?/source/x*.[ch]". */
#define ONENAMELEN 30
/* the length of one filename component on the Amiga */
/* whole is a pathname with wildcards, wildtail points somewhere in the */
/* middle of it. All wildcards to be expanded must come AFTER wildtail. */
local int wild_recurse(whole, wildtail) char *whole; char *wildtail;
{
DIR *dir;
char *subwild, *name, *newwhole = NULL, *glue = NULL, plug = 0, plug2;
ush newlen, amatch = 0;
BPTR lok;
int e = ZE_MISS;
if (!isshexp(wildtail))
if (lok = Lock(whole, ACCESS_READ)) { /* p exists? */
UnLock(lok);
return procname(whole, 0);
} else
return ZE_MISS; /* woops, no wildcards! */
/* back up thru path components till existing dir found */
do {
name = wildtail + strlen(wildtail) - 1;
for (;;)
if (name-- <= wildtail || *name == PATH_END) {
subwild = name + 1;
plug2 = *subwild;
*subwild = 0;
break;
}
if (glue)
*glue = plug;
glue = subwild;
plug = plug2;
dir = opendir(whole);
} while (!dir && !disk_not_mounted && subwild > wildtail);
wildtail = subwild; /* skip past non-wild components */
if ((subwild = strchr(wildtail + 1, PATH_END)) != NULL) {
/* this "+ 1" dodges the ^^^ hole left by *glue == 0 */
*(subwild++) = 0; /* wildtail = one component pattern */
newlen = strlen(whole) + strlen(subwild) + (ONENAMELEN + 2);
} else
newlen = strlen(whole) + (ONENAMELEN + 1);
if (!dir || !(newwhole = malloc(newlen))) {
if (glue)
*glue = plug;
e = dir ? ZE_MEM : ZE_MISS;
goto ohforgetit;
}
strcpy(newwhole, whole);
newlen = strlen(newwhole);
if (glue)
*glue = plug; /* repair damage to whole */
if (!isshexp(wildtail)) {
e = ZE_MISS; /* non-wild name not found */
goto ohforgetit;
}
while (name = readd(dir)) {
if (MATCH(wildtail, name, 0)) {
strcpy(newwhole + newlen, name);
if (subwild) {
name = newwhole + strlen(newwhole);
*(name++) = PATH_END;
strcpy(name, subwild);
e = wild_recurse(newwhole, name);
} else
e = procname(newwhole, 0);
newwhole[newlen] = 0;
if (e == ZE_OK)
amatch = 1;
else if (e != ZE_MISS)
break;
}
}
ohforgetit:
if (dir) closedir(dir);
if (subwild) *--subwild = PATH_END;
if (newwhole) free(newwhole);
if (e == ZE_MISS && amatch)
e = ZE_OK;
return e;
}
int wild(p) char *p;
{
char *use;
/* special handling of stdin request */
if (strcmp(p, "-") == 0) /* if compressing stdin */
return newname(p, 0, 0);
/* wild_recurse() can't handle colons in wildcard part: */
if (use = strchr(p, ':')) {
if (strchr(++use, ':'))
return ZE_PARMS;
} else
use = p;
return wild_recurse(p, use);
}
int procname(n, caseflag)
char *n; /* name to process */
int caseflag; /* true to force case-sensitive match */
/* Process a name or sh expression to operate on (or exclude). Return
an error code in the ZE_ class. */
{
char *a; /* path and name for recursion */
DIR *d; /* directory stream from opendir() */
char *e; /* pointer to name from readd() */
int m; /* matched flag */
char *p; /* path for recursion */
struct stat s; /* result of stat() */
struct zlist far *z; /* steps through zfiles list */
if (strcmp(n, "-") == 0) /* if compressing stdin */
return newname(n, 0, caseflag);
else if (LSSTAT(n, &s))
{
/* Not a file or directory--search for shell expression in zip file */
p = ex2in(n, 0, (int *)NULL); /* shouldn't affect matching chars */
m = 1;
for (z = zfiles; z != NULL; z = z->nxt) {
if (MATCH(p, z->iname, caseflag))
{
z->mark = pcount ? filter(z->zname, caseflag) : 1;
if (verbose)
fprintf(mesg, "zip diagnostic: %scluding %s\n",
z->mark ? "in" : "ex", z->name);
m = 0;
}
}
free((zvoid *)p);
return m ? ZE_MISS : ZE_OK;
}
/* Live name--use if file, recurse if directory */
if ((s.st_mode & S_IFDIR) == 0)
{
/* add or remove name of file */
if ((m = newname(n, 0, caseflag)) != ZE_OK)
return m;
} else {
/* Add trailing / to the directory name */
if ((p = malloc(strlen(n)+2)) == NULL)
return ZE_MEM;
strcpy(p, n);
a = p + strlen(p);
if (*p && a[-1] != '/' && a[-1] != ':')
strcpy(a, "/");
if (dirnames && (m = newname(p, 1, caseflag)) != ZE_OK) {
free((zvoid *)p);
return m;
}
/* recurse into directory */
if (recurse && (d = opendir(n)) != NULL)
{
while ((e = readd(d)) != NULL) {
if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL)
{
closedir(d);
free((zvoid *)p);
return ZE_MEM;
}
strcat(strcpy(a, p), e);
if ((m = procname(a, caseflag)) != ZE_OK) /* recurse on name */
{
if (m == ZE_MISS)
zipwarn("name not matched: ", a);
else
ziperr(m, a);
}
free((zvoid *)a);
}
closedir(d);
}
free((zvoid *)p);
} /* (s.st_mode & S_IFDIR) == 0) */
return ZE_OK;
}
char *ex2in(x, isdir, pdosflag)
char *x; /* external file name */
int isdir; /* input: x is a directory */
int *pdosflag; /* output: force MSDOS file attributes? */
/* Convert the external file name to a zip file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *n; /* internal file name (malloc'ed) */
char *t; /* shortened name */
int dosflag;
dosflag = dosify; /* default for non-DOS and non-OS/2 */
/* Find starting point in name before doing malloc */
if ((t = strrchr(x, ':')) != NULL) /* reject ":" */
t++;
else
t = x;
{ /* reject "//" */
char *tt = t;
while (tt = strchr(tt, '/'))
while (*++tt == '/')
t = tt;
}
while (*t == '/') /* reject leading "/" on what's left */
t++;
if (!pathput)
t = last(t, PATH_END);
/* Malloc space for internal name and copy it */
if ((n = malloc(strlen(t) + 1)) == NULL)
return NULL;
strcpy(n, t);
if (dosify)
msname(n);
/* Returned malloc'ed name */
if (pdosflag)
*pdosflag = dosflag;
return n;
}
char *in2ex(n)
char *n; /* internal file name */
/* Convert the zip file name to an external file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *x; /* external file name */
if ((x = malloc(strlen(n) + 1 + PAD)) == NULL)
return NULL;
strcpy(x, n);
return x;
}
void stamp(f, d)
char *f; /* name of file to change */
ulg d; /* dos-style time to change it to */
/* Set last updated and accessed time of file f to the DOS time d. */
{
time_t u[2]; /* argument for utime() */
/* Convert DOS time to time_t format in u */
u[0] = u[1] = dos2unixtime(d);
/* Set updated and accessed times of f */
utime(f, u);
}
ulg filetime(f, a, n, t)
char *f; /* name of file to get info on */
ulg *a; /* return value: file attributes */
long *n; /* return value: file size */
iztimes *t; /* return value: access, modific. and creation times */
/* If file *f does not exist, return 0. Else, return the file's last
modified date and time as an MSDOS date and time. The date and
time is returned in a long with the date most significant to allow
unsigned integer comparison of absolute times. Also, if a is not
a NULL pointer, store the file attributes there, with the high two
bytes being the Unix attributes, and the low byte being a mapping
of that to DOS attributes. If n is not NULL, store the file size
there. If t is not NULL, the file's access, modification and creation
times are stored there as UNIX time_t values.
If f is "-", use standard input as the file. If f is a device, return
a file size of -1 */
{
struct stat s; /* results of stat() */
/* convert FNMAX to malloc - 11/8/04 EG */
char *name;
int len = strlen(f);
if (f == label) {
if (a != NULL)
*a = label_mode;
if (n != NULL)
*n = -2L; /* convention for a label name */
if (t != NULL)
t->atime = t->mtime = t->ctime = label_utim;
return label_time;
}
if ((name = malloc(len + 1)) == NULL) {
ZIPERR(ZE_MEM, "filetime");
}
strcpy(name, f);
if (name[len - 1] == '/')
name[len - 1] = '\0';
/* not all systems allow stat'ing a file with / appended */
if (strcmp(f, "-") == 0) {
if (fstat(fileno(stdin), &s) != 0)
error("fstat(stdin)");
} else if (SSTAT(name, &s) != 0) {
/* Accept about any file kind including directories
* (stored with trailing / with -r option)
*/
free(name);
return 0;
}
free(name);
if (a != NULL) {
*a = ((ulg)s.st_mode << 16) | !(s.st_mode & S_IWRITE);
if ((s.st_mode & S_IFDIR) != 0) {
*a |= MSDOS_DIR_ATTR;
}
}
if (n != NULL)
*n = (s.st_mode & S_IFMT) == S_IFREG ? s.st_size : -1L;
if (t != NULL) {
t->atime = s.st_atime;
t->mtime = s.st_mtime;
t->ctime = s.st_ctime;
}
return unix2dostime(&s.st_mtime);
}
int set_extra_field(z, z_utim)
struct zlist far *z;
iztimes *z_utim;
/* create extra field and change z->att if desired */
{
#ifdef USE_EF_UT_TIME
#ifdef IZ_CHECK_TZ
if (!zp_tz_is_valid) return ZE_OK; /* skip silently if no valid TZ info */
#endif
if ((z->extra = (char *)malloc(EB_HEADSIZE+EB_UT_LEN(1))) == NULL)
return ZE_MEM;
z->extra[0] = 'U';
z->extra[1] = 'T';
z->extra[2] = EB_UT_LEN(1); /* length of data part of e.f. */
z->extra[3] = 0;
z->extra[4] = EB_UT_FL_MTIME;
z->extra[5] = (char)(z_utim->mtime);
z->extra[6] = (char)(z_utim->mtime >> 8);
z->extra[7] = (char)(z_utim->mtime >> 16);
z->extra[8] = (char)(z_utim->mtime >> 24);
z->cextra = z->extra;
z->cext = z->ext = (EB_HEADSIZE+EB_UT_LEN(1));
return ZE_OK;
#else /* !USE_EF_UT_TIME */
return (int)(z-z);
#endif /* ?USE_EF_UT_TIME */
}
int deletedir(d)
char *d; /* directory to delete */
/* Delete the directory *d if it is empty, do nothing otherwise.
Return the result of rmdir(), delete(), or system().
For VMS, d must be in format [x.y]z.dir;1 (not [x.y.z]).
*/
{
return rmdir(d);
}
#endif /* !UTIL */
/******************************/
/* Function version_local() */
/******************************/
/* NOTE: the following include depends upon the environment
* variable $Workbench to be set correctly. (Set by
* default, by Version command in Startup-sequence.)
*/
int WBversion = (int)
#include "ENV:Workbench"
;
void version_local()
{
static ZCONST char CompiledWith[] = "Compiled with %s%s under %s%s%s%s.\n\n";
/* Define buffers. */
char buf1[16]; /* compiler name */
char buf2[16]; /* revstamp */
char buf3[16]; /* OS */
char buf4[16]; /* Date */
/* char buf5[16]; /* Time */
/* format "with" name strings */
#ifdef AMIGA
# ifdef __SASC
strcpy(buf1,"SAS/C ");
# else
# ifdef LATTICE
strcpy(buf1,"Lattice C ");
# else
# ifdef AZTEC_C
strcpy(buf1,"Manx Aztec C ");
# else
strcpy(buf1,"UNKNOWN ");
# endif
# endif
# endif
/* "under" */
sprintf(buf3,"AmigaDOS v%d",WBversion);
#else
strcpy(buf1,"Unknown compiler ");
strcpy(buf3,"Unknown OS");
#endif
/* Define revision, date, and time strings.
* NOTE: Do not calculate run time, be sure to use time compiled.
* Pass these strings via your makefile if undefined.
*/
#if defined(__VERSION__) && defined(__REVISION__)
sprintf(buf2,"version %d.%d",__VERSION__,__REVISION__);
#else
# ifdef __VERSION__
sprintf(buf2,"version %d",__VERSION__);
# else
sprintf(buf2,"unknown version");
# endif
#endif
#ifdef __DATE__
sprintf(buf4," on %s",__DATE__);
#else
strcpy(buf4," unknown date");
#endif
/******
#ifdef __TIME__
sprintf(buf5," at %s",__TIME__);
#else
strcpy(buf5," unknown time");
#endif
******/
/* Print strings using "CompiledWith" mask defined above.
* ("Compiled with %s%s under %s%s%s%s.")
*/
printf(CompiledWith,
buf1,
buf2,
buf3,
buf4,
/* buf5, */ "",
"" ); /* buf6 not used */
} /* end function version_local() */

View file

@ -1,144 +0,0 @@
;===========================================================================
; 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
;===========================================================================
; crc_68 created by Paul Kienitz, last modified 04 Jan 96.
;
; Return an updated 32 bit CRC value, given the old value and a block of data.
; The CRC table used to compute the value is gotten by calling get_crc_table().
; This replaces the older updcrc() function used in Zip and fUnZip. The
; prototype of the function is:
;
; ulg crc32(ulg crcval, uch *text, extent textlen);
;
; On the Amiga, type extent is always unsigned long, not unsigned int, because
; int can be short or long at whim, but size_t is long.
;
; If using this source on a non-Amiga 680x0 system, note that we treat
; a0/a1/d0/d1 as scratch registers not preserved across function calls.
; We do not bother to support registerized arguments for crc32() -- the
; textlen parm is usually large enough so that savings outside the loop
; are pointless.
;
; Define NO_UNROLLED_LOOPS to use a simple short loop which might be more
; efficient on certain machines with dinky instruction caches ('020?), or for
; processing short strings. If loops are unrolled, the textlen parm must be
; less than 512K; if not unrolled, it must be less than 64K.
xdef _crc32 ; (ulg val, uch *buf, extent bufsize)
DO_CRC0 MACRO
moveq #0,ltemp
move.b (textbuf)+,ltemp
eor.b crcval,ltemp
lsl.w #2,ltemp
move.l (crc_table,ltemp.w),ltemp
lsr.l #8,crcval
eor.l ltemp,crcval
ENDM
machine mc68020
DO_CRC2 MACRO
move.b (textbuf)+,btemp
eor.b crcval,btemp
lsr.l #8,crcval
move.l (crc_table,btemp.w*4),ltemp
eor.l ltemp,crcval
ENDM
crc_table equr a0 array of unsigned long
crcval equr d0 unsigned long initial value
textbuf equr a1 array of unsigned char
textbufsize equr d1 unsigned long (count of bytes in textbuf)
btemp equr d2
ltemp equr d3
xref _get_crc_table ; ulg *get_crc_table(void)
NOLIST
INCLUDE 'exec/execbase.i'
LIST
xref _SysBase ; struct ExecBase *
_crc32:
move.l 8(sp),d0
bne.s valid
moveq #0,d0
rts
valid: movem.l btemp/ltemp,-(sp)
jsr _get_crc_table
move.l d0,ltemp
move.l 12(sp),crcval
move.l 16(sp),textbuf
move.l 20(sp),textbufsize
not.l crcval
move.l _SysBase,crc_table
move.w AttnFlags(crc_table),btemp
move.l ltemp,crc_table
btst #AFB_68020,btemp
bne twenty
IFD NO_UNROLLED_LOOPS
bra.s decr
loop: DO_CRC0
decr: dbra textbufsize,loop
bra.s done
twenty: moveq #0,btemp
bra.s decr2
loop2: DO_CRC2
decr2: dbra textbufsize,loop2
ELSE ; !NO_UNROLLED_LOOPS
move.l textbufsize,btemp
lsr.l #3,textbufsize
bra decr8
loop8: DO_CRC0
DO_CRC0
DO_CRC0
DO_CRC0
DO_CRC0
DO_CRC0
DO_CRC0
DO_CRC0
decr8: dbra textbufsize,loop8
and.w #7,btemp
bra.s decr1
loop1: DO_CRC0
decr1: dbra btemp,loop1
bra done
twenty: moveq #0,btemp
move.l textbufsize,-(sp)
lsr.l #3,textbufsize
bra decr82
loop82: DO_CRC2
DO_CRC2
DO_CRC2
DO_CRC2
DO_CRC2
DO_CRC2
DO_CRC2
DO_CRC2
decr82: dbra textbufsize,loop82
move.l (sp)+,textbufsize
and.w #7,textbufsize
bra.s decr12
loop12: DO_CRC2
decr12: dbra textbufsize,loop12
ENDC ; ?NO_UNROLLED_LOOPS
done: movem.l (sp)+,btemp/ltemp
not.l crcval
;;;;; move.l crcval,d0 ; crcval already is d0
rts

File diff suppressed because it is too large Load diff

View file

@ -1,599 +0,0 @@
/*
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*/

View file

@ -1,304 +0,0 @@
# Makefile for Zip, ZipNote, ZipCloak, ZipSplit for Aztec C 5.2
# Also ZipLM, a version of Zip that needs much less free memory
# -- Paul Kienitz, last updated 07 Jan 2007
# Make sure platform is defined correctly, and select memory usage options:
DEFINES = -d AMIGA -d DYN_ALLOC -d ASM_CRC
CC = cc
AS = as
LD = ln
LDLIBS = -lc16
# -------- RELEASE VERSION:
CFLAGS = -psb0e -sabfmnpu -wcr0u $(DEFINES)
# -pbs means unsigned chars and short ints, -sabfmnpu is various small
# optimizations, -wcr0u adjusts type checking strictness
ASOPTS = -n -eAMIGA -eDYN_ALLOC -eCPUTEST -eINT16
LDFLAGS = -m +q
# -------- DEBUG VERSION:
CFLAGD = -bs -psb0e -s0f0n -wcr0u $(DEFINES)
# -bs is include source debugging info, -s0f0n is avoid hard-to-debug
# optimizations
LDFLAGD = -m +q -g -w
# -------- MINIMUM MEMORY USAGE RELEASE VERSION:
WSIZ = WSIZE=4096
LOWFLAGS = $(CFLAGS) -d $(WSIZ) -d SMALL_MEM
LOWASOPTS = $(ASOPTS) -e$(WSIZ) -eSMALL_MEM
# Options used for assembling amiga/deflate.a; must generally match the
# settings in DEFINES.
# -------- MINIMUM MEMORY USAGE DEBUG VERSION:
LOWFLAGD = $(CFLAGD) -d $(WSIZ) -d SMALL_MEM
# the directory where we stick all the object files:
O = obA/
# default C rules
.c.o :
$(CC) $(CFLAGS) -o $@ $*.c
# rules for routines containing entries needed by utilities
.c.oo :
$(CC) $(CFLAGS) -d UTIL -o $@ $*.c
# rules for the low-memory version:
.c.ol :
$(CC) $(LOWFLAGS) -o $@ $*.c
# default C rules for debugging
.c.od :
$(CC) $(CFLAGD) -o $@ $*.c
# debugging rules for routines containing entries needed by utilities
.c.dd :
$(CC) $(CFLAGD) -d UTIL -o $@ $*.c
# rules for the debugging low-memory version:
.c.dl :
$(CC) $(LOWFLAGD) -o $@ $*.c
# object file lists
ZIP_H = zip.h ziperr.h tailor.h amiga/osdep.h amiga/z-stat.h
OBJZ = $(O)zip.o $(O)deflate.o \
$(O)trees.o $(O)zipfile.o $(O)zipup.o $(O)util.o $(O)timezone.o \
$(O)fileio.o $(O)globals.o $(O)crc32.o $(O)crypt.o $(O)ttyio.o \
$(O)amiga.o $(O)amigazip.o $(O)crc_68.o
OBJL = $(O)zip.ol $(O)deflate.ol \
$(O)trees.ol $(O)zipfile.ol $(O)zipup.ol $(O)util.ol $(O)timezone.ol \
$(O)fileio.ol $(O)globals.ol $(O)crc32.ol $(O)crypt.ol $(O)ttyio.ol \
$(O)amiga.ol $(O)amigazip.ol $(O)crc_68.o
OBJU = $(O)zipfile.oo $(O)fileio.oo \
$(O)util.oo $(O)globals.o $(O)amiga.oo $(O)amigazip.oo
OBJN = $(O)zipnote.o $(OBJU)
OBJC = $(O)zipcloak.o $(OBJU) $(O)crc32.oo \
$(O)crypt.oo $(O)ttyio.o
OBJS = $(O)zipsplit.o $(OBJU)
# These are the debuggable versions:
DBJZ = $(O)zip.od $(O)deflate.od \
$(O)trees.od $(O)zipfile.od $(O)zipup.od $(O)util.od $(O)timezone.od \
$(O)fileio.od $(O)globals.od $(O)crc32.od $(O)crypt.od $(O)ttyio.od \
$(O)amiga.od $(O)amigazip.od $(O)crc_68.o
DBJL = $(O)zip.dl $(O)deflate.dl \
$(O)trees.dl $(O)zipfile.dl $(O)zipup.dl $(O)util.dl $(O)timezone.dl \
$(O)fileio.dl $(O)globals.dl $(O)crc32.dl $(O)crypt.dl $(O)ttyio.dl \
$(O)amiga.dl $(O)amigazip.dl $(O)crc_68.o
DBJU = $(O)zipfile.dd $(O)fileio.dd \
$(O)util.dd $(O)globals.od $(O)amiga.dd $(O)amigazip.dd
DBJN = $(O)zipnote.od $(DBJU)
DBJC = $(O)zipcloak.od $(DBJU) $(O)crc32.dd \
$(O)crypt.dd $(O)ttyio.od
DBJS = $(O)zipsplit.od $(DBJU)
# HERE WE GO:
all : Zip ZipNote ZipSplit ZipCloak ZipLM
z : Zip
n : ZipNote
s : ZipSplit
c : ZipCloak
l : ZipLM
# Debug versions:
dall : Zip.dbg ZipNote.dbg ZipSplit.dbg ZipCloak.dbg ZipLM.dbg
dz : Zip.dbg
dn : ZipNote.dbg
ds : ZipSplit.dbg
dc : ZipCloak.dbg
dl : ZipLM.dbg
Zip : $(OBJZ) $(ZIP_H)
$(LD) $(LDFLAGS) -o $@ $(OBJZ) $(LDLIBS)
-@delete Zip.dbg
ZipNote : $(OBJN) $(ZIP_H)
$(LD) $(LDFLAGS) -o $@ $(OBJN) $(LDLIBS)
-@delete ZipNote.dbg
ZipSplit : $(OBJS) $(ZIP_H)
$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
-@delete ZipSplit.dbg
ZipCloak : $(OBJC) $(ZIP_H)
$(LD) $(LDFLAGS) -o $@ $(OBJC) $(LDLIBS)
-@delete ZipCloak.dbg
ZipLM : $(OBJL) $(ZIP_H)
$(LD) $(LDFLAGS) -o $@ $(OBJL) $(LDLIBS)
-@delete ZipLM.dbg
Zip.dbg : $(DBJZ) $(ZIP_H)
$(LD) $(LDFLAGD) -o Zip $(DBJZ) $(LDLIBS)
ZipNote.dbg : $(DBJN) $(ZIP_H)
$(LD) $(LDFLAGD) -o ZipNote $(DBJN) $(LDLIBS)
ZipSplit.dbg : $(DBJS) $(ZIP_H)
$(LD) $(LDFLAGD) -o ZipSplit $(DBJS) $(LDLIBS)
ZipCloak.dbg : $(DBJC) $(ZIP_H)
$(LD) $(LDFLAGD) -o ZipCloak $(DBJC) $(LDLIBS)
ZipLM.dbg : $(DBJL) $(ZIP_H)
$(LD) $(LDFLAGD) -o ZipLM $(DBJL) $(LDLIBS)
clean : bugclean
-delete quiet $(OBJZ)
-delete quiet $(OBJL)
-delete quiet $(O)zipnote.o $(O)zipcloak.o $(O)zipsplit.o \
$(O)crypt.oo $(OBJU)
bugclean :
-delete quiet $(DBJZ)
-delete quiet $(DBJL)
-delete quiet $(O)zipnote.od $(O)zipcloak.od $(O)zipsplit.od \
$(O)crypt.dd $(DBJU)
cleaner : clean
-delete quiet Zip ZipNote ZipSplit ZipCloak ZipLM
-delete quiet Zip.dbg ZipNote.dbg ZipSplit.dbg ZipCloak.dbg ZipLM.dbg
# header dependencies:
$(O)zip.o $(O)zipnote.o $(O)zipcloak.o $(O)zipsplit.o $(O)crypt.o $(O)ttyio.o \
$(O)deflate.o $(O)trees.o $(O)zipfile.o $(O)zipup.o $(O)fileio.o $(O)util.o \
$(O)timezone.o $(O)crc32.o $(O)globals.o $(O)amiga.o : $(ZIP_H)
$(O)zip.ol $(O)zipnote.ol $(O)zipcloak.ol $(O)zipsplit.ol $(O)crypt.ol \
$(O)ttyio.ol $(O)deflate.ol $(O)trees.ol $(O)zipfile.ol $(O)zipup.ol \
$(O)fileio.ol $(O)util.ol $(O)timezone.ol $(O)crc32.ol $(O)globals.ol \
$(O)amiga.ol : $(ZIP_H)
$(O)crc32.oo $(O)crypt.oo $(O)zipfile.oo $(O)fileio.oo $(O)util.oo : $(ZIP_H)
$(O)amigazip.o $(O)amigazip.ol $(O)amigazip.oo : amiga/amiga.h $(ZIP_H)
$(O)zip.o $(O)zipnote.o $(O)zipcloak.o $(O)zipsplit.o $(O)zipup.o \
$(O)zip.ol $(O)zipnote.ol $(O)zipcloak.ol $(O)zipsplit.ol \
$(O)zipup.ol : revision.h
$(O)amiga.o $(O)amiga.ol : crypt.h
$(O)crc32.o $(O)crc32.oo $(O)crc32.ol $(O)crypt.o $(O)crypt.oo $(O)crypt.ol \
$(O)zipcloak.o $(O)zipcloak.ol $(O)zip.o $(O)zip.ol \
$(O)zipup.o $(O)zipup.ol \
$(O)zipfile.o $(O)zipfile.oo $(O)zipfile.ol \
$(O)fileio.o $(O)fileio.oo $(O)fileio.ol : crc32.h
$(O)crypt.o $(O)crypt.oo $(O)crypt.ol $(O)ttyio.o $(O)ttyio.ol \
$(O)zipcloak.o $(O)zipcloak.ol $(O)zip.o $(O)zip.ol \
$(O)zipup.o $(O)zipup.ol : crypt.h ttyio.h
$(O)timezone.o $(O)timezone.ol $(O)timezone.od $(O)timezone.dl \
$(O)amiga.o $(O)amiga.ol $(O)amiga.oo : timezone.h
$(O)zipup.o $(O)zipup.ol : amiga/zipup.h
# SPECIAL CASES:
# -mr changes expression parsing; avoids a bogus "expression too complex" error:
$(O)trees.o : trees.c
$(CC) $(CFLAGS) -mr -o $@ trees.c
$(O)trees.ol : trees.c
$(CC) $(LOWFLAGS) -mr -o $@ trees.c
$(O)trees.od : trees.c
$(CC) $(CFLAGD) -mr -o $@ trees.c
$(O)trees.ld : trees.c
$(CC) $(LOWFLAGD) -mr -o $@ trees.c
# Substitute the assembly version of deflate.c: (but not in debug version)
$(O)deflate.o : amiga/deflate.a
$(AS) $(ASOPTS) -o $@ amiga/deflate.a
$(O)deflate.ol : amiga/deflate.a
$(AS) $(LOWASOPTS) -o $@ amiga/deflate.a
# The assembly CRC function:
$(O)crc_68.o : amiga/crc_68.a
$(AS) -n -o $@ amiga/crc_68.a
# Put the Amiga internal version data with today's date into amiga.c:
$(O)amiga.o : amiga/amiga.c amiga/filedate.c amiga/stat.c
rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
$(CC) $(CFLAGS) -o $@ amiga/amiga.c
delete env:VersionDate
$(O)amiga.ol : amiga/amiga.c amiga/filedate.c amiga/stat.c
rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
$(CC) $(LOWFLAGS) -o $@ amiga/amiga.c
delete env:VersionDate
$(O)amiga.od : amiga/amiga.c amiga/filedate.c amiga/stat.c
rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
$(CC) $(CFLAGD) -o $@ amiga/amiga.c
delete env:VersionDate
$(O)amiga.ld : amiga/amiga.c amiga/filedate.c amiga/stat.c
rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
$(CC) $(LOWFLAGD) -o $@ amiga/amiga.c
delete env:VersionDate
$(O)amiga.oo : amiga/amiga.c amiga/filedate.c amiga/stat.c
rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
$(CC) $(CFLAGS) -d UTIL -o $@ amiga/amiga.c
delete env:VersionDate
$(O)amiga.dd : amiga/amiga.c amiga/filedate.c amiga/stat.c
rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
$(CC) $(CFLAGD) -d UTIL -o $@ amiga/amiga.c
delete env:VersionDate
# Put the compiler version number into amigazip.c:
$(O)amigazip.o : amiga/amigazip.c
$(CC) $(CFLAGS) -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c
$(O)amigazip.ol : amiga/amigazip.c
$(CC) $(LOWFLAGS) -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c
$(O)amigazip.od : amiga/amigazip.c
$(CC) $(CFLAGD) -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c
$(O)amigazip.ld : amiga/amigazip.c
$(CC) $(LOWFLAGD) -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c
$(O)amigazip.oo : amiga/amigazip.c
$(CC) $(CFLAGS) -d UTIL -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c
$(O)amigazip.dd : amiga/amigazip.c
$(CC) $(CFLAGD) -d UTIL -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c

View file

@ -1,182 +0,0 @@
;===========================================================================
; Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
;
; See the accompanying file LICENSE, version 1999-Oct-05 or later
; (the contents of which are also included in zip.h) for terms of use.
; If, for some reason, both of these files are missing, the Info-ZIP license
; also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
;===========================================================================
; match.a -- optional optimized asm version of longest match in deflate.c
; Written by Jean-loup Gailly
; Adapted for the Amiga by Carsten Steger <stegerc@informatik.tu-muenchen.de>
; using the code in match.S.
; The major change in this code consists of removing all unaligned
; word accesses, because they cause 68000-based Amigas to crash.
; For maximum speed, UNALIGNED_OK can be defined in Makefile.sasc.
; The program will then only run on 68020-based Amigas, though.
; If you have reduced WSIZE in zip.h, then make sure this is
; assembled with an equivalent -dWSIZE=<whatever>.
;
; This code will run with registerized parameters too, unless SAS
; changes parameter passing conventions between new releases of SAS/C.
Cur_Match reg d0 ; Must be in d0!
Best_Len reg d1
Loop_Counter reg d2
Scan_Start reg d3
Scan_End reg d4
Limit reg d5
Chain_Length reg d6
Scan_Test reg d7
Scan reg a0
Match reg a1
Prev_Address reg a2
Scan_Ini reg a3
Match_Ini reg a4
MAX_MATCH equ 258
MIN_MATCH equ 3
ifnd WSIZE
WSIZE equ 32768
endc
MAX_DIST equ WSIZE-MAX_MATCH-MIN_MATCH-1
xref _max_chain_length
xref _prev_length
xref _prev
xref _window
xref _strstart
xref _good_match
xref _match_start
xref _nice_match
section match,code
xdef _match_init
xdef @match_init
xdef _longest_match
xdef @longest_match
_match_init:
@match_init:
rts
_longest_match:
move.l 4(sp),Cur_Match
@longest_match:
ifd UNALIGNED_OK
movem.l d2-d6/a2-a4,-(sp)
else
movem.l d2-d7/a2-a4,-(sp)
endc
move.l _max_chain_length,Chain_Length
move.l _prev_length,Best_Len
lea _prev,Prev_Address
lea _window+MIN_MATCH,Match_Ini
move.l _strstart,Limit
move.l Match_Ini,Scan_Ini
add.l Limit,Scan_Ini
subi.w #MAX_DIST,Limit
bhi.b limit_ok
moveq #0,Limit
limit_ok:
cmp.l _good_match,Best_Len
bcs.b length_ok
lsr.l #2,Chain_Length
length_ok:
subq.l #1,Chain_Length
ifd UNALIGNED_OK
move.w -MIN_MATCH(Scan_Ini),Scan_Start
move.w -MIN_MATCH-1(Scan_Ini,Best_Len.L),Scan_End
else
move.b -MIN_MATCH(Scan_Ini),Scan_Start
lsl.w #8,Scan_Start
move.b -MIN_MATCH+1(Scan_Ini),Scan_Start
move.b -MIN_MATCH-1(Scan_Ini,Best_Len.L),Scan_End
lsl.w #8,Scan_End
move.b -MIN_MATCH(Scan_Ini,Best_Len.L),Scan_End
endc
bra.b do_scan
long_loop:
ifd UNALIGNED_OK
move.w -MIN_MATCH-1(Scan_Ini,Best_Len.L),Scan_End
else
move.b -MIN_MATCH-1(Scan_Ini,Best_Len.L),Scan_End
lsl.w #8,Scan_End
move.b -MIN_MATCH(Scan_Ini,Best_Len.L),Scan_End
endc
short_loop:
lsl.w #1,Cur_Match
move.w 0(Prev_Address,Cur_Match.L),Cur_Match
cmp.w Limit,Cur_Match
dbls Chain_Length,do_scan
bra.b return
do_scan:
move.l Match_Ini,Match
add.l Cur_Match,Match
ifd UNALIGNED_OK
cmp.w -MIN_MATCH-1(Match,Best_Len.L),Scan_End
bne.b short_loop
cmp.w -MIN_MATCH(Match),Scan_Start
bne.b short_loop
else
move.b -MIN_MATCH-1(Match,Best_Len.L),Scan_Test
lsl.w #8,Scan_Test
move.b -MIN_MATCH(Match,Best_Len.L),Scan_Test
cmp.w Scan_Test,Scan_End
bne.b short_loop
move.b -MIN_MATCH(Match),Scan_Test
lsl.w #8,Scan_Test
move.b -MIN_MATCH+1(Match),Scan_Test
cmp.w Scan_Test,Scan_Start
bne.b short_loop
endc
move.w #(MAX_MATCH-MIN_MATCH),Loop_Counter
move.l Scan_Ini,Scan
scan_loop:
cmpm.b (Match)+,(Scan)+
dbne Loop_Counter,scan_loop
sub.l Scan_Ini,Scan
addq.l #(MIN_MATCH-1),Scan
cmp.l Best_Len,Scan
bls.b short_loop
move.l Scan,Best_Len
move.l Cur_Match,_match_start
cmp.l _nice_match,Best_Len
bcs.b long_loop
return:
move.l Best_Len,d0
ifd UNALIGNED_OK
movem.l (sp)+,d2-d6/a2-a4
else
movem.l (sp)+,d2-d7/a2-a4
endc
rts
end

View file

@ -1,273 +0,0 @@
;===========================================================================
; Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
;
; See the accompanying file LICENSE, version 1999-Oct-05 or later
; (the contents of which are also included in zip.h) for terms of use.
; If, for some reason, both of these files are missing, the Info-ZIP license
; also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
;===========================================================================
; This is a 68000 assembly language version of the Zip function
; longest_match(). It is written for any 680x0 based computer, but at this
; time the feature for runtime testing of CPU type is only supported for the
; Amiga. Hopefully a similar test for the Macintosh is possible, and for any
; other system that supports both 68000 and 68020+ CPUs. This is written by
; Paul Kienitz, partially derived from a simpler version by Carsten Steger,
; derived in turn from a 386 assembly function by Jean-loup Gailly and Kai Uwe
; Rommel... but also based directly on the C original.
;
; The main difference of this from other longest_match() implementations is
; that it includes both byte based and word based versions of the function,
; and various symbols can be defined to select whether to use one routine or
; the other, or to do a platform-specific test at runtime. The symbols that
; can be used to select behavior are as follows:
;
; CPU020 if defined, use 68020 instructions always
; CPUTEST if defined, check at runtime for CPU type. Another symbol
; specifying the platform-specific test must be used with this.
; If neither of these is defined, use 68000 instructions only.
; AMIGA use Amiga-specific test for 68020, if CPUTEST defined. Also
; tells it to let a0/a1/d1 be clobbered by functions.
; ATSIGN define entry symbols in @foo form as well as _foo, with
; @longest_match taking its parm in d0 instead of on the stack.
; WSIZE if defined, determines the sliding window size for deflate;
; the default is 32K. If you have reduced WSIZE for the C code,
; make sure that this module is assembled with an equivalent
; "-dWSIZE=<whatever>" (or "-e...") switch.
;
; NOTE: no provision is made for 16 bit ints. All external int variables are
; treated as 32 bit values. This also assumes that longest_match's result is
; returned in D0.
IFND CPU020
IFND CPUTEST
CPU000 equ 1
ENDC
ENDC
; global variables:
xref _max_chain_length ; unsigned int
xref _prev_length ; unsigned int
xref _match_start ; unsigned int
xref _strstart ; unsigned int
xref _good_match ; signed int
xref _nice_match ; signed int
xref _window ; array of unsigned char
xref _prev ; array of unsigned short
; our entry points:
xdef _match_init ; void match_init(void);
xdef _longest_match ; int longest_match(unsigned cur_match);
IFD ATSIGN
xdef @match_init ; for SAS assembler
xdef @longest_match ; ditto
ENDC
; flag variable for remembering CPU type:
IFD CPUTEST
section cpuflag,data
is020: ds.w 1
ENDC
section match,code
_match_init:
IFD ATSIGN
@match_init:
ENDC
IFD CPUTEST ; now check for platform type
IFD AMIGA ; Amiga specific test for '020 CPU:
xref _SysBase
NOLIST
INCLUDE 'exec/execbase.i'
LIST
clr.w is020 ; default value is 68000
move.l _SysBase,a0
btst #AFB_68020,AttnFlags+1(a0)
beq.s cheap
move.w #1,is020
cheap:
ELSE ; !AMIGA
!! Write an '020-detector for your system here!
ENDC ; AMIGA
ENDC ; CPUTEST
rts ; match_init consists only of rts if CPUTEST unset
IFD AMIGA
SAVEREGS reg d3-d7/a2/a3/a5 ; don't protect d0/d1/a0/a1
ELSE
SAVEREGS reg d1/d3-d7/a0-a3/a5 ; protect all but d0 return val
ENDC
Cur_Match equr d0 ; Must be in d0!
Best_Len equr d1
Scan_Start equr d3
Scan_End equr d4
Limit equr d5
Chain_Length equr d6
Scan_Test equr d7
Scan equr a0
Match equr a1
Prev_Address equr a2
Scan_Ini equr a3
Match_Ini equr a5
MAX_MATCH equ 258
MIN_MATCH equ 3
IFND WSIZE
WSIZE equ 32768
ENDC
MAX_DIST equ WSIZE-MAX_MATCH-MIN_MATCH-1
_longest_match:
move.l 4(sp),Cur_Match ; stack arg to register
IFD ATSIGN
@longest_match:
ENDC
movem.l SAVEREGS,-(sp)
; setup steps common to byte and word versions:
move.l _max_chain_length,Chain_Length
move.l _prev_length,Best_Len
lea _prev,Prev_Address
lea _window,Match_Ini
move.l _strstart,Limit
move.l Match_Ini,Scan_Ini
addq #MIN_MATCH,Match_Ini
add.l Limit,Scan_Ini
subi.w #MAX_DIST,Limit
bhi.s limit_ok
moveq #0,Limit
limit_ok:
cmp.l _good_match,Best_Len
bcs.s length_ok
lsr.l #2,Chain_Length
length_ok:
subq.l #1,Chain_Length
IFD CPUTEST
tst.w is020 ; can we use '020 stuff today?
bne WORD_match
ENDC
IFND CPU020
; for 68000 or 68010, use byte operations:
moveq #0,Scan_Start ; clear 2nd and 4th bytes, use 1st & 3rd
moveq #0,Scan_End
moveq #0,Scan_Test
move.b (Scan_Ini),Scan_Start
swap Scan_Start
move.b 1(Scan_Ini),Scan_Start
move.b -1(Scan_Ini,Best_Len),Scan_End
swap Scan_End
move.b 0(Scan_Ini,Best_Len),Scan_End
bra.s bdo_scan
blong_loop:
move.b -1(Scan_Ini,Best_Len),Scan_End
swap Scan_End
move.b 0(Scan_Ini,Best_Len),Scan_End
bshort_loop:
add.w Cur_Match,Cur_Match
move.w 0(Prev_Address,Cur_Match.l),Cur_Match
cmp.l Limit,Cur_Match
dbls Chain_Length,bdo_scan
bra return
bdo_scan:
move.l Match_Ini,Match
add.l Cur_Match,Match
move.b -MIN_MATCH-1(Match,Best_Len),Scan_Test
swap Scan_Test
move.b -MIN_MATCH(Match,Best_Len),Scan_Test
cmp.l Scan_Test,Scan_End
bne.s bshort_loop
move.b -MIN_MATCH(Match),Scan_Test
swap Scan_Test
move.b -MIN_MATCH+1(Match),Scan_Test
cmp.l Scan_Test,Scan_Start
bne.s bshort_loop
move.w #(MAX_MATCH-MIN_MATCH),Scan_Test
lea MIN_MATCH(Scan_Ini),Scan
bscan_loop:
cmpm.b (Match)+,(Scan)+
dbne Scan_Test,bscan_loop
subq #1,Scan
sub.l Scan_Ini,Scan
cmp.l Best_Len,Scan
bls.s bshort_loop
move.l Scan,Best_Len
move.l Cur_Match,_match_start
cmp.l _nice_match,Best_Len
bcs.s blong_loop
IFD CPUTEST
bra return
ENDC
ENDC ; !CPU020
IFND CPU000
; for 68020 or higher, use word operations even on odd addresses:
WORD_match:
move.w (Scan_Ini),Scan_Start
move.w -1(Scan_Ini,Best_Len),Scan_End
bra.s wdo_scan
wlong_loop:
move.w -1(Scan_Ini,Best_Len),Scan_End
wshort_loop:
add.w Cur_Match,Cur_Match
move.w (Prev_Address,Cur_Match.l),Cur_Match
cmp.l Limit,Cur_Match
dbls Chain_Length,wdo_scan
bra.s return
wdo_scan:
move.l Match_Ini,Match
add.l Cur_Match,Match
cmp.w -MIN_MATCH-1(Match,Best_Len),Scan_End
bne.s wshort_loop
cmp.w -MIN_MATCH(Match),Scan_Start
bne.s wshort_loop
moveq #((MAX_MATCH-MIN_MATCH)/2),Scan_Test ; value = 127
lea MIN_MATCH(Scan_Ini),Scan
wscan_loop:
cmpm.w (Match)+,(Scan)+
dbne Scan_Test,wscan_loop
subq #2,Scan
move.b -MIN_MATCH+1(Match),Scan_Test
cmp.b (Scan),Scan_Test
bne steven
addq #1,Scan
steven:
sub.l Scan_Ini,Scan
cmp.l Best_Len,Scan
bls.s wshort_loop
move.l Scan,Best_Len
move.l Cur_Match,_match_start
cmp.l _nice_match,Best_Len
bcs.s wlong_loop
ENDC ; !CPU000
return:
move.l Best_Len,d0 ; function return value
movem.l (sp)+,SAVEREGS
rts
end

View file

@ -1,119 +0,0 @@
/*
Copyright (c) 1990-2005 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 2005-Feb-10 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, 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_osdep_h
#define __amiga_osdep_h
/* default to MEDIUM_MEM, but allow makefile override */
#if ( (!defined(BIG_MEM)) && (!defined(SMALL_MEM)))
# define MEDIUM_MEM
#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
#ifndef IZTZ_GETLOCALETZINFO
# define IZTZ_GETLOCALETZINFO GetPlatformLocalTimezone
#endif
/* AmigaDOS can't even support disk partitions over 4GB, let alone files */
#define NO_LARGE_FILE_SUPPORT
#ifdef LARGE_FILE_SUPPORT
# undef LARGE_FILE_SUPPORT
#endif
#define USE_CASE_MAP
#define USE_EF_UT_TIME
#define HANDLE_AMIGA_SFX
#define PROCNAME(n) (action == ADD || action == UPDATE ? wild(n) : \
procname(n, 1))
#define EXIT(e) ClearIOErr_exit(e)
void ClearIOErr_exit(int e);
#include "amiga/z-stat.h"
#ifdef __SASC
# include <sys/types.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>
# if (defined(_M68020) && !defined(UNALIGNED_OK))
# define UNALIGNED_OK
# endif
# ifndef REENTRANT
# define REENTRANT
# endif
# if (defined(_NEAR_DATA) && !defined(DYN_ALLOC))
# define DYN_ALLOC
# endif
# ifdef DEBUG
# include <sprof.h> /* profiler header file */
# endif
# ifndef IZTZ_SETLOCALTZINFO
/* XXX !! We have really got to find a way to operate without these. */
# define IZTZ_SETLOCALTZINFO
# endif
/*
A word on short-integers and SAS/C (a bug of [mc]alloc?)
Using short integers (i.e. compiling with option SHORT-INTEGERS) is
*not* recommended. To get maximum compression ratio the window size stored
in WSIZE should be 32k (0x8000). However, since the size of the window[]
array is 2*WSIZE, 65536 bytes must be allocated. The calloc function can
only allocate UINT_MAX (defined in limits.h) bytes which is one byte short
(65535) of the maximum window size if you are compiling with short-ints.
You'll get an error message "Out of memory (window allocation)" whenever
you try to deflate. Note that the compiler won't produce any warning.
The maximum window size with short-integers is therefore 32768 bytes.
The following is only implemented to allow the use of short-integers but
it is once again not recommended because of a loss in compression ratio.
*/
# if (defined(_SHORTINT) && !defined(WSIZE))
# define WSIZE 0x4000 /* only half of maximum window size */
# endif /* possible with short-integers */
#endif /* __SASC */
/*
With Aztec C, using short integers imposes no size limits and makes
the program run faster, even with 32 bit CPUs, so it's recommended.
*/
#ifdef AZTEC_C
# define NO_UNISTD_H
# define NO_RMDIR
# define BROKEN_FSEEK
# ifndef IZTZ_DEFINESTDGLOBALS
# define IZTZ_DEFINESTDGLOBALS
# endif
#endif
extern int real_timezone_is_set;
void tzset(void);
#define VALID_TIMEZONE(tempvar) (tzset(), real_timezone_is_set)
#ifdef ZCRYPT_INTERNAL
# ifndef CLIB_EXEC_PROTOS_H
void *FindTask(void *);
# endif
# define ZCR_SEED2 (unsigned)(ulg)FindTask(NULL)
#endif
int Agetch(void); /* getch() like function, in amiga/filedate.c */
char *GetComment(char *);
#define FOPR "rb"
#define FOPM "rb+"
#define FOPW "wb"
/* prototype for ctrl-C trap function */
void _abort(void);
#endif /* !__amiga_osdep_h */

View file

@ -1,662 +0,0 @@
#===========================================================================
# Makefile for Zip, ZipNote, ZipCloak, ZipSplit AMIGA SAS/C Version 6.58
# Version: 2.3 last revised: 07 Jan 2007
#===========================================================================
# -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 executeables below
# zip builds zip executeable
# zipsplit builds zipsplit executeable
# zipcloak builds zipcloak executeable
# zipnote builds zipnote executeable
# ziplm builds low memory version of zip executable
# clean remove all files created by the compilation
# spotless like clean target but removes binaries too
##########################
# USER MACRO DEFINITIONS #
##########################
# *** NOTE ***
# The assembly version is not implemented yet.
# (Un)commenting the assembler macros has no effect unless the
# file dependencies are changed too.
# Most of the amiga/*.a files do not assmble with 68000 instructions.
# Any help is appreciated, of course.
# Set the processor to generate code for.
# Compiler: ANY 68000 68010 68020 68030 68040 68060
# Assembler: 0 0 1 2 3 4 n/a
# Defaults: ANY and 0
#
CUSECPU = ANY
AUSECPU = 0
# UNCOMMENT to use 68020 instructions in the assembly version of deflate.o
# Only use if code is generated for 68020 or higher processors above.
# Note: You could use CPUTEST too to enable runtime cpu detection.
# However, it is not recommended since both 68000 and 68020 code will be
# included which would be an unnecessary increase in size.
# (see amiga/deflate.a for more information)
#
#AUSE020 = CPU020
# To disable the assembler replacements and use the standard C source,
# you have to change the Zip and ZipLM dependencies. See below for details.
# (remember that assembler use is *not* implemented yet)
# 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 programs if you raise your stack to 10000 (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 , ASMOPTS 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
#ASMOPTS = -dINT16
#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
ASMOPTS =
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
#ASMOPTS = -dINT16
#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
#ASMOPTS =
#LSTARTUP = c.o
#
# DEBUGGING
# ---------
# Default: No debugging information added.
# The three macros below will be overwritten if you choose to add
# debug info, therefore no need to comment.
CDBG = NODEBUG NOPROFILE NOCOVERAGE # default: no debug info
ADBG =
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, ADBG and LDBG to include debugging information
#CDBG = $(CDBG1) $(CDBG2) $(CDBG3) ADDSYM DEBUG=FULLFLUSH STACKCHECK NOOPT
#ADBG = DEBUG
#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 memwatch.library 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)
#
MAPFZ = zip.map # Zip map filename
MAPFN = zipnote.map # ZipNote map filename
MAPFC = zipcloak.map # ZipCloak map filename
MAPFS = zipsplit.map # ZipSplit map filename
MAPFL = ziplm.map # Zip low memory version 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
#LMAPZ = $(MAPFSTYLE) MAP $(MAPFZ) f,h,l,o,s,x # Zip maps
#LMAPN = $(MAPFSTYLE) MAP $(MAPFN) f,h,l,o,s,x # ZipNote maps
#LMAPC = $(MAPFSTYLE) MAP $(MAPFC) f,h,l,o,s,x # ZipCloak maps
#LMAPS = $(MAPFSTYLE) MAP $(MAPFS) f,h,l,o,s,x # ZipSplit maps
#LMAPL = $(MAPFSTYLE) MAP $(MAPFL) f,h,l,o,s,x # Zip lowmem maps
#
# LISTINGS
# --------
# Listfile-extensions for each executable (enter *with* dot)
#
LISTEXTZ = .lst # extension for Zip listfiles
LISTEXTU = .ulst # extension for utility listfiles (ZipNote,ZipCloak,ZipSplit)
LISTEXTL = .llst # extension for Zip low memory listfiles
# List files and cross references for each OBJECT.
# Add/remove flags as needed. Not all listed by default.
# Use LISTINCLUDES 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 # extension for Zip objects
OU = .uo # extension for utility objects (ZipNote, ZipSplit and ZipCloak)
OL = .lo # extension for low memory Zip objects
# Filename used to store converted options from environment variable
# LOCAL_ZIP. Default: scoptions_local_zip
#
CWITHOPT = scoptions_local_zip
# Filenames to store compiler options to prevent command line overflow
#
# Common options file for Zip and other executables
CFILE = scoptions-zip
# Temp filenames for object lists to load using linker "WITH" command.
OBJLISTZ = zip_objlist.with # Zip object list
OBJLISTN = zipnote_objlist.with # ZipNote object list
OBJLISTC = zipcloak_objlist.with # ZipCloak object list
OBJLISTS = zipsplit_objlist.with # ZipSplit object list
OBJLISTL = ziplm_objlist.with # Zip low-mem object list
# Filenames to store linker options
#
LWITHZ = zip.lnk # zip linker options
LWITHN = zipnote.lnk # zipnote linker options
LWITHC = zipcloak.lnk # zipcloak linker options
LWITHS = zipsplit.lnk # zipsplit linker options
LWITHL = ziplm.lnk # zip low-mem linker options
# Define AMIGA_BETA to print "Beta Notice" up front. See tailor.h.
# Undefine AMIGA_BETA when building a released version.
#CDEFBETA = DEF=AMIGA_BETA
#####################################
# NOTHING TO CHANGE BEYOND HERE ... #
#####################################
# (except for C/asm dependencies)
# Define MEDIUM_MEM for production release (per Paul Kienitz).
# This reduces runtime memory requirement but not speed or compression.
# Note: Do *not* use BIG_MEM or MMAP since it isn't yet supported by the
assembler version of deflate.c : amiga/deflate.a
CUSEMEM = DEF=MEDIUM_MEM
AUSEMEM = -DMEDIUM_MEM # for asm deflate.o, must match above
# Defines for building low-memory use version of Zip
WSIZEL = WSIZE=4096 # deflate.c window size for low-mem version
CLOWMEM = DEF=SMALL_MEM DEF=$(WSIZEL)
ALOWMEM = -DSMALL_MEM -D$(WSIZEL) # for asm deflate.o, must match above
# 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
#
CDEFINES = $(CMEMLIB) $(CDEFBETA) DEF=AMIGA
COPTIONS = $(DATAOPTS) CODE=NEAR CPU=$(CUSECPU) VERBOSE PARAMETERS=BOTH NOMINC
COPTIONS = $(COPTIONS) ERRORREXX NOERRORCONSOLE MEMSIZE=HUGE $(CLIST) $(CXREF)
COPTIONS = $(COPTIONS) $(CSTACK) $(CUTIL) STRICT UNSCHAR NOICONS STRINGMERGE
CFLAGS = $(CDEFINES) $(COPTIONS) $(OPT) $(CDBG) $(CIGNORE)
# Linker definitions
# See SASLIB definition above
#
LD = slink
# special linker flags for 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)
LIBFLAGS = LIB $(LMEMLIB) SC:LIB/$(SASLIB).lib SC:LIB/amiga.lib
# Assembler definitions
#
ASM = asm
#
# Options used for assembling amiga/deflate.a
# Must match defines in C-Source.
#
AFLAGS0 = -d__SASC -dSASC -dAMIGA
AFLAGS1 = $(AUSE020) $(ASMOPTS) $(ADBG)
AFLAGS2 = -m$(AUSECPU) -jm -iINCLUDE:
AFLAGS = $(AFLAGS0) $(AFLAGS1) $(AFLAGS2)
ASMOPTSZ = $(AFLAGS) $(AUSEMEM) -dDYN_ALLOC # Zip asm flags
ASMOPTSL = $(AFLAGS) $(ALOWMEM) # Zip low-mem version asm flags
##################
# TARGET OBJECTS #
##################
# Zip objects
OBJZ1 = zip$(O) zipfile$(O) zipup$(O) fileio$(O) util$(O) globals$(O)
OBJZ2 = crc32$(O) crypt$(O) timezone$(O) ttyio$(O)
OBJZI = deflate$(O) trees$(O)
OBJZA = amiga$(O) amigazip$(O) stat$(O) filedate$(O)
OBJZ = $(OBJZ1) $(OBJZ2) $(OBJZI) $(OBJZA)
# Shared utility objects for ZipNote, ZipCloak and ZipSplit
OBJU1 = globals$(O)
OBJUU = zipfile$(OU) fileio$(OU) timezone$(O) util$(OU)
OBJUA = amigazip$(OU) amiga$(O) stat$(O) filedate$(O)
OBJU = $(OBJU1) $(OBJUU) $(OBJUA)
# ZipNote objects
OBJN1 = zipnote$(O)
OBJN = $(OBJN1) $(OBJU)
# ZipCloak objects
OBJC1 = zipcloak$(O)
OBJCU = $(OBJU) crypt$(OU)
OBJCS = crc32$(OU) ttyio$(O)
OBJC = $(OBJC1) $(OBJCU) $(OBJCS)
#ZipSplit objects
OBJS1 = zipsplit$(O)
OBJS = $(OBJS1) $(OBJU)
# ZipLM objects
OBJL1 = zip$(OL) zipfile$(OL) zipup$(OL) fileio$(OL) util$(OL) globals$(OL)
OBJL2 = crc32$(OL) crypt$(OL) timezone$(OL) ttyio$(OL)
OBJLI = deflate$(OL) trees$(OL)
OBJLA = amiga$(OL) amigazip$(OL) stat$(OL) filedate$(OL)
OBJL = $(OBJL1) $(OBJL2) $(OBJLI) $(OBJLA)
# Common header files
ZIP_H1 = zip.h ziperr.h tailor.h
ZIP_HA = amiga/osdep.h amiga/z-stat.h
ZIP_H = $(ZIP_H1) $(ZIP_HA)
# Output targets
ZIPS = Zip ZipNote ZipCloak ZipSplit ZipLM
# Temp filenames for object lists to load using linker "WITH" command.
OBJLISTZ = zip_objlist.with # Zip object list
OBJLISTN = zipnote_objlist.with # ZipNote object list
OBJLISTC = zipcloak_objlist.with # ZipCloak object list
OBJLISTS = zipsplit_objlist.with # ZipSplit object list
OBJLISTL = ziplm_objlist.with # Zip low-mem object list
#######################################
# DEFAULT TARGET AND PROCESSING RULES #
#######################################
all: request flush $(ZIPS)
# Zip transformation rules
#
.c$(O):
$(CC) WITH=$(CFILE) $(CUSEMEM) LISTFILE=$>$(LISTEXTZ) OBJNAME=$@ $*.c
# Zip low-memory version transformation rules
#
.c$(OL):
$(CC) WITH=$(CFILE) $(CLOWMEM) LISTFILE=$>$(LISTEXTL) OBJNAME=$@ $*.c
# Utilities (ZipNote, ZipCloak and ZipSplit) transformation rules
#
.c$(OU):
$(CC) WITH=$(CFILE) $(CUSEMEM) DEF=UTIL LISTFILE=$>$(LISTEXTU) OBJNAME=$@ $*.c
#########################
# Final output targets. #
#########################
zip: local_zip CommonFlags $(OBJZ)
@Echo "$(OBJZ)" > $(OBJLISTZ)
Type $(OBJLISTZ)
@Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTZ) $(LIBFLAGS)" \
"$(LDFLAGS2) $(LMAPZ)" >$(LWITHZ)
Type $(LWITHZ)
$(LD) TO Zip WITH $(LWITHZ)
zipnote: local_zip CommonFlags $(OBJN)
@Echo "$(OBJN)" > $(OBJLISTN)
Type $(OBJLISTN)
@Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTN) $(LIBFLAGS) " \
"$(LDFLAGS2) $(LMAPN)" >$(LWITHN)
Type $(LWITHN)
$(LD) TO ZipNote WITH $(LWITHN)
zipcloak: local_zip CommonFlags $(OBJC)
@Echo "$(OBJC)" > $(OBJLISTC)
Type $(OBJLISTC)
@Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTC) $(LIBFLAGS) " \
"$(LDFLAGS2) $(LMAPC)" >$(LWITHC)
Type $(LWITHC)
$(LD) TO ZipCloak WITH $(LWITHC)
zipsplit: local_zip CommonFlags $(OBJS)
@Echo "$(OBJS)" > $(OBJLISTS)
Type $(OBJLISTS)
@Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTS) $(LIBFLAGS) " \
"$(LDFLAGS2) $(LMAPS)" >$(LWITHS)
Type $(LWITHS)
$(LD) TO ZipSplit WITH $(LWITHS)
ziplm: local_zip CommonFlags $(OBJL)
@Echo "$(OBJL)" > $(OBJLISTL)
Type $(OBJLISTL)
@Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTL) $(LIBFLAGS) " \
"$(LDFLAGS2) $(LMAPL)" >$(LWITHL)
Type $(LWITHL)
$(LD) TO ZipLM WITH $(LWITHL)
clean:
-Delete >nil: $(OBJZ) quiet
-Delete >nil: $(OBJN) quiet
-Delete >nil: $(OBJC) quiet
-Delete >nil: $(OBJS) quiet
-Delete >nil: $(OBJL) quiet
-Delete >nil: $(OBJLISTZ) $(OBJLISTL) $(OBJLISTN) $(OBJLISTS) $(OBJLISTC) quiet
-Delete >nil: $(MAPFZ) $(MAPFN) $(MAPFC) $(MAPFS) $(MAPFL) quiet
-Delete >nil: \#?$(LISTEXTZ) \#?$(LISTEXTU) \#?$(LISTEXTL) quiet
-Delete >nil: $(CWITHOPT) $(CFILE) quiet
-Delete >nil: $(LWITHZ) $(LWITHN) $(LWITHC) $(LWITHS) $(LWITHL) quiet
-Delete >nil: env:VersionDate quiet
-Delete >nil: \#?.q.?? \#?.tmp \#?.cov quiet
spotless: clean
-Delete >nil: $(ZIPS) quiet
################
# DEPENDENCIES #
################
# To change between the assembler and C sources, you have to comment/uncomment
# the approprite lines. C sources are marked by #C-src and assembler sources
# #asm-src at the end.
# Zip dependencies:
#
zip$(O): zip.c $(ZIP_H) revision.h crc32.h crypt.h ttyio.h
zipup$(O): zipup.c $(ZIP_H) revision.h crc32.h crypt.h amiga/zipup.h
zipfile$(O): zipfile.c $(ZIP_H) revision.h crc32.h
crypt$(O): crypt.c $(ZIP_H) crypt.h crc32.h ttyio.h
ttyio$(O): ttyio.c $(ZIP_H) crypt.h ttyio.h
deflate$(O): deflate.c $(ZIP_H) #C-src
trees$(O): trees.c $(ZIP_H)
fileio$(O): fileio.c $(ZIP_H) crc32.h
util$(O): util.c $(ZIP_H)
crc32$(O): crc32.c $(ZIP_H) crc32.h
globals$(O): globals.c $(ZIP_H)
timezone$(O): timezone.c $(ZIP_H) timezone.h
# Amiga specific objects
stat$(O): amiga/stat.c amiga/z-stat.h
filedate$(O): amiga/filedate.c crypt.h timezone.h
amiga$(O): amiga/amiga.c ziperr.h
amigazip$(O): amiga/amigazip.c $(ZIP_H) amiga/amiga.h env:Workbench
# Substitute assembly version of deflate.c:
#deflate$(O): amiga/deflate.a #asm-src
# $(ASM) $(ASMOPTSZ) -o$@ $*.a #asm-src
# Utility (ZipNote, ZipCloak, ZipSplit) dependencies:
#
zipnote$(O): zipnote.c $(ZIP_H) revision.h
zipcloak$(O): zipcloak.c $(ZIP_H) revision.h crc32.h crypt.h ttyio.h
zipsplit$(O): zipsplit.c $(ZIP_H) revision.h
zipfile$(OU): zipfile.c $(ZIP_H) revision.h crc32.h
fileio$(OU): fileio.c $(ZIP_H) crc32.h
util$(OU): util.c $(ZIP_H)
crc32$(OU): crc32.c $(ZIP_H) crc32.h
crypt$(OU): crypt.c $(ZIP_H) crypt.h crc32.h ttyio.h
# Amiga specific objects
amigazip$(OU): amiga/amigazip.c $(ZIP_H) amiga/amiga.h env:Workbench
# ZipLM dependencies:
#
zip$(OL): zip.c $(ZIP_H) revision.h crc32.h crypt.h ttyio.h
zipup$(OL): zipup.c $(ZIP_H) revision.h crc32.h crypt.h amiga/zipup.h
zipfile$(OL): zipfile.c $(ZIP_H) revision.h crc32.h
crypt$(OL): crypt.c $(ZIP_H) crypt.h crc32.h ttyio.h
ttyio$(OL): ttyio.c $(ZIP_H) crypt.h ttyio.h
deflate$(OL): deflate.c $(ZIP_H)
trees$(OL): trees.c $(ZIP_H)
fileio$(OL): fileio.c $(ZIP_H) crc32.h
util$(OL): util.c $(ZIP_H)
crc32$(OL): crc32.c $(ZIP_H)
globals$(OL): globals.c $(ZIP_H)
timezone$(OL): timezone.c $(ZIP_H) timezone.h
# Amiga specific objects
stat$(OL): amiga/stat.c amiga/z-stat.h
filedate$(OL): amiga/filedate.c crypt.h timezone.h
amiga$(OL): amiga/amiga.c ziperr.h
# Substitute assembly version of deflate.c:
#deflate$(OL): amiga/deflate.a
# $(ASM) $(ASMOPTSL) -o$@ $*.a
########################
# 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 "$(CFLAGS)" >$(CFILE)
@Type "$(CWITHOPT)" >>$(CFILE)
-Type $(CFILE)
# special rules for adding Amiga internal version number to amiga/amiga.c
amiga$(O):
rx > env:VersionDate "say '""'translate(date('E'),'.','/')'""'"
$(CC) WITH=$(CFILE) $(CUSEMEM) LISTFILE=$>$(LISTEXTZ) OBJNAME=$@ $*.c
-Delete env:VersionDate
amiga$(OL):
rx > env:VersionDate "say '""'translate(date('E'),'.','/')'""'"
$(CC) WITH=$(CFILE) $(CLOWMEM) LISTFILE=$>$(LISTEXTL) OBJNAME=$@ $*.c
-Delete env:VersionDate
# needed in amiga/amigazip.c
# should be set in startup-sequence, but just in case:
# (only works with OS 2.0 and above)
env\:WorkBench:
@Execute < < (Workbench_smk.tmp)
FailAt 21
If not exists ENV:Workbench
Version >nil:
SetEnv Workbench $$Workbench
Endif
<
# Read environment variable LOCAL_ZIP and convert options to SAS format
#
# e.g.: to define FOO_ONE and FOO_TWO enter:
#
# SetEnv LOCAL_ZIP "-DFOO_ONE -DFOO_TWO"
#
# Put the statement into your startup-sequence or (for AmigaDOS 2.0 or higher
# only) make sure LOCAL_ZIP is stored in the ENVARC: directory
# ( Copy ENV:LOCAL_ZIP ENVARC: )
#
local_zip:
@Execute < < (Local_Zip_smk.tmp)
Failat 21
If exists ENV:LOCAL_ZIP
Echo "Using environment variable LOCAL_ZIP !"
Copy >NIL: ENV:LOCAL_ZIP SASCOPTS
Else
Echo "You could use envvar ZIP_OPT to set your special compilation options."
Delete >nil: SASCOPTS quiet
Endif
; Do not remove the lctosc command! If LOCAL_ZIP is unset, an
; empty file is created which needed by CommonFlags !
lctosc >$(CWITHOPT)
<
# 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, etc."
@Echo " Feel free to mail comments, suggestions, etc."
@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>"

View file

@ -1,293 +0,0 @@
/*
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 */

View file

@ -1,95 +0,0 @@
/*
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 */

View file

@ -1,25 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#ifndef __amiga_zipup_h
#define __amiga_zipup_h
#ifndef O_RAW
# define O_RAW 0
#endif
#define fhow (O_RDONLY | O_RAW)
#define fbad (-1)
typedef int ftype;
#define zopen(n,p) open(n,p)
#define zread(f,b,n) read(f,b,n)
#define zclose(f) close(f)
#define zerr(f) (k == (extent)(-1L))
#define zstdin 0
#endif /* __amiga_zipup_h */

View file

@ -1,659 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#include <dirent.h>
#include <time.h>
#include "zip.h"
#include <paru.h> /* parameter definitions */
#include <sys_calls.h> /* AOS/VS system call interface */
#include <packets/filestatus.h> /* AOS/VS ?FSTAT packet defs */
#ifndef UTIL /* AOS/VS specific fileio code not needed for UTILs */
#define PAD 0
#define PATH_END ':'
/*
* could probably avoid the union -
* all are same size & 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 struct zextrafld
{
char extra_header_id[2]; /* set to VS - in theory, an int */
char extra_data_size[2]; /* size of rest, in Intel little-endian order */
char extra_sentinel[4]; /* set to FCI w/ trailing null */
unsigned char extra_rev; /* set to 10 for rev 1.0 */
ZVSFSTAT_STRU fstat_packet; /* the fstat packet */
char aclbuf[$MXACL]; /* raw ACL, or link-resolution name */
} ZEXTRAFLD;
#define ZEXTRA_HEADID "VS"
#define ZEXTRA_SENTINEL "FCI"
#define ZEXTRA_REV (unsigned char) 10
local ZEXTRAFLD zzextrafld; /* buffer for extra field containing
?FSTAT packet & ACL buffer */
local char zlinkres[$MXPL]; /* buf for link resolution contents */
local char znamebuf[$MXPL]; /* buf for AOS/VS filename */
static char vsnamebuf[$MXPL];
static char uxnamebuf[FNMAX];
static P_FSTAT vsfstatbuf;
local ulg label_time = 0;
local ulg label_mode = 0;
local time_t label_utim = 0;
/* Local functions */
local char *readd OF((DIR *));
char *readd(d)
DIR *d; /* directory stream to read from */
/* Return a pointer to the next name in the directory stream d, or NULL if
no more entries or an error occurs. */
{
struct dirent *e;
e = readdir(d);
return e == NULL ? (char *) NULL : e->d_name;
}
int procname(n, caseflag)
char *n; /* name to process */
int caseflag; /* true to force case-sensitive match */
/* Process a name or sh expression to operate on (or exclude). Return
an error code in the ZE_ class. */
{
char *a; /* path and name for recursion */
DIR *d; /* directory stream from opendir() */
char *e; /* pointer to name from readd() */
int m; /* matched flag */
char *p; /* path for recursion */
struct stat s; /* result of stat() */
struct zlist far *z; /* steps through zfiles list */
if (strcmp(n, "-") == 0) /* if compressing stdin */
return newname(n, 0, caseflag);
else if (LSSTAT(n, &s))
{
/* Not a file or directory--search for shell expression in zip file */
p = ex2in(n, 0, (int *)NULL); /* shouldn't affect matching chars */
m = 1;
for (z = zfiles; z != NULL; z = z->nxt) {
if (MATCH(p, z->iname, caseflag))
{
z->mark = pcount ? filter(z->zname, caseflag) : 1;
if (verbose)
fprintf(mesg, "zip diagnostic: %scluding %s\n",
z->mark ? "in" : "ex", z->name);
m = 0;
}
}
free((zvoid *)p);
return m ? ZE_MISS : ZE_OK;
}
/* Live name--use if file, recurse if directory */
if ((s.st_mode & S_IFDIR) == 0)
{
/* add or remove name of file */
if ((m = newname(n, 0, caseflag)) != ZE_OK)
return m;
} else {
/* Add trailing / to the directory name */
if ((p = malloc(strlen(n)+2)) == NULL)
return ZE_MEM;
if (strcmp(n, ".") == 0) {
*p = '\0'; /* avoid "./" prefix and do not create zip entry */
} else {
strcpy(p, n);
a = p + strlen(p);
if (a[-1] != '/')
strcpy(a, "/");
if (dirnames && (m = newname(p, 1, caseflag)) != ZE_OK) {
free((zvoid *)p);
return m;
}
}
/* recurse into directory */
if (recurse && (d = opendir(n)) != NULL)
{
while ((e = readd(d)) != NULL) {
if (strcmp(e, ".") && strcmp(e, ".."))
{
if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL)
{
closedir(d);
free((zvoid *)p);
return ZE_MEM;
}
strcat(strcpy(a, p), e);
if ((m = procname(a, caseflag)) != ZE_OK) /* recurse on name */
{
if (m == ZE_MISS)
zipwarn("name not matched: ", a);
else
ziperr(m, a);
}
free((zvoid *)a);
}
}
closedir(d);
}
free((zvoid *)p);
} /* (s.st_mode & S_IFDIR) == 0) */
return ZE_OK;
}
char *strlower(s)
char *s; /* string to convert */
/* Convert all uppercase letters to lowercase in string s */
{
char *p; /* scans string */
for (p = s; *p; p++)
if (*p >= 'A' && *p <= 'Z')
*p += 'a' - 'A';
return s;
}
char *strupper(s)
char *s; /* string to convert */
/* Convert all lowercase letters to uppercase in string s */
{
char *p; /* scans string */
for (p = s; *p; p++)
if (*p >= 'a' && *p <= 'z')
*p -= 'a' - 'A';
return s;
}
char *ex2in(x, isdir, pdosflag)
char *x; /* external file name */
int isdir; /* input: x is a directory */
int *pdosflag; /* output: force MSDOS file attributes? */
/* Convert the external file name to a zip file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *n; /* internal file name (malloc'ed) */
char *t; /* shortened name */
int dosflag;
dosflag = dosify; /* default for non-DOS and non-OS/2 */
/* Find starting point in name before doing malloc */
for (t = x; *t == '/'; t++)
;
if (*t == '=') /* AOS/VS for ./ */
t++;
else if (*t == ':') /* AOS/VS for / */
t++;
if (!pathput)
t = last(t, PATH_END);
if (*t == '^') /* AOS/VS for ../ */
{
if ((n = malloc(strlen(t) + 3)) == NULL)
return NULL;
strcpy(n, "../");
strcpy(n + 3, t + 1);
}
else if (*t == '@') /* AOS/VS for :PER:, kind of like /dev/ */
{
if ((n = malloc(strlen(t) + 5)) == NULL)
return NULL;
strcpy(n, "/PER/");
strcpy(n + 5, t + 1);
}
else
{
if ((n = malloc(strlen(t) + 1)) == NULL)
return NULL;
strcpy(n, t);
}
/* now turn AOS/VS dir separators (colons) into slashes */
for (t = n; *t != '\0'; t++)
if (*t == ':')
*t = '/';
/*
* Convert filename to uppercase (for correct matching).
* (It may make more sense to patch the matching code, since
* we may want those filenames in uppercase on the target system,
* but this seems better at present. If we're converting, uppercase
* also seems to make sense.)
*/
strupper(n);
if (dosify)
msname(n);
/* Returned malloc'ed name */
if (pdosflag)
*pdosflag = dosflag;
return n;
}
char *in2ex(n)
char *n; /* internal file name */
/* Convert the zip file name to an external file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *x; /* external file name */
if ((x = malloc(strlen(n) + 1 + PAD)) == NULL)
return NULL;
strcpy(x, n);
return x;
}
void stamp(f, d)
char *f; /* name of file to change */
ulg d; /* dos-style time to change it to */
/* Set last updated and accessed time of file f to the DOS time d. */
{
time_t u[2]; /* argument for utime() */
/* Convert DOS time to time_t format in u */
u[0] = u[1] = dos2unixtime(d);
utime(f, u);
}
ulg filetime(f, a, n, t)
char *f; /* name of file to get info on */
ulg *a; /* return value: file attributes */
long *n; /* return value: file size */
iztimes *t; /* return value: access, modific. and creation times */
/* If file *f does not exist, return 0. Else, return the file's last
modified date and time as an MSDOS date and time. The date and
time is returned in a long with the date most significant to allow
unsigned integer comparison of absolute times. Also, if a is not
a NULL pointer, store the file attributes there, with the high two
bytes being the Unix attributes, and the low byte being a mapping
of that to DOS attributes. If n is not NULL, store the file size
there. If t is not NULL, the file's access, modification and creation
times are stored there as UNIX time_t values.
If f is "-", use standard input as the file. If f is a device, return
a file size of -1 */
{
struct stat s; /* results of stat() */
/* convert FNMAX to malloc - 11/8/04 EG */
char *name;
int len = strlen(f);
if (f == label) {
if (a != NULL)
*a = label_mode;
if (n != NULL)
*n = -2L; /* convention for a label name */
if (t != NULL)
t->atime = t->mtime = t->ctime = label_utim;
return label_time;
}
if ((name = malloc(len + 1)) == NULL) {
ZIPERR(ZE_MEM, "filetime");
}
strcpy(name, f);
if (name[len - 1] == '/')
name[len - 1] = '\0';
/* not all systems allow stat'ing a file with / appended */
if (strcmp(f, "-") == 0) {
if (fstat(fileno(stdin), &s) != 0)
error("fstat(stdin)");
} else if (LSSTAT(name, &s) != 0) {
/* Accept about any file kind including directories
* (stored with trailing / with -r option)
*/
free(name);
return 0;
}
free(name);
if (a != NULL) {
*a = ((ulg)s.st_mode << 16) | !(s.st_mode & S_IWRITE);
if ((s.st_mode & S_IFDIR) != 0) {
*a |= MSDOS_DIR_ATTR;
}
}
if (n != NULL)
*n = (s.st_mode & S_IFMT) == S_IFREG ? s.st_size : -1L;
if (t != NULL) {
t->atime = s.st_atime;
t->mtime = s.st_mtime;
t->ctime = s.st_ctime;
}
return unix2dostime(&s.st_ctime);
}
int deletedir(d)
char *d;
{
return rmdir(d);
}
int set_extra_field(z, z_utim)
struct zlist far *z;
iztimes *z_utim;
/* create extra field and change z->att if desired */
/* NOTE: this AOS/VS version assumes the pathname in z->name is an
* AOS/VS pathname, not a unix-style one. Since you can zip up using
* unix-style pathnames, this may create problems occasionally.
* We COULD add code to parse back to AOS/VS format ...
* (This might also fail for other reasons such as access denied, but
* that should already have occurred.)
* We set the central-dir extra fld pointer & length here to the same data.
*/
{
int aclend = 0;
/*
* use this to simplify because different calls depending on
* whether links are resolved
*/
unsigned short errc;
z->ext = 0; /* init to no extra field */
/* get the ?FSTAT info & the acl - if no errors, get memory & store.
* (first, we have to cut off the trailing slash that was added if
* it's a dir, since AOS/VS doesn't accept that kind of thing)
*/
strncpy(znamebuf, z->name, $MXPL);
znamebuf[$MXPL-1] = '\0';
if (znamebuf[strlen(znamebuf)-1] == '/')
znamebuf[strlen(znamebuf)-1] = '\0';
if (linkput)
errc = sys_fstat(znamebuf, BIT1, &(zzextrafld.fstat_packet));
else
errc = sys_fstat(znamebuf, 0, &(zzextrafld.fstat_packet));
if (errc)
{
fprintf(stderr,
"\n Warning: can't get ?FSTAT info & acl of %s - error %d\n ",
znamebuf, errc);
perror("sys_fstat()");
}
else
{
/* store the ACL - or, if a link (no ACL!), store the resolution name */
if (zzextrafld.fstat_packet.norm_fstat_packet.styp_type != $FLNK)
{
if ((errc = sys_gacl(znamebuf, zzextrafld.aclbuf)) != 0)
{
fprintf(stderr, "\n Warning: can't get acl of %s - error %d\n ",
z->name, errc);
perror("sys_gacl()");
}
else
{
/* find length of ACL - ends with double-null */
while (aclend++ < $MXACL &&
(zzextrafld.aclbuf[aclend - 1] != '\0' ||
zzextrafld.aclbuf[aclend] != '\0'))
/* EMPTY LOOP */ ;
if ((z->cextra = z->extra =
malloc(sizeof(ZEXTRAFLD) - $MXACL + aclend + 4)) != NULL)
{
strncpy(zzextrafld.extra_header_id, ZEXTRA_HEADID,
sizeof(zzextrafld.extra_header_id));
strncpy(zzextrafld.extra_sentinel, ZEXTRA_SENTINEL,
sizeof(zzextrafld.extra_sentinel));
zzextrafld.extra_rev = ZEXTRA_REV; /* this is a char, no need
to worry about byte order */
/* set size (Intel (little-endian)) 2-byte int, which we've set
as array to make it easier */
errc = (unsigned short) (sizeof(ZEXTRAFLD) - $MXACL + aclend + 4 -
sizeof(zzextrafld.extra_header_id) -
sizeof(zzextrafld.extra_data_size));
zzextrafld.extra_data_size[0] = errc & 0xFF; /* low-order byte */
zzextrafld.extra_data_size[1] = errc >> 8; /* high-order byte */
memcpy((char *) z->extra, (char *) &zzextrafld,
sizeof(ZEXTRAFLD) - $MXACL + aclend + 4);
z->cext = z->ext = sizeof(ZEXTRAFLD) - $MXACL + aclend + 4;
}
}
}
else /* a link */
{
if ((errc = sys_glink(z->name, zzextrafld.aclbuf)) != 0)
{
fprintf(stderr,
"\n Warning: can't get link-resolution of %s - error %d\n ",
z->name, errc);
perror("sys_glink()");
}
else
{
aclend = strlen(zzextrafld.aclbuf) + 1;
if ((z->extra = malloc(sizeof(ZEXTRAFLD) - $MXACL + aclend + 4))
!= NULL)
{
strncpy(zzextrafld.extra_header_id, ZEXTRA_HEADID,
sizeof(zzextrafld.extra_header_id));
strncpy(zzextrafld.extra_sentinel, ZEXTRA_SENTINEL,
sizeof(zzextrafld.extra_sentinel));
zzextrafld.extra_rev = ZEXTRA_REV; /* this is a char, no need
to worry about byte order */
/* set size (Intel (little-endian)) 2-byte int, which we've set
as array to make it easier */
errc = (unsigned short) (sizeof(ZEXTRAFLD) - $MXACL + aclend + 4 -
sizeof(zzextrafld.extra_header_id) -
sizeof(zzextrafld.extra_data_size));
zzextrafld.extra_data_size[0] = errc & 0xFF; /* low-order byte */
zzextrafld.extra_data_size[1] = errc >> 8; /* high-order byte */
memcpy((char *) z->extra, (char *) &zzextrafld,
sizeof(ZEXTRAFLD) - $MXACL + aclend + 4);
z->ext = sizeof(ZEXTRAFLD) - $MXACL + aclend + 4;
}
}
}
}
return ZE_OK;
}
#endif /* !UTIL */
void version_local()
{
printf("Compiled with %s under %s.\n",
"a C compiler",
"AOS/VS"
);
}
/*
* This file defines for AOS/VS two Unix functions relating to links;
* the calling code should have the following defines:
*
* #define lstat(path,buf) zvs_lstat(path,buf)
* #define readlink(path,buf,nbytes) zvs_readlink(path,buf,nbytes)
*
* For these functions, I'm going to define yet 2 MORE filename buffers
* and also insert code to change pathnames to Unix & back. This is
* easier than changing all the other places this kind of thing happens to
* be efficient. This is a kludge. I'm also going to put the functions
* here for my immediate convenience rather than somewhere else for
* someone else's.
*
* WARNING: the use of static buffers means that you'd better get your
* data out of these buffers before the next call to any of these functions!
*
*/
/* =========================================================================
* ZVS_LSTAT() - get (or simulate) stat information WITHOUT following symlinks
* This is intended to look to the outside like the unix lstat()
* function. We do a quick-&-dirty filename conversion.
*
* If the file is NOT a symbolic link, we can just do a stat() on it and
* that should be fine. But if it IS a link, we have to set the elements
* of the stat struct ourselves, since AOS/VS doesn't have a built-in
* lstat() function.
*
* RETURNS: 0 on success, or -1 otherwise
*
*/
int zvs_lstat(char *path, struct stat *buf)
{
char *cp_vs = vsnamebuf;
char *cp_ux = path;
int mm, dd, yy;
/*
* Convert the Unix pathname to an AOS/VS pathname.
* This is quick & dirty; it won't handle (for instance) pathnames with
* ../ in the middle of them, and may choke on other Unixisms. We hope
* they're unlikely.
*/
if (!strncmp(cp_ux, "../", 3))
{
*cp_vs++ = '^'; /* AOS/VS for ../ */
cp_ux += 3;
}
else if (!strncmp(cp_ux, "./", 2))
{
*cp_vs++ = '='; /* AOS/VS for ./ */
cp_ux += 2;
}
do
{
if (*cp_ux == '/')
{
*cp_vs++ = ':';
}
else
{
*cp_vs++ = (char) toupper(*cp_ux);
}
} while (*cp_ux++ != '\0' && cp_vs - vsnamebuf < sizeof(vsnamebuf));
/* If Unix name was too long for our buffer, return an error return */
if (cp_vs - vsnamebuf >= sizeof(vsnamebuf) && *(cp_vs - 1) != '\0')
return (-1); /* error */
/* Make AOS/VS ?FSTAT call that won't follow links & see if we find
* anything. If not, we return error.
*/
if (sys_fstat(vsnamebuf,
BIT1, /* BIT1 says to not resolve links */
&vsfstatbuf))
return (-1); /* error */
/* If we DID find the file but it's not a link,
* call stat() and return its value.
*/
if (vsfstatbuf.styp_type != $FLNK)
return (stat(path, buf)); /* call with Unix pathname ... */
/* Otherwise, we have to kludge up values for the stat structure */
memset((char *) buf, 0, sizeof(*buf)); /* init to nulls (0 values) */
buf->st_mode = S_IFLNK | 0777; /* link and rwxrwxrwx */
buf->st_uid = -1; /* this is what we get on AOS/VS
anyway (maybe unless we set up
a dummy password file?) */
buf->st_nlink = 1;
/* The DG date we've got is days since 12/31/67 and seconds/2. So we
* need to subtract 732 days (if that's not negative), convert to seconds,
* and add adjusted seconds.
*/
if (vsfstatbuf.stch.short_time[0] < 732)
buf->st_ctime = buf->st_mtime = buf->st_atime = 0L;
else
{
buf->st_ctime = buf->st_mtime = buf->st_atime =
((long) vsfstatbuf.stch.short_time[0] - 732L) * 24L * 3600L +
2L * (long) vsfstatbuf.stch.short_time[1];
}
/* And we need to get the filename linked to and use its length as
* the file size. We'll use the Unix pathname buffer for this - hope
* it's big enough. (We won't overwrite anything, but we could get a
* truncated path.) If there's an error, here's our last chance to
* say anything.
*/
if ((buf->st_size = zvs_readlink(vsnamebuf, uxnamebuf, FNMAX)) < 0)
return (-1);
else
return (0);
} /* end zvs_lstat() */
/* =========================================================================
* ZVS_READLINK() - get pathname pointed to by an AOS/VS link file
* This is intended to look to the outside like the unix readlink()
* function. We do a quick-&-dirty filename conversion.
*
* RETURNS: the length of the output path (in bytes), or -1 if an error
*
*/
int zvs_readlink(char *path, char *buf, int nbytes)
{
char *cp_vs = vsnamebuf;
char *cp_ux = buf;
/* This is called with z->name, the filename the user gave, so we'll get
* the link-resolution name on the assumption that it's a valid AOS/VS
* name. We're also assuming a reasonable value (> 5) for nbytes.
*/
if (sys_glink(path, vsnamebuf))
return (-1); /* readlink() is supposed to return -1 on error */
/* Now, convert the AOS/VS pathname to a Unix pathname.
* Note that sys_glink(), unlike readlink(), does add a null.
*/
if (*cp_vs == '^') /* AOS/VS for ../ */
{
strncpy(cp_ux, "../", 3);
cp_ux += 3;
cp_vs++;
}
else if (*cp_vs == '@') /* AOS/VS for :PER:, kind of like /dev/ */
{
strncpy(cp_ux, "/PER/", 5);
cp_ux += 5;
cp_vs++;
}
else if (*cp_vs == '=') /* AOS/VS for ./ */
{
strncpy(cp_ux, "./", 2);
cp_ux += 2;
cp_vs++;
}
while (*cp_vs != '\0' && cp_ux - buf < nbytes)
{
if (*cp_vs == ':')
{
*cp_ux++ = '/';
}
else
{
*cp_ux++ = (char) toupper(*cp_vs);
}
cp_vs++;
}
return (cp_ux - buf); /* # characters in Unix path (no trailing null) */
} /* end zvs_readlink() */

View file

@ -1,5 +0,0 @@
push
prompt pop
sea :c_4.10 :c_4.10:lang_rt [!sea]
cc%0/%/link/NOUNX AOS_VS/DEFINE NODIR/DEFINE <ZIP CRC32 CRYPT DEFLATE FILEIO GLOBALS MKTIME TREES TTYIO UTIL ZIPFILE ZIPUP AOSVS>.C
pop

View file

@ -1,3 +1,4 @@
/* clang-format off */
/*
api.c - Zip 3

View file

@ -1,3 +1,4 @@
/* clang-format off */
/*
api.h - Zip 3
@ -12,7 +13,7 @@
#ifndef _ZIPAPI_H
#define _ZIPAPI_H
#include "zip.h"
#include "third_party/infozip/zip/zip.h"
#ifdef WIN32
# ifndef PATH_MAX

View file

@ -1,111 +0,0 @@
# Makefile for Zip, ZipNote, ZipCloak and ZipSplit
MAKE = make
SHELL = /bin/sh
# (to use the Gnu compiler, change cc to gcc in CC and BIND)
CC = cc
BIND = $(CC)
AS = $(CC) -c
E =
CPP = /lib/cpp
# probably can change this to 'install' if you have it
INSTALL = cp
# target directories - where to install executables and man pages to
BINDIR = /usr/local/bin
manext=1
MANDIR = /usr/local/man/man$(manext)
# flags
# CFLAGS flags for C compile
# LFLAGS1 flags after output file spec, before obj file list
# LFLAGS2 flags after obj file list (libraries, etc)
CFLAGS = -O
LFLAGS1 =
LFLAGS2 = -s
# object file lists
OBJZ = zip.o zipfile.o zipup.o fileio.o util.o crc32.o globals.o \
crypt.o ttyio.o atari.o
OBJI = deflate.o trees.o
OBJA =
OBJU = zipfile_.o fileio_.o util_.o globals.o atari_.o
OBJN = zipnote.o $(OBJU)
OBJC = zipcloak.o $(OBJU) crc32_.o crypt_.o ttyio.o
OBJS = zipsplit.o $(OBJU)
ZIP_H = zip.h ziperr.h tailor.h atari/osdep.h
# suffix rules
.SUFFIXES:
.SUFFIXES: _.o .o .c .doc .1
.c_.o:
rm -f $*_.c; ln $< $*_.c
$(CC) $(CFLAGS) -DUTIL -c $*_.c
rm -f $*_.c
.c.o:
$(CC) $(CFLAGS) -c $<
.1.doc:
nroff -man $< | col -b | uniq > $@
# rules for zip, zipnote, zipcloak, zipsplit, and the Zip MANUAL.
$(OBJZ): $(ZIP_H)
$(OBJI): $(ZIP_H)
$(OBJN): $(ZIP_H)
$(OBJS): $(ZIP_H)
$(OBJC): $(ZIP_H)
zip.o crc32.o crypt.o fileio.o zipfile.o zipup.o: crc32.h
zipcloak.o crc32_.o crypt_.o fileio_.o zipfile_.o: crc32.h
zip.o zipup.o crypt.o ttyio.o zipcloak.o crypt_.o: crypt.h
zip.o zipup.o zipnote.o zipcloak.o zipsplit.o: revision.h
zip.o crypt.o ttyio.o zipcloak.o crypt_.o: ttyio.h
zipup.o: atari/zipup.h
match.o: match.s
$(CPP) match.s > _match.s
$(AS) _match.s
mv _match.o match.o
rm -f _match.s
ZIPS = zip$E zipnote$E zipsplit$E zipcloak$E
zips: $(ZIPS)
zipsman: $(ZIPS) $(ZIPMANUAL)
zip$E: $(OBJZ) $(OBJI) $(OBJA)
$(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2)
zipnote$E: $(OBJN)
$(BIND) -o zipnote$E $(LFLAGS1) $(OBJN) $(LFLAGS2)
zipcloak$E: $(OBJC)
$(BIND) -o zipcloak$E $(LFLAGS1) $(OBJC) $(LFLAGS2)
zipsplit$E: $(OBJS)
$(BIND) -o zipsplit$E $(LFLAGS1) $(OBJS) $(LFLAGS2)
$(ZIPMANUAL): man/zip.1
nroff -man man/zip.1 | col -b | uniq > $(ZIPMANUAL)
# install
install: $(ZIPS)
$(INSTALL) $(ZIPS) $(BINDIR)
$(INSTALL) man/zip.1 $(MANDIR)/zip.$(manext)
uninstall:
-cd $(BINDIR); rm -f $(ZIPS)
-cd $(MANDIR); rm -f zip.$(manext)
dist: $(ZIPMANUAL)
zip -u9T zip`sed -e '/VERSION/!d' -e 's/.*"\(.*\)".*/\1/' \
-e s/[.]//g -e q revision.h` \
`awk '/^Makefile/,/vms_zip.rnh/ {print $$1}' < contents`
# ATARI version (gcc 2.5.8 and Mintlibs PL46)
atari:
$(MAKE) zips CFLAGS="-O -DATARI" OBJA=atari/atari.o CC=gcc E=.ttp
# clean up after making stuff and installing it
clean:
rm -f *.o $(ZIPS) flags

View file

@ -1,5 +0,0 @@
From: harry@hal.westfalen.de (Harald Denker)
The old zip ATARI port is based on TurboC which is no more
supported (for more than 3 years). I used the GNU gcc 2.5.8 and
MiNTlibs PL46.

View file

@ -1,681 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#include "zip.h"
#ifndef UTIL /* the companion #endif is a bit of ways down ... */
#include <time.h>
#include <errno.h>
#include <dirent.h>
#include <mintbind.h>
#include <osbind.h>
#include <ostruct.h>
#define PAD 0
#define PATH_END '/'
extern char *label; /* defined in fileio.c */
local ulg label_time = 0;
local ulg label_mode = 0;
local time_t label_utim = 0;
local char *readd(d)
DIR *d; /* directory stream to read from */
/* Return a pointer to the next name in the directory stream d, or NULL if
no more entries or an error occurs. */
{
struct dirent *e;
e = readdir(d);
return e == NULL ? (char *) NULL : e->d_name;
}
local char *getVolumeLabel(drive, vtime, vmode, utim)
int drive; /* drive name: 'A' .. 'Z' or '\0' for current drive */
ulg *vtime; /* volume label creation time (DOS format) */
ulg *vmode; /* volume label file mode */
time_t utim;/* volume label creation time (UNIX format) */
/* If a volume label exists for the given drive, return its name and
set its time and mode. The returned name must be static data. */
{
static char vol[14];
_DTA *dtaptr;
if (drive) {
vol[0] = (char)drive;
strcpy(vol+1, ":/");
} else {
strcpy(vol, "/");
}
strcat(vol, "*.*");
if (Fsfirst(vol, FA_LABEL) == 0) {
dtaptr = Fgetdta();
strncpy(vol, dtaptr->dta_name, sizeof(vol)-1);
*vtime = ((ulg)dtaptr->dta_date << 16) |
((ulg)dtaptr->dta_time & 0xffff);
*vmode = (ulg)dtaptr->dta_attribute;
return vol;
}
return NULL;
}
char GetFileMode(char *name)
{
struct stat sb;
sb.st_attr = 0;
Fxattr(linkput ? 1 : 0, name, &sb);
if (errno == EINVAL) {
_DTA *dtaptr, *old;
old = Fgetdta();
Fsfirst(name, FA_RDONLY+FA_HIDDEN+FA_SYSTEM+FA_DIR);
dtaptr = Fgetdta();
sb.st_attr = dtaptr->dta_attribute;
Fsetdta(old);
}
return sb.st_attr & 0x3f;
}
int wild2(w)
char *w; /* path/pattern to match */
/* If not in exclude mode, expand the pattern based on the contents of the
file system. Return an error code in the ZE_ class. */
{
DIR *d; /* stream for reading directory */
char *e; /* name found in directory */
int r; /* temporary variable */
char *n; /* constructed name from directory */
int f; /* true if there was a match */
char *a; /* alloc'ed space for name */
char *p; /* path */
char *q; /* name */
char v[5]; /* space for device current directory */
if (volume_label == 1) {
volume_label = 2;
label = getVolumeLabel(w[1] == ':' ? to_up(w[0]) : '\0',
&label_time, &label_mode, &label_utim);
if (label != NULL) {
newname(label, 0, 0);
}
if (w[1] == ':' && w[2] == '\0') return ZE_OK;
/* "zip -$ foo a:" can be used to force drive name */
}
/* special handling of stdin request */
if (strcmp(w, "-") == 0) /* if compressing stdin */
return newname(w, 0, 0);
/* Allocate and copy pattern */
if ((p = a = malloc(strlen(w) + 1)) == NULL)
return ZE_MEM;
strcpy(p, w);
/* Normalize path delimiter as '/'. */
for (q = p; *q; q++) /* use / consistently */
if (*q == '\\')
*q = '/';
/* Only name can have special matching characters */
if ((q = isshexp(p)) != NULL &&
(strrchr(q, '/') != NULL || strrchr(q, ':') != NULL))
{
free((zvoid *)a);
return ZE_PARMS;
}
/* Separate path and name into p and q */
if ((q = strrchr(p, '/')) != NULL && (q == p || q[-1] != ':'))
{
*q++ = '\0'; /* path/name -> path, name */
if (*p == '\0') /* path is just / */
p = strcpy(v, "/.");
}
else if ((q = strrchr(p, ':')) != NULL)
{ /* has device and no or root path */
*q++ = '\0';
p = strcat(strcpy(v, p), ":"); /* copy device as path */
if (*q == '/') /* -> device:/., name */
{
strcat(p, "/");
q++;
}
strcat(p, ".");
}
else if (recurse && (strcmp(p, ".") == 0 || strcmp(p, "..") == 0))
{ /* current or parent directory */
/* I can't understand Mark's code so I am adding a hack here to get
* "zip -r foo ." to work. Allow the dubious "zip -r foo .." but
* reject "zip -rm foo ..".
*/
if (dispose && strcmp(p, "..") == 0)
ziperr(ZE_PARMS, "cannot remove parent directory");
q = "*.*";
}
else /* no path or device */
{
q = p;
p = strcpy(v, ".");
}
if (recurse && *q == '\0') {
q = "*.*";
}
/* Search that level for matching names */
if ((d = opendir(p)) == NULL)
{
free((zvoid *)a);
return ZE_MISS;
}
if ((r = strlen(p)) > 1 &&
(strcmp(p + r - 2, ":.") == 0 || strcmp(p + r - 2, "/.") == 0))
*(p + r - 1) = '\0';
f = 0;
while ((e = readd(d)) != NULL) {
if (strcmp(e, ".") && strcmp(e, "..") && MATCH(q, e, 0))
{
f = 1;
if (strcmp(p, ".") == 0) { /* path is . */
r = procname(e, 0); /* name is name */
if (r) {
f = 0;
break;
}
} else
{
if ((n = malloc(strlen(p) + strlen(e) + 2)) == NULL)
{
free((zvoid *)a);
closedir(d);
return ZE_MEM;
}
n = strcpy(n, p);
if (n[r = strlen(n) - 1] != '/' && n[r] != ':')
strcat(n, "/");
r = procname(strcat(n, e), 0); /* name is path/name */
free((zvoid *)n);
if (r) {
f = 0;
break;
}
}
}
}
closedir(d);
/* Done */
free((zvoid *)a);
return f ? ZE_OK : ZE_MISS;
}
#include <regexp.h>
#include <osbind.h>
void regerror( char ZCONST *msg ) {
perror( msg );
}
static int ret;
static regexp *regptr;
static short is_w, ind_w;
static char fullpath[FILENAME_MAX], file_arg[FILENAME_MAX];
#define FTW_F 0
#define FTW_D 1
#define FTW_DNR 2
#define FTW_NS 3
static int ftwfunc( struct stat *stats, int ftw_status )
{
char *path = &fullpath[0];
if (strncmp(path, "./", 2) == 0) path += 2;
switch (ftw_status) {
case FTW_NS:
zipwarn("can't stat file: ", path);
ret = ZE_MISS;
return 0;
case FTW_F:
if (!is_w || regexec(regptr, path, 1)) {
#if 0
char fn[FILENAME_MAX];
int k;
if (S_ISLNK(stats->st_mode) &&
(k = readlink(path, fn, FILENAME_MAX)) > 0) {
int l = strlen(path);
fn[k] = '\0';
strcat(strcat(path, " -> "), fn);
ret = newname(path, 0, 0); /* procname(path, 0); */
path[l] = '\0';
} else
#endif
ret = newname(path, 0, 0); /* procname(path, 0); */
}
return 0;
case FTW_DNR:
zipwarn("can't open directory: ", path);
ret = ZE_MISS;
return 0;
case FTW_D:
if (strcmp(path, ".") == 0) return 0;
if (is_w && ind_w > 0 && strncmp(path, file_arg, ind_w) != 0)
return 4;
}
return 0;
}
static int myftw( int depth )
{
register DIR *dirp;
struct dirent *entp;
struct stat stats;
register char *p,*q;
register long i;
if (LSSTAT(fullpath, &stats) < 0)
return ftwfunc(&stats, FTW_NS);
if (!S_ISDIR(stats.st_mode))
return ftwfunc(&stats, FTW_F);
if ((dirp = opendir(fullpath)) == NULL)
return ftwfunc(&stats, FTW_DNR);
if (i = ftwfunc(&stats, FTW_D)) {
closedir(dirp);
return (i == 4 ? 0 : (int)i);
}
i = strlen(fullpath);
p = &fullpath[i];
*p++ = '/'; *p = '\0';
if (dirnames && i > 1) {
q = (strncmp(fullpath, "./", 2) == 0 ? &fullpath[2] : &fullpath[0]);
ret = newname(q, 1, 0);
}
i = 0;
while (depth > 0 && (entp = readdir(dirp)) != 0)
if (strcmp(entp->d_name,".") != 0 && strcmp(entp->d_name,"..") != 0) {
strcpy(p, entp->d_name);
if (i = myftw(depth-1))
depth = 0; /* force User's finish */
}
closedir(dirp);
return (int)i;
}
int wild( char *p )
{
char *d;
ret = ZE_OK;
if (p == NULL) p = "*";
if (strcmp(p, "-") == 0) /* if compressing stdin */
ret = newname(p, 0, 0);
strcpy(fullpath, p);
/* now turning UNIX-Wildcards into basic regular expressions */
for (is_w = ind_w = 0, d = &file_arg[0]; *p; d++, p++)
switch (*p) {
case '*': *d++ = '.'; *d = *p; is_w = 1; break;
case '?': *d = '.'; is_w = 1; break;
case '[': *d = *p;
if (*(p+1) == '!') {
*++d = '^'; p++;
} is_w = 1; break;
case '.': *d++ = '\\'; *d = *p; break;
default : *d = *p;
if (!is_w) ind_w++;
}
*++d = '\0';
if (is_w) {
strcat( file_arg, "$" ); /* to get things like *.[ch] work */
if ((regptr = regcomp( file_arg )) == NULL)
return ZE_MEM;
strcpy( fullpath, "." );
myftw( recurse ? 99 : 1 );
free(regptr);
} else if (recurse) {
myftw( 99 );
} else
myftw( 1 ); /* ret = procname( fullpath, 0 ); */
return ret;
}
int procname(n, caseflag)
char *n; /* name to process */
int caseflag; /* true to force case-sensitive match */
/* Process a name or sh expression to operate on (or exclude). Return
an error code in the ZE_ class. */
{
char *a; /* path and name for recursion */
DIR *d; /* directory stream from opendir() */
char *e; /* pointer to name from readd() */
int m; /* matched flag */
char *p; /* path for recursion */
struct stat s; /* result of stat() */
struct zlist far *z; /* steps through zfiles list */
if (strcmp(n, "-") == 0) /* if compressing stdin */
return newname(n, 0, caseflag);
else if (LSSTAT(n, &s))
{
/* Not a file or directory--search for shell expression in zip file */
p = ex2in(n, 0, (int *)NULL); /* shouldn't affect matching chars */
m = 1;
for (z = zfiles; z != NULL; z = z->nxt) {
if (MATCH(p, z->iname, caseflag))
{
z->mark = pcount ? filter(z->zname, caseflag) : 1;
if (verbose)
fprintf(mesg, "zip diagnostic: %scluding %s\n",
z->mark ? "in" : "ex", z->name);
m = 0;
}
}
free((zvoid *)p);
return m ? ZE_MISS : ZE_OK;
}
/* Live name--use if file, recurse if directory */
for (p = n; *p; p++) /* use / consistently */
if (*p == '\\')
*p = '/';
if (!S_ISDIR(s.st_mode))
{
/* add or remove name of file */
if ((m = newname(n, 0, caseflag)) != ZE_OK)
return m;
} else {
/* Add trailing / to the directory name */
if ((p = malloc(strlen(n)+2)) == NULL)
return ZE_MEM;
if (strcmp(n, ".") == 0) {
*p = '\0'; /* avoid "./" prefix and do not create zip entry */
} else {
strcpy(p, n);
a = p + strlen(p);
if (a[-1] != '/')
strcpy(a, "/");
if (dirnames && (m = newname(p, 1, caseflag)) != ZE_OK) {
free((zvoid *)p);
return m;
}
}
/* recurse into directory */
if (recurse && (d = opendir(n)) != NULL)
{
while ((e = readd(d)) != NULL) {
if (strcmp(e, ".") && strcmp(e, ".."))
{
if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL)
{
closedir(d);
free((zvoid *)p);
return ZE_MEM;
}
strcat(strcpy(a, p), e);
if ((m = procname(a, caseflag)) != ZE_OK) /* recurse on name */
{
if (m == ZE_MISS)
zipwarn("name not matched: ", a);
else
ziperr(m, a);
}
free((zvoid *)a);
}
}
closedir(d);
}
free((zvoid *)p);
} /* (s.st_mode & S_IFDIR) == 0) */
return ZE_OK;
}
char *ex2in(x, isdir, pdosflag)
char *x; /* external file name */
int isdir; /* input: x is a directory */
int *pdosflag; /* output: force MSDOS file attributes? */
/* Convert the external file name to a zip file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *n; /* internal file name (malloc'ed) */
char *t, *p; /* shortened name */
int dosflag;
dosflag = 0;
/* Find starting point in name before doing malloc */
t = *x && *(x + 1) == ':' ? x + 2 : x;
while (*t == '/' || *t == '\\')
t++;
/* Make changes, if any, to the copied name (leave original intact) */
for (n = t; *n; n++)
if (*n == '\\')
*n = '/';
if (!pathput)
t = last(t, PATH_END);
/* Malloc space for internal name and copy it */
if ((n = malloc(strlen(t) + 1)) == NULL)
return NULL;
strcpy(n, t);
#if 0
if (p = strstr(t, " -> ")) /* shorten "link -> data" to "link" */
*p = '\0';
#endif
if (dosify)
msname(n);
/* Returned malloc'ed name */
if (pdosflag)
*pdosflag = dosflag;
return n;
}
char *in2ex(n)
char *n; /* internal file name */
/* Convert the zip file name to an external file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *x; /* external file name */
if ((x = malloc(strlen(n) + 1 + PAD)) == NULL)
return NULL;
strcpy(x, n);
return x;
}
void stamp(f, d)
char *f; /* name of file to change */
ulg d; /* dos-style time to change it to */
/* Set last updated and accessed time of file f to the DOS time d. */
{
struct utimbuf u; /* argument for utime() const ?? */
/* Convert DOS time to time_t format in u[0] and u[1] */
u.actime = u.modtime = dos2unixtime(d);
/* Set updated and accessed times of f */
utime(f, &u);
}
ulg filetime(f, a, n, t)
char *f; /* name of file to get info on */
ulg *a; /* return value: file attributes */
long *n; /* return value: file size */
iztimes *t; /* return value: access, modific. and creation times */
/* If file *f does not exist, return 0. Else, return the file's last
modified date and time as an MSDOS date and time. The date and
time is returned in a long with the date most significant to allow
unsigned integer comparison of absolute times. Also, if a is not
a NULL pointer, store the file attributes there, with the high two
bytes being the Unix attributes, and the low byte being a mapping
of that to DOS attributes. If n is not NULL, store the file size
there. If t is not NULL, the file's access, modification and creation
times are stored there as UNIX time_t values.
If f is "-", use standard input as the file. If f is a device, return
a file size of -1 */
{
struct stat s; /* results of stat() */
/* convert FNMAX to malloc - 11/8/04 EG */
char *name;
int len = strlen(f);
if (f == label) {
if (a != NULL)
*a = label_mode;
if (n != NULL)
*n = -2L; /* convention for a label name */
if (t != NULL)
t->atime = t->mtime = t->ctime = label_utim;
return label_time;
}
if ((name = malloc(len + 1)) == NULL) {
ZIPERR(ZE_MEM, "filetime");
}
strcpy(name, f);
if (name[len - 1] == '/')
name[len - 1] = '\0';
/* not all systems allow stat'ing a file with / appended */
if (strcmp(f, "-") == 0) {
if (fstat(fileno(stdin), &s) != 0) {
free(name);
error("fstat(stdin)");
}
} else if (LSSTAT(name, &s) != 0) {
/* Accept about any file kind including directories
* (stored with trailing / with -r option)
*/
free(name);
return 0;
}
if (a != NULL) {
/* *a = ((ulg)s.st_mode << 16) | (ulg)GetFileMode(name); */
*a = ((ulg)s.st_mode << 16) | (ulg)s.st_attr;
}
free(name);
if (n != NULL)
*n = S_ISREG(s.st_mode) ? s.st_size : -1L;
if (t != NULL) {
t->atime = s.st_atime;
t->mtime = s.st_mtime;
t->ctime = s.st_ctime;
}
return unix2dostime(&s.st_mtime);
}
int set_extra_field(z, z_utim)
struct zlist far *z;
iztimes *z_utim;
/* create extra field and change z->att if desired */
{
#ifdef USE_EF_UT_TIME
#ifdef IZ_CHECK_TZ
if (!zp_tz_is_valid) return ZE_OK; /* skip silently if no valid TZ info */
#endif
if ((z->extra = (char *)malloc(EB_HEADSIZE+EB_UT_LEN(2))) == NULL)
return ZE_MEM;
if ((z->cextra = (char *)malloc(EB_HEADSIZE+EB_UT_LEN(1))) == NULL)
return ZE_MEM;
z->extra[0] = 'U';
z->extra[1] = 'T';
z->extra[2] = EB_UT_LEN(2); /* length of data part of e.f. */
z->extra[3] = 0;
z->extra[4] = EB_UT_FL_MTIME | EB_UT_FL_ATIME;
z->extra[5] = (char)(z_utim->mtime);
z->extra[6] = (char)(z_utim->mtime >> 8);
z->extra[7] = (char)(z_utim->mtime >> 16);
z->extra[8] = (char)(z_utim->mtime >> 24);
z->extra[9] = (char)(z_utim->atime);
z->extra[10] = (char)(z_utim->atime >> 8);
z->extra[11] = (char)(z_utim->atime >> 16);
z->extra[12] = (char)(z_utim->atime >> 24);
z->ext = (EB_HEADSIZE+EB_UX_LEN(2));
memcpy(z->cextra, z->extra, (EB_HEADSIZE+EB_UT_LEN(1)));
z->cextra[EB_LEN] = EB_UT_LEN(1);
z->cext = (EB_HEADSIZE+EB_UX_LEN(1));
return ZE_OK;
#else /* !USE_EF_UT_TIME */
return (int)(z-z);
#endif /* ?USE_EF_UT_TIME */
}
int deletedir(d)
char *d; /* directory to delete */
/* Delete the directory *d if it is empty, do nothing otherwise.
Return the result of rmdir(), delete(), or system().
For VMS, d must be in format [x.y]z.dir;1 (not [x.y.z]).
*/
{
return rmdir(d);
}
#endif /* !UTIL */
/******************************/
/* Function version_local() */
/******************************/
void version_local()
{
static ZCONST char CompiledWith[] = "Compiled with %s%s for %s%s%s%s.\n\n";
#ifdef __TURBOC__
char buf[40];
#endif
printf(CompiledWith,
#ifdef __GNUC__
"gcc ", __VERSION__,
#else
# if 0
"cc ", (sprintf(buf, " version %d", _RELEASE), buf),
# else
# ifdef __TURBOC__
"Turbo C", (sprintf(buf, " (0x%04x = %d)", __TURBOC__, __TURBOC__), buf),
# else
"unknown compiler", "",
# endif
# endif
#endif
#ifdef __MINT__
"Atari TOS/MiNT",
#else
"Atari TOS",
#endif
" (Atari ST/TT/Falcon030)",
#ifdef __DATE__
" on ", __DATE__
#else
"", ""
#endif
);
} /* end function version_local() */

View file

@ -1,7 +0,0 @@
rm -f *.o *.sym *.ttp
make370 SHELL=/bin/mupfel.ttp CC=gcc CFLAGS="-O -DATARI" E=.ttp OBJA=atari.o zips
#make370 SHELL=/bin/mupfel.ttp CC=gcc CFLAGS="-g -D__NO_INLINE__ -DATARI" E=.ttp OBJA=atari.o zip.ttp
#make370 SHELL=/bin/mupfel.ttp CC=gcc CFLAGS="-g -D__NO_INLINE__ -DATARI" E=.sym OBJA=atari.o zip.sym LFLAGS2="-B/bin/sym-"
#make370 SHELL=/bin/mupfel.ttp CC=gcc CFLAGS="-O -DATARI" E=.ttp OBJA=atari.o -n zips > make_all.mup
#fixstk 32K pgp.ttp
prgflags 017 007 *.ttp

View file

@ -1,7 +0,0 @@
#rm -f *.o *.sym *.ttp
#make370 SHELL=/bin/mupfel.ttp CC=gcc CFLAGS="-O -DATARI" E=.ttp OBJA=atari.o zips
make370 SHELL=/bin/mupfel.ttp CC=gcc CFLAGS="-g -D__NO_INLINE__ -DATARI" E=.ttp OBJA=atari.o zip.ttp
make370 SHELL=/bin/mupfel.ttp CC=gcc CFLAGS="-g -D__NO_INLINE__ -DATARI" E=.sym OBJA=atari.o zip.sym LFLAGS2="-B/bin/sym-"
#make370 SHELL=/bin/mupfel.ttp CC=gcc CFLAGS="-O -DATARI" E=.ttp OBJA=atari.o -n zips > make_all.mup
#fixstk 32K pgp.ttp
prgflags 017 007 *.ttp

View file

@ -1,20 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#define FOPR "rb"
#define FOPM "r+b"
#define FOPW "wb"
#define DIRENT
#define NO_TERMIO
#define USE_CASE_MAP
#define PROCNAME(n) (action == ADD || action == UPDATE ? wild(n) : \
procname(n, 1))
#include <sys/types.h>
#include <sys/stat.h>

View file

@ -1,19 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#ifndef O_RDONLY
# define O_RDONLY 0
#endif
#define fhow O_RDONLY
#define fbad (-1)
typedef int ftype;
#define zopen(n,p) open(n,p)
#define zread(f,b,n) read(f,b,n)
#define zclose(f) close(f)
#define zerr(f) (k == (extent)(-1L))
#define zstdin 0

View file

@ -1,146 +0,0 @@
######################################################################
#
# Makefile for Info-ZIP's zip, zipcloak, zipnote, and zipsplit on AtheOS
#
# Copyright (C) 1999-2007 Info-ZIP
# Chris Herborth (chrish@pobox.com)
# Ruslan Nickolaev (nruslan@hotbox.ru)
#
######################################################################
# Things that don't change:
# Punish people who don't have SMP hardware.
MAKE = make -j 4 -f atheos/Makefile
SHELL = /bin/sh
LN = ln -s
RM = rm -f
BIND = $(CC)
AS = as
INSTALL = install
# Target directories
prefix = /usr
BINDIR = $(prefix)/bin
manext = 1
MANDIR = $(prefix)/man/man$(manext)
ZIPMANUAL = MANUAL
VERSION = Version 2.3 of __DATE__
######################################################################
CC:=gcc
CFLAGS:=-O3 -march=i586 -Wall -I. -DHAVE_DIRENT_H -DPASSWD_FROM_STDIN -DASMV -DASM_CRC
LFLAGS1:=
LFLAGS2:=
TARGET=$(ZIPS)
######################################################################
# Helpful targets
all:
$(MAKE) CC=$(CC) CFLAGS="$(CFLAGS)" \
LFLAGS1="$(LFLAGS1)" LFLAGS2="$(LFLAGS2)" \
$(TARGET)
######################################################################
# Object file lists and other build goodies
# Object file lists
OBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o crc32.o crypt.o \
ttyio.o atheos.o
OBJI = deflate.o trees.o
OBJA = match.o crc_i386.o
OBJU = zipfile_.o fileio_.o util_.o globals.o atheos_.o
OBJN = zipnote.o $(OBJU)
OBJC = zipcloak.o $(OBJU) crc32_.o crypt_.o ttyio.o
OBJS = zipsplit.o $(OBJU)
# Headers
ZIP_H = zip.h ziperr.h tailor.h atheos/osdep.h
# What to build?
ZIPS = zip zipnote zipsplit zipcloak
# suffix rules
.SUFFIXES:
.SUFFIXES: _.o .o .c .doc .1
.c_.o:
$(RM) $*_.c; $(LN) $< $*_.c
$(CC) -c $(CFLAGS) -DUTIL $*_.c
$(RM) $*_.c
.c.o:
$(CC) -c $(CFLAGS) $<
.1.doc:
groff -man -Tascii $< > $@
# rules for zip, zipnote, zipcloak, zipsplit, and the Zip MANUAL.
$(OBJZ): $(ZIP_H)
$(OBJI): $(ZIP_H)
$(OBJN): $(ZIP_H)
$(OBJS): $(ZIP_H)
$(OBJC): $(ZIP_H)
zip.o crc32.o crypt.o fileio.o zipfile.o zipup.o: crc32.h
zipcloak.o crc32_.o crypt_.o fileio_.o zipfile_.o: crc32.h
zip.o zipup.o crypt.o ttyio.o zipcloak.o crypt_.o: crypt.h
zip.o zipup.o zipnote.o zipcloak.o zipsplit.o: revision.h
zip.o crypt.o ttyio.o zipcloak.o crypt_.o: ttyio.h
zipup.o: atheos/zipup.h
match.o: match.S
$(CC) -E match.S > matchs.s
$(AS) -o $@ matchs.s
$(RM) matchs.s
crc_i386.o: crc_i386.S
$(CC) -E crc_i386.S > crc_i386s.s
$(AS) -o $@ crc_i386s.s
$(RM) crc_i386s.s
atheos.o: atheos/atheos.c
$(CC) -c $(CFLAGS) atheos/atheos.c
atheos_.o: atheos/atheos.c
$(RM) $*_.c; $(LN) atheos/atheos.c $*_.c
$(CC) -c $(CFLAGS) -DUTIL $*_.c
$(RM) $*_.c
zips: $(ZIPS)
zipsman: $(ZIPS) $(ZIPMANUAL)
zip: $(OBJZ) $(OBJI) $(OBJA)
$(BIND) -o zip $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2)
zipnote: $(OBJN)
$(BIND) -o zipnote $(LFLAGS1) $(OBJN) $(LFLAGS2)
zipcloak: $(OBJC)
$(BIND) -o zipcloak $(LFLAGS1) $(OBJC) $(LFLAGS2)
zipsplit: $(OBJS)
$(BIND) -o zipsplit $(LFLAGS1) $(OBJS) $(LFLAGS2)
$(ZIPMANUAL): man/zip.1
groff -man -Tascii man/zip.1 > $(ZIPMANUAL)
# install
install: $(ZIPS)
$(INSTALL) -m755 $(ZIPS) $(BINDIR)
mkdir -p $(MANDIR)
$(INSTALL) -m644 man/zip.1 $(MANDIR)/zip.$(manext)
uninstall:
-cd $(BINDIR); $(RM) $(ZIPS)
-cd $(MANDIR); $(RM) zip.$(manext)
dist: $(ZIPMANUAL)
zip -u9T zip`sed -e '/VERSION/!d' -e 's/.*"\(.*\)".*/\1/' \
-e s/[.]//g -e q revision.h` \
`awk '/^Makefile/,/vms_zip.rnh/ {print $$1}' < contents`
# clean up after making stuff and installing it
clean:
$(RM) *.o $(ZIPS) flags
# end of Makefile

View file

@ -1,21 +0,0 @@
Info-ZIP's zip for AtheOS/Syllable
FEATURES
stores AtheOS/Syllable file attributes, compressing them if possible
TODO
----
There is only one thing to be fixed:
write_attr() should return count of writed bytes. However that's bug related with AFS only.
Please report any bugs to Info-ZIP at www.info-zip.org.
If this bug related with AtheOS/Syllable only, you can mail me directly: nruslan@hotbox.ru.
Visit the Info-ZIP web site (http://www.info-zip.org) for all the
latest zip and unzip information, FAQs, source code and ready-to-run
executables.
- Ruslan Nickolaev (nruslan@hotbox.ru)
Sep 06/2004
(updated 12 November 2004)

View file

@ -1,885 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
This AtheOS - specific file is based on unix.c and beos.c;
changes by Ruslan Nickolaev (nruslan@hotbox.ru)
*/
#include "zip.h"
#ifndef UTIL /* the companion #endif is a bit of ways down ... */
#include <time.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/errno.h>
#include <limits.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <atheos/fs_attribs.h>
#define PAD 0
#define PATH_END '/'
/* Library functions not in (most) header files */
#ifdef _POSIX_VERSION
# include <utime.h>
#else
int utime OF((char *, time_t *));
#endif
extern char *label;
local ulg label_time = 0;
local ulg label_mode = 0;
local time_t label_utim = 0;
/* Local functions */
local char *readd OF((DIR *));
local int get_attr_dir( const char *, char **, off_t * );
local int add_UT_ef( struct zlist far * );
local int add_Ux_ef( struct zlist far * );
local int add_At_ef( struct zlist far * );
local char *readd(d)
DIR *d; /* directory stream to read from */
/* Return a pointer to the next name in the directory stream d, or NULL if
no more entries or an error occurs. */
{
struct dirent *e;
e = readdir(d);
return e == NULL ? (char *) NULL : e->d_name;
}
int procname(n, caseflag)
char *n; /* name to process */
int caseflag; /* true to force case-sensitive match */
/* Process a name or sh expression to operate on (or exclude). Return
an error code in the ZE_ class. */
{
char *a; /* path and name for recursion */
DIR *d; /* directory stream from opendir() */
char *e; /* pointer to name from readd() */
int m; /* matched flag */
char *p; /* path for recursion */
struct stat s; /* result of stat() */
struct zlist far *z; /* steps through zfiles list */
if (strcmp(n, "-") == 0) /* if compressing stdin */
return newname(n, 0, caseflag);
else if (LSSTAT(n, &s))
{
/* Not a file or directory--search for shell expression in zip file */
p = ex2in(n, 0, (int *)NULL); /* shouldn't affect matching chars */
m = 1;
for (z = zfiles; z != NULL; z = z->nxt) {
if (MATCH(p, z->iname, caseflag))
{
z->mark = pcount ? filter(z->zname, caseflag) : 1;
if (verbose)
fprintf(mesg, "zip diagnostic: %scluding %s\n",
z->mark ? "in" : "ex", z->name);
m = 0;
}
}
free((zvoid *)p);
return m ? ZE_MISS : ZE_OK;
}
/* Live name--use if file, recurse if directory */
if ((s.st_mode & S_IFREG) == S_IFREG ||
(s.st_mode & S_IFLNK) == S_IFLNK)
{
/* add or remove name of file */
if ((m = newname(n, 0, caseflag)) != ZE_OK)
return m;
}
else if ((s.st_mode & S_IFDIR) == S_IFDIR)
{
/* Add trailing / to the directory name */
if ((p = malloc(strlen(n)+2)) == NULL)
return ZE_MEM;
if (strcmp(n, ".") == 0) {
*p = '\0'; /* avoid "./" prefix and do not create zip entry */
} else {
strcpy(p, n);
a = p + strlen(p);
if (a[-1] != '/')
strcpy(a, "/");
if (dirnames && (m = newname(p, 1, caseflag)) != ZE_OK) {
free((zvoid *)p);
return m;
}
}
/* recurse into directory */
if (recurse && (d = opendir(n)) != NULL)
{
while ((e = readd(d)) != NULL) {
if (strcmp(e, ".") && strcmp(e, ".."))
{
if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL)
{
closedir(d);
free((zvoid *)p);
return ZE_MEM;
}
strcat(strcpy(a, p), e);
if ((m = procname(a, caseflag)) != ZE_OK) /* recurse on name */
{
if (m == ZE_MISS)
zipwarn("name not matched: ", a);
else
ziperr(m, a);
}
free((zvoid *)a);
}
}
closedir(d);
}
free((zvoid *)p);
} /* (s.st_mode & S_IFDIR) */
else
zipwarn("ignoring special file: ", n);
return ZE_OK;
}
char *ex2in(x, isdir, pdosflag)
char *x; /* external file name */
int isdir; /* input: x is a directory */
int *pdosflag; /* output: force MSDOS file attributes? */
/* Convert the external file name to a zip file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *n; /* internal file name (malloc'ed) */
char *t = NULL; /* shortened name */
int dosflag;
dosflag = dosify; /* default for non-DOS and non-OS/2 */
/* Find starting point in name before doing malloc */
/* Strip "//host/share/" part of a UNC name */
if (!strncmp(x,"//",2) && (x[2] != '\0' && x[2] != '/')) {
n = x + 2;
while (*n != '\0' && *n != '/')
n++; /* strip host name */
if (*n != '\0') {
n++;
while (*n != '\0' && *n != '/')
n++; /* strip `share' name */
}
if (*n != '\0')
t = n + 1;
} else
t = x;
while (*t == '/')
t++; /* strip leading '/' chars to get a relative path */
while (*t == '.' && t[1] == '/')
t += 2; /* strip redundant leading "./" sections */
/* Make changes, if any, to the copied name (leave original intact) */
if (!pathput)
t = last(t, PATH_END);
/* Malloc space for internal name and copy it */
if ((n = malloc(strlen(t) + 1)) == NULL)
return NULL;
strcpy(n, t);
if (isdir == 42) return n; /* avoid warning on unused variable */
if (dosify)
msname(n);
/* Returned malloc'ed name */
if (pdosflag)
*pdosflag = dosflag;
return n;
}
char *in2ex(n)
char *n; /* internal file name */
/* Convert the zip file name to an external file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *x; /* external file name */
if ((x = malloc(strlen(n) + 1 + PAD)) == NULL)
return NULL;
strcpy(x, n);
return x;
}
/*
* XXX use ztimbuf in both POSIX and non POSIX cases ?
*/
void stamp(f, d)
char *f; /* name of file to change */
ulg d; /* dos-style time to change it to */
/* Set last updated and accessed time of file f to the DOS time d. */
{
#ifdef _POSIX_VERSION
struct utimbuf u; /* argument for utime() const ?? */
#else
time_t u[2]; /* argument for utime() */
#endif
/* Convert DOS time to time_t format in u */
#ifdef _POSIX_VERSION
u.actime = u.modtime = dos2unixtime(d);
utime(f, &u);
#else
u[0] = u[1] = dos2unixtime(d);
utime(f, u);
#endif
}
ulg filetime(f, a, n, t)
char *f; /* name of file to get info on */
ulg *a; /* return value: file attributes */
long *n; /* return value: file size */
iztimes *t; /* return value: access, modific. and creation times */
/* If file *f does not exist, return 0. Else, return the file's last
modified date and time as an MSDOS date and time. The date and
time is returned in a long with the date most significant to allow
unsigned integer comparison of absolute times. Also, if a is not
a NULL pointer, store the file attributes there, with the high two
bytes being the Unix attributes, and the low byte being a mapping
of that to DOS attributes. If n is not NULL, store the file size
there. If t is not NULL, the file's access, modification and creation
times are stored there as UNIX time_t values.
If f is "-", use standard input as the file. If f is a device, return
a file size of -1 */
{
struct stat s; /* results of stat() */
char *name;
int len = strlen(f);
if (f == label) {
if (a != NULL)
*a = label_mode;
if (n != NULL)
*n = -2L; /* convention for a label name */
if (t != NULL)
t->atime = t->mtime = t->ctime = label_utim;
return label_time;
}
if ((name = malloc(len + 1)) == NULL {
ZIPERR(ZE_MEM, "filetime");
}
strcpy(name, f);
if (name[len - 1] == '/')
name[len - 1] = '\0';
/* not all systems allow stat'ing a file with / appended */
if (strcmp(f, "-") == 0) {
if (fstat(fileno(stdin), &s) != 0) {
free(name);
error("fstat(stdin)");
}
}
else if (LSSTAT(name, &s) != 0) {
/* Accept about any file kind including directories
* (stored with trailing / with -r option)
*/
free(name);
return 0;
}
free(name);
if (a != NULL) {
#ifndef OS390
*a = ((ulg)s.st_mode << 16) | !(s.st_mode & S_IWRITE);
#else
/*
** The following defines are copied from the unizip source and represent the
** legacy Unix mode flags. These fixed bit masks are no longer required
** by XOPEN standards - the S_IS### macros being the new recommended method.
** The approach here of setting the legacy flags by testing the macros should
** work under any _XOPEN_SOURCE environment (and will just rebuild the same bit
** mask), but is required if the legacy bit flags differ from legacy Unix.
*/
#define UNX_IFDIR 0040000 /* Unix directory */
#define UNX_IFREG 0100000 /* Unix regular file */
#define UNX_IFSOCK 0140000 /* Unix socket (BSD, not SysV or Amiga) */
#define UNX_IFLNK 0120000 /* Unix symbolic link (not SysV, Amiga) */
#define UNX_IFBLK 0060000 /* Unix block special (not Amiga) */
#define UNX_IFCHR 0020000 /* Unix character special (not Amiga) */
#define UNX_IFIFO 0010000 /* Unix fifo (BCC, not MSC or Amiga) */
{
mode_t legacy_modes;
/* Initialize with permission bits - which are not implementation optional */
legacy_modes = s.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX);
if (S_ISDIR(s.st_mode))
legacy_modes |= UNX_IFDIR;
if (S_ISREG(s.st_mode))
legacy_modes |= UNX_IFREG;
if (S_ISLNK(s.st_mode))
legacy_modes |= UNX_IFLNK;
if (S_ISBLK(s.st_mode))
legacy_modes |= UNX_IFBLK;
if (S_ISCHR(s.st_mode))
legacy_modes |= UNX_IFCHR;
if (S_ISFIFO(s.st_mode))
legacy_modes |= UNX_IFIFO;
if (S_ISSOCK(s.st_mode))
legacy_modes |= UNX_IFSOCK;
*a = ((ulg)legacy_modes << 16) | !(s.st_mode & S_IWRITE);
}
#endif
if ((s.st_mode & S_IFMT) == S_IFDIR) {
*a |= MSDOS_DIR_ATTR;
}
}
if (n != NULL)
*n = (s.st_mode & S_IFMT) == S_IFREG ? s.st_size : -1L;
if (t != NULL) {
t->atime = s.st_atime;
t->mtime = s.st_mtime;
t->ctime = t->mtime; /* best guess, (s.st_ctime: last status change!!) */
}
return unix2dostime(&s.st_mtime);
}
/* ----------------------------------------------------------------------
Return a malloc()'d buffer containing all of the attributes and their names
for the file specified in name. You have to free() this yourself. The length
of the buffer is also returned.
If get_attr_dir() fails, the buffer will be NULL, total_size will be 0,
and an error will be returned:
EOK - no errors occurred
EINVAL - attr_buff was pointing at a buffer
ENOMEM - insufficient memory for attribute buffer
Other errors are possible (whatever is returned by the fs_attrib.h functions).
PROBLEMS:
- pointers are 32-bits; attributes are limited to ssize_t in size so it's
possible to overflow... in practice, this isn't too likely... your
machine will thrash like hell before that happens
*/
#define INITIAL_BUFF_SIZE 65536
int get_attr_dir( const char *name, char **attr_buff, off_t *total_size )
{
int retval = EOK;
int fd;
DIR *fa_dir;
struct dirent *fa_ent;
off_t attrs_size = 0;
size_t entname_size;
char *ptr;
struct attr_info fa_info;
*total_size = 0;
/* ----------------------------------------------------------------- */
/* Sanity-check. */
if( *attr_buff != NULL ) {
return EINVAL;
}
/* ----------------------------------------------------------------- */
/* Can we open the file/directory? */
/* */
/* linkput is a zip global; it's set to 1 if we're storing symbolic */
/* links as symbolic links (instead of storing the thing the link */
/* points to)... if we're storing the symbolic link as a link, we'll */
/* want the link's file attributes, otherwise we want the target's. */
fd = open( name, linkput ? O_RDONLY | O_NOTRAVERSE : O_RDONLY );
if( fd < 0 ) {
return errno;
}
/* ----------------------------------------------------------------- */
/* Allocate an initial buffer; 64k should usually be enough. */
*attr_buff = (char *)malloc( INITIAL_BUFF_SIZE );
ptr = *attr_buff;
if( ptr == NULL ) {
close( fd );
return ENOMEM;
}
/* ----------------------------------------------------------------- */
/* Open the attributes directory for this file. */
fa_dir = open_attrdir( fd );
if( fa_dir == NULL ) {
close( fd );
free( ptr );
*attr_buff = NULL;
return retval;
}
/* ----------------------------------------------------------------- */
/* Read all the attributes; the buffer could grow > 64K if there are */
/* many and/or they are large. */
while( ( fa_ent = read_attrdir( fa_dir ) ) != NULL ) {
retval = stat_attr( fd, fa_ent->d_name, &fa_info );
/* TODO: check retval != EOK */
entname_size = strlen( fa_ent->d_name ) + 1;
attrs_size += entname_size + sizeof( struct attr_info ) + fa_info.ai_size;
if( attrs_size > INITIAL_BUFF_SIZE ) {
unsigned long offset = ptr - *attr_buff;
*attr_buff = (char *)realloc( *attr_buff, attrs_size );
if( *attr_buff == NULL ) {
retval = close_attrdir( fa_dir );
/* TODO: check retval != EOK */
close( fd );
return ENOMEM;
}
ptr = *attr_buff + offset;
}
/* Now copy the data for this attribute into the buffer. */
strcpy( ptr, fa_ent->d_name );
ptr += entname_size;
memcpy( ptr, &fa_info, sizeof( struct attr_info ) );
ptr += sizeof( struct attr_info );
if( fa_info.ai_size > 0 ) {
ssize_t read_bytes = read_attr( fd, fa_ent->d_name, fa_info.ai_type, ptr, 0, fa_info.ai_size );
if( read_bytes != fa_info.ai_size ) {
/* print a warning about mismatched sizes */
char buff[80];
sprintf( buff, "read %d, expected %d", read_bytes, (ssize_t)fa_info.ai_size );
zipwarn( "attribute size mismatch: ", buff );
}
ptr += fa_info.ai_size;
}
}
/* ----------------------------------------------------------------- */
/* Close the attribute directory. */
retval = close_attrdir( fa_dir );
/* TODO: check retval != EOK */
/* ----------------------------------------------------------------- */
/* If the buffer is too big, shrink it. */
if( attrs_size < INITIAL_BUFF_SIZE ) {
*attr_buff = (char *)realloc( *attr_buff, attrs_size );
if( *attr_buff == NULL ) {
close( fd );
return ENOMEM;
}
}
*total_size = attrs_size;
close( fd );
return EOK;
}
/* ---------------------------------------------------------------------- */
/* Add a 'UT' extra field to the zlist data pointed to by z. */
#define EB_L_UT_SIZE (EB_HEADSIZE + EB_UT_LEN(2))
#define EB_C_UT_SIZE (EB_HEADSIZE + EB_UT_LEN(1))
local int add_UT_ef( struct zlist far *z )
{
char *l_ef = NULL;
char *c_ef = NULL;
struct stat s;
#ifdef IZ_CHECK_TZ
if (!zp_tz_is_valid)
return ZE_OK; /* skip silently if no valid TZ info */
#endif
/* We can't work if there's no entry to work on. */
if( z == NULL ) {
return ZE_LOGIC;
}
/* Check to make sure we've got enough room in the extra fields. */
if( z->ext + EB_L_UT_SIZE > USHRT_MAX ||
z->cext + EB_C_UT_SIZE > USHRT_MAX ) {
return ZE_MEM;
}
/* stat() the file (or the symlink) to get the data; if we can't get */
/* the data, there's no point in trying to fill out the fields. */
if(LSSTAT( z->name, &s ) ) {
return ZE_OPEN;
}
/* Allocate memory for the local and central extra fields. */
if( z->extra && z->ext != 0 ) {
l_ef = (char *)realloc( z->extra, z->ext + EB_L_UT_SIZE );
} else {
l_ef = (char *)malloc( EB_L_UT_SIZE );
z->ext = 0;
}
if( l_ef == NULL ) {
return ZE_MEM;
}
z->extra = l_ef;
l_ef += z->ext;
if( z->cextra && z->cext != 0 ) {
c_ef = (char *)realloc( z->cextra, z->cext + EB_C_UT_SIZE );
} else {
c_ef = (char *)malloc( EB_C_UT_SIZE );
z->cext = 0;
}
if( c_ef == NULL ) {
return ZE_MEM;
}
z->cextra = c_ef;
c_ef += z->cext;
/* Now add the local version of the field. */
*l_ef++ = 'U';
*l_ef++ = 'T';
*l_ef++ = (char)(EB_UT_LEN(2)); /* length of data in local EF */
*l_ef++ = (char)0;
*l_ef++ = (char)(EB_UT_FL_MTIME | EB_UT_FL_ATIME);
*l_ef++ = (char)(s.st_mtime);
*l_ef++ = (char)(s.st_mtime >> 8);
*l_ef++ = (char)(s.st_mtime >> 16);
*l_ef++ = (char)(s.st_mtime >> 24);
*l_ef++ = (char)(s.st_atime);
*l_ef++ = (char)(s.st_atime >> 8);
*l_ef++ = (char)(s.st_atime >> 16);
*l_ef++ = (char)(s.st_atime >> 24);
z->ext += EB_L_UT_SIZE;
/* Now add the central version. */
memcpy(c_ef, l_ef-EB_L_UT_SIZE, EB_C_UT_SIZE);
c_ef[EB_LEN] = (char)(EB_UT_LEN(1)); /* length of data in central EF */
z->cext += EB_C_UT_SIZE;
return ZE_OK;
}
/* ---------------------------------------------------------------------- */
/* Add a 'Ux' extra field to the zlist data pointed to by z. */
#define EB_L_UX2_SIZE (EB_HEADSIZE + EB_UX2_MINLEN)
#define EB_C_UX2_SIZE (EB_HEADSIZE)
local int add_Ux_ef( struct zlist far *z )
{
char *l_ef = NULL;
char *c_ef = NULL;
struct stat s;
/* Check to make sure we've got enough room in the extra fields. */
if( z->ext + EB_L_UX2_SIZE > USHRT_MAX ||
z->cext + EB_C_UX2_SIZE > USHRT_MAX ) {
return ZE_MEM;
}
/* stat() the file (or the symlink) to get the data; if we can't get */
/* the data, there's no point in trying to fill out the fields. */
if(LSSTAT( z->name, &s ) ) {
return ZE_OPEN;
}
/* Allocate memory for the local and central extra fields. */
if( z->extra && z->ext != 0 ) {
l_ef = (char *)realloc( z->extra, z->ext + EB_L_UX2_SIZE );
} else {
l_ef = (char *)malloc( EB_L_UX2_SIZE );
z->ext = 0;
}
if( l_ef == NULL ) {
return ZE_MEM;
}
z->extra = l_ef;
l_ef += z->ext;
if( z->cextra && z->cext != 0 ) {
c_ef = (char *)realloc( z->cextra, z->cext + EB_C_UX2_SIZE );
} else {
c_ef = (char *)malloc( EB_C_UX2_SIZE );
z->cext = 0;
}
if( c_ef == NULL ) {
return ZE_MEM;
}
z->cextra = c_ef;
c_ef += z->cext;
/* Now add the local version of the field. */
*l_ef++ = 'U';
*l_ef++ = 'x';
*l_ef++ = (char)(EB_UX2_MINLEN);
*l_ef++ = (char)(EB_UX2_MINLEN >> 8);
*l_ef++ = (char)(s.st_uid);
*l_ef++ = (char)(s.st_uid >> 8);
*l_ef++ = (char)(s.st_gid);
*l_ef++ = (char)(s.st_gid >> 8);
z->ext += EB_L_UX2_SIZE;
/* Now add the central version of the field. */
*c_ef++ = 'U';
*c_ef++ = 'x';
*c_ef++ = 0;
*c_ef++ = 0;
z->cext += EB_C_UX2_SIZE;
return ZE_OK;
}
/* ---------------------------------------------------------------------- */
/* Add a 'At' extra field to the zlist data pointed to by z. */
#define EB_L_AT_SIZE (EB_HEADSIZE + EB_L_AT_LEN) /* + attr size */
#define EB_C_AT_SIZE (EB_HEADSIZE + EB_C_AT_LEN)
#define MEMCOMPRESS_HEADER 6 /* ush compression type, ulg CRC */
#define DEFLAT_WORSTCASE_ADD 5 /* byte blocktype, 2 * ush blocklength */
#define MEMCOMPRESS_OVERHEAD (MEMCOMPRESS_HEADER + DEFLAT_WORSTCASE_ADD)
local int add_At_ef( struct zlist far *z )
{
char *l_ef = NULL;
char *c_ef = NULL;
char *attrbuff = NULL;
off_t attrsize = 0;
char *compbuff = NULL;
ush compsize = 0;
uch flags = 0;
/* Check to make sure we've got enough room in the extra fields. */
if( z->ext + EB_L_AT_SIZE > USHRT_MAX ||
z->cext + EB_C_AT_SIZE > USHRT_MAX ) {
return ZE_MEM;
}
/* Attempt to load up a buffer full of the file's attributes. */
{
if (get_attr_dir( z->name, &attrbuff, &attrsize) != EOK ) {
return ZE_OPEN;
}
if (attrsize == 0) {
return ZE_OK;
}
if (attrbuff == NULL) {
return ZE_LOGIC;
}
/* Check for way too much data. */
if (attrsize > (off_t)ULONG_MAX) {
zipwarn( "uncompressed attributes truncated", "" );
attrsize = (off_t)(ULONG_MAX - MEMCOMPRESS_OVERHEAD);
}
}
if (verbose) {
printf( "\t[in=%lu]", (unsigned long)attrsize );
}
/* Try compressing the data */
compbuff = (char *)malloc( (size_t)attrsize + MEMCOMPRESS_OVERHEAD );
if( compbuff == NULL ) {
return ZE_MEM;
}
compsize = memcompress( compbuff,
(size_t)attrsize + MEMCOMPRESS_OVERHEAD,
attrbuff,
(size_t)attrsize );
if (verbose) {
printf( " [out=%u]", compsize );
}
/* Attempt to optimise very small attributes. */
if (compsize > attrsize) {
free( compbuff );
compsize = (ush)attrsize;
compbuff = attrbuff;
flags = EB_AT_FL_NATURAL;
}
/* Check to see if we really have enough room in the EF for the data. */
if( ( z->ext + compsize + EB_L_AT_LEN ) > USHRT_MAX ) {
compsize = USHRT_MAX - EB_L_AT_LEN - z->ext;
}
/* Allocate memory for the local and central extra fields. */
if( z->extra && z->ext != 0 ) {
l_ef = (char *)realloc( z->extra, z->ext + EB_L_AT_SIZE + compsize );
} else {
l_ef = (char *)malloc( EB_L_AT_SIZE + compsize );
z->ext = 0;
}
if( l_ef == NULL ) {
return ZE_MEM;
}
z->extra = l_ef;
l_ef += z->ext;
if( z->cextra && z->cext != 0 ) {
c_ef = (char *)realloc( z->cextra, z->cext + EB_C_AT_SIZE );
} else {
c_ef = (char *)malloc( EB_C_AT_SIZE );
z->cext = 0;
}
if( c_ef == NULL ) {
return ZE_MEM;
}
z->cextra = c_ef;
c_ef += z->cext;
/* Now add the local version of the field. */
*l_ef++ = 'A';
*l_ef++ = 't';
*l_ef++ = (char)(compsize + EB_L_AT_LEN);
*l_ef++ = (char)((compsize + EB_L_AT_LEN) >> 8);
*l_ef++ = (char)((unsigned long)attrsize);
*l_ef++ = (char)((unsigned long)attrsize >> 8);
*l_ef++ = (char)((unsigned long)attrsize >> 16);
*l_ef++ = (char)((unsigned long)attrsize >> 24);
*l_ef++ = flags;
memcpy( l_ef, compbuff, (size_t)compsize );
z->ext += EB_L_AT_SIZE + compsize;
/* And the central version. */
*c_ef++ = 'A';
*c_ef++ = 't';
*c_ef++ = (char)(EB_C_AT_LEN);
*c_ef++ = (char)(EB_C_AT_LEN >> 8);
*c_ef++ = (char)compsize;
*c_ef++ = (char)(compsize >> 8);
*c_ef++ = (char)(compsize >> 16);
*c_ef++ = (char)(compsize >> 24);
*c_ef++ = flags;
z->cext += EB_C_AT_SIZE;
return ZE_OK;
}
/* Extra field info:
- 'UT' - UNIX time extra field
- 'Ux' - UNIX uid/gid extra field
- 'At' - AtheOS file attributes extra field
This is done the same way ../unix/unix.c stores the 'UT'/'Ux' fields
(full data in local header, only modification time in central header),
with the 'At' field added to the end and the size of the 'At' field
in the central header.
See the end of atheos/osdep.h for a simple explanation of the 'At' EF
layout.
*/
int set_extra_field(z, z_utim)
struct zlist far *z;
iztimes *z_utim;
/* store full data in local header but just modification time stamp info
in central header */
{
int retval;
/* Check to make sure z is valid. */
if( z == NULL ) {
return ZE_LOGIC;
}
retval = add_UT_ef(z);
if( retval != ZE_OK ) {
return retval;
}
retval = add_Ux_ef(z);
if( retval != ZE_OK ) {
return retval;
}
return add_At_ef(z); /* last function; we can use return value directly */
}
/* ---------------------------------------------------------------------- */
/* Set a file's MIME type. */
void setfiletype(const char *file, const char *type)
{
int fd;
off_t nLen;
ssize_t nError;
fd = open( file, O_RDWR );
if (fd < 0) {
zipwarn( "can't open zipfile to write file type", "" );
}
else
{
nLen = strlen( type );
/* FIXME: write_attr() should return count of writed bytes */
nError = write_attr( fd, "os::MimeType", O_TRUNC, ATTR_TYPE_STRING, type, 0, nLen );
if (nError < 0) {
zipwarn( "couldn't write complete file type", "" );
}
close( fd );
}
}
#endif /* !UTIL */
/******************************/
/* Function version_local() */
/******************************/
void version_local()
{
static ZCONST char CompiledWith[] = "Compiled with %s%s for %s%s%s%s.\n\n";
printf(CompiledWith,
#ifdef __GNUC__
"gcc ", __VERSION__,
#else
"(unknown compiler)", "",
#endif
"Syllable",
#if defined(i486) || defined(__i486) || defined(__i486__) || defined(i386) || defined(__i386) || defined(__i386__)
" (x86)",
#else
" (unknown platform)",
#endif
#ifdef __DATE__
" on ", __DATE__
#else
"", ""
#endif
);
} /* end function version_local() */

View file

@ -1,64 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#ifndef _OSDEP_H_
#define _OSDEP_H_
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/unistd.h>
#define USE_EF_UT_TIME /* Enable use of "UT" extra field time info */
#define EB_L_AT_LEN 5 /* min size is an unsigned long and flag */
#define EB_C_AT_LEN 5 /* Length of data in local EF and flag. */
#define EB_AT_FL_NATURAL 0x01 /* data is 'natural' (not compressed) */
#define EB_AT_FL_BADBITS 0xfe /* bits currently undefined */
#ifndef ZP_NEED_MEMCOMPR
define ZP_NEED_MEMCOMPR
#endif
#define deletedir(d) rmdir(d);
/* Set a file's MIME type. */
void setfiletype( const char *file, const char *type );
/*
'At' extra-field layout:
'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_AT_FL_NATURAL = the data is not compressed
flags & EB_AT_FL_BADBITS = the data is corrupted or we
can't handle it properly
data - compressed or uncompressed file attribute data
If flag & EB_AT_FL_NATURAL, 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_L_AT_LEN ) bytes of data, and full_size
should equal ( ef_size - EB_L_AT_LEN ).
If the data is compressed, there will be ( ef_size - EB_L_AT_LEN ) 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 (little-endian)
attr_data (length in attr_info.ai_size)
*/
#endif

View file

@ -1,24 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#ifndef _ZIPUP_H_
#define _ZIPUP_H_
#ifndef O_RDONLY
# include <sys/fcntl.h>
#endif
#define fhow O_RDONLY
#define fbad (-1)
typedef int ftype;
#define zopen(n,p) open(n,p)
#define zread(f,b,n) read(f,b,n)
#define zclose(f) close(f)
#define zerr(f) (k == (extent)(-1L))
#define zstdin 0
#endif /* _ZIPUP_H_ */

View file

@ -1,14 +0,0 @@
Contents of the "beos" sub-directory for Zip 2.2 and later:
Contents this file
README Notes from the author of the BeOS port
Makefile makefile for building (sorry, no project files)
beos.c BeOS-specific routines (similar to the UNIX ones)
osdep.h BeOS-specific includes and whatnot
zipup.h Definitions for zip routines
This port supports both Metrowerks CodeWarrior and GNU C as the compiler,
and PowerPC and x86 architectures.
- Chris Herborth (chrish@pobox.com)
June 24, 1998

View file

@ -1,182 +0,0 @@
######################################################################
#
# Makefile for Info-ZIP's zip, zipcloak, zipnote, and zipsplit on BeOS
#
# Copyright © 1999 Info-ZIP
# Chris Herborth (chrish@pobox.com)
#
# This is the new New and Improved Makefile for BeOS; it automatically
# detects your platform and uses the appropriate compiler and compiler
# flags.
######################################################################
# Things that don't change:
# Punish people who don't have SMP hardware.
MAKE = make -j 4 -f beos/Makefile
SHELL = /bin/sh
LN = ln -s
BIND = $(CC)
AS = $(CC) -c
CPP = $(CC) -E
INSTALL = install
# Target directories
prefix = /boot/home/config
BINDIR = $(prefix)/bin
manext = 1
MANDIR = $(prefix)/man/man$(manext)
ZIPMANUAL = MANUAL
VERSION = Version 2.3 of __DATE__
######################################################################
# Things that change:
# PowerPC system
ifeq "$(BE_HOST_CPU)" "ppc"
CC:=mwcc
ifeq "$(shell uname -r)" "4.0"
CFLAGS:=-O7 -opt schedule604 -rostr -w9 \
-I. -DHAVE_DIRENT_H -DPASSWD_FROM_STDIN
LFLAGS1:=-warn
else
CFLAGS:=-O7 -proc 604e -w9 -I. -DHAVE_DIRENT_H -DPASSWD_FROM_STDIN
LFLAGS1:=-nodup
endif
LFLAGS2:=-L/boot/develop/lib/ppc -lbe -lroot
OBJA =
TARGET=$(ZIPS)
# x86 system
else
CC:=gcc
# Removed -Wconversion and -Wshadow because of the unnecessary warnings
# they generate. - Sept. 28, 1999
CFLAGS:=-O3 -mpentiumpro \
-Wall -Wno-multichar -Wno-ctor-dtor-privacy \
-Wbad-function-cast -Woverloaded-virtual \
-I. -I/boot/develop/headers/be/support \
-I/boot/develop/headers/be/storage \
-DHAVE_DIRENT_H -DPASSWD_FROM_STDIN # -DASMV
LFLAGS1:=
LFLAGS2:=-L/boot/develop/lib/x86 -lbe -lroot
OBJA = #match.o
TARGET=$(ZIPS)
endif
######################################################################
# Helpful targets
all:
$(MAKE) CC=$(CC) CFLAGS="$(CFLAGS)" \
LFLAGS1="$(LFLAGS1)" LFLAGS2="$(LFLAGS2)" \
$(TARGET)
######################################################################
# Object file lists and other build goodies
# Object file lists
OBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o crypt.o ttyio.o \
beos.o crc32.o
OBJI = deflate.o trees.o
# OBJA moved into ifeq block above; we'll use assembly for x86
OBJU = zipfile_.o fileio_.o util_.o globals.o beos_.o
OBJN = zipnote.o $(OBJU)
OBJC = zipcloak.o $(OBJU) crc32_.o crypt_.o ttyio.o
OBJS = zipsplit.o $(OBJU)
# Headers
ZIP_H = zip.h ziperr.h tailor.h beos/osdep.h
# What to build?
ZIPS = zip zipnote zipsplit zipcloak
# suffix rules
.SUFFIXES:
.SUFFIXES: _.o .o .c .doc .1
.c_.o:
rm -f $*_.c; $(LN) $< $*_.c
$(CC) -c $(CFLAGS) -DUTIL $*_.c
rm -f $*_.c
.c.o:
$(CC) -c $(CFLAGS) $<
.1.doc:
groff -man -Tascii $< > $@
# rules for zip, zipnote, zipcloak, zipsplit, and the Zip MANUAL.
$(OBJZ): $(ZIP_H)
$(OBJI): $(ZIP_H)
$(OBJN): $(ZIP_H)
$(OBJS): $(ZIP_H)
$(OBJC): $(ZIP_H)
zip.o crc32.o crypt.o fileio.o zipfile.o zipup.o: crc32.h
zipcloak.o crc32_.o crypt_.o fileio_.o zipfile_.o: crc32.h
zip.o zipup.o crypt.o ttyio.o zipcloak.o crypt_.o: crypt.h
zip.o zipup.o zipnote.o zipcloak.o zipsplit.o: revision.h
zip.o crypt.o ttyio.o zipcloak.o crypt_.o: ttyio.h
zipup.o: beos/zipup.h
match.o: match.S
$(CPP) match.S > _match.s
$(AS) _match.s
mv -f _match.o match.o
rm -f _match.s
beos.o: beos/beos.c
$(CC) -c $(CFLAGS) beos/beos.c
beos_.o: beos/beos.c
rm -f $*_.c; $(LN) beos/beos.c $*_.c
$(CC) -c $(CFLAGS) -DUTIL $*_.c
rm -f $*_.c
zips: $(ZIPS)
zipsman: $(ZIPS) $(ZIPMANUAL)
zip: $(OBJZ) $(OBJI) $(OBJA)
$(BIND) -o zip $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2)
zipnote: $(OBJN)
$(BIND) -o zipnote $(LFLAGS1) $(OBJN) $(LFLAGS2)
zipcloak: $(OBJC)
$(BIND) -o zipcloak $(LFLAGS1) $(OBJC) $(LFLAGS2)
zipsplit: $(OBJS)
$(BIND) -o zipsplit $(LFLAGS1) $(OBJS) $(LFLAGS2)
$(ZIPMANUAL): man/zip.1
groff -man -Tascii man/zip.1 > $(ZIPMANUAL)
# install
install: $(ZIPS)
$(INSTALL) -m755 $(ZIPS) $(BINDIR)
mkdir -p $(MANDIR)
$(INSTALL) -m644 man/zip.1 $(MANDIR)/zip.$(manext)
uninstall:
-cd $(BINDIR); rm -f $(ZIPS)
-cd $(MANDIR); rm -f zip.$(manext)
dist: $(ZIPMANUAL)
zip -u9T zip`sed -e '/VERSION/!d' -e 's/.*"\(.*\)".*/\1/' \
-e s/[.]//g -e q revision.h` \
`awk '/^Makefile/,/vms_zip.rnh/ {print $$1}' < contents`
# clean up after making stuff and installing it
clean:
rm -f *.o $(ZIPS) flags
# end of Makefile

View file

@ -1,31 +0,0 @@
Info-ZIP's zip for BeOS
KNOWN BUGS
- None! (as of zip 2.21)
- building on x86 BeOS generates a hell of a lot of bugs; I'm not going to
worry about them until Be fixes their headers though...
FEATURES
- stores BeOS file attributes, compressing them if possible (as of 2.21,
this works properly for symbolic links, too; as of 2.3, this works
properly for symbolic links whether you're storing them as links or not)
- zip files are created with the correct file type (application/zip)
- supports both Metrowerks CodeWarrior (PowerPC platform) and GNU C
(x86 platform), automatically picking the default compiler for each
architecture
Please report any bugs to the Zip-Bugs mailing list; our email address is
zip-bugs@lists.wku.edu. If it's something BeOS-specific, you could email
me directly.
Visit the Info-ZIP web site (http://www.cdrom.com/pub/infozip/) for all the
latest zip and unzip information, FAQs, source code and ready-to-run
executables.
- Chris Herborth (chrish@pobox.com)
April 2/1999

View file

@ -1,945 +0,0 @@
/*
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
*/
/*
This BeOS-specific file is based on unix.c in the unix directory; changes
by Chris Herborth (chrish@pobox.com).
*/
#include "zip.h"
#ifndef UTIL /* the companion #endif is a bit of ways down ... */
#include <time.h>
#include <dirent.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <dirent.h>
#include <kernel/fs_attr.h>
#include <storage/Mime.h>
#include <support/byteorder.h>
#define PAD 0
#define PATH_END '/'
/* Library functions not in (most) header files */
#ifdef _POSIX_VERSION
# include <utime.h>
#else
int utime OF((char *, time_t *));
#endif
extern char *label;
local ulg label_time = 0;
local ulg label_mode = 0;
local time_t label_utim = 0;
/* Local functions */
local char *readd OF((DIR *));
local int get_attr_dir( const char *, char **, off_t * );
local int add_UT_ef( struct zlist far * );
local int add_Ux_ef( struct zlist far * );
local int add_Be_ef( struct zlist far * );
#ifdef NO_DIR /* for AT&T 3B1 */
#include <sys/dir.h>
#ifndef dirent
# define dirent direct
#endif
typedef FILE DIR;
/*
** Apparently originally by Rich Salz.
** Cleaned up and modified by James W. Birdsall.
*/
#define opendir(path) fopen(path, "r")
struct dirent *readdir(dirp)
DIR *dirp;
{
static struct dirent entry;
if (dirp == NULL)
return NULL;
for (;;)
if (fread (&entry, sizeof (struct dirent), 1, dirp) == 0)
return NULL;
else if (entry.d_ino)
return (&entry);
} /* end of readdir() */
#define closedir(dirp) fclose(dirp)
#endif /* NO_DIR */
local char *readd(d)
DIR *d; /* directory stream to read from */
/* Return a pointer to the next name in the directory stream d, or NULL if
no more entries or an error occurs. */
{
struct dirent *e;
e = readdir(d);
return e == NULL ? (char *) NULL : e->d_name;
}
int procname(n, caseflag)
char *n; /* name to process */
int caseflag; /* true to force case-sensitive match */
/* Process a name or sh expression to operate on (or exclude). Return
an error code in the ZE_ class. */
{
char *a; /* path and name for recursion */
DIR *d; /* directory stream from opendir() */
char *e; /* pointer to name from readd() */
int m; /* matched flag */
char *p; /* path for recursion */
struct stat s; /* result of stat() */
struct zlist far *z; /* steps through zfiles list */
if (strcmp(n, "-") == 0) /* if compressing stdin */
return newname(n, 0, caseflag);
else if (LSSTAT(n, &s))
{
/* Not a file or directory--search for shell expression in zip file */
p = ex2in(n, 0, (int *)NULL); /* shouldn't affect matching chars */
m = 1;
for (z = zfiles; z != NULL; z = z->nxt) {
if (MATCH(p, z->iname, caseflag))
{
z->mark = pcount ? filter(z->zname, caseflag) : 1;
if (verbose)
fprintf(mesg, "zip diagnostic: %scluding %s\n",
z->mark ? "in" : "ex", z->name);
m = 0;
}
}
free((zvoid *)p);
return m ? ZE_MISS : ZE_OK;
}
/* Live name--use if file, recurse if directory */
if ((s.st_mode & S_IFDIR) == 0)
{
/* add or remove name of file */
if ((m = newname(n, 0, caseflag)) != ZE_OK)
return m;
} else {
/* Add trailing / to the directory name */
if ((p = malloc(strlen(n)+2)) == NULL)
return ZE_MEM;
if (strcmp(n, ".") == 0) {
*p = '\0'; /* avoid "./" prefix and do not create zip entry */
} else {
strcpy(p, n);
a = p + strlen(p);
if (a[-1] != '/')
strcpy(a, "/");
if (dirnames && (m = newname(p, 1, caseflag)) != ZE_OK) {
free((zvoid *)p);
return m;
}
}
/* recurse into directory */
if (recurse && (d = opendir(n)) != NULL)
{
while ((e = readd(d)) != NULL) {
if (strcmp(e, ".") && strcmp(e, ".."))
{
if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL)
{
closedir(d);
free((zvoid *)p);
return ZE_MEM;
}
strcat(strcpy(a, p), e);
if ((m = procname(a, caseflag)) != ZE_OK) /* recurse on name */
{
if (m == ZE_MISS)
zipwarn("name not matched: ", a);
else
ziperr(m, a);
}
free((zvoid *)a);
}
}
closedir(d);
}
free((zvoid *)p);
} /* (s.st_mode & S_IFDIR) == 0) */
return ZE_OK;
}
char *ex2in(x, isdir, pdosflag)
char *x; /* external file name */
int isdir; /* input: x is a directory */
int *pdosflag; /* output: force MSDOS file attributes? */
/* Convert the external file name to a zip file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *n; /* internal file name (malloc'ed) */
char *t; /* shortened name */
int dosflag;
dosflag = dosify; /* default for non-DOS and non-OS/2 */
/* Find starting point in name before doing malloc */
for (t = x; *t == '/'; t++)
; /* strip leading '/' chars to get a relative path */
while (*t == '.' && t[1] == '/')
t += 2; /* strip redundant leading "./" sections */
/* Make changes, if any, to the copied name (leave original intact) */
if (!pathput)
t = last(t, PATH_END);
/* Malloc space for internal name and copy it */
if ((n = malloc(strlen(t) + 1)) == NULL)
return NULL;
strcpy(n, t);
if (isdir == 42) return n; /* avoid warning on unused variable */
if (dosify)
msname(n);
/* Returned malloc'ed name */
if (pdosflag)
*pdosflag = dosflag;
return n;
}
char *in2ex(n)
char *n; /* internal file name */
/* Convert the zip file name to an external file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *x; /* external file name */
if ((x = malloc(strlen(n) + 1 + PAD)) == NULL)
return NULL;
strcpy(x, n);
return x;
}
/*
* XXX use ztimbuf in both POSIX and non POSIX cases ?
*/
void stamp(f, d)
char *f; /* name of file to change */
ulg d; /* dos-style time to change it to */
/* Set last updated and accessed time of file f to the DOS time d. */
{
#ifdef _POSIX_VERSION
struct utimbuf u; /* argument for utime() const ?? */
#else
time_t u[2]; /* argument for utime() */
#endif
/* Convert DOS time to time_t format in u */
#ifdef _POSIX_VERSION
u.actime = u.modtime = dos2unixtime(d);
utime(f, &u);
#else
u[0] = u[1] = dos2unixtime(d);
utime(f, u);
#endif
}
ulg filetime(f, a, n, t)
char *f; /* name of file to get info on */
ulg *a; /* return value: file attributes */
long *n; /* return value: file size */
iztimes *t; /* return value: access, modific. and creation times */
/* If file *f does not exist, return 0. Else, return the file's last
modified date and time as an MSDOS date and time. The date and
time is returned in a long with the date most significant to allow
unsigned integer comparison of absolute times. Also, if a is not
a NULL pointer, store the file attributes there, with the high two
bytes being the Unix attributes, and the low byte being a mapping
of that to DOS attributes. If n is not NULL, store the file size
there. If t is not NULL, the file's access, modification and creation
times are stored there as UNIX time_t values.
If f is "-", use standard input as the file. If f is a device, return
a file size of -1 */
{
struct stat s; /* results of stat() */
/* convert FNAMX to malloc - 11/8/04 EG */
char *name;
int len = strlen(f);
if (f == label) {
if (a != NULL)
*a = label_mode;
if (n != NULL)
*n = -2L; /* convention for a label name */
if (t != NULL)
t->atime = t->mtime = t->ctime = label_utim;
return label_time;
}
if ((name = malloc(len + 1)) == NULL) {
ZIPERR(ZE_MEM, "filetime");
}
strcpy(name, f);
if (name[len - 1] == '/')
name[len - 1] = '\0';
/* not all systems allow stat'ing a file with / appended */
if (strcmp(f, "-") == 0) {
if (fstat(fileno(stdin), &s) != 0) {
free(name);
error("fstat(stdin)");
}
} else if (LSSTAT(name, &s) != 0) {
/* Accept about any file kind including directories
* (stored with trailing / with -r option)
*/
free(name);
return 0;
}
free(name);
if (a != NULL) {
*a = ((ulg)s.st_mode << 16) | !(s.st_mode & S_IWRITE);
if ((s.st_mode & S_IFMT) == S_IFDIR) {
*a |= MSDOS_DIR_ATTR;
}
}
if (n != NULL)
*n = (s.st_mode & S_IFMT) == S_IFREG ? s.st_size : -1L;
if (t != NULL) {
t->atime = s.st_atime;
t->mtime = s.st_mtime;
t->ctime = s.st_mtime; /* best guess (s.st_ctime: last status change!) */
}
return unix2dostime(&s.st_mtime);
}
/* ----------------------------------------------------------------------
Return a malloc()'d buffer containing all of the attributes and their names
for the file specified in name. You have to free() this yourself. The length
of the buffer is also returned.
If get_attr_dir() fails, the buffer will be NULL, total_size will be 0,
and an error will be returned:
EOK - no errors occurred
EINVAL - attr_buff was pointing at a buffer
ENOMEM - insufficient memory for attribute buffer
Other errors are possible (whatever is returned by the fs_attr.h functions).
PROBLEMS:
- pointers are 32-bits; attributes are limited to off_t in size so it's
possible to overflow... in practice, this isn't too likely... your
machine will thrash like hell before that happens
*/
#define INITIAL_BUFF_SIZE 65536
int get_attr_dir( const char *name, char **attr_buff, off_t *total_size )
{
int retval = EOK;
int fd;
DIR *fa_dir;
struct dirent *fa_ent;
off_t attrs_size;
off_t this_size;
char *ptr;
struct attr_info fa_info;
struct attr_info big_fa_info;
retval = EOK;
attrs_size = 0; /* gcc still says this is used uninitialized... */
*total_size = 0;
/* ----------------------------------------------------------------- */
/* Sanity-check. */
if( *attr_buff != NULL ) {
return EINVAL;
}
/* ----------------------------------------------------------------- */
/* Can we open the file/directory? */
/* */
/* linkput is a zip global; it's set to 1 if we're storing symbolic */
/* links as symbolic links (instead of storing the thing the link */
/* points to)... if we're storing the symbolic link as a link, we'll */
/* want the link's file attributes, otherwise we want the target's. */
if( linkput ) {
fd = open( name, O_RDONLY | O_NOTRAVERSE );
} else {
fd = open( name, O_RDONLY );
}
if( fd < 0 ) {
return errno;
}
/* ----------------------------------------------------------------- */
/* Allocate an initial buffer; 64k should usually be enough. */
*attr_buff = (char *)malloc( INITIAL_BUFF_SIZE );
ptr = *attr_buff;
if( ptr == NULL ) {
close( fd );
return ENOMEM;
}
/* ----------------------------------------------------------------- */
/* Open the attributes directory for this file. */
fa_dir = fs_fopen_attr_dir( fd );
if( fa_dir == NULL ) {
close( fd );
free( ptr );
*attr_buff = NULL;
return retval;
}
/* ----------------------------------------------------------------- */
/* Read all the attributes; the buffer could grow > 64K if there are */
/* many and/or they are large. */
fa_ent = fs_read_attr_dir( fa_dir );
while( fa_ent != NULL ) {
retval = fs_stat_attr( fd, fa_ent->d_name, &fa_info );
/* TODO: check retval != EOK */
this_size = strlen( fa_ent->d_name ) + 1;
this_size += sizeof( struct attr_info );
this_size += fa_info.size;
attrs_size += this_size;
if( attrs_size > INITIAL_BUFF_SIZE ) {
unsigned long offset = ptr - *attr_buff;
*attr_buff = (char *)realloc( *attr_buff, attrs_size );
if( *attr_buff == NULL ) {
retval = fs_close_attr_dir( fa_dir );
/* TODO: check retval != EOK */
close( fd );
return ENOMEM;
}
ptr = *attr_buff + offset;
}
/* Now copy the data for this attribute into the buffer. */
strcpy( ptr, fa_ent->d_name );
ptr += strlen( fa_ent->d_name );
*ptr++ = '\0';
/* We need to put a big-endian version of the fa_info data into */
/* the archive. */
big_fa_info.type = B_HOST_TO_BENDIAN_INT32( fa_info.type );
big_fa_info.size = B_HOST_TO_BENDIAN_INT64( fa_info.size );
memcpy( ptr, &big_fa_info, sizeof( struct attr_info ) );
ptr += sizeof( struct attr_info );
if( fa_info.size > 0 ) {
ssize_t read_bytes;
read_bytes = fs_read_attr( fd, fa_ent->d_name, fa_info.type, 0,
ptr, fa_info.size );
if( read_bytes != fa_info.size ) {
/* print a warning about mismatched sizes */
char buff[80];
sprintf( buff, "read %ld, expected %ld",
(ssize_t)read_bytes, (ssize_t)fa_info.size );
zipwarn( "attribute size mismatch: ", buff );
}
/* Wave my magic wand... this swaps all the Be types to big- */
/* endian automagically. */
(void)swap_data( fa_info.type, ptr, fa_info.size,
B_SWAP_HOST_TO_BENDIAN );
ptr += fa_info.size;
}
fa_ent = fs_read_attr_dir( fa_dir );
}
/* ----------------------------------------------------------------- */
/* Close the attribute directory. */
retval = fs_close_attr_dir( fa_dir );
/* TODO: check retval != EOK */
/* ----------------------------------------------------------------- */
/* If the buffer is too big, shrink it. */
if( attrs_size < INITIAL_BUFF_SIZE ) {
*attr_buff = (char *)realloc( *attr_buff, attrs_size );
if( *attr_buff == NULL ) {
/* This really shouldn't happen... */
close( fd );
return ENOMEM;
}
}
*total_size = attrs_size;
close( fd );
return EOK;
}
/* ---------------------------------------------------------------------- */
/* Add a 'UT' extra field to the zlist data pointed to by z. */
#define EB_L_UT_SIZE (EB_HEADSIZE + EB_UT_LEN(2))
#define EB_C_UT_SIZE (EB_HEADSIZE + EB_UT_LEN(1))
local int add_UT_ef( struct zlist far *z )
{
char *l_ef = NULL;
char *c_ef = NULL;
struct stat s;
#ifdef IZ_CHECK_TZ
if (!zp_tz_is_valid)
return ZE_OK; /* skip silently if no valid TZ info */
#endif
/* We can't work if there's no entry to work on. */
if( z == NULL ) {
return ZE_LOGIC;
}
/* Check to make sure we've got enough room in the extra fields. */
if( z->ext + EB_L_UT_SIZE > USHRT_MAX ||
z->cext + EB_C_UT_SIZE > USHRT_MAX ) {
return ZE_MEM;
}
/* stat() the file (or the symlink) to get the data; if we can't get */
/* the data, there's no point in trying to fill out the fields. */
if(LSSTAT( z->name, &s ) ) {
return ZE_OPEN;
}
/* Allocate memory for the local and central extra fields. */
if( z->extra && z->ext != 0 ) {
l_ef = (char *)realloc( z->extra, z->ext + EB_L_UT_SIZE );
} else {
l_ef = (char *)malloc( EB_L_UT_SIZE );
z->ext = 0;
}
if( l_ef == NULL ) {
return ZE_MEM;
}
z->extra = l_ef;
l_ef += z->ext;
if( z->cextra && z->cext != 0 ) {
c_ef = (char *)realloc( z->cextra, z->cext + EB_C_UT_SIZE );
} else {
c_ef = (char *)malloc( EB_C_UT_SIZE );
z->cext = 0;
}
if( c_ef == NULL ) {
return ZE_MEM;
}
z->cextra = c_ef;
c_ef += z->cext;
/* Now add the local version of the field. */
*l_ef++ = 'U';
*l_ef++ = 'T';
*l_ef++ = (char)(EB_UT_LEN(2)); /* length of data in local EF */
*l_ef++ = (char)0;
*l_ef++ = (char)(EB_UT_FL_MTIME | EB_UT_FL_ATIME);
*l_ef++ = (char)(s.st_mtime);
*l_ef++ = (char)(s.st_mtime >> 8);
*l_ef++ = (char)(s.st_mtime >> 16);
*l_ef++ = (char)(s.st_mtime >> 24);
*l_ef++ = (char)(s.st_atime);
*l_ef++ = (char)(s.st_atime >> 8);
*l_ef++ = (char)(s.st_atime >> 16);
*l_ef++ = (char)(s.st_atime >> 24);
z->ext += EB_L_UT_SIZE;
/* Now add the central version. */
memcpy(c_ef, l_ef-EB_L_UT_SIZE, EB_C_UT_SIZE);
c_ef[EB_LEN] = (char)(EB_UT_LEN(1)); /* length of data in central EF */
z->cext += EB_C_UT_SIZE;
return ZE_OK;
}
/* ---------------------------------------------------------------------- */
/* Add a 'Ux' extra field to the zlist data pointed to by z. */
#define EB_L_UX2_SIZE (EB_HEADSIZE + EB_UX2_MINLEN)
#define EB_C_UX2_SIZE (EB_HEADSIZE)
local int add_Ux_ef( struct zlist far *z )
{
char *l_ef = NULL;
char *c_ef = NULL;
struct stat s;
/* Check to make sure we've got enough room in the extra fields. */
if( z->ext + EB_L_UX2_SIZE > USHRT_MAX ||
z->cext + EB_C_UX2_SIZE > USHRT_MAX ) {
return ZE_MEM;
}
/* stat() the file (or the symlink) to get the data; if we can't get */
/* the data, there's no point in trying to fill out the fields. */
if(LSSTAT( z->name, &s ) ) {
return ZE_OPEN;
}
/* Allocate memory for the local and central extra fields. */
if( z->extra && z->ext != 0 ) {
l_ef = (char *)realloc( z->extra, z->ext + EB_L_UX2_SIZE );
} else {
l_ef = (char *)malloc( EB_L_UX2_SIZE );
z->ext = 0;
}
if( l_ef == NULL ) {
return ZE_MEM;
}
z->extra = l_ef;
l_ef += z->ext;
if( z->cextra && z->cext != 0 ) {
c_ef = (char *)realloc( z->cextra, z->cext + EB_C_UX2_SIZE );
} else {
c_ef = (char *)malloc( EB_C_UX2_SIZE );
z->cext = 0;
}
if( c_ef == NULL ) {
return ZE_MEM;
}
z->cextra = c_ef;
c_ef += z->cext;
/* Now add the local version of the field. */
*l_ef++ = 'U';
*l_ef++ = 'x';
*l_ef++ = (char)(EB_UX2_MINLEN);
*l_ef++ = (char)(EB_UX2_MINLEN >> 8);
*l_ef++ = (char)(s.st_uid);
*l_ef++ = (char)(s.st_uid >> 8);
*l_ef++ = (char)(s.st_gid);
*l_ef++ = (char)(s.st_gid >> 8);
z->ext += EB_L_UX2_SIZE;
/* Now add the central version of the field. */
*c_ef++ = 'U';
*c_ef++ = 'x';
*c_ef++ = 0;
*c_ef++ = 0;
z->cext += EB_C_UX2_SIZE;
return ZE_OK;
}
/* ---------------------------------------------------------------------- */
/* Add a 'Be' extra field to the zlist data pointed to by z. */
#define EB_L_BE_SIZE (EB_HEADSIZE + EB_L_BE_LEN) /* + attr size */
#define EB_C_BE_SIZE (EB_HEADSIZE + EB_C_BE_LEN)
/* maximum memcompress overhead is the sum of the compression header length */
/* (6 = ush compression type, ulg CRC) and the worstcase deflate overhead */
/* when uncompressible data are kept in 2 "stored" blocks (5 per block = */
/* byte blocktype + 2 * ush blocklength) */
#define MEMCOMPRESS_OVERHEAD (EB_MEMCMPR_HSIZ + EB_DEFLAT_EXTRA)
local int add_Be_ef( struct zlist far *z )
{
char *l_ef = NULL;
char *c_ef = NULL;
char *attrbuff = NULL;
off_t attrsize = 0;
char *compbuff = NULL;
ush compsize = 0;
uch flags = 0;
/* Check to make sure we've got enough room in the extra fields. */
if( z->ext + EB_L_BE_SIZE > USHRT_MAX ||
z->cext + EB_C_BE_SIZE > USHRT_MAX ) {
return ZE_MEM;
}
/* Attempt to load up a buffer full of the file's attributes. */
{
int retval;
retval = get_attr_dir( z->name, &attrbuff, &attrsize );
if( retval != EOK ) {
return ZE_OPEN;
}
if( attrsize == 0 ) {
return ZE_OK;
}
if( attrbuff == NULL ) {
return ZE_LOGIC;
}
/* Check for way too much data. */
if( attrsize > (off_t)ULONG_MAX ) {
zipwarn( "uncompressed attributes truncated", "" );
attrsize = (off_t)(ULONG_MAX - MEMCOMPRESS_OVERHEAD);
}
}
if( verbose ) {
printf( "\t[in=%lu]", (unsigned long)attrsize );
}
/* Try compressing the data */
compbuff = (char *)malloc( (size_t)attrsize + MEMCOMPRESS_OVERHEAD );
if( compbuff == NULL ) {
return ZE_MEM;
}
compsize = memcompress( compbuff,
(size_t)attrsize + MEMCOMPRESS_OVERHEAD,
attrbuff,
(size_t)attrsize );
if( verbose ) {
printf( " [out=%u]", compsize );
}
/* Attempt to optimise very small attributes. */
if( compsize > attrsize ) {
free( compbuff );
compsize = (ush)attrsize;
compbuff = attrbuff;
flags = EB_BE_FL_NATURAL;
}
/* Check to see if we really have enough room in the EF for the data. */
if( ( z->ext + compsize + EB_L_BE_LEN ) > USHRT_MAX ) {
compsize = USHRT_MAX - EB_L_BE_LEN - z->ext;
}
/* Allocate memory for the local and central extra fields. */
if( z->extra && z->ext != 0 ) {
l_ef = (char *)realloc( z->extra, z->ext + EB_L_BE_SIZE + compsize );
} else {
l_ef = (char *)malloc( EB_L_BE_SIZE + compsize );
z->ext = 0;
}
if( l_ef == NULL ) {
return ZE_MEM;
}
z->extra = l_ef;
l_ef += z->ext;
if( z->cextra && z->cext != 0 ) {
c_ef = (char *)realloc( z->cextra, z->cext + EB_C_BE_SIZE );
} else {
c_ef = (char *)malloc( EB_C_BE_SIZE );
z->cext = 0;
}
if( c_ef == NULL ) {
return ZE_MEM;
}
z->cextra = c_ef;
c_ef += z->cext;
/* Now add the local version of the field. */
*l_ef++ = 'B';
*l_ef++ = 'e';
*l_ef++ = (char)(compsize + EB_L_BE_LEN);
*l_ef++ = (char)((compsize + EB_L_BE_LEN) >> 8);
*l_ef++ = (char)((unsigned long)attrsize);
*l_ef++ = (char)((unsigned long)attrsize >> 8);
*l_ef++ = (char)((unsigned long)attrsize >> 16);
*l_ef++ = (char)((unsigned long)attrsize >> 24);
*l_ef++ = flags;
memcpy( l_ef, compbuff, (size_t)compsize );
z->ext += EB_L_BE_SIZE + compsize;
/* And the central version. */
*c_ef++ = 'B';
*c_ef++ = 'e';
*c_ef++ = (char)(EB_C_BE_LEN);
*c_ef++ = (char)(EB_C_BE_LEN >> 8);
*c_ef++ = (char)compsize;
*c_ef++ = (char)(compsize >> 8);
*c_ef++ = (char)(compsize >> 16);
*c_ef++ = (char)(compsize >> 24);
*c_ef++ = flags;
z->cext += EB_C_BE_SIZE;
return ZE_OK;
}
/* Extra field info:
- 'UT' - UNIX time extra field
- 'Ux' - UNIX uid/gid extra field
- 'Be' - BeOS file attributes extra field
This is done the same way ../unix/unix.c stores the 'UT'/'Ux' fields
(full data in local header, only modification time in central header),
with the 'Be' field added to the end and the size of the 'Be' field
in the central header.
See the end of beos/osdep.h for a simple explanation of the 'Be' EF
layout.
*/
int set_extra_field(z, z_utim)
struct zlist far *z;
iztimes *z_utim;
/* store full data in local header but just modification time stamp info
in central header */
{
int retval;
/* Tell picky compilers to shut up about unused variables. */
z_utim = z_utim;
/* Check to make sure z is valid. */
if( z == NULL ) {
return ZE_LOGIC;
}
/* This function is much simpler now that I've moved the extra fields */
/* out... it simplified the 'Be' code, too. */
retval = add_UT_ef( z );
if( retval != ZE_OK ) {
return retval;
}
retval = add_Ux_ef( z );
if( retval != ZE_OK ) {
return retval;
}
retval = add_Be_ef( z );
if( retval != ZE_OK ) {
return retval;
}
return ZE_OK;
}
/* ---------------------------------------------------------------------- */
/* Set a file's MIME type. */
void setfiletype( const char *file, const char *type )
{
int fd;
attr_info fa;
ssize_t wrote_bytes;
fd = open( file, O_RDWR );
if( fd < 0 ) {
zipwarn( "can't open zipfile to write file type", "" );
return;
}
fa.type = B_MIME_STRING_TYPE;
fa.size = (off_t)(strlen( type ) + 1);
wrote_bytes = fs_write_attr( fd, BE_FILE_TYPE_NAME, fa.type, 0,
type, fa.size );
if( wrote_bytes != (ssize_t)fa.size ) {
zipwarn( "couldn't write complete file type", "" );
}
close( fd );
}
int deletedir(d)
char *d; /* directory to delete */
/* Delete the directory *d if it is empty, do nothing otherwise.
Return the result of rmdir(), delete(), or system().
For VMS, d must be in format [x.y]z.dir;1 (not [x.y.z]).
*/
{
# ifdef NO_RMDIR
/* code from Greg Roelofs, who horked it from Mark Edwards (unzip) */
int r, len;
char *s; /* malloc'd string for system command */
len = strlen(d);
if ((s = malloc(len + 34)) == NULL)
return 127;
sprintf(s, "IFS=\" \t\n\" /bin/rmdir %s 2>/dev/null", d);
r = system(s);
free(s);
return r;
# else /* !NO_RMDIR */
return rmdir(d);
# endif /* ?NO_RMDIR */
}
#endif /* !UTIL */
/******************************/
/* Function version_local() */
/******************************/
void version_local()
{
static ZCONST char CompiledWith[] = "Compiled with %s%s for %s%s%s%s.\n\n";
printf(CompiledWith,
#ifdef __MWERKS__
"Metrowerks CodeWarrior", "",
#else
# ifdef __GNUC__
"gcc ", __VERSION__,
# endif
#endif
"BeOS",
#ifdef __POWERPC__
" (PowerPC)",
#else
# ifdef __INTEL__
" (x86)",
# else
" (UNKNOWN!)",
# endif
#endif
#ifdef __DATE__
" on ", __DATE__
#else
"", ""
#endif
);
} /* end function version_local() */

View file

@ -1,59 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <support/Errors.h> /* for B_NO_ERROR */
#define USE_EF_UT_TIME /* Enable use of "UT" extra field time info */
#define EB_L_BE_LEN 5 /* min size is an unsigned long and flag */
#define EB_C_BE_LEN 5 /* Length of data in local EF and flag. */
#define EB_BE_FL_NATURAL 0x01 /* data is 'natural' (not compressed) */
#define EB_BE_FL_BADBITS 0xfe /* bits currently undefined */
#ifndef ZP_NEED_MEMCOMPR
# define ZP_NEED_MEMCOMPR
#endif
/* Set a file's MIME type. */
#define BE_FILE_TYPE_NAME "BEOS:TYPE"
void setfiletype( const char *file, const char *type );
/*
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_NATURAL = 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_NATURAL, 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_L_BE_LEN ) bytes of data, and full_size
should equal ( ef_size - EB_L_BE_LEN ).
If the data is compressed, there will be ( ef_size - EB_L_BE_LEN ) 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 (big-endian)
attr_data (length in attr_info.size)
*/

View file

@ -1,19 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#ifndef O_RDONLY
# include <fcntl.h>
#endif
#define fhow O_RDONLY
#define fbad (-1)
typedef int ftype;
#define zopen(n,p) open(n,p)
#define zread(f,b,n) read(f,b,n)
#define zclose(f) close(f)
#define zerr(f) (k == (extent)(-1L))
#define zstdin 0

View file

@ -1,258 +0,0 @@
HOW TO ADD BZIP2 SUPPORT TO ZIP
This document describes how to add bzip2 support to Zip.
Compiling or linking in the bzip2 library adds an additional bzip2
compression method to Zip. This new method can be selected instead
of the Zip traditional compression method deflation to compress files
and often gives a better compression ratio (perhaps at the cost of
greater CPU time). The compression method is specified using the
"-Z method" command-line option, where "method" may be either "deflate"
(the default), or "bzip2" (if Zip is built with bzip2 support). Zip
has been tested with bzip2 library 1.0.5 and earlier.
Notes
Compression method bzip2 requires a modern unzip. Before using bzip2
compression in Zip, verify that a modern UnZip program with bzip2 support
will be used to read the resulting zip archive so that entries compressed
with bzip2 (compression method 12) can be read. Older unzips probably
won't recognize the compression method and will skip those entries.
The Zip source kit does not include the bzip2 library or source files, but
these can be found at "http://www.bzip.org/" for example. See below for
how to add bzip2 to Zip for various operating systems.
Zip using bzip2 compression is not compatible with the bzip2 application,
but instead provides an additional way to compress files before adding
them to a Zip archive. It does not replace the bzip2 program itself,
which creates bzip2 archives in a different format that are not
compatible with zip or unzip.
The bzip2 code and algorithms are provided under the bzip2 license
(provided in the bzip2 source kit) and what is not covered by that license
is covered under the Info-ZIP license. Info-ZIP will look at issues
involving the use of bzip2 compression in Zip, but any questions about
the bzip2 code and algorithms or bzip2 licensing, for example, should be
directed to the bzip2 maintainer.
Installation
To build Zip with bzip2 support, Zip generally needs one bzip2 header
file, "bzlib.h", and the object library, typically "libbz2.a", except
in cases where the source files are compiled in directly. If you
are either compiling the bzip2 library or compiling in the bzip2
source files, we recommend defining the C macro BZ_NO_STDIO, which
excludes a lot of standalone error code (not used when bzip2 is
used as a library and makes the library smaller) and provides hooks
that Zip can use to provide better error handling. However, a
standard bzip2 object library will work, though any errors that bzip2
generates may be more cryptic.
Building the bzip2 library from the bzip2 source files (recommended):
Download the latest bzip2 package (from "http://www.bzip.org/", for
example).
Unpack the bzip2 source kit (bzip2-1.0.5.tar.gz was current as of
this writing, but the latest should work).
Read the README file in the bzip2 source kit.
Compile the bzip2 library for your OS, preferably defining
BZ_NO_STDIO. Note: On UNIX systems, this may be done automatically
when building Zip, as explained below.
Installation on UNIX (see below for installation on other systems):
Note: Zip on UNIX uses the "bzlib.h" include file and the compiled
"libbz2.a" library to static link to bzip2. Currently we do not
support using the shared library (patches welcome).
The easiest approach may be to drop the two above files in the
bzip2 directory of the Zip source tree and build Zip using the
"generic" target, that is, using a command like
make -f unix/Makefile generic
If all goes well, make should confirm that it found the files and
will be compiling in bzip2 by setting the BZIP2_SUPPORT flag and
then including the libraries while compiling and linking Zip.
To use bzlib.h and libbz2.a from somewhere else on your system,
define the "make" macro IZ_BZIP2 to point to that directory. For
example:
make -f unix/Makefile generic IZ_BZIP2=/mybz2
where /mybz2 might be "/usr/local/src/bzip2/bzip2-1.0.5" on some
systems. Only a compiled bzip2 library can be pointed to using
IZ_BZIP2 and Zip will not compile bzip2 source in other than the
bzip2 directory.
If IZ_BZIP2 is not defined, Zip will look for the bzip2 files in
the "bzip2" directory in the Zip source directory. The bzip2
directory is empty in the Zip source distribution (except for
this install.txt file) and is provided as a place to put the
bzip2 files. To use this directory, either drop bzlib.h and
libbz2.a in it to use the compiled library as noted above or drop
the contents of the bzip2 source kit in this directory so that
bzlib.h is directly in the bzip2 directory and Zip will try to
compile it if no compiled library is already there.
Unpacking bzip2 so Zip compiles it:
To make this work, the bzip2 source kit must be unpacked directly
into the Zip "bzip2" directory. For example:
# Unpack the Zip source kit.
gzip -cd zip30.tar-gz | tar xfo -
# Move down to the Zip kit's "bzip2" directory, ...
cd zip30/bzip2
# ... and unpack the bzip2 source kit there.
gzip -cd ../../bzip2-1.0.5.tar.gz | tar xfo -
# Move the bzip2 source files up to the Zip kit's bzip2 directory.
cd bzip2-1.0.5
mv * ..
# Return to the Zip source kit directory, ready to build.
cd ../..
# Build Zip.
make -f unix/Makefile generic
Using a system bzip2 library:
If IZ_BZIP2 is not defined and both a compiled library and the bzip2
source files are missing from the Zip bzip2 directory, Zip will test
to see if bzip2 is globally defined on the system in the default
include and library paths and, if found, link in the system bzip2
library. This is automatic.
Preventing inclusion of bzip2:
To build Zip with _no_ bzip2 support on a system where the automatic
bzip2 detection scheme will find bzip2, you can specify a bad
IZ_BZIP2 directory. For example:
make -f unix/Makefile generic IZ_BZIP2=no_such_directory
You can also define NO_BZIP2_SUPPORT to exclude bzip2.
Verifying bzip2 support in Zip:
When the Zip build is complete, verify that bzip2 support has been
enabled by checking the feature list:
./zip -v
If all went well, bzip2 (and its library version) should be listed.
Installation on other systems
MSDOS:
Thanks to Robert Riebisch, the DJGPP 2.x Zip port now supports bzip2.
To include bzip2, first install bzip2. The new msdos/makebz2.dj2
makefile then looks in the standard bzip2 installation directories
for the needed files. As he says:
It doesn't try to be clever about finding libbz2.a. It just
expects bzip2 stuff installed to the default include and library
folders, e.g., "C:\DJGPP\include" and "C:\DJGPP\lib" on DOS.
Given a standard DJGPP 2.x installation, this should create a
version of Zip 3.0 with bzip2 support.
The bzip2 library for DJGPP can be found on any DJGPP mirror in
"current/v2apps" (or "beta/v2apps/" for the latest beta). This
library has been ported to MSDOS/DJGPP by Juan Manuel Guerrero.
WIN32 (Windows NT/2K/XP/2K3/... and Windows 95/98/ME):
For Windows there seems to be two approaches, either use bzip2
as a dynamic link library or compile the bzip2 source in directly.
I have not gotten the static library libbz2.lib to work, but that
may be me.
Using bzip2 as a dynamic link library:
Building bzip2:
If you have the needed bzlib.h, libbz2.lib, and libbz2.dll files
you can skip building bzip2. If not, open the libbz2.dsp project
and build libbz2.dll
This creates
debug/libbz2.lib
and
libbz2.dll
Building Zip:
Copy libbz2.lib to the bzip2 directory in the Zip source tree. This
is needed to compile Zip with bzip2 support. Also copy the matching
bzlib.h from the bzip2 source to the same directory.
Add libbz2.lib to the link list for whatever you are building. Also
define the compiler define BZIP2_SUPPORT.
Build Zip.
Using Zip with bzip2 as dll:
Put libbz2.dll in your command path. This is needed to run Zip with
bzip2 support.
Verify that bzip2 is enabled with the command
zip -v
You should see bzip2 listed.
Compiling in bzip2 from the bzip2 source:
This approach compiles in the bzip2 code directly. No external
library is needed.
Get a copy of the bzip2 source and copy the contents to the bzip2
directory in the Zip source tree so that bzlib.h is directly in
the bzip2 directory.
Use the vc6bz2 project to build Zip. This project knows of the
added bzip2 files.
Verify that bzip2 is enabled with the command
zip -v
Windows DLL (WIN32):
Nothing yet.
Mac OS X:
Follow the standard UNIX build procedure. Mac OS X includes bzip2
and the UNIX builders should find the bzip2 files in the standard
places. Note that the version of bzip2 on your OS may not be
current and you can instead specify a different library or compile
your own bzip2 library as noted in the Unix procedures above.
OS/2:
Nothing yet.
VMS (OpenVMS):
See [.vms]install_vms.txt for how to enable bzip2 support on VMS.
Last updated 26 March 2007, 15 July 2007, 9 April 2008, 27 June 2008
S. Schweda, E. Gordon

View file

@ -1,434 +0,0 @@
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

View file

@ -1,92 +0,0 @@
Thank you for trying this first port of ZIP for VM/CMS and MVS!
Using under MVS:
---------------------------
1. To use the Info-ZIP's ZIP 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 zip22.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 youruserid.ZIP.C
- Copy all the .H files in the PDS called youruserid.ZIP.H
- adjust the job ZIPMVSC.JOB to work on your size. Change my
userid - C888090 to yours
- execute the job ZIPMVSC to compile and link all the sources.
- maybe you have to preallocate PDS datasets named:
youruserid.ZIP.OBJ and youruserid.ZIP.LOAD
- execute ZIPVMC to compile and link all the sources.
- if everything is ok you will get an ZIP MODULE
- the warnings about the duplicated ASCII and EBCDIC symbols
are OK :-)
3. Using ZIP
- Just read MANUAL
- A few exceptions concerning MVS
3.1. if you want to make a portable zip file that is to be unzipped
on ASCII based systems use the -a option
3.2. If you want to zip the input files as binary ebcdic files
use the -B (capital letter) option
3.3. The date/end the time of the input files is set in the zip's
dir to the current system date/time
3.4. Without specifying the "-a" or "-B" option, the ZIP program
defaults to "native" (EBCDIC) mode and tries to preserve the
file information (LRECL,BLKSIZE..)
So when you UNZIP a file zipped with ZIP under VM/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 as input file names:
So you CAN'T use things like: zip myzip *.c
3.6. You can use DD names for zipfilename for example:
under tso/rexx:
"alloc fi(input) da('myzip.zip')"
"zip dd:input file1.txt file2.txt ..."
under Batch:
//MYZIP JOB (account)
//STEP1 EXEC PGM=ZIP,PARM='dd:input file1.txt file2.txt'
//STEPLIB DD DSN=userid.UNZIP.LOAD,DISP=SHR
//INPUT DD DSN=userid.MYZIP.ZIP,DISP=NEW,
// SPACE=(15000,(15000,10000),RLSE),
// DCB=(LRECL=80,RECFM=F)
//SYSPRINT DD SYSOUT=*
Please report all bugs and problems to :
zip-bugs@lists.wku.edu
That's all for now.
Have fun!
George Petrov

View file

@ -1,286 +0,0 @@
Notes on Zip under MVS Language Environment (LE).
First see README.MVS. This note describes just one beta test on OS/390
V2R5 using IBM's C compiler (5647A01), V2R4. The major difference is
the use of LE on the beta site, together with some MVS native mode
fixes. Changes have not been tested on CMS.
Some of the notes are to clarify things that were not clear from the
MANUAL or README.MVS.
1. By default, IBM C generates the same csect name for each input
source. The prelink stage does not rename them and the linkage
editor throws away all but the first occurrence of each duplicate.
Oops, my code just disappeared :(.
To get around this "feature", compile with the CSECT option to
force sensible names on the code and data sections of each csect.
The name of the static data csect defaults to the source name in
lower case, the code csect defaults to the source name in upper
case. These csect names still have to be unique, they cannot be
the same as function names. Of course, several csects have a
function which is the same name as the source in lower case, not
exactly an unusual occurrence. Therefore to make the csect name
unique, some of the sources have
#ifdef MVS
# pragma csect(STATIC,xxxx_s)
#endif
Where xxxx is an abbreviation of the source name. There has to be
a better way!
2. The prelink step always gets cond code 4. It complains about
unresolved references, ignore it unless the linker also complains.
Prelink also complains about duplicate @@PPA2 sections and so does
the linker, but it seems to do no harm. Compile and link steps
should get 0, just prelink gets 4. See JCL at the bottom.
3. Under MVS native mode (not Open Edition), tmpnam() returns a quoted
name of 5 qualifiers. The first is a HLQ chosen according to the
MVS LE algorithm (see below), the other qualifiers are time stamps.
If running on MVS and tmpnam() returns a quoted name with at leat
one '.', it is only safe to let the user change the high level
qualifier. Therefore -b insists on a single qualifier without '.'
in the MVS native environment.
4. In Open Edition (OE) mode, the manual says that tmpnam() returns a
fully qualified name in directory TMPDIR or /tmp if TMPDIR is not
set. There is no point in zip trying to override that name so -b
is ignored in MVS OE mode (untested). The user should specify
environment variable TMPDIR instead.
5. The MVS LE algorithm for choosing the high level qualifier for
native filenames is interesting, as in "May you live in interesting
times". The HLQ varies according to the environment the program is
running in, sometimes it is userid, sometimes it is TSO prefix.
See OS/390 C/C++ Programming Guide, Using a Data Set Name,
somewhere around section 2.9.
If in doubt, use fully qualified and quoted names. Instead of
archive.zip, use 'prefix.archive.zip'. For input files, instead of
filename, use 'prefix.filename'. For PARM= in JCL, double up the
quotes. You even have to quote filenames in stdin.
6. If your PARM includes any '/', make sure the PARM starts with '/'.
LE assumes anything before the first '/' is LE run time parameters.
It does no harm to always code a leading '/' for LE parms.
7. JCL limits a PARM= to 100 characters total with approx. 65 on a
single line. Alas the syntax for continuing PARM= always embeds an
extra ',' somewhere in the parameters that the program finally
gets. No workaround, limit your PARM to a single line. With the
extra quotes around filenames, that does not leave much room. In
most cases, you will have to use '-@' to read the list of filenames
from SYSIN (stdin), it will not fit on a single PARM line.
8. Filenames can be dataset names or you can refer to a ddname with
'DD:name', case insensitive for external files, case sensitive for
OE files. You can even specify 'dd:name(mem)'. No wildcards, to
zip a complete pds you have to specify each member individually.
Directory recursion in OE does not appear to work at the moment.
9. Zip attempts to map MVS filenames to Unix style names. It did not
work correctly for quoted names, fixed. Although you can pick up
an external (non-OE) file with a name using any case, be aware that
the mapping to a Unix style name faithfully follows the case you
supply.
10. The archive file was being created with recfm=V and lrecl=32760.
32760 is not valid for recfm=V under MVS, I originally changed it
to lrecl=32756. Then zip broke trying to fseek() over a record
boundary, I do not know whether this was a zip or LE bug. Trial
and error showed that recfm=U with byteseek seems to work on MVS.
No BDW or RDW, just a byte stream. The blocksize is always 6144.
NOTE: This is an incompatible change from the previous beta,
archive files used to be recfm=V. That should not matter
because we just transfer the data, ignoring BDW and RDW
anyway.
11. Zip used to complain about preallocated but empty archives, wrong
length records, no signature etc. The usual IBM/360 problem of no
end of file marker in a new, unopened dataset. Fixed, see routine
readzipfile in zipfile.c for the gory details. PARM= works fine.
12. Several source files have records that are more than 80 bytes long.
It works if you transfer to mainframe datasets with a larger lrecl,
I used recfm=fb,lrecl=120 for the .C and .H files. To compile with
anything longer than 72 bytes, you need MVS C options NOMARGINS and
NOSEQUENCE (NOMAR,NOSEQ).
13. cmsmvs was still using zname instead of name for open. Fixed.
14. zip has to jump through a lot of hoops to see if an existing
zipfile actually contains data. A side effect of this is that
creating a zipfile with the RLSE parameter is a waste of time.
Keith Owens <kaos@ocs.com.au>. Not a maintainer, just a beta tester.
Mon Sep 14 19:31:30 EST 1998
Sample JCL to compile Zip under MVS LE. You might need a large region,
I used REGION=128M on the job card. Also watch the output lines,
75,000 with OPT(2), 100,000+ with OPT(2) replaced with DEF(DEBUG). You
need to allocate prefix.ZIP.C.OBJ (recfm=FB, lrecl=80) and
prefix.ZIP.LOAD (recfm=U, blksize is site defined).
//CBC JCLLIB ORDER=CBC.SCBCPRC
//ZIP EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
// INFILE='prefix.ZIP.C(ZIP)',
// OUTFILE='prefix.ZIP.C.OBJ(ZIP),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
//CRYPT EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
// INFILE='prefix.ZIP.C(CRYPT)',
// OUTFILE='prefix.ZIP.C.OBJ(CRYPT),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
//TTYIO EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
// INFILE='prefix.ZIP.C(TTYIO)',
// OUTFILE='prefix.ZIP.C.OBJ(TTYIO),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
//TREES EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
// INFILE='prefix.ZIP.C(TREES)',
// OUTFILE='prefix.ZIP.C.OBJ(TREES),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
//DEFLATE EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
// INFILE='prefix.ZIP.C(DEFLATE)',
// OUTFILE='prefix.ZIP.C.OBJ(DEFLATE),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
//FILEIO EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
// INFILE='prefix.ZIP.C(FILEIO)',
// OUTFILE='prefix.ZIP.C.OBJ(FILEIO),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
//GLOBALS EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
// INFILE='prefix.ZIP.C(GLOBALS)',
// OUTFILE='prefix.ZIP.C.OBJ(GLOBALS),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
//UTIL EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
// INFILE='prefix.ZIP.C(UTIL)',
// OUTFILE='prefix.ZIP.C.OBJ(UTIL),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
//CRC32 EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
// INFILE='prefix.ZIP.C(CRC32)',
// OUTFILE='prefix.ZIP.C.OBJ(CRC32),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
//CRCTAB EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
// INFILE='prefix.ZIP.C(CRCTAB)',
// OUTFILE='prefix.ZIP.C.OBJ(CRCTAB),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
//ZIPFILE EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
// INFILE='prefix.ZIP.C(ZIPFILE)',
// OUTFILE='prefix.ZIP.C.OBJ(ZIPFILE),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
//ZIPUP EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
// INFILE='prefix.ZIP.C(ZIPUP)',
// OUTFILE='prefix.ZIP.C.OBJ(ZIPUP),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
//CMSMVS EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
// INFILE='prefix.ZIP.C(CMSMVS)',
// OUTFILE='prefix.ZIP.C.OBJ(CMSMVS),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
//MVS EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
// INFILE='prefix.ZIP.C(MVS)',
// OUTFILE='prefix.ZIP.C.OBJ(MVS),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
// CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
//PLINK EXEC PROC=EDCPL,
// OUTFILE='prefix.ZIP.LOAD(ZIP),DISP=SHR',
// PREGSIZ=6M,
// PPARM='NONCAL,MAP,MEMORY',
// LPARM='LIST,MAP,XREF'
//PLKED.SYSIN DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(ZIP)
// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(CRYPT)
// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(TREES)
// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(DEFLATE)
// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(FILEIO)
// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(GLOBALS)
// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(UTIL)
// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(CRC32)
// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(CRCTAB)
// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(ZIPFILE)
// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(ZIPUP)
// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(MVS)
// DD DISP=SHR,DSN=prefix.ZIP.C.OBJ(CMSMVS)
//LKED.SYSLIB DD DISP=SHR,DSN=CEE.SCEELKED
//SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(2,2))
//
Sample JCL to zip the mainframe .C and .H files as ASCII (-a). Delete
any existing archive first, point the temporary file at a particular
prefix (-b), use 'prefix.ARCHIVE.ZIP' for the archive file, read the
list of files to zip from stdin (SYSIN).
//DELETE EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE prefix.ARCHIVE.ZIP
SET MAXCC = 0
//ZIP EXEC PGM=ZIP,
// PARM='/-a -v -b temppref ''prefix.ARCHIVE.ZIP'' -@'
//STEPLIB DD DSN=prefix.ZIP.LOAD,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//CEEDUMP DD SYSOUT=*
//ZIPC DD DISP=SHR,DSN=prefix.ZIP.C
//ZIPH DD DISP=SHR,DSN=prefix.ZIP.H
//SYSIN DD *
dd:zipc(api)
dd:zipc(cms)
dd:zipc(cmsmvs)
dd:zipc(crctab)
dd:zipc(crc32)
dd:zipc(crypt)
dd:zipc(deflate)
dd:zipc(fileio)
dd:zipc(globals)
dd:zipc(mktime)
dd:zipc(mvs)
dd:zipc(trees)
dd:zipc(ttyio)
dd:zipc(util)
dd:zipc(zip)
dd:zipc(zipcloak)
dd:zipc(zipfile)
dd:zipc(zipnote)
dd:zipc(zipsplit)
dd:zipc(zipup)
dd:ziph(api)
dd:ziph(cmsmvs)
dd:ziph(crypt)
dd:ziph(cstat)
dd:ziph(ebcdic)
dd:ziph(mvs)
dd:ziph(revision)
dd:ziph(stat)
dd:ziph(tailor)
dd:ziph(ttyio)
dd:ziph(zip)
dd:ziph(ziperr)
dd:ziph(zipup)

View file

@ -1,123 +0,0 @@
/* CCZIP EXEC Compile zip 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.
globals.c and cmsmvs.c require EXTENDED features */
CCopts = 'LONGNAME RENT LANGLVL(EXTENDED) NOEXECOPS'
/* ZIP 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'
/* resources needed to build */
'GLOBAL TXTLIB SCEELKED CMSLIB'
'GLOBAL LOADLIB SCEERUN'
/* produce the TEXT (object) files */
linklist=''
modname='ZIP'
Say 'Building' modname 'MODULE...'
Call Compile 'ZIP'
Call Compile 'CRC32'
Call Compile 'CRYPT'
Call Compile 'DEFLATE'
Call Compile 'FILEIO'
Call Compile 'GLOBALS'
Call Compile 'TREES'
Call Compile 'TTYIO'
Call Compile 'UTIL'
Call Compile 'ZIPUP'
Call Compile 'ZIPFILE'
Call Compile 'CMSMVS'
Call Compile 'CMS'
Say 'Linking...'
'EXEC CMOD' linklist '(MODNAME' modname LINKopts
Say modname 'built successfully.'
/*---------------------------------------------------------------------*/
/* Build utility programs */
/*---------------------------------------------------------------------*/
CCopts = CCopts 'DEFINE(UTIL)'
linklist=''
modname='ZIPNOTE'
Say
Say 'Building' modname 'MODULE...'
Call Compile 'ZIPNOTE'
Call Compile 'ZIPFILE'
Call Compile 'FILEIO'
Call Compile 'UTIL'
Call Compile 'GLOBALS'
Call Compile 'CMSMVS'
Say 'Linking...'
'EXEC CMOD' linklist '(MODNAME' modname LINKopts
Say modname 'built successfully.'
linklist=''
modname='ZIPSPLIT'
Say
Say 'Building' modname 'MODULE...'
Call Compile 'ZIPSPLIT'
Call Compile 'ZIPFILE'
Call Compile 'FILEIO'
Call Compile 'UTIL'
Call Compile 'GLOBALS'
Call Compile 'CMSMVS'
Say 'Linking...'
'EXEC CMOD' linklist '(MODNAME' modname LINKopts
Say modname 'built successfully.'
linklist=''
modname='ZIPCLOAK'
Say
Say 'Building' modname 'MODULE...'
Call Compile 'ZIPCLOAK'
Call Compile 'ZIPFILE'
Call Compile 'FILEIO'
Call Compile 'UTIL'
Call Compile 'GLOBALS'
Call Compile 'CRC32'
Call Compile 'CRYPT'
Call Compile 'TTYIO'
Call Compile 'CMSMVS'
Say 'Linking...'
'EXEC CMOD' linklist '(MODNAME' modname LINKopts
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

View file

@ -1,34 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
/*
* VM/CMS specific things.
*/
#include "zip.h"
int procname(n, caseflag)
char *n; /* name to process */
int caseflag; /* true to force case-sensitive match */
/* Process a name or sh expression to operate on (or exclude). Return
an error code in the ZE_ class. */
{
FILE *stream;
if (strcmp(n, "-") == 0) /* if compressing stdin */
return newname(n, 0, caseflag);
else {
if ((stream = fopen(n, "r")) != (FILE *)NULL)
{
fclose(stream);
return newname(n, 0, caseflag);
}
else return ZE_MISS;
}
return ZE_OK;
}

View file

@ -1,442 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
/*
* routines common to VM/CMS and MVS
*/
#include "zip.h"
#include <stdio.h>
#include <time.h>
#include <errno.h>
#ifndef MVS /* MVS has perfectly good definitions of the following */
int stat(const char *path, struct stat *buf)
{
if ((buf->fp = fopen(path, "r")) != NULL) {
fldata_t fdata;
if (fldata( buf->fp, buf->fname, &fdata ) == 0) {
buf->st_dev = fdata.__device;
buf->st_mode = *(short *)(&fdata);
}
strcpy( buf->fname, path );
fclose(buf->fp);
}
return (buf->fp != NULL ? 0 : 1);
}
#endif /* MVS */
#ifndef UTIL /* the companion #endif is a bit of ways down ... */
#define PAD 0
#define PATH_END '/'
/* Library functions not in (most) header files */
#ifdef USE_ZIPMAIN
int main OF((void));
#endif
int utime OF((char *, ztimbuf *));
extern char *label;
local ulg label_time = 0;
local ulg label_mode = 0;
local time_t label_utim = 0;
#ifndef MVS /* MVS has perfectly good definitions of the following */
int fstat(int fd, struct stat *buf)
{
fldata_t fdata;
if ((fd != -1) && (fldata( (FILE *)fd, buf->fname, &fdata ) == 0)) {
buf->st_dev = fdata.__device;
buf->st_mode = *(short *)(&fdata);
buf->fp = (FILE *)fd;
return 0;
}
return -1;
}
#endif /* MVS */
char *ex2in(x, isdir, pdosflag)
char *x; /* external file name */
int isdir; /* input: x is a directory */
int *pdosflag; /* output: force MSDOS file attributes? */
/* Convert the external file name to a zip file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *n; /* internal file name (malloc'ed) */
char *t; /* shortened name */
int dosflag;
char mem[10] = ""; /* member name */
char ext[10] = ""; /* extension name */
dosflag = dosify; /* default for non-DOS non-OS/2 */
/* Find starting point in name before doing malloc */
for (t = x; *t == '/'; t++)
;
/* Make changes, if any, to the copied name (leave original intact) */
if (!pathput)
t = last(t, PATH_END);
/* Malloc space for internal name and copy it */
if ((n = malloc(strlen(t) + 1)) == NULL)
return NULL;
strcpy(n, t);
#ifdef MVS
/* strip quotes from name, non-OE format */
if (*n == '\'' && (t = strrchr(n, '\'')) != n) {
if (!*(t+1)) {
/* yes, it is a quoted name */
int l = strlen(n) - 2;
memmove(n, n+1, l);
*(n+l) = '\0';
}
}
/* Change member names to fn.ext */
if (t = strrchr(n, '(')) {
*t = '\0';
strcpy(mem,t+1); /* Save member name */
if (t = strchr(mem, ')')) *t = '\0'; /* Set end of mbr */
/* Save extension */
if (t = strrchr(n, '.')) t++;
else t = n;
strcpy(ext,t);
/* Build name as "member.ext" */
strcpy(t,mem);
strcat(t,".");
strcat(t,ext);
}
/* Change all but the last '.' to '/' */
if (t = strrchr(n, '.')) {
while (--t > n)
if (*t == '.')
*t = '/';
}
#else
/* On CMS, remove the filemode (all past 2nd '.') */
if (t = strchr(n, '.'))
if (t = strchr(t+1, '.'))
*t = '\0';
t = n;
#endif
strcpy(n, t);
if (isdir == 42) return n; /* avoid warning on unused variable */
if (dosify)
msname(n); /* msname() needs string in native charset */
strtoasc(n, n);
/* Returned malloc'ed name */
if (pdosflag)
*pdosflag = dosflag;
return n;
}
char *in2ex(n)
char *n; /* internal file name */
/* Convert the zip file name to an external file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *x; /* external file name */
if ((x = malloc(strlen(n) + 1 + PAD)) == NULL)
return NULL;
strtoebc(x, n);
return x;
}
void stamp(f, d)
char *f; /* name of file to change */
ulg d; /* dos-style time to change it to */
/* Set last updated and accessed time of file f to the DOS time d. */
{
ztimbuf u; /* argument for utime() */
/* Convert DOS time to time_t format in u.actime and u.modtime */
u.actime = u.modtime = dos2unixtime(d);
utime(f, &u);
}
ulg filetime(f, a, n, t)
char *f; /* name of file to get info on */
ulg *a; /* return value: file attributes */
long *n; /* return value: file size */
iztimes *t; /* return value: access, modific. and creation times */
{
FILE *stream;
time_t ltime;
if (strcmp(f, "-") != 0) { /* if not compressing stdin */
Trace((mesg, "opening file '%s' with '%s'\n", f, FOPR));
if ((stream = fopen(f, FOPR)) == (FILE *)NULL) {
return 0;
} else {
if (n != NULL) {
/* With byteseek, this will work */
fseek(stream, 0L, SEEK_END);
*n = ftell(stream);
Trace((mesg, "file size = %lu\n", *((ulg *)n)));
}
fclose(stream);
}
}
else {
/* Reading from stdin */
if (n != NULL) {
*n = -1L;
}
}
/* Return current time for all the times -- for now */
time(&ltime);
if (t != NULL)
t->atime = t->mtime = t->ctime = ltime;
/* Set attributes (always a file) */
if (a != NULL)
*a = 0;
return unix2dostime(&ltime);
}
int set_extra_field(z, z_utim)
struct zlist far *z;
iztimes *z_utim;
/* create extra field and change z->att if desired */
{
fldata_t fdata;
FILE *stream;
char *eb_ptr;
#ifdef USE_EF_UT_TIME
extent ef_l_len = (EB_HEADSIZE+EB_UT_LEN(1));
#else /* !USE_EF_UT_TIME */
extent ef_l_len = 0;
#endif /* ?USE_EF_UT_TIME */
int set_cmsmvs_eb = 0;
/*translate_eol = 0;*/
if (aflag == ASCII) {
z->att = ASCII;
} else {
if (bflag)
z->att = BINARY;
else
z->att = __EBCDIC;
ef_l_len += sizeof(fdata)+EB_HEADSIZE;
set_cmsmvs_eb = 1;
}
if (ef_l_len > 0) {
z->extra = (char *)malloc(ef_l_len);
if (z->extra == NULL) {
printf("\nFLDATA : Unable to allocate memory !\n");
return ZE_MEM;
}
z->cext = z->ext = ef_l_len;
eb_ptr = z->cextra = z->extra;
if (set_cmsmvs_eb) {
if (bflag)
/*** stream = fopen(z->zname,"rb,type=record"); $RGH$ ***/
stream = fopen(z->name,"rb");
else
stream = fopen(z->name,"r");
if (stream == NULL) {
printf("\nFLDATA : Could not open file : %s !\n",z->name);
printf("Error %d: '%s'\n", errno, strerror(errno));
return ZE_NONE;
}
fldata(stream,z->name,&fdata);
/*put the system ID */
#ifdef VM_CMS
*(eb_ptr) = EF_VMCMS & 0xFF;
*(eb_ptr+1) = EF_VMCMS >> 8;
#else
*(eb_ptr) = EF_MVS & 0xFF;
*(eb_ptr+1) = EF_MVS >> 8;
#endif
*(eb_ptr+2) = sizeof(fdata) & 0xFF;
*(eb_ptr+3) = sizeof(fdata) >> 8;
memcpy(eb_ptr+EB_HEADSIZE,&fdata,sizeof(fdata));
fclose(stream);
#ifdef USE_EF_UT_TIME
eb_ptr += (sizeof(fdata)+EB_HEADSIZE);
#endif /* USE_EF_UT_TIME */
}
#ifdef USE_EF_UT_TIME
eb_ptr[0] = 0x55; /* ascii[(unsigned)('U')] */
eb_ptr[1] = 0x54; /* ascii[(unsigned)('T')] */
eb_ptr[2] = EB_UT_LEN(1); /* length of data part of e.f. */
eb_ptr[3] = 0;
eb_ptr[4] = EB_UT_FL_MTIME;
eb_ptr[5] = (char)(z_utim->mtime);
eb_ptr[6] = (char)(z_utim->mtime >> 8);
eb_ptr[7] = (char)(z_utim->mtime >> 16);
eb_ptr[8] = (char)(z_utim->mtime >> 24);
#endif /* USE_EF_UT_TIME */
}
return ZE_OK;
}
int deletedir(d)
char *d; /* directory to delete */
/* Delete the directory *d if it is empty, do nothing otherwise.
Return the result of rmdir(), delete(), or system().
For VMS, d must be in format [x.y]z.dir;1 (not [x.y.z]).
*/
{
return 0;
}
#ifdef USE_ZIPMAIN
/* 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(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 zipmain(argc, argv);
}
#endif /* USE_ZIPMAIN */
#endif /* !UTIL */
/******************************/
/* Function version_local() */
/******************************/
void version_local()
{
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
printf("Compiled with %s%s for %s%s%s.\n\n",
/* Add compiler name and level */
compiler, complevel,
/* Add platform */
platform,
/* Add timestamp */
#ifdef __DATE__
" on " __DATE__
#ifdef __TIME__
" at " __TIME__
#endif
#endif
".\n",
liblvlmsg
);
} /* end function version_local() */

View file

@ -1,123 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
/* Include file for VM/CMS and MVS */
/* This is normally named osdep.h on most systems. Since CMS */
/* generally doesn't support directories, it's been given a unique */
/* name to avoid confusion. */
#ifndef __cmsmvs_h /* prevent multiple inclusions */
#define __cmsmvs_h
#ifdef MVS
# define _POSIX_SOURCE /* tell MVS we want full definitions */
# include <features.h>
#endif /* MVS */
#include <time.h> /* the usual non-BSD time functions */
/* cstat.h is not required for MVS and actually gets in the way. Is it
* needed for CMS?
*/
#ifdef MVS
# include <sys/stat.h>
# include <sys/modes.h>
#else /* !MVS */
# include "cstat.h"
#endif
/* Newer compiler version defines something for us */
#if defined(__VM__) && !defined(VM_CMS)
# define VM_CMS
#endif
#define CMS_MVS
#define EBCDIC
#ifndef MVS /* MVS has perfectly good definitions for the following */
# define NO_UNISTD_H
# define NO_FCNTL_H
#endif /*MVS */
/* If we're generating a stand-alone CMS module, patch in */
/* a new main() function before the real main() for arg parsing. */
#ifdef CMS_STAND_ALONE
# define USE_ZIPMAIN
#endif
#ifndef NULL
# define NULL 0
#endif
#define PASSWD_FROM_STDIN
/* Kludge until we know how to open a non-echo tty channel */
/* definition for ZIP */
#define getch() getc(stdin)
#define MAXPATHLEN 128
#define NO_RMDIR
#define NO_MKTEMP
#define USE_CASE_MAP
#define isatty(t) 1
#ifndef MVS /* MVS has perfectly good definitions for the following */
# define fileno(x) (char *)(x)
# define fdopen fopen
# define unlink remove
# define link rename
# define utime(f,t)
#endif /*MVS */
#ifdef ZCRYPT_INTERNAL
# define ZCR_SEED2 (unsigned)3141592654L /* use PI as seed pattern */
#endif
#ifdef MVS
# if defined(__CRC32_C)
# pragma csect(STATIC,"crc32_s")
# elif defined(__DEFLATE_C)
# pragma csect(STATIC,"deflat_s")
# elif defined(__ZIPFILE_C)
# pragma csect(STATIC,"zipfil_s")
# elif defined(__ZIPUP_C)
# pragma csect(STATIC,"zipup_s")
# endif
#endif /* MVS */
/* end defines for ZIP */
#if 0 /*$RGH$*/
/* RECFM=F, LRECL=1 works for sure */
#define FOPR "rb,recfm=fb"
#define FOPM "r+"
#define FOPW "wb,recfm=fb,lrecl=1"
#define FOPWT "w"
#endif
/* Try allowing ZIP files to be RECFM=V with "byteseek" for CMS, recfm=U for MVS */
#define FOPR "rb,byteseek"
#define FOPM "r+,byteseek"
#ifdef MVS
#define FOPW "wb,recfm=u,byteseek"
#else /* !MVS */
#define FOPW "wb,recfm=v,lrecl=32760,byteseek"
#endif /* MVS */
#if 0
#define FOPW_TMP "w,byteseek"
#else
#define FOPW_TMP "w,type=memory(hiperspace)"
#endif
#define CBSZ 0x40000
#define ZBSZ 0x40000
#endif /* !__cmsmvs_h */

View file

@ -1,53 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
/* cstat.h
Definitions used for file status functions
*/
#ifndef __STAT_H
#define __STAT_H
#include <stdio.h>
#define S_IFMT 0xF000 /* file type mask */
#define S_IFDIR 0x4000 /* directory */
#define S_IFIFO 0x1000 /* FIFO special */
#define S_IFCHR 0x2000 /* character special */
#define S_IFBLK 0x3000 /* block special */
#define S_IFREG 0x8000 /* or just 0x0000, regular */
#define S_IREAD 0x0100 /* owner may read */
#define S_IWRITE 0x0080 /* owner may write */
#define S_IEXEC 0x0040 /* owner may execute <directory search> */
struct stat
{
short st_dev; /* Drive number of disk containing the */
/* file or file handle if the file is */
/* on device */
short st_ino; /* Not meaningfull for VM/CMS */
short st_mode; /* Bit mask giving information about */
/* the file's mode */
short st_nlink; /* Set to the integer constant 1 */
int st_uid; /* Not meaningfull for VM/CMS */
int st_gid; /* Not meaningfull for VM/CMS */
short st_rdev; /* Same as st_dev */
long st_size; /* Size of the file in bytes */
long st_atime; /* Most recent access */
long st_mtime; /* Same as st_atime */
long st_ctime; /* Same as st_atime */
FILE *fp;
char fname[FILENAME_MAX];
};
int stat(const char *path, struct stat *sb);
int fstat(int fd, struct stat *sb);
#endif /* __STAT_H */

View file

@ -1,95 +0,0 @@
/* 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:',
'| strip both',
'| 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' DMSCSL | > 'fn' LINK A'
'set cmstype ht'
'state 'fn' LINK A'
rcc = rc
'set cmstype rt'
if rcc = 0 then do
say ''
say 'ERRORS discovered during linking!'
say 'See: 'fn' LINK A for more info'
end
exit rc
error:
say 'Error in REXX detected!'
Say 'Syntax error on line' Sigl':' Sourceline(Sigl)
Say 'Error was:' Errortext(RC)
return rc

View file

@ -1,221 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
/*
* MVS specific things
*/
#include "zip.h"
#include "mvs.h"
#include <errno.h>
static int gen_node( DIR *dirp, RECORD *recptr )
{
char *ptr, *name, ttr[TTRLEN];
int skip, count = 2;
unsigned int info_byte, alias, ttrn;
struct dirent *new;
ptr = recptr->rest;
while (count < recptr->count) {
if (!memcmp( ptr, endmark, NAMELEN ))
return 1;
name = ptr; /* member name */
ptr += NAMELEN;
memcpy( ttr, ptr, TTRLEN ); /* ttr name */
ptr += TTRLEN;
info_byte = (unsigned int) (*ptr); /* info byte */
if ( !(info_byte & ALIAS_MASK) ) { /* no alias */
new = malloc( sizeof(struct dirent) );
if (dirp->D_list == NULL)
dirp->D_list = dirp->D_curpos = new;
else
dirp->D_curpos = (dirp->D_curpos->d_next = new);
new->d_next = NULL;
memcpy( new->d_name, name, NAMELEN );
new->d_name[NAMELEN] = '\0';
if ((name = strchr( new->d_name, ' ' )) != NULL)
*name = '\0'; /* skip trailing blanks */
}
skip = (info_byte & SKIP_MASK) * 2 + 1;
ptr += skip;
count += (TTRLEN + NAMELEN + skip);
}
return 0;
}
DIR *opendir(const char *dirname)
{
int bytes, list_end = 0;
DIR *dirp;
FILE *fp;
RECORD rec;
fp = fopen( dirname, "rb" );
if (fp != NULL) {
dirp = malloc( sizeof(DIR) );
if (dirp != NULL) {
dirp->D_list = dirp->D_curpos = NULL;
strcpy( dirp->D_path, dirname );
do {
bytes = fread( &rec, 1, sizeof(rec), fp );
if (bytes == sizeof(rec))
list_end = gen_node( dirp, &rec );
} while (!feof(fp) && !list_end);
fclose( fp );
dirp->D_curpos = dirp->D_list;
return dirp;
}
fclose( fp );
}
return NULL;
}
struct dirent *readdir(DIR *dirp)
{
struct dirent *cur;
cur = dirp->D_curpos;
dirp->D_curpos = dirp->D_curpos->d_next;
return cur;
}
void rewinddir(DIR *dirp)
{
dirp->D_curpos = dirp->D_list;
}
int closedir(DIR *dirp)
{
struct dirent *node;
while (dirp->D_list != NULL) {
node = dirp->D_list;
dirp->D_list = dirp->D_list->d_next;
free( node );
}
free( dirp );
return 0;
}
local char *readd(d)
DIR *d; /* directory stream to read from */
/* Return a pointer to the next name in the directory stream d, or NULL if
no more entries or an error occurs. */
{
struct dirent *e;
e = readdir(d);
return e == NULL ? (char *) NULL : e->d_name;
}
int procname(n, caseflag)
char *n; /* name to process */
int caseflag; /* true to force case-sensitive match */
/* Process a name or sh expression to operate on (or exclude). Return
an error code in the ZE_ class. */
{
char *a; /* path and name for recursion */
DIR *d; /* directory stream from opendir() */
char *e; /* pointer to name from readd() */
int m; /* matched flag */
char *p; /* path for recursion */
struct stat s; /* result of stat() */
struct zlist far *z; /* steps through zfiles list */
int exists; /* 1 if file exists */
if (strcmp(n, "-") == 0) /* if compressing stdin */
return newname(n, 0, caseflag);
else if (!(exists = (LSSTAT(n, &s) == 0)))
{
#ifdef MVS
/* special case for MVS. stat does not work on non-HFS files so if
* stat fails with ENOENT, try to open the file for reading anyway.
* If the user has no OMVS segment, stat gets an initialization error,
* even on external files.
*/
if (errno == ENOENT || errno == EMVSINITIAL) {
FILE *f = fopen(n, "r");
if (f) {
/* stat got ENOENT but fopen worked, external file */
fclose(f);
exists = 1;
memset(&s, '\0', sizeof(s)); /* stat data is unreliable for externals */
s.st_mode = S_IFREG; /* fudge it */
}
}
#endif /* MVS */
}
if (! exists) {
/* Not a file or directory--search for shell expression in zip file */
p = ex2in(n, 0, (int *)NULL); /* shouldn't affect matching chars */
m = 1;
for (z = zfiles; z != NULL; z = z->nxt) {
if (MATCH(p, z->iname, caseflag))
{
z->mark = pcount ? filter(z->zname, caseflag) : 1;
if (verbose)
fprintf(mesg, "zip diagnostic: %scluding %s\n",
z->mark ? "in" : "ex", z->name);
m = 0;
}
}
free((zvoid *)p);
return m ? ZE_MISS : ZE_OK;
}
/* Live name--use if file, recurse if directory */
if (!S_ISDIR(s.st_mode))
{
/* add or remove name of file */
if ((m = newname(n, 0, caseflag)) != ZE_OK)
return m;
} else {
/* Add trailing / to the directory name */
if ((p = malloc(strlen(n)+2)) == NULL)
return ZE_MEM;
if (strcmp(n, ".") == 0) {
*p = '\0'; /* avoid "./" prefix and do not create zip entry */
} else {
strcpy(p, n);
a = p + strlen(p);
if (a[-1] != '/')
strcpy(a, "/");
if (dirnames && (m = newname(p, 1, caseflag)) != ZE_OK) {
free((zvoid *)p);
return m;
}
}
/* recurse into directory */
if (recurse && (d = opendir(n)) != NULL)
{
while ((e = readd(d)) != NULL) {
if (strcmp(e, ".") && strcmp(e, ".."))
{
if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL)
{
closedir(d);
free((zvoid *)p);
return ZE_MEM;
}
strcat(strcpy(a, p), e);
if ((m = procname(a, caseflag)) != ZE_OK) /* recurse on name */
{
if (m == ZE_MISS)
zipwarn("name not matched: ", a);
else
ziperr(m, a);
}
free((zvoid *)a);
}
}
closedir(d);
}
free((zvoid *)p);
} /* (s.st_mode & S_IFDIR) == 0) */
return ZE_OK;
}

View file

@ -1,40 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
/* <dirent.h> definitions */
#define NAMELEN 8
struct dirent {
struct dirent *d_next;
char d_name[NAMELEN+1];
};
typedef struct _DIR {
struct dirent *D_list;
struct dirent *D_curpos;
char D_path[FILENAME_MAX];
} DIR;
DIR * opendir(const char *dirname);
struct dirent *readdir(DIR *dirp);
void rewinddir(DIR *dirp);
int closedir(DIR *dirp);
char * readd(DIR *dirp);
#define ALIAS_MASK (unsigned int) 0x80
#define SKIP_MASK (unsigned int) 0x1F
#define TTRLEN 3
#define RECLEN 254
typedef _Packed struct {
unsigned short int count;
char rest[RECLEN];
} RECORD;
char *endmark = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF";

View file

@ -1,125 +0,0 @@
# Makefile for the MVS (OS/390 Base) version of ZIP 2.3
# 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 zip.mvs
#
# To compile a test version into the HFS file system:
# make hfs
# ZIP options -- MVS, REENTRANT
ZIPOPTS=-DMVS -DREENTRANT
# 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)zip$(O) $(BLD_P)trees$(O) \
$(BLD_P)crypt$(O) $(BLD_P)ttyio$(O) $(BLD_P)deflate$(O) \
$(BLD_P)fileio$(O) $(BLD_P)globals$(O) $(BLD_P)util$(O) \
$(BLD_P)crc32$(O) $(BLD_P)zipfile$(O) \
$(BLD_P)zipup$(O) $(BLD_P)cmsmvs$(O) $(BLD_P)mvs$(O)
# Header files
HFILES= $(SRC_P)api.h $(SRC_P)crc32.h $(SRC_P)crypt.h $(SRC_P)ebcdic.h \
$(SRC_P)revision.h $(SRC_P)tailor.h $(SRC_P)ttyio.h \
$(SRC_P)zip.h $(SRC_P)ziperr.h $(CMSMVS_P)cmsmvs.h \
$(CMSMVS_P)cstat.h $(CMSMVS_P)mvs.h $(CMSMVS_P)zipup.h
# Rules
all: $(BLD_P)zip.mvs$(E)
hfs: $(BLD_P)zip$(E)
# link
$(BLD_P)zip.mvs$(E): $(OBJECTS)
$(LD) -o "//INFOZIP.LOAD(ZIP)" $(LDFLAGS) $^
echo "tso call \"infozip(zip)\" \"'\"\"""$$""@""\"\"'\"" > $%
chmod a+x $%
$(BLD_P)zip$(E): $(OBJECTS)
$(LD) -o $% $(LDFLAGS) $^
# compile
$(BLD_P)trees$(O): $(SRC_P)trees.c $(HFILES)
$(CC) -c -o $% $(CFLAGS) $(SRC_P)trees.c
$(BLD_P)crypt$(O): $(SRC_P)crypt.c $(HFILES)
$(CC) -c -o $% $(CFLAGS) $(SRC_P)crypt.c
$(BLD_P)ttyio$(O): $(SRC_P)ttyio.c $(HFILES)
$(CC) -c -o $% $(CFLAGS) $(SRC_P)ttyio.c
$(BLD_P)deflate$(O): $(SRC_P)deflate.c $(HFILES)
$(CC) -c -o $% $(CFLAGS) $(SRC_P)deflate.c
$(BLD_P)fileio$(O): $(SRC_P)fileio.c $(HFILES)
$(CC) -c -o $% $(CFLAGS) $(SRC_P)fileio.c
$(BLD_P)globals$(O): $(SRC_P)globals.c $(HFILES)
$(CC) -c -o $% $(CFLAGS) $(SRC_P)globals.c
$(BLD_P)zip$(O): $(SRC_P)zip.c $(HFILES)
$(CC) -c -o $% $(CFLAGS) $(SRC_P)zip.c
$(BLD_P)util$(O): $(SRC_P)util.c $(HFILES)
$(CC) -c -o $% $(CFLAGS) $(SRC_P)util.c
$(BLD_P)crc32$(O): $(SRC_P)crc32.c $(HFILES)
$(CC) -c -o $% $(CFLAGS) $(SRC_P)crc32.c
$(BLD_P)zipfile$(O): $(SRC_P)zipfile.c $(HFILES)
$(CC) -c -o $% $(CFLAGS) $(SRC_P)zipfile.c
$(BLD_P)zipup$(O): $(SRC_P)zipup.c $(HFILES)
$(CC) -c -o $% $(CFLAGS) $(SRC_P)zipup.c
$(BLD_P)cmsmvs$(O): $(CMSMVS_P)cmsmvs.c $(HFILES)
$(CC) -c -o $% $(CFLAGS) $(CMSMVS_P)cmsmvs.c
$(BLD_P)mvs$(O): $(CMSMVS_P)mvs.c $(HFILES)
$(CC) -c -o $% $(CFLAGS) $(CMSMVS_P)mvs.c

View file

@ -1,27 +0,0 @@
/* PIPZIP REXX Rexx filter to use ZIP */
/* Author : George Petrov, 8 May 1995 */
parse arg opts
'callpipe *:',
'| specs w1 1 /./ n w2 n',
'| join * / /',
'| specs /zip 'opts'/ 1 1-* nw',
'| cms',
'| *:'
exit rc

View file

@ -1,66 +0,0 @@
/***********************************************************************/
/* */
/* 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

View file

@ -1,21 +0,0 @@
* This is a comment
* this makefile compiles filter ZIPME
GLOBALS:
long def(VM_CMS)
TEXT:
trees c
crypt c
ttyio c
deflate c
fileio c
globals c
zip c
util c
crc32.c
zipfile c
zipup c
cmsmvs c
cms c
MODULE:
zip module

View file

@ -1,66 +0,0 @@
/***********************************************************************/
/* */
/* 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

View file

@ -1,89 +0,0 @@
//CCZIP JOB (BI09255),
// MSGLEVEL=(1,1),MSGCLASS=C,CLASS=D,NOTIFY=C888090
//PROCLIB JCLLIB ORDER=(SYS1.C370.PROCLIB.M24)
//ZIP EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
// INFILE='C888090.ZIP.C(ZIP)',
// OUTFILE='C888090.ZIP.C.OBJ(ZIP),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
//CRYPT EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
// INFILE='C888090.ZIP.C(CRYPT)',
// OUTFILE='C888090.ZIP.C.OBJ(CRYPT),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
//TTYIO EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
// INFILE='C888090.ZIP.C(TTYIO)',
// OUTFILE='C888090.ZIP.C.OBJ(TTYIO),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
//TREES EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
// INFILE='C888090.ZIP.C(TREES)',
// OUTFILE='C888090.ZIP.C.OBJ(TREES),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
//DEFLATE EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
// INFILE='C888090.ZIP.C(DEFLATE)',
// OUTFILE='C888090.ZIP.C.OBJ(DEFLATE),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
//FILEIO EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
// INFILE='C888090.ZIP.C(FILEIO)',
// OUTFILE='C888090.ZIP.C.OBJ(FILEIO),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
//GLOBALS EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
// INFILE='C888090.ZIP.C(GLOBALS)',
// OUTFILE='C888090.ZIP.C.OBJ(GLOBALS),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
//UTIL EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
// INFILE='C888090.ZIP.C(UTIL)',
// OUTFILE='C888090.ZIP.C.OBJ(UTIL),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
//CRC32 EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
// INFILE='C888090.ZIP.C(CRC32)',
// OUTFILE='C888090.ZIP.C.OBJ(CRC32),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
//ZIPFILE EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
// INFILE='C888090.ZIP.C(ZIPFILE)',
// OUTFILE='C888090.ZIP.C.OBJ(ZIPFILE),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
//ZIPUP EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
// INFILE='C888090.ZIP.C(ZIPUP)',
// OUTFILE='C888090.ZIP.C.OBJ(ZIPUP),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
//CMSMVS EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
// INFILE='C888090.ZIP.C(CMSMVS)',
// OUTFILE='C888090.ZIP.C.OBJ(CMSMVS),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
//MVS EXEC EDCC,COND=(12,LE),CREGSIZ='4M',
// INFILE='C888090.ZIP.C(MVS)',
// OUTFILE='C888090.ZIP.C.OBJ(MVS),DISP=SHR',
// CPARM='LONG,NOTERM,LIST,XREF,SOURCE,OPT(2),DEF(MVS)'
//COMPILE.USERLIB DD DSN=C888090.ZIP.H,DISP=SHR
//PLINK EXEC PROC=EDCPL,COND=(12,LE),
// OUTFILE='C888090.ZIP.LOAD(ZIP),DISP=SHR',
// PPARM='NONCAL,MAP',
// LPARM='LIST,MAP,XREF'
//SYSPRINT DD SYSOUT=*
//PLKED.SYSIN DD DSN=C888090.ZIP.C.OBJ(ZIP),DISP=SHR
// DD DSN=C888090.ZIP.C.OBJ(BITS),DISP=SHR
// DD DSN=C888090.ZIP.C.OBJ(CRYPT),DISP=SHR
// DD DSN=C888090.ZIP.C.OBJ(TREES),DISP=SHR
// DD DSN=C888090.ZIP.C.OBJ(DEFLATE),DISP=SHR
// DD DSN=C888090.ZIP.C.OBJ(FILEIO),DISP=SHR
// DD DSN=C888090.ZIP.C.OBJ(GLOBALS),DISP=SHR
// DD DSN=C888090.ZIP.C.OBJ(UTIL),DISP=SHR
// DD DSN=C888090.ZIP.C.OBJ(CRC32),DISP=SHR
// DD DSN=C888090.ZIP.C.OBJ(ZIPFILE),DISP=SHR
// DD DSN=C888090.ZIP.C.OBJ(ZIPUP),DISP=SHR
// DD DSN=C888090.ZIP.C.OBJ(CMSMVS),DISP=SHR
// DD DSN=C888090.ZIP.C.OBJ(MVS),DISP=SHR
//PLKED.SYSLIB DD DSN=SYS1.C370.SEDCBASE,DISP=SHR
// DD DSN=SYS1.PL1.SIBMBASE,DISP=SHR
//SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(2,2)),DISP=NEW

View file

@ -1,200 +0,0 @@
Zip file/directories name convention under MVS
---------------------------------------------------
Draft 1.1
1. Translating native file names to Zip filenames.
1.1 Zipping a PDS
On MVS there are directories called PDS (Partition Data Set) which have
the following format : name1.name2.name3(mname)
for example: myuserid.unzip.c(unzip)
So as you see the path delimiter is '.'. Each dir name can be max 8
chars long beginning with a number.
Between '(' and ')' there is the so called member name - it is also 8
chars long. This is the actual file name.
1.1.1 Converting MVS PDS name to zip path/filename (status: not implemented)
The PDS name is converted to zippath as follows:
in the zip : name1/name2/mname.name3
becomes on MVS: name1.name2.name3(mname)
1.2 Unzipping as PDS (status: implemented)
When you unzip the file name myuserid/unzip/unzip.c the same process
is done backwards, so you get : myuserid.unzip.c(unzip)
Notice that the file extension is used as last dirname!
1.2 Unzipping to a different PDS (status: implemented)
You can also use -d option while unzipping for example:
unzip mytest myuserid/unzip/unzip.c -dnewdest.test
then the new name will become:
newdest.test.myuserid.unzip.c(unzip)
Second example:
unzip mytest myuserid/unzip/*.c -dnewdest.test
then you get a PDS:
newdest.test.myuserid.unzip.c(...)
with all *.c files in it.
1.3 Zipping a Sequential Dataset (status: not implemented)
Sequential dataset is a dataset with NO members.
Such a dataset is translated from native MVS to zip format by replacing
the '.' (points) with '/' (backslash).
Example:
on MVS: name1.name2.name3
becomes in the zip : name1/name2/name3
NOTE : The new filename in the zip has NO extension this way it can be
recognised as a Sequential dataset and not a PDS.
But this also means that all files in the zip archive that have
no extension will be unzipped as Sequential datasets!
1.4 Using a DDNAMES for input. (status: not implemented)
To use DDNAMES as input file names put a 'dd:' before the ddname:
example: zip myzip dd:name1 dd:name2 dd:sales
In the Zip archive the ddnames are saved as name.DDNAME so if you try
the example above you will get in your zip file (when listing it) :
..size .. date time .. crc .. NAME1.DDNAME
..size .. date time .. crc .. NAME2.DDNAME
..size .. date time .. crc .. SALES.DDNAME
1.4 Using a DDNAMES as zip name (status: implemented)
It is allowed to use a DDNAME as zipfile, just put dd: before it
example: unzip dd:myzip *.c
this will unzip all .c files from ddname myzip
example2: ZIP DD:MYZIP DD:MANE1 MYSOURCE.C MYDOC.TEXT(ZIPPING)
this will zip ddname name1 file mysource.c and PDS mydoc.text(zipping)
into as a zip file in the ddname myzip
2. Converting longer path names (unix like) (status: not implemented)
to native MVS names.
When in the zip archive there are dirnames longer that 8 chars they are
chopped at the 8 position. For example
MyLongZippath/WithLongFileName.text
is translated to:
MYLONGZI.TEXT(WITHLONG)
Notice that all chars are converted to uppercase.
2.1 Using special characters (status: implemented)
Also all '_' (underscore), '+' (plus), '-' (minus), '(' and ')'
from the file name/path in the zip archive are skipped because they
are not valid in the MVS filenames.
2.2 Numeric file names (status: not implemented)
On MVS no name can begin with a number, so when a dir/file name begins with
one, a leading letter 'N' is inserted. For example:
Contents.512
becomes:
CONTENTS.N512
Zip file/directories name convention under VM/CMS
---------------------------------------------------
1. Translating native file names to Zip filenames.
On VM/CMS (not ESA ) there are NO directories so you got only disks
and files.
The file names are delimited with spaces. But for use with unzip/zip
you have to use '.' points as delimiters.
For example on your A disk you have file called PROFILE EXEC
if you want to zip it type : zip myzip profile.exec
If the same file is on your F disk you have to type:
zip myzip profile.exec.f
So as you can see the general format is fname.ftype.fmode
In the zipfile the disk from which the file comes is not saved!
So only the fname.ftype is saved.
If you unzip and you want to give a different destination disk just use
the -d option like:
unzip mytest *.c -df
This will unzip all *.c files to your F disk.
2. Converting longer path names (unix like) to native VM/CMS names.
When in the zip archive there are dirnames longer that 8 chars they are
chopped at the 8 position. Also the path is removed. For example
Zippath/WithLongFileName.text
is translated to:
WITHLONG.TEXT
Notice that all chars are converted to uppercase.
Also all '+' (plus), '-' (minus), '(' and ')'
from the file name/path in the zip archive are skipped because they
are not valid in the VM/CMS filenames.
If there is no extension for the file name in the zip archive, unzip
will add .NONAME for example:
mypath/dir1/testfile
becomes:
TESTFILE.NONAME
3. Future?
There is also discussion for a new option on ZIP that you can give
a virtual directory to be added before each file name that is zipped.
For example you want to zip a few .c file and put them in the zip
structure under the directory 'mydir/test', but you can't create dirs on
VM/CMS so you have to the something like:
ZIP myzip file1.c file2.c -dmydir/test
and you get in the zip archive files:
mydir/test/file1.c
mydir/test/file2.c
-------------------------------------------------------------------------
NOTE: Not all of those functions are implemented in the first beta
release of VM/MVS UNZIP/ZIP.
Every ideas/corrections/bugs will be appreciated.
Mail to maillist: Info-ZIP@LISTS.WKU.EDU
George Petrov

View file

@ -1,66 +0,0 @@
/***********************************************************************/
/* */
/* 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

View file

@ -1,66 +0,0 @@
/***********************************************************************/
/* */
/* 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

View file

@ -1,18 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#define fhow "r,byteseek"
#define fhowb "rb,byteseek"
#define fbad NULL
typedef FILE *ftype;
#define zopen(n,p) (ftype)fopen((n),(p))
#define zread(f,b,n) fread((b),1,(n),(FILE*)(f))
#define zclose(f) fclose((FILE*)(f))
#define zerr(f) ferror((FILE*)(f))
#define zstdin stdin

View file

@ -1,48 +0,0 @@
/* VMCOMPIL EXEC Unzip compile for VM/CMS */
/* Author : George Petrov, 11 Apr 1995 */
signal on error
parms = '(long def(VM_CMS)'
/* Add local parms */
parms = parms 'TARGET(COMPAT) SOURCE'
say 'Compiling TREES C...'
'cc trees c 'parms
say 'Compiling CRYPT C...'
'cc crypt c 'parms
say 'Compiling TTYIO C...'
'cc ttyio c 'parms
say 'Compiling DEFLATE C...'
'cc deflate c 'parms
say 'Compiling FILEIO C...'
'cc fileio c 'parms
say 'Compiling GLOBALS C...'
'cc globals c 'parms
say 'Compiling ZIP C...'
'cc zip c 'parms
say 'Compiling UTIL C...'
'cc util c 'parms
say 'Compiling CRC32 C...'
'cc crc32 c 'parms
say 'Compiling ZIPFILE C...'
'cc zipfile c 'parms
say 'Compiling ZIPUP C...'
'cc zipup c 'parms
say 'Compiling CMSMVS C...'
'cc cmsmvs c 'parms
say 'Compiling CMS C...'
'cc cms c 'parms
say 'Linking all files...'
'cmod zip zip trees crypt deflate fileio globals ttyio',
'util crc32 zipfile zipup cmsmvs cms'
say 'All Done!'
say "To run enter : ZIP parms"
exit rc
error:
say 'Error durring compilation!'
exit rc

View file

@ -1,3 +1,4 @@
/* clang-format off */
/*
Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
@ -21,7 +22,7 @@
#define __CRC32_C /* identifies this source module */
#include "zip.h"
#include "third_party/infozip/zip/zip.h"
#if (!defined(USE_ZLIB) || defined(USE_OWN_CRCTAB))
@ -29,7 +30,7 @@
# define ZCONST const
#endif
#include "crc32.h"
#include "third_party/infozip/zip/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

View file

@ -1,3 +1,4 @@
/* clang-format off */
/*
Copyright (c) 1990-2008 Info-ZIP. All rights reserved.

View file

@ -1,3 +1,4 @@
/* clang-format off */
/*
Copyright (c) 1990-2008 Info-ZIP. All rights reserved.
@ -30,9 +31,10 @@
*/
#define ZCRYPT_INTERNAL
#include "zip.h"
#include "crypt.h"
#include "ttyio.h"
#include "third_party/infozip/zip/zip.h"
#include "third_party/infozip/zip/crypt.h"
#include "third_party/infozip/zip/ttyio.h"
#include "libc/rand/rand.h"
#if CRYPT
@ -74,7 +76,7 @@
as a fallback to allow successful compilation in "beta state"
environments.
*/
# include <time.h> /* time() function supplies first part of crypt seed */
# include "libc/time/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 */
@ -106,7 +108,7 @@
# endif
#endif
#include "crc32.h"
#include "third_party/infozip/zip/crc32.h"
#ifdef IZ_CRC_BE_OPTIMIZ
local z_uint4 near crycrctab[256];

View file

@ -1,3 +1,4 @@
/* clang-format off */
/*
Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
@ -140,7 +141,6 @@ void init_keys OF((__GPRO__ ZCONST char *passwd));
int zipbare OF((struct zlist far *, ZCONST char *));
# else
unsigned zfwrite OF((zvoid *, extent, extent));
extern char *key;
# endif
#endif /* ZIP */

View file

@ -1,3 +1,4 @@
/* clang-format off */
/*
deflate.c - Zip 3
@ -69,7 +70,7 @@
#define __DEFLATE_C
#include "zip.h"
#include "third_party/infozip/zip/zip.h"
#ifndef USE_ZLIB

View file

@ -1,3 +1,4 @@
/* clang-format off */
/*
ebcdic.h

View file

@ -1,15 +0,0 @@
Info-ZIP's Zip 3.0: generic C sources.
Complete C source code for Info-ZIP's
PKZIP-compatible .zip archiver, 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.
Includes Info-ZIP's ZCrypt 2.9 for
PKWARE-compatible standard encryption
and decryption support for Info-ZIP's
Zip 2.32, Zip 3.0, UnZip 5.52,
UnZip 6.0, and WiZ 5.02 (and later).
This is FREE (but copyrighted) software.
See LICENSE for details on distribution
and reuse.

View file

@ -1,3 +1,4 @@
/* clang-format off */
/*
fileio.c - Zip 3
@ -13,8 +14,8 @@
*/
#define __FILEIO_C
#include "zip.h"
#include "crc32.h"
#include "third_party/infozip/zip/zip.h"
#include "third_party/infozip/zip/crc32.h"
#ifdef MACOS
# include "helpers.h"
@ -24,7 +25,12 @@
# include "vms/vms.h"
#endif /* def VMS */
#include <time.h>
#include "libc/fmt/fmt.h"
#include "libc/alg/alg.h"
#include "libc/stdio/temp.h"
#include "libc/time/time.h"
#include "libc/time/struct/tm.h"
#include "libc/limits.h"
#ifdef NO_MKTIME
time_t mktime OF((struct tm *));
@ -33,7 +39,7 @@ time_t mktime OF((struct tm *));
#ifdef OSF
#define EXDEV 18 /* avoid a bug in the DEC OSF/1 header files. */
#else
#include <errno.h>
#include "libc/errno.h"
#endif
#ifdef NO_ERRNO
@ -43,7 +49,7 @@ extern int errno;
/* -----------------------
For long option support
----------------------- */
#include <ctype.h>
#include "libc/str/str.h"
#if defined(VMS) || defined(TOPS20)

View file

@ -1,3 +1,4 @@
/* clang-format off */
/*
globals.c - Zip 3
@ -18,7 +19,7 @@
#define UTIL /* do not declare the read_buf variable */
#endif
#include "zip.h"
#include "third_party/infozip/zip/zip.h"
/* Handy place to build error messages */

View file

@ -1,95 +0,0 @@
# Makefile for Zip, ZipCloak, ZipNote and ZipSplit for human68k
# Written by NIIMI Satoshi <a01309@cfi.waseda.ac.jp>
#
# 1999/09/23: Modified by Shimazaki Ryo.
ifeq "$(TARGET)" "X68030"
COPT = -m68020-40
AOPT = -m68020 -sCPU020
LDFLAGS = -L/usr/local/lib/lib060
endif
VPATH = human68k
CC = gcc2
CFLAGS = $(COPT) -I. -Wall -O2 -fomit-frame-pointer -fstrength-reduce \
-DASM_CRC -D__DOS_INLINE__
#LDFLAGS = -Wl,-x
LIBS = -lhmem -lttyi -lsignal
AS = g2as
ASFLAGS = $(AOPT) -1 -c4 -y -w2
# object file lists
OBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o crypt.o ttyio.o \
crc32.o human68k.o crc_68.o
OBJI = deflate.o trees.o
OBJA =
OBJU = zipfile_.o fileio_.o util_.o globals.o human68k_.o
OBJN = zipnote.o $(OBJU)
OBJC = zipcloak.o $(OBJU) crc32_.o crypt_.o ttyio.o
OBJS = zipsplit.o $(OBJU)
ZIP_H = zip.h ziperr.h tailor.h human68k/osdep.h
all: zips
.SUFFIXES: _.o .o .c
.c_.o:
$(CC) $(CFLAGS) -DUTIL -c $< -o $@
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
ZIPS = zip.x zipnote.x zipsplit.x zipcloak.x
zips: $(ZIPS)
zip.x: $(OBJZ) $(OBJI) $(OBJA)
$(CC) $(LDFLAGS) -o $@ $(OBJZ) $(OBJI) $(OBJA) $(LIBS)
zipnote.x: $(OBJN)
$(CC) $(LDFLAGS) -o $@ $(OBJN) $(LIBS)
zipcloak.x: $(OBJC)
$(CC) $(LDFLAGS) -o $@ $(OBJC) $(LIBS)
zipsplit.x: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
human68k.o: human68k/human68k.c
$(CC) $(CFLAGS) -c -o $@ $<
human68k_.o: human68k/human68k.c
$(CC) $(CFLAGS) -c -o $@ $< -DUTIL
#match.o: human68k/match.s
# $(AS) $(ASFLAGS) -o $@ $<
deflate.o: human68k/deflate.s
$(AS) $(ASFLAGS) -o $@ $<
crc_68.o: human68k/crc_68.s
$(AS) $(ASFLAGS) -o $@ $<
clean:
rm -f *.o $(ZIPS)
zip.bfd: $(ZIPS)
rm -f $@
for file in $(ZIPS); do \
bdif -A -R uploaded/$$file $$file $@; \
done
# rules for zip, zipnote, zipcloak, zipsplit.
$(OBJZ): $(ZIP_H)
$(OBJI): $(ZIP_H)
$(OBJN): $(ZIP_H)
$(OBJS): $(ZIP_H)
$(OBJC): $(ZIP_H)
zip.o crc32.o crypt.o fileio.o zipfile.o zipup.o: crc32.h
zipcloak.o crc32_.o crypt_.o fileio_.o zipfile_.o: crc32.h
zip.o zipup.o crypt.o ttyio.o zipcloak.o crypt_.o: crypt.h
zip.o zipup.o zipnote.o zipcloak.o zipsplit.o: revision.h
zip.o crypt.o ttyio.o zipcloak.o crypt_.o: ttyio.h
zipup.o: human68k/zipup.h
# EOF

View file

@ -1,78 +0,0 @@
# Makefile for Zip, ZipCloak, ZipNote and ZipSplit for human68k
# Written by NIIMI Satoshi <a01309@cfi.waseda.ac.jp>
VPATH = human68k
CC = gcc
AS = as
# if you are using mc68030 (or higher) based X68000,
# uncomment following defines
#CC = gcc -DUNALIGNED_OK
#AS = as -s UNALIGNED_OK
CFLAGS = -Wall -O -fomit-frame-pointer -fstrength-reduce -DASMV
LDFLAGS = -s
LIBS = -lsignal -lmb -ldos
# object file lists
OBJZ = zip.o zipfile.o zipup.o fileio.o util.o crc32.o globals.o \
crypt.o ttyio.o
OBJI = deflate.o trees.o
OBJA = match.o human68k.o
OBJU = zipfile_.o fileio_.o util_.o globals.o human68_.o
OBJN = zipnote.o $(OBJU)
OBJC = zipcloak.o $(OBJU) crc32_.o crypt_.o ttyio.o
OBJS = zipsplit.o $(OBJU)
ZIP_H = zip.h ziperr.h tailor.h human68k/osdep.h
all: zips
.SUFFIXES: _.o .o .c
.c_.o:
$(CC) $(CFLAGS) -DUTIL -c $< -o $@
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
ZIPS = zip.x zipnote.x zipsplit.x zipcloak.x
zips: $(ZIPS)
zip.x: $(OBJZ) $(OBJI) $(OBJA)
$(CC) -o zip.x $(LDFLAGS) $(OBJZ) $(OBJI) $(OBJA) $(LIBS)
zipnote.x: $(OBJN)
$(CC) -o zipnote.x $(LDFLAGS) $(OBJN) $(LIBS)
zipcloak.x: $(OBJC)
$(CC) -o zipcloak.x $(LDFLAGS) $(OBJC) $(LIBS)
zipsplit.x: $(OBJS)
$(CC) -o zipsplit.x $(LDFLAGS) $(OBJS) $(LIBS)
match.o: human68k/match.s
$(AS) -o $@ $<
human68_.o: human68k/human68k.c
$(CC) $(CFLAGS) -DUTIL -c -o $@ $<
clean:
rm -f *.o $(ZIPS)
zip.bfd: $(ZIPS)
rm -f $@
for file in $(ZIPS); do \
bdif -A -R uploaded/$$file $$file $@; \
done
# rules for zip, zipnote, zipcloak, zipsplit.
$(OBJZ): $(ZIP_H)
$(OBJI): $(ZIP_H)
$(OBJN): $(ZIP_H)
$(OBJS): $(ZIP_H)
$(OBJC): $(ZIP_H)
zip.o crc32.o crypt.o fileio.o zipfile.o zipup.o: crc32.h
zipcloak.o crc32_.o crypt_.o fileio_.o zipfile_.o: crc32.h
zip.o zipup.o crypt.o ttyio.o zipcloak.o crypt_.o: crypt.h
zip.o zipup.o zipnote.o zipcloak.o zipsplit.o: revision.h
zip.o crypt.o ttyio.o zipcloak.o crypt_.o: ttyio.h
zipup.o: human68k/zipup.h

View file

@ -1,144 +0,0 @@
;===========================================================================
; 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
;===========================================================================
; crc_68 created by Paul Kienitz, last modified 04 Jan 96.
;
; Return an updated 32 bit CRC value, given the old value and a block of data.
; The CRC table used to compute the value is gotten by calling get_crc_table().
; This replaces the older updcrc() function used in Zip and fUnZip. The
; prototype of the function is:
;
; ulg crc32(ulg crcval, uch *text, extent textlen);
;
; On the Amiga, type extent is always unsigned long, not unsigned int, because
; int can be short or long at whim, but size_t is long.
;
; If using this source on a non-Amiga 680x0 system, note that we treat
; a0/a1/d0/d1 as scratch registers not preserved across function calls.
; We do not bother to support registerized arguments for crc32() -- the
; textlen parm is usually large enough so that savings outside the loop
; are pointless.
;
; Define NO_UNROLLED_LOOPS to use a simple short loop which might be more
; efficient on certain machines with dinky instruction caches ('020?), or for
; processing short strings. If loops are unrolled, the textlen parm must be
; less than 512K; if not unrolled, it must be less than 64K.
;
; 1999/09/23: for Human68k: Modified by Shimazaki Ryo.
xdef _crc32 ; (ulg val, uch *buf, extent bufsize)
DO_CRC0 MACRO
moveq #0,ltemp
move.b (textbuf)+,ltemp
eor.b crcval,ltemp
lsl.w #2,ltemp
move.l (crc_table,ltemp.w),ltemp
lsr.l #8,crcval
eor.l ltemp,crcval
ENDM
DO_CRC2 MACRO
move.b (textbuf)+,btemp
eor.b crcval,btemp
lsr.l #8,crcval
move.l (crc_table,btemp.w*4),ltemp
eor.l ltemp,crcval
ENDM
crc_table reg a0 array of unsigned long
crcval reg d0 unsigned long initial value
textbuf reg a1 array of unsigned char
textbufsize reg d1 unsigned long (count of bytes in textbuf)
btemp reg d2
ltemp reg d3
xref _get_crc_table ; ulg *get_crc_table(void)
quad
_crc32:
move.l 8(sp),d0
bne.s valid
;;;;; moveq #0,d0
rts
valid: movem.l btemp/ltemp,-(sp)
jsr _get_crc_table
movea.l d0,crc_table
move.l 12(sp),crcval
move.l 16(sp),textbuf
move.l 20(sp),textbufsize
not.l crcval
ifdef NO_UNROLLED_LOOPS
if CPU==68000
bra.s decr
loop: DO_CRC0
decr: dbra textbufsize,loop
bra.s done
else
twenty: moveq #0,btemp
bra.s decr2
loop2: DO_CRC2
decr2: dbra textbufsize,loop2
endif
ELSE ; !NO_UNROLLED_LOOPS
if CPU==68000
moveq #7,btemp
and textbufsize,btemp
lsr.l #3,textbufsize
bra decr8
loop8: DO_CRC0
DO_CRC0
DO_CRC0
DO_CRC0
DO_CRC0
DO_CRC0
DO_CRC0
DO_CRC0
decr8: dbra textbufsize,loop8
bra.s decr1
loop1: DO_CRC0
decr1: dbra btemp,loop1
bra done
else
twenty: moveq #0,btemp
move.l textbufsize,-(sp)
lsr.l #3,textbufsize
bra decr82
quad
loop82: DO_CRC2
DO_CRC2
DO_CRC2
DO_CRC2
DO_CRC2
DO_CRC2
DO_CRC2
DO_CRC2
decr82: dbra textbufsize,loop82
moveq #7,textbufsize
and.l (sp)+,textbufsize
bra.s decr12
loop12: DO_CRC2
decr12: dbra textbufsize,loop12
endif
ENDC ; ?NO_UNROLLED_LOOPS
done: movem.l (sp)+,btemp/ltemp
not.l crcval
;;;;; move.l crcval,d0 ; crcval already is d0
rts

File diff suppressed because it is too large Load diff

View file

@ -1,371 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#include "zip.h"
#include <time.h>
#include <stdio.h>
#include <dirent.h>
#ifndef UTIL
#include <sys/dos.h>
#endif
#define MATCH shmatch
#define PAD 0
#ifndef UTIL
/* Library functions not in (most) header files */
int utime OF((char *, ztimbuf *));
/* Local functions */
local char *readd OF((DIR *));
local char *readd(DIR* d)
{
struct dirent* e = readdir(d);
return e == NULL ? NULL : e->d_name;
}
int wild(char* w)
{
struct _filbuf inf;
/* convert FNAMX to malloc - 11/08/04 EG */
char *name;
char *p;
if (strcmp(w, "-") == 0) /* if compressing stdin */
return newname(w, 0, 0);
if ((name = malloc(strlen(w) + 1)) == NULL) {
ZIPERR(ZE_MEM, "wild");
}
strcpy(name, w);
_toslash(name);
if ((p = strrchr(name, '/')) == NULL && (p = strrchr(name, ':')) == NULL)
p = name;
else
p++;
if (_dos_lfiles (&inf, w, 0xff) < 0) {
free(name);
return ZE_MISS;
}
do {
int r;
strcpy(p, inf.name);
r = procname(name, 0);
if (r != ZE_OK) {
free(name);
return r;
}
} while (_dos_nfiles(&inf) >= 0);
free(name);
return ZE_OK;
}
int procname(n, caseflag)
char *n; /* name to process */
int caseflag; /* true to force case-sensitive match */
/* Process a name or sh expression to operate on (or exclude). Return
an error code in the ZE_ class. */
{
char *a; /* path and name for recursion */
DIR *d; /* directory stream from opendir() */
char *e; /* pointer to name from readd() */
int m; /* matched flag */
char *p; /* path for recursion */
struct stat s; /* result of stat() */
struct zlist far *z; /* steps through zfiles list */
if (strcmp(n, "-") == 0) /* if compressing stdin */
return newname(n, 0, caseflag);
else if (LSSTAT(n, &s))
{
/* Not a file or directory--search for shell expression in zip file */
p = ex2in(n, 0, (int *)NULL); /* shouldn't affect matching chars */
m = 1;
for (z = zfiles; z != NULL; z = z->nxt) {
if (MATCH(p, z->iname, caseflag))
{
z->mark = pcount ? filter(z->zname, caseflag) : 1;
if (verbose)
fprintf(mesg, "zip diagnostic: %scluding %s\n",
z->mark ? "in" : "ex", z->name);
m = 0;
}
}
free((zvoid *)p);
return m ? ZE_MISS : ZE_OK;
}
/* Live name--use if file, recurse if directory */
_toslash(n);
if ((s.st_mode & S_IFDIR) == 0)
{
/* add or remove name of file */
if ((m = newname(n, 0, caseflag)) != ZE_OK)
return m;
} else {
/* Add trailing / to the directory name */
if ((p = malloc(strlen(n)+2)) == NULL)
return ZE_MEM;
if (strcmp(n, ".") == 0) {
*p = '\0'; /* avoid "./" prefix and do not create zip entry */
} else {
strcpy(p, n);
a = p + strlen(p);
if (a[-1] != '/')
strcpy(a, "/");
if (dirnames && (m = newname(p, 1, caseflag)) != ZE_OK) {
free((zvoid *)p);
return m;
}
}
/* recurse into directory */
if (recurse && (d = opendir(n)) != NULL)
{
while ((e = readd(d)) != NULL) {
if (strcmp(e, ".") && strcmp(e, ".."))
{
if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL)
{
closedir(d);
free((zvoid *)p);
return ZE_MEM;
}
strcat(strcpy(a, p), e);
if ((m = procname(a, caseflag)) != ZE_OK) /* recurse on name */
{
if (m == ZE_MISS)
zipwarn("name not matched: ", a);
else
ziperr(m, a);
}
free((zvoid *)a);
}
}
closedir(d);
}
free((zvoid *)p);
} /* (s.st_mode & S_IFDIR) == 0) */
return ZE_OK;
}
char *ex2in(x, isdir, pdosflag)
char *x; /* external file name */
int isdir; /* input: x is a directory */
int *pdosflag; /* output: force MSDOS file attributes? */
/* Convert the external file name to a zip file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *n; /* internal file name (malloc'ed) */
char *t; /* shortened name */
/* Find starting point in name before doing malloc */
t = (x[0] && x[1] == (char)':') ? x + 2 : x;
while (*t == (char)'/')
t++;
/* Make changes, if any, to the copied name (leave original intact) */
_toslash(t);
if (!pathput)
t = last(t, '/');
/* Malloc space for internal name and copy it */
if ((n = malloc(strlen(t) + 1)) == NULL)
return NULL;
strcpy(n, t);
if (dosify)
msname(n);
/* Returned malloc'ed name */
if (pdosflag)
*pdosflag = dosify;
return n;
}
char *in2ex(n)
char *n; /* internal file name */
/* Convert the zip file name to an external file name, returning the malloc'ed
string or NULL if not enough memory. */
{
char *x; /* external file name */
if ((x = malloc(strlen(n) + 1 + PAD)) == NULL)
return NULL;
return strcpy(x, n);
}
void stamp(f, d)
char *f; /* name of file to change */
ulg d; /* dos-style time to change it to */
/* Set last updated and accessed time of file f to the DOS time d. */
{
ztimbuf u; /* argument for utime() */
/* Convert DOS time to time_t format in u */
u.actime = u.modtime = dos2unixtime(d);
/* Set updated and accessed times of f */
utime(f, &u);
}
ulg filetime(f, a, n, t)
char *f; /* name of file to get info on */
ulg *a; /* return value: file attributes */
long *n; /* return value: file size */
iztimes *t; /* return value: access, modific. and creation times */
/* If file *f does not exist, return 0. Else, return the file's last
modified date and time as an MSDOS date and time. The date and
time is returned in a long with the date most significant to allow
unsigned integer comparison of absolute times. Also, if a is not
a NULL pointer, store the file attributes there, with the high two
bytes being the Unix attributes, and the low byte being a mapping
of that to DOS attributes. If n is not NULL, store the file size
there. If t is not NULL, the file's access, modification and creation
times are stored there as UNIX time_t values.
If f is "-", use standard input as the file. If f is a device, return
a file size of -1 */
{
struct stat s; /* results of stat() */
/* convert FNMAX to malloc - 11/8/04 EG */
char *name;
int len = strlen(f);
isstdin = !strcmp(f, "-");
if ((name = malloc(len + 1)) == NULL) {
ZIPERR(ZE_MEM, "filetime");
}
strcpy(name, f);
if (name[len - 1] == '/')
name[len - 1] = '\0';
/* not all systems allow stat'ing a file with / appended */
if (isstdin) {
if (fstat(fileno(stdin), &s) != 0) {
free(name);
error("fstat(stdin)");
}
} else if (LSSTAT(name, &s) != 0) {
/* Accept about any file kind including directories
* (stored with trailing / with -r option)
*/
free(name);
return 0;
}
if (a != NULL) {
int atr = _dos_chmod(name, -1);
if (atr < 0)
atr = 0x20;
*a = ((ulg)s.st_mode << 16) | (isstdin ? 0L : (ulg)atr);
}
free(name);
if (n != NULL)
*n = S_ISVOL(s.st_mode) ? -2L : S_ISREG(s.st_mode) ? s.st_size : -1L;
if (t != NULL) {
t->atime = s.st_atime;
t->mtime = s.st_mtime;
t->ctime = s.st_ctime;
}
return unix2dostime(&s.st_mtime);
}
int set_extra_field(z, z_utim)
struct zlist far *z;
iztimes *z_utim;
/* create extra field and change z->att if desired */
{
#ifdef USE_EF_UT_TIME
if ((z->extra = (char *)malloc(EB_HEADSIZE+EB_UT_LEN(1))) == NULL)
return ZE_MEM;
z->extra[0] = 'U';
z->extra[1] = 'T';
z->extra[2] = EB_UT_LEN(1); /* length of data part of e.f. */
z->extra[3] = 0;
z->extra[4] = EB_UT_FL_MTIME;
z->extra[5] = (char)(z_utim->mtime);
z->extra[6] = (char)(z_utim->mtime >> 8);
z->extra[7] = (char)(z_utim->mtime >> 16);
z->extra[8] = (char)(z_utim->mtime >> 24);
z->cext = z->ext = (EB_HEADSIZE+EB_UT_LEN(1));
z->cextra = z->extra;
return ZE_OK;
#else /* !USE_EF_UT_TIME */
return (int)(z-z);
#endif /* ?USE_EF_UT_TIME */
}
int deletedir(d)
char *d; /* directory to delete */
/* Delete the directory *d if it is empty, do nothing otherwise.
Return the result of rmdir(), delete(), or system().
For VMS, d must be in format [x.y]z.dir;1 (not [x.y.z]).
*/
{
return rmdir(d);
}
void print_period(void)
{
fputc('.', stderr);
}
#endif /* !UTIL */
/******************************/
/* Function version_local() */
/******************************/
void version_local()
{
static ZCONST char CompiledWith[] = "Compiled with %s%s for %s%s%s%s.\n\n";
#if 0
char buf[40];
#endif
printf(CompiledWith,
#ifdef __GNUC__
"gcc ", __VERSION__,
#else
# if 0
"cc ", (sprintf(buf, " version %d", _RELEASE), buf),
# else
"unknown compiler", "",
# endif
#endif
"Human68k",
#ifdef __MC68020__
" (X68030)",
#else
" (X680x0)",
#endif
#ifdef __DATE__
" on ", __DATE__
#else
"", ""
#endif
);
} /* end function version_local() */

View file

@ -1,163 +0,0 @@
*===========================================================================
* Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
*
* See the accompanying file LICENSE, version 1999-Oct-05 or later
* (the contents of which are also included in zip.h) for terms of use.
* If, for some reason, both of these files are missing, the Info-ZIP license
* also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*===========================================================================
*
* match.s -- optional optimized asm version of longest match in deflate.c
* Written by Jean-loup Gailly
*
* Adapted for X68000 by NIIMI Satoshi <a01309@cfi.waseda.ac.jp>
* Adapted for the Amiga by Carsten Steger <stegerc@informatik.tu-muenchen.de>
* using the code in match.S.
* The major change in this code consists of removing all unaligned
* word accesses, because they cause 68000-based machines to crash.
* For maximum speed, UNALIGNED_OK can be defined.
* The program will then only run on 68020-based machines, though.
Cur_Match reg d0 ; Must be in d0!
Best_Len reg d1
Loop_Counter reg d2
Scan_Start reg d3
Scan_End reg d4
Limit reg d5
Chain_Length reg d6
Scan_Test reg d7
Scan reg a0
Match reg a1
Prev_Address reg a2
Scan_Ini reg a3
Match_Ini reg a4
MAX_MATCH equ 258
MIN_MATCH equ 3
WSIZE equ 32768
MAX_DIST equ WSIZE-MAX_MATCH-MIN_MATCH-1
.xref _max_chain_length
.xref _prev_length
.xref _prev
.xref _window
.xref _strstart
.xref _good_match
.xref _match_start
.xref _nice_match
.xdef _match_init
.xdef _longest_match
.text
.even
_match_init:
rts
_longest_match:
move.l 4(sp),Cur_Match
.ifdef UNALIGNED_OK
movem.l d2-d6/a2-a4,-(sp)
.else
movem.l d2-d7/a2-a4,-(sp)
.endif
move.l _max_chain_length,Chain_Length
move.l _prev_length,Best_Len
lea _prev,Prev_Address
lea _window+MIN_MATCH,Match_Ini
move.l _strstart,Limit
move.l Match_Ini,Scan_Ini
add.l Limit,Scan_Ini
subi.w #MAX_DIST,Limit
bhi.b limit_ok
moveq #0,Limit
limit_ok:
cmp.l _good_match,Best_Len
bcs.b length_ok
lsr.l #2,Chain_Length
length_ok:
subq.l #1,Chain_Length
.ifdef UNALIGNED_OK
move.w -MIN_MATCH(Scan_Ini),Scan_Start
move.w -MIN_MATCH-1(Scan_Ini,Best_Len.w),Scan_End
.else
move.b -MIN_MATCH(Scan_Ini),Scan_Start
lsl.w #8,Scan_Start
move.b -MIN_MATCH+1(Scan_Ini),Scan_Start
move.b -MIN_MATCH-1(Scan_Ini,Best_Len.w),Scan_End
lsl.w #8,Scan_End
move.b -MIN_MATCH(Scan_Ini,Best_Len.w),Scan_End
.endif
bra.b do_scan
long_loop:
.ifdef UNALIGNED_OK
move.w -MIN_MATCH-1(Scan_Ini,Best_Len.w),Scan_End
.else
move.b -MIN_MATCH-1(Scan_Ini,Best_Len.w),Scan_End
lsl.w #8,Scan_End
move.b -MIN_MATCH(Scan_Ini,Best_Len.w),Scan_End
.endif
short_loop:
lsl.w #1,Cur_Match
move.w 0(Prev_Address,Cur_Match.l),Cur_Match
cmp.w Limit,Cur_Match
dbls Chain_Length,do_scan
bra.b return
do_scan:
move.l Match_Ini,Match
add.l Cur_Match,Match
.ifdef UNALIGNED_OK
cmp.w -MIN_MATCH-1(Match,Best_Len.w),Scan_End
bne.b short_loop
cmp.w -MIN_MATCH(Match),Scan_Start
bne.b short_loop
.else
move.b -MIN_MATCH-1(Match,Best_Len.w),Scan_Test
lsl.w #8,Scan_Test
move.b -MIN_MATCH(Match,Best_Len.w),Scan_Test
cmp.w Scan_Test,Scan_End
bne.b short_loop
move.b -MIN_MATCH(Match),Scan_Test
lsl.w #8,Scan_Test
move.b -MIN_MATCH+1(Match),Scan_Test
cmp.w Scan_Test,Scan_Start
bne.b short_loop
.endif
move.w #(MAX_MATCH-MIN_MATCH),Loop_Counter
move.l Scan_Ini,Scan
scan_loop:
cmpm.b (Match)+,(Scan)+
dbne Loop_Counter,scan_loop
sub.l Scan_Ini,Scan
addq.l #(MIN_MATCH-1),Scan
cmp.l Best_Len,Scan
bls.b short_loop
move.l Scan,Best_Len
move.l Cur_Match,_match_start
cmp.l _nice_match,Best_Len
bcs.b long_loop
return:
move.l Best_Len,d0
.ifdef UNALIGNED_OK
movem.l (sp)+,d2-d6/a2-a4
.else
movem.l (sp)+,d2-d7/a2-a4
.endif
rts
end

View file

@ -1,28 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#include <io.h>
#include <sys/stat.h>
#include <sys/xglob.h>
#ifdef ZCRYPT_INTERNAL
# include <process.h> /* getpid() declaration for srand seed */
#endif
#define USE_CASE_MAP
#define ROUNDED_TIME(time) (((time) + 1) & (~1))
#define PROCNAME(n) (action == ADD || action == UPDATE ? wild(n) : \
procname(n, 1))
#ifdef HAVE_MBCTYPE_H
# include <mbctype.h>
#else
# define ismbblead(c) (0x80 <= (c) && ((c) < 0xa0 || 0xe0 <= (c)))
#endif

View file

@ -1,16 +0,0 @@
/*
Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 1999-Oct-05 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, both of these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
*/
#define fhow (O_RDONLY|O_BINARY)
#define fbad (-1)
typedef int ftype;
#define zopen(n,p) open(n,p)
#define zread(f,b,n) read(f,b,n)
#define zclose(f) close(f)
#define zerr(f) (k == (extent)(-1L))
#define zstdin 0

View file

@ -1,63 +0,0 @@
Contents of the "macos" sub-archive for Zip 2.3 and later:
MacOS:
Contents this file
readme.1st Instruction to unpack mac specific files
README.TXT Dirk Haase's infos on updated MacIntosh ports of Zip/UnZip
HISTORY.TXT Dirk Haase's MacOS specific ChangeLog
zipup.h MacOS
osdep.h MacOS specific configuration and declarations
ZipLib.h used to build a static library, global to the project
ZipSx.h used to build a standalone App with MW Sioux, global
to the project
ZpPrj.hqx Metrowerks CodeWarrior pro3 project file (BinHex)
source/ subdirectory containing all sources:
a) Zip specific code
extrafld.c contains all code related to the mac extra field
extrafld.h
macglob.h
macopen.c replaces fopen() and open()
macopen.h
macos.c Macintosh-specific routines for use with Info-ZIP's Zip
MatWild.c Pattern matching function
recurse.c Functions to go through the directories
recurse.h
unixlike.c This file provides a unix like file-stat routine
unixlike.h
VolWarn.h contains the warning message, about volumes with the
same name
zip_rc.hqx resource file for Macintosh unzip (BinHex)
b) general utilities shared between Zip and UnZip
charmap.h character mapping tables ISO 8859-1 <--> MacRoman
helpers.c some helper functions
helpers.h
macstuff.c Mac filemanager routines copied from MoreFiles 1.4.8
macstuff.h
mactime.c replacement for broken Metrowerks RTL time functions
pathname.c functions for handling MacOS HFS path- /filenames
pathname.h
The new ZpPrj.hqx project file should be "un-BinHex'ed" into ZpPrj,
which builds the following targets:
- Zip Lib (68K) -> static library 68k
- Zip Lib (PPC) -> static library PPC
- Zip Sioux (68K) -> MW Sioux standalone App, good for debugging
- Zip Sioux (PPC) -> MW Sioux standalone App, good for debugging
The resource files and the compiler project files are in BinHex form because
they contain Macintosh resource forks. The resource info cannot be
maintained when handling (e.g. repacking) the master source collection on
non-Macintosh systems. The BinHex form is the traditional way for
transferring such files via non-Macintosh systems.
It's also the safest since it uses only printable characters. The ".hqx"
files must be converted with StuffitExpander or BinHex 4.0 (or equivalent)
on a Macintosh system before using them.

View file

@ -1,600 +0,0 @@
A free Macintosh Port of Info-ZIP's
Zip and UnZip
By Dirk Haase, d_haase@sitec.net
Home page: www.sitec.net/maczip
Mirror page:
www.haase-online.de/dirk/maczip
================================
Release MacZip ver1.07 beta 1
22. Februray 2001
-----------------
1) CHG: {unzip} switch to latest final release
unzip 5.42
2) CHG: {zip} switch to latest beta release
zip 2.40a
Release MacZip ver1.06 final
22. Februray 2001
-----------------
1) CHG: {unzip} switch to latest final release
unzip 5.42
2) CHG: switch to latest release of Apples
Universal Interfaces 3.3.2
3) CHG: switch to latest release of
Morefiles 1.5
Release MacZip ver1.06 beta 2
02. August 2000
---------------
1) CHG: {unzip} switch to latest beta release
unzip 5.42d
Release MacZip ver1.06 beta 1
27. July 2000
-------------
1) CHG: {zip} switch to latest beta release
unzip 2.30
2) CHG: {unzip} switch to latest beta release
unzip 5.42c
Release MacZip ver1.05 final
27. July 2000
-------------
1) CHG: {unzip} switch to latest final release
unzip 5.41
2) FIX: {unzip} Fixed "unique unzip folder" foldername handling
3) FIX: {unzip} added prototype crc32() in macbin3.c
4) CHG: {unzip/zip} added exported Codewarrior project-file in xml-format
5) ADD: {unzip} added extra-field recognition for Mac SmartZip in
zipinfo.c and unzpriv.h.
Release MacZip ver1.04 final
25. January 2000
----------------
Final release of MacZip. All parts now
in final release state !!
1) Switch to MW Codewarrior pro 5.3
2) CHG: {zip} switch (back) to latest final release
unzip 2.30
3) CHG: {unzip} switch (back) to latest final release
unzip 5.40
Release MacZip ver1.04 beta 3
05. October 1999
----------------
1) CHG: {zip} switch to latest source level
unzip 2.30o beta release
2) CHG: {unzip} switch to latest source level
unzip 5.41c beta release
3) ADD: {console} added menu to print the license
Release MacZip ver1.04 beta 2
02. June 1999
--------------
1) FIX: {unzip} added one more criteria to make the recognition
of macbinary more save.
2) FIX: {unzip} sometimes, archive entries without any extra field
caused problems; the default setting of the extra field
was not set back to 'unknown' properly.
3) FIX: {zip} Archive filename with invalid characters like '/' gets
renamed. However, I do not check the complete path - needs
some more work here.
4) FIX: {zip} Filename match was case sensitive.
6) CHG: {zip} switch to latest source level
unzip 2.30m beta release
7) CHG: {unzip} switch to latest source level
unzip 5.41b beta release
8) FIX: {zip/unzip 68k only) I have found a wrong compiler setting
for the 68k version. Because of this wrong setting the 68k
version crashed.
Release MacZip ver1.04 beta 1
30. March 1999
--------------
1) CHG: {unzip) switch to latest source level
unzip 5.41a beta release
2) ADD: {all} Added message logging support for Syslogd
by Brian Bergstrand. Syslogd can be found at
http://www.classicalguitar.net/brian/apps/syslogd/
This feature is 'under construction'.
3) FIX: {all} many small fixes and code cleanups
Release MacZip ver1.03
27. March 1999
--------------
1) CHG: {console} Like Stuffit Expander MacZip quits automatically when
used with drag'n drop or as Helper App (Web-Browser).
2) CHG: {console} Since Macintosh users are used to be guided by their
software in order not to do something stupid, I added a check
to post an extra warning if the options -m and data fork only
are both checked.
This behavior can be disabled: See Applescript example and
"maczip.env".
3) CHG: {zip} switch from immediate deletion to moving to the
trash. Immediate deletion is now an option in "maczip.env".
4) CHG: {zip} enhanced progress display.
5) CHG: {zip) switch to latest source level
zip 2.3l beta release
6) CHG: {unzip} The zip archive contains file names greater than
31 characters. When MacZip tries to unzip the file, the
FSpCreate command fails because the filename length is to
long. MacZip correct this problem by trying to truncate
the file names to the 31 character limit.
7) FIX: {zip/console} A couple of minor fixes
8) CHG: {zip} Switched file-globbing to the Info-ZIP version.
Release MacZip ver1.02
14. February 1999
-----------------
1) CHG: {zip} Changed the rule of file inclusion if switch '-X'
is set. Following conditions are checked:
a) if length of resource-fork is equal zero *and* the
length of data-fork is equal zero include the file.
b) if length of resource-fork greater zero *and* the
length of data-fork is equal zero don't include the file.
c) if length of data-fork greater zero include the file.
2) CHG: {Console} Some users are very confused by the buttons "START PATH"
and "ZIP ARCHIVE". Somehow, it wasn't clear what the intended
meaning was. I changed the buttons to more clear labels on
them like: "file or folder to compress" and "location of
compressed file"
3) CHG: {Console} I changed the menu structure to be more intuitive.
4) FIX: {Console} Found a nasty bug which sometimes caused crashes
when the Zip / Unzip Dialogbox was used.
5) CHG: {Console} Handling of file dialog is now a bit more restricted:
e.g: it's not possible to select a file if you have to select
a folder.
Release MacZip ver1.01
30. January 1999
----------------------
1) CHG: {console} The use of the "Current App" mechanism was clumsy
and forces the user into the Zip or Unzip modes. This kind
of modality is not so good for the command line. It's now
neccessary to enter zip or unzip to choose the action.
2) FIX: {console} When Applescript sends quit to MacZip the script
that is running shows a spinning cursor and MacZip
does not quit.
3) FIX: {console} MacZip gots accidentally the wrong creator code
(from BBedit)
Final Release MacZip ver1.0
---------------------------
Released 21. January 1999
9. Beta release 06.December.1998
---------------------------------
1) CHG: {console} The checkbox of Filedialog (for extract path and file path)
"Show all files" is now selected by default.
2) CHG: {unzip/standalone} changed prototypes of mac[f]printf() to return
an int number (better ANSI conformance);
3) FIX: {unzip} repaired "stdout/stderr" mode of macwrite(). So func
MacMessagePrnt() is now obsolete and removed.
4) ADD: {zip/unzip} Compressed Mac3 extra-fields are now supported
(Thanks to Christian Spieler)
5) ADD: {unzip} Extraction of ZipIt archive are now supported. This support
is not complete: Filenames are correct but folder names are only
restored with the public directory names.
6) ADD: {zip/unzip} Improved documentation.
7) FIX: {unzip} Function isZipfile() is completely rewritten.
8) CHG: {zip/unzip) switch to latest source level
zip 2.3i beta and unzip 5.4 final release
9) ADD: Applescript event "do_cmd".
Unless there are big bugs found, this release will be the last
beta release. The final release will come out in January 1999.
8. Beta release 20.November.1998
---------------------------------
1) CHG: {zip/unzip) switch to latest source level
zip 2.3h beta and unzip 5.4 final release
2) ADD: {zip} Zip finds "namelocked" files also, if switch "-S"
is set.
3) FIX: {unzip} Function isZipfile() fails if the zip archive
has a comment.
4) CHG: {zip} added some small speed improvements to pattern matching and
isZipFile() function.
5) FIX: {unzip} Display of comments is fixed.
UzpMessagePrnt() is replaced by MacMessagePrnt(). I do not care
about ansi-bombs. I'm not sure, so this fix may be changed later.
6) RMV: {unzip} Buildin More capability is removed since it's already built
into the GUI-App.
7. Beta release 09.November.1998
---------------------------------
1) CHG: {all} switched to Metrowerks Codewarrior Pro 4
2) FIX: {unzip} Display of comments stored in the zip-file is
now fixed
3) FIX: {zip} Fixed display of the zip help-screen.
4) CHG: {zip/unzip} Changed special dir 'Re$0urce.Fk' to 'XtraStuf.mac'
(see entry at 13.June.1998 item 3). I found it more descriptive for
users outside the mac-community.
5) CHG: {all} switched to MoreFiles 1.4.9.
6) CHG: {console} changed behaivor of the file open dialog: The select
button is now always enabled.
7) ADD: {all} Environment variables are now supported.
Basically, it is possible to add timezone (= TZ environment variable)
support here, but it's not yet implemented.
See "MacZip.Env" for further info.
8) RMV: {console} Targets "zip only" and "unzip only" are removed.
6. Beta release 09.September.1998
---------------------------------
1) CHG: {Zip/Unzip} Metrowerks Standardlibrary time funktions are
rather broken and incomplete so I was forced to rewrite the
funktions: mktime(), localtime(), gmtime() and time().
2) ADD: {Console} Added Pause Funktion for screen output.
The Pause-Function is selfadjusting: Count of lines is depending
on the window size.
3) CHG: Extra-Field layout is changed: All datas are now in little-endian
format (see appnote)
4) ADD: {Console} Added an option to test the archive automatically
after zipping. This option is only via Zip-Dialogbox available
because it needs the unzip-module also.
5) CHG: {Zip} code is now up to date with the latest beta 2.3f.
6) ADD: {Console} Added (drag'n) drop support. Drop on the MacZip icon.
The following situations are supported:
1. drop of one or more zipfiles (action = unzip)
each archive will be extracted in a separate folder
2. drop of a folder (action = zip -r )
The complete folder (inclusive sub-folders)
will be zipped
Not (yet) supported is currently: dropping more than one file
to compress. Workaround: Put all your files in one folder and
drop that folder on MacZip.
MacZip recognize zip-archives automatically.
5. Beta release 21.Aug.1998
----------------------------
1) ADD: {Console} Userinterface has now a Statusbar to show the
Progress.
2) ADD: {Console} It's now possible to stop the run of Zip/Unzip
with the well known shortcut [Command] + [.]
3) CHG: {Console} Improved user-entry routine.
4) ADD: {Zip/Unzip} Crypt-code added. It's now possible to
encrypt/decrypt archives.
5) RMV: {Unzip} Removed the warning of PKZip/Mac archive.
Unzip gets confused with the extra field of PKZip/Mac. So I assume
the extra field isn't compatible with Info-ZIP's definition.
6) CHG: switched to Metrowerks Codewarrior Pro 3
this includes:
- new Universal Interfaces 3.1 Headers
- improved codegeneration
7) CHG: {Zip} code is now up to date with the latest beta 2.3e.
8) CHG: {Unzip} changed function names wprintf, wgets .. to macprintf, macgets ..
to avoid naming conflict standart library.
9) ADD: {Zip/Unzip} FXinfo, Mac-Pathname, file-dates and Finder-Comments
are now stored in the extra-field. Extra-field layout is
changed accordingly. Unzip uses now the filename stored in the
extra-field when unzipping.
10) CHG: {Unzip} code is now up to date with the latest beta 5.33g.
11) CHG: {Unzip} code is (again) up to date with the latest beta 5.33h.
12) ADD: {Unzip} following switches were added:
-J [MacOS only] ignore mac extra info. All macintosh
info are not restored. Datafork and resource-fork
are restored separatly.
-i [MacOS only] ignore filenames stored in mac extra
field. Use the most compatible filename stored in
the public field.
-E [MacOS only] show mac extra field during restoring
13) ADD: {Zip/Unzip} Charset MacRoman to ISO8859 Latin and vice versa
14) RMV: {Zip} -N option removed. This MacZip crashes using this option.
I will fix it later.
I think I'm very close for a final release of "MacZip 1.0" :-)
4. Beta release 27.June.1998
----------------------------
26.June.1998
------------
1) FIX: {Zip} extra field size value was wrong.
25.June.1998
------------
1) CHG: {Zip} code is now up to date with the latest beta 2.3d.
So both modules, zip & unzip, uses now latest beta.
2) ADD: {Zip} added a UT extra-field for better compatibility.
3) CHG: {Unzip} changed the code to find the mac extra-field.
Unzip has to look for a mac extra-field because
mac-archives has now two extra-fields (UT + M3).
4) CHG: {Unzip} changed the method to move extra-field data to
the internal extra-structure.
Old method was just BlockMove of the ef_structptr to ef_memptr.
This method was dangerous because not all members of the
structure seamless aligned. There are may be some fill
bytes in the structure depending on the compiler setting.
5) ADD: {Unzip} added a warning if unzipping a ZipIt/PKZip archive.
ZipIt/PKZip archives are usually additionally coded somehow.
InfoZip's Unzip will *not* decode the files. So extracted
files are may be not decoded. (see also 6. and 7.)
6) ADD: ZipIt (the Shareware Tool) has now a new extra-field signature:
0x2705. Found in "ZipIt 1.3.8". I added a new macro: EF_ZIPIT2
7) ADD: Added PKWare's extra-field signature: 0xCF77.
Found in "PKZIP v2.03". I added a new macro: EF_PKMAC
8) ADD: {console} It's now possible to save all screen outputs
to the disk.
9) RMV: {console} this is the first beta without expire-date.
16.June.1998
------------
1) FIX: {Unzip/console} Extract path now defaults to current-dir if
no path is given.
2> CHG: {Unzip} creates now a extract-folder by default. This behavior
differs to the commandline tool of Unzip on other platforms.
However, for a mac-user is this behavior more convenient.
3. Beta release 15.June.1998
----------------------------
15.June.1998
------------
1) CHG: {unzip/zip} I changed the layout of the extra field
to support more data.
14.June.1998
------------
1) FIX: {Unzip} adjusted time_t value with an correct offset value.
2) FIX: {Unzip} removed all unused code based on unfinished ideas by
former porter(s).
3) CHG: use of shared code izshr 032.
13.June.1998
------------
1) FIX: {Unzip} Filenames are only converted when needed. When zipping
with the switch 'datafork only' the filenames are shorted which
was wrong.
2) CHG: {Unzip} code is now up to date with the latest beta 5.33f.
3) CHG: {Zip} Changed the naming rule of filenames from old Johnny Lee's
to my implementation. Johnny Lee's idea is based on change of the
filenames which cases several problems when unziping on a non mac
plattform. My idea is to add a special directory: 'Re$0urce.Fk'.
For the future: Zip will create archives according the new nameing
rule. However unzip will be compatible with old nameing rule.
See also 4.
4} ADD: {Unzip} Added a new nameing rule for resource forks filename.
Resource forks are now stored in a special directory: 'Re$0urce.Fk'.
This naming rule make it easier to for other platforms to use
mac zip-files.
11.June.1998
------------
1) FIX: {Zip} Internal file attribute is set to BINARY by default
when zipping resource forks otherwise Unzip will create
sometimes wrong resource-forks.
2) CHG: {Unzip} code is now up to date with the latest beta 5.33e.
2. Beta release 10.June.1998
--------------------------
1) FIX: {Unzip} Long pathname fix solved. Unzip is now able to extract
archives with path longer than 256 chars.
2) CHG: {Unzip} removed all conversion from c-style string to
pascal-string (see fix 1)
3) ADD: {Unzip} Finderinfo of folders are also restored.
4) ADD: {Console} Added info about current path in the command-line box.
5) FIX: {Console} Construction of the command-line of the unzip-dialog
box fixed.
First beta release 06.June.1998
-----------------------------
no history.
Just to many code was neccessary to build the first mac-port.
Start of the port MacZip
February 1998
--------------------------------------------------------------------------------
Legende:
FIX: fixes a bug
CHG: inform about changed items.
ADD: added feature
RMV: removed Item
{Unzip} -> only related to the Unzip-module
{Zip} -> only related to the Zip-module
These are just libraries and are linked into the console-app.
{Console} -> only related to the Userinterface (not SIOUX)
MacOS has no tool like a command-line. So it's neccessary
to write wrapper around the command-line tools.
Dirk Haase

View file

@ -1,569 +0,0 @@
A free Macintosh Port of Info-ZIP's
Zip and UnZip
By Dirk Haase, d_haase@sitec.net
Home page: www.sitec.net/maczip
Mirror page:
www.haase-online.de/dirk/maczip
================================
Abstract:
---------
MacZip is a cross-platform compatible tool that includes
both Zip (for compression) and UnZip (for extraction).
Zip is a compression and file packaging utility for Unix,
VMS, MSDOS, OS/2, Windows 9x, Windows NT, Atari, Macintosh,
Amiga, Acorn RISC OS, and other systems.
UnZip unpacks zip archives. The Zip and UnZip programs can
process archives produced by PKZIP, and PKZIP and PKUNZIP
can work with archives produced by zip. Zip version 2.2 is
compatible with PKZIP 2.04.
If you are new to MacZip please read first the file
"ReadMe.1st".
License:
--------
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
Requirements
------------
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 is distributed as a fat binary with both
regular 68K and native PowerPC versions included.
Installation
------------
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. The GUI is very simple. It was not my intention to
make a full-blown GUI, however I think it is comfortable
enough to use it as regular tool.
This port supports also Apple-event. So you can install it
in your WWW-Browser as a helper app.
For more Info about the contents of this package, take a
look into the "macos/Contents" (or :macos:Contents) file.
Some notes on how to rebuild the Macintosh applications can
be found in INSTALL.
Usage:
------
Basically there are four ways to start MacZip:
a) Drag'n Drop
b) using the Dialog box (Menu: File -> Zip/Unzip):
Please read the file "ReadMe.1st"
for the description of the items a and b.
c) Using the Command line (Menu: File->Command Line):
The Zip & UnZip tools are command line tools. So the
behavior is exactly the same like the Zip & UnZip tools on
Unix or Windows/DOS. This means, if you want to zip some
files, you have to write a command line like this: "zip
[switches] path_to_zip_archive path_to_files_folders"
- Go to "File", select "Command Line" and the
"MacZip Entry box" Dialog Box appears.
An example:
a: your zip may be created at
Macintosh HD:applications:archive.zip
b: your files may be found at
Macintosh HD:somewhere:my_folder_to_archive:*
Note: At the end of the path there must be a filename or
a wild card !
(see Footnotes: 1 wild card, 2 Mac path names)
So the command line should look like (one line!):
zip "Macintosh HD:applications:archive.zip" "Macintosh HD:somewhere:my_folder_to_archive:*"
- Click on "Enter" to start the task.
Since you can not set a default folder you have to enter
always a full qualified path names. Full-qualified path
names are path names including the Volume name ! (see
Footnote: 2 Mac path names)
d) Using Applescript:
There is only one additional event defined: "do_cmd". You
can enter every valid command line. The first word must be
"zip" or "unzip" to select the action (compress or
extraction).
See sample Applescript:
tell application "MacZip (PPC)"
activate
with timeout of 90000 seconds
do_cmd "zip -rjjN Volume:archive \"My Volume:*\" "
end timeout
end tell
This script opens MacZip, brings it to the foreground on the
Mac, starts the zip action with the command line: zip -rjjN
Volume:archive "My Volume:*" .
A short introduction is also available online:
http://www.sitec.net/maczip/How-To-Do/
It's possible to stop the run of Zip/Unzip with the well
known shortcut [Command] + [.].
---------------------------------------------------------------------------
There are some Mac-specific switches available.
Zip Module:
-df [MacOS] Include only data-fork of files zipped into
the archive. Good for exporting files to foreign
operating-systems. Resource-forks will be ignored
at all.
-jj [MacOS] record Fullpath (+ Volname). The complete
path including volume will be stored. By default
the relative path will be stored.
-S [MSDOS, OS/2, WIN32 and ATARI] Include system and
hidden files.
[MacOS] Includes finder invisible files, which are
ignored otherwise.
Unzip Module:
-E [MacOS only] display contents of MacOS extra field
during restore operation.
-i [MacOS only] ignore filenames stored in MacOS extra
fields. Instead, the most compatible filename
stored in the generic part of the entry's header is
used.
-J [MacOS only] ignore MacOS extra fields. All Macin-
tosh specific info is skipped. Data-fork and
resource-fork are restored as separate files.
Select [File]->[Get Help on Zip/Unzip] for a complete list
of switches.
Limitations / Problems:
-----------------------
- Aliases are not supported. I tried, but I got broken
aliases. This port will silently ignore all aliases.
It's on my to-do list for future releases.
- Zip needs much memory to compress many files: You may need
to increase the 'Preferred Size' in 'Get Info'. Values of 12
Megabytes or more are possible
- Unzip needs about 500 Kbytes of memory to unzip no matter
how many files were compressed and expanded.
- and finally one big macintosh-related problem:
This port has one weak point: It's based on path names.
As you may be already know: Path names are not unique on a Mac !
The main reason is that an attempt to implement support exact
saving of the MacOS specific internal file structures would
require a throughout rewrite of major parts of shared code,
probably sacrifying compatibility with other systems. I have
no solution at the moment. The port will just warn you if you
try zip from / to a volume which has a duplicate name.
MacZip has problems to find the archive or the files. My
(Big) recommendation: Name all your volumes with a unique
name and MacZip will run without any problem.
Known Bugs:
- crypted files in a zip archive are sometimes corrupt:
I get an error message: invalid compressed data to inflate.
Appearance of this error is purely be chance: I did a small
test: Unzipping an archive containing 3589 files 56 files
fails to unzip, so about 1.5%. Root cause is completely
unclear to me :(
I strongly recommend to test your archive (e.g. unzip -t archive).
Zip Programs / Macintosh Extra-Data:
-----------------------------------------
A brief overview:
Currently, as far as I know, there are 6 Zip programs
available for the Macintosh platform. These programs build
(of course) different variants of Zip files:
- Info-ZIP's first Port of Zip. Ported by Johnny Lee
This port is rather outdated and no longer supported (since 1992).
68K only. Only minimal Mac-info is stored
(Creator/Type, Finder attributes). Creator/Type: '????' / '????'
Until year 1998, only UnZip 5.32 survived.
- ZipIt by Tom Brown. This is Shareware and still supported I think.
ZipIt has a nice GUI, but I found it can't handle large Zip files
quite well. ZipIt compresses Macintosh files using the Mac Binary
format. So, transferring files to other platforms is not so easy.
Only minimal Mac-info is stored (Creator/Type, Finder attributes).
Mac filenames are changed to a most compatible filename.
Creator/Type: 'ZIP ' / 'ZIP '
- PKZIP/mac v2.03/210d. This is Shareware.
This Zip implementation for the Mac can be found on ASI's web site
(http://www.asizip.com/products/products.htm). The name of this
program is misleading, it is NOT a product from PKWARE. ASI's last
release version is v2.03, and they also offer a newer beta version
PKZIP/mac 210d. But even the Beta version is rather outdated (1995).
Only minimal Mac-info is stored (Creator/Type, Finder attributes).
The Zipfile format looks like incompatible to other platforms.
(More details about the compatibility issue can be found in
proginfo/3rdparty.bug!). Type: 'PKz1'
Mac filenames are restored without any change.
- Aladdin DropZip 1999, This is Shareware. Aladdin chose
the format of ZipIt. Therefore, it has the some drawbacks
like ZipIt.
Creator/Type: 'SITx' / 'ZIP '
- SmartZip 1.0 1999 - by Marco Bambini Vampire Software.
This is Shareware. SmartZip compresses Macintosh files using the
Mac Binary. Therefore, it has the same drawbacks like ZipIt.
Creator/Type: 'dZIP' / 'ZIP '
and finally:
- Info-ZIP's latest Port of Zip. MacZip 1.0. Ported by me :-)
It is supported (of course) and up to date. Full set of macintosh
info is stored: Creator/Type, Finder attributes, Finder comments,
MacOS 8.0 Folder settings, Icon/Folder Positions ...
Mac filenames are restored without any change.
Creator/Type: 'IZip' / 'ZIP '
Compatibility of my port; Extraction:
- Archives from Info-ZIP's first port (by Johnny Lee) are
still compatible.
- Extraction of ZipIt archives is supported. This support
is not complete: Filenames are correct but Directory names
are sometimes mangled to a DOS compatible form. Segmented
archives are not supported.
- PKZiP/mac archive files are extracted without resource-forks
and without any Finder info. I have no information about
that zip format.
Compatibility of my port; Compression:
- My port supports only the new Info-ZIP format (introduced
with this port). Therefore archives created by MacZip 1.0
(March 1999) must be extracted with this version or later
releases of Info-ZIP's UnZip to restore the complete set of
Macintosh attributes.
Note: This port is complete unrelated to the shareware ZipIt.
Even more, handling of special Macintosh attributes is
incompatible with ZipIt. This port (MacZip) may be used to
extract archives created by ZipIt, but make sure that you
get the result as you expected.
Macintosh Files; File Forks:
----------------------------
All Macintosh files comprise two forks, known as the data
fork and the resource fork. Unlike the bytes stored in the
resource fork, the bytes in the data fork do not have to
exhibit any particular internal structure. The application
is responsible for interpreting the bytes in the data fork
in whatever manner is appropriate. The bytes in the resource
fork usually have a defined internal structure and contain
data object like menus, dialog boxes, icons and pictures.
Although all Macintosh files contain both a data fork and a
resource fork, one or both of these forks may be empty.
MacZip stores data-forks and resource-forks separately. The
Zipfile format does not allow to store two archive entries
using exactly the same name. My solution is to modify the
Path name of the resource-fork. All resource-fork names are
prepended with a leading special directory named
"XtraStuf.mac". So, when extracting on a Mac, you should
never see this directory "XtraStuf.mac" on your *disk*.
On all foreign systems that support directories in filenames
(e.g.: OS/2, Unix, DOS/Windows, VMS) you will get a
directory "XtraStuf.mac" when extracting MacZip archives.
You can delete the complete directory "XtraStuf.mac" since
Mac resources do not make much sense outside the MacOS
world.
Text encoding; Charsets of the Filenames:
-----------------------------------------
The following information is only important if you plan to
transfer archives across different platforms/language systems:
A typical Zip archive does not support different charsets.
All filenames stored in the public area (= accessible by
foreign systems other than MacOS) must be coded in the
charset ISO-8859-1 (CP1252 in the Microsoft Windows world)
or CP850 (DOSLatin1). The latter should only be used by Zip
programs that mark the archive entries as "created under
DOS". Apart from Macs, the commonly used platforms either
support ISO-8859-1 directly, or are compatible with it. To
achieve maximum compatibility, MacZip convert filenames from
the Mac OS Roman character set to ISO-8859-1 and vice versa.
But not every char of the charset MacRoman has their
equivalent in ISO-8859-1. To make the mapping in most cases
possible, I chose most similar chars or at least the MIDDLE
DOT.
Mac OS Roman character set is used for at least the
following Mac OS localizations: U.S., British, Canadian
French, French, Swiss French, German, Swiss German, Italian,
Swiss Italian, Dutch, Swedish, Norwegian, Danish, Finnish,
Spanish, Catalan, Portuguese, Brazilian, and the default
International system.
In all Mac OS encodings, character codes 0x00-0x7F are
identical to ASCII, except that
- in Mac OS Japanese, yen sign replaces reverse solidus
- in Mac OS Arabic, Farsi, and Hebrew, some of the
punctuation in this range is treated as having strong
left-right directionality, although the corresponding
Unicode characters have neutral directionality
So, for best compatibility, confine filenames to the standard
7-bit ASCII character set.
If you generate a filename list of your archive (unzip -l),
you will see the converted filenames. Your can also extract
the archive with the switch '-i' (= ignore mac filenames),
and test your result.
This MacZip port uses its own filename stored in the
archive. At the moment, the filename will be not converted.
However, I'm planning to add support for Unicode.
Currently, the following Mac OS encodings are NOT supported:
Japanese, ChineseTrad, Korean, Arabic, Hebrew, Greek,
Cyrillic, Devanagari, Gurmukhi, Gujarati, Oriya, Bengali,
Tamil, Telugu Kannada, Malayalam, Sinhalese, Burmese, Khmer,
Thai, Laotian, Georgian, Armenian, ChineseSimp, Tibetan,
Mongolian, Ethiopic, Vietnamese, ExtArabic and finally:
Symbol - this is the encoding for the font named "Symbol".
Dingbats - this is the encoding for the font named "Zapf Dingbats".
If you extract an archive coded with one of these
charsets you will probably get filenames with funny
characters.
These problems apply only to filenames and NOT to the file
content.
of course: The content of the files will NEVER be converted !!
File-/Creator Type:
-------------
This port uses the creator type 'IZip' and it is registered
at Apple (since 08. March 1998). File types can not be
registered any more. This port uses 'ZIP ' for Zip archive
files. The creator 'IZip' type should be used for all future
versions of MacZip.
Hints for proper restoration of file-time stamps:
-------------------------------------------------
UnZip requires the host computer to have proper time zone
information in order to handle certain tasks correctly (see
unzip.txt). To set the time zone on the Macintosh, go to
the Map Control Panel and enter the correct number of hours
(and, in a few locales, minutes) offset from Universal
Time/Greenwich Mean Time. For example, the US Pacific time
zone is -8 hours from UTC/GMT during standard (winter) time
and -7 hours from UTC/GMT during Daylight Savings Time. The
US Eastern time zone is -5 hours during the winter and -4
hours during the summer.
Discussion of Daylight Savings Time
-----------------------------------
The setting in the Date & Time control panel for Daylight
Savings time is a universal setting. That is, it assumes
everybody in the world is observing Daylight Savings time
when its check box is selected.
If other areas of the world are not observing Daylight
Savings time when the check box is selected in the Date &
Time control panel, then the Map control panel will be off
by an hour for all areas that are not recognizing Daylight
Savings time.
Conversely, if you set the Map control panel to an area that
does not observe Daylight Savings time and deselect/uncheck
the check box for Daylight Savings time in the Date & Time
control panel, then time in all areas celebrating Daylight
Savings time will be off by an hour in the Map control
panel.
Example:
In the case of Hawaiians, sometimes they are three hours
behind Pacific Standard Time (PST) and sometimes two hours
behind Pacific Daylight Time (PDT). The Map control panel
can only calculate differences between time zones relative
to Greenwich Mean Time (GMT). Hawaii will always show up as
three hours past the Pacific time zone and five hours past
the Central time zone.
When Hawaiians are not observing Daylight Savings time, but
the rest of the country is, there is no combination of
settings in Map and Date & Time control panels which will
enable you to display Hawaiian local time correctly AND
concurrently display the correct time in other places that
do observe Daylight Savings time.
The knowledge about which countries observe Daylight Savings
time and which do not is not built into the Map control
panel, so it does not allow for such a complex calculation.
This same situation also occurs in other parts of the world
besides Hawaii. Phoenix, Arizona is an example of an area of
the U.S. which also does not observe Daylight Savings time.
Conclusion:
MacZip only knows the GMT and DST offsets of the
current time, not for the time in question.
Projects & Packages:
--------------------
A Note to version numbers: Version of MacZip is currently
1.06 and is based on the zip code version 2.3 and unzip code
version 5.42. See About Box for current version and compiler
build date.
Because of the amount of sources I splitted this port into
several projects. See http://www.sitec.net/maczip for
updates.
- core source parts:
unzxxx.zip
zipxxx.zip
These archives contains the main parts of the port. You can
build libraries and a standalone App with Metrowerks
standard console SIOUX. They contain only sources, no
executables. These archives are exact copies of the standard
Info-ZIP source distributions; they were only repackaged
under MacOS using MacZip, with one minor addition: For those
files that are stored in BinHex'ed format in the Info-ZIP
reference source archives, unpacked version that are ready
for use have been added.
- additional source part:
MacZipxxx.zip: contains all the GUI stuff and the project
files to build the main-app. Only sources of the GUI, no
zip or unzip code. To build MacZip successfully you will
need to also download the zip and unzip packages.
- executables:
MacZipxxxnc.hqx: contains only executables and 'README.TXT',
This version is without en-/decryption support !
MacZipxxxc.hqx: contains only executables and 'README.TXT',
This version supports en-/decryption !
- encryption sources:
zcryptxx.zip: To build crypt versions of MacZip.
download from ftp://ftp.icce.rug.nl/infozip/ (and subdirectories)
- documentation:
MacZipDocu.zip: contains some further docus about the algorithm,
limits, Info-ZIP's appnote and a How-to-do Webpage.
Credits:
--------
Macstuff.c and recurse.c: All the functions are from More Files.
More Files fixes many of the broken or underfunctional parts of
the file system. Thanks to Jim Luther. (see morefiles.doc)
---------------------------------------------------------------------------
Footnotes:
1. wild card:
The '*' is a wild card and means 'all files'
Just in case you don't know wild cards:
'*' is a place holder for any character.
e.g.:
"this*" matches with "this_file" or "this_textfile" but it
doesn't match with "only_this_file" or "first_this_textfile"
"*this*" matches with "this_file" or "this_textfile" AND
matches with "only_this_file" or "first_this_textfile"
2. Mac pathnames:
The following characteristics of Macintosh pathnames should
be noted:
A full pathname never begins with a colon, but must contain
at least one colon.
A partial pathname always begins with a colon separator except
in the case where the file partial pathname is a simple file or
directory name.
Single trailing separator colons in full or partial pathnames
are ignored except in the case of full pathnames to volumes.
In full pathnames to volumes, the trailing separator colon is
required.
Consecutive separator colons can be used to ascend a level
from a directory to its parent directory. Two consecutive
separator colons will ascend one level, three consecutive
separator colons will ascend two levels, and so on. Ascending
can only occur from a directory; not a file.
---------------------------------------------------------------------------
Dirk Haase
==========

Some files were not shown because too many files have changed in this diff Show more