home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume23
/
zip
/
part09
< prev
next >
Wrap
Text File
|
1991-10-21
|
42KB
|
1,309 lines
Newsgroups: comp.sources.misc
From: kirsch@usasoc.soc.mil (David Kirschbaum)
Subject: v23i096: zip - Portable zip v1.0, Part09/09
Message-ID: <1991Oct21.042253.8320@sparky.imd.sterling.com>
X-Md4-Signature: 257e761b177443508ff2a00c7da97aaa
Date: Mon, 21 Oct 1991 04:22:53 GMT
Approved: kent@sparky.imd.sterling.com
Submitted-by: kirsch@usasoc.soc.mil (David Kirschbaum)
Posting-number: Volume 23, Issue 96
Archive-name: zip/part09
Environment: UNIX, Minix, MSDOS, OS/2, VMS
#! /bin/sh
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# Contents: INFOZIP.WHO crypt.h dir_os2.h globals.c makecrc.c makefile
# makefile.bor makefile.msc revision.h tailor.h tempf.c tempf.h
# Wrapped by kent@sparky on Sun Oct 20 22:58:57 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive 9 (of 9)."'
if test -f 'INFOZIP.WHO' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'INFOZIP.WHO'\"
else
echo shar: Extracting \"'INFOZIP.WHO'\" \(4521 characters\)
sed "s/^X//" >'INFOZIP.WHO' <<'END_OF_FILE'
XThese members of the INFO-ZIP group contributed to the development and
Xtesting of portable Zip. They are responsible for whatever works in Zip.
XWhatever doesn't work is solely the fault of the authors of Zip (Mark Adler,
XRich Wales, and Jean-loup Gailly).
X
XMark Adler madler@tybalt.caltech.edu NeXT 2.x
XGlenn J. Andrews oper1%drcv06.decnet@drcvax.af.mil VAX VMS
XTom Betz marob!upaya!tbetz@phri.nyu.edu SCO Xenix 2.3.1
XJames Birdsall jwbirdsa@amc.com AT&T 3B1
XWim Bonner 27313853@WSUVM1.CSC.WSU.EDU HP 9000/840a HPUX
XPaul Borman prb@cray.com Cray-X/YMP,2 UNICOS 6-8
XLeslie C. Brown lbrown@BRL.MIL Pyramid MIS-4
XRalf Brown ralf@b.gp.cs.cmu.edu Pyramid MIS-4
XPietro Caselli zaphod@petruz.sublink.org Minix 1.5.10
XBill Davidsen davidsen@crdos1.crd.ge.com Xenix (on what?)
XDaniel Deimert daniel@hexagon.se zeus3.21 Zilog S8000
XJames P. Dugal jpd@usl.edu Pyramid 90X OSx4.1
X"Evil Ed" esaffle@gmuvax2.gmu.edu Ulrix-32 V3.1 (Rev. 9)
XGreg Flint afc@klaatu.cc.purdue.edu ETA-10P* hybrid Sys V
XJeff Foy jfoy@glia.biostr.washington.edu IRIX Sys V Rel 3.3.1
XKevin M. Fritz kmfritz@apgea.army.mil Turbo C++ 1.0
XJean-loup Gailly jloup@chorus.fr MS-DOS Microsoft C 5.1
XScott D. Galloway sgallowa@letterkenn-emh1.army.mil Sperry 5000 SysV.3
XDavid Gundlach david@rolf.stat.uga.edu Sun SS1+ SunOS 4.1
XPeter Jones jones@mips1.info.uqam.ca MIPS UMIPS 4.0
XBruce Kahn bkahn@archive.webo.dg.com MS-DOS Microsoft C 5.1
XBob Kemp Robert.V.Kemp@ATT.COM AT&T 3B2 SysV 3.2v2
XEarl Kiech KIECH@utkvx.utk.edu VAX VMS V5.4-1A
XDavid Kirschbaum kirsch@usasoc.soc.mil He got us all in this
X mess in the first place
XBo Kullmar bk@kullmar.se DNIX 5.2, 5.3
XHarry Langenbacher harry@neuron6.Jpl.Nasa.Gov Sun SS1+ SunOS 4.1
XMichael D. Lawler mdlawler@bsu-cs.bsu.edu Mt.Xinu BSD 4.3 on VAX
XDavid Lemson lemson@ux1.cso.uiuc.edu Sequent Dynix 3.0.17
XOnno van der Linden linden@fwi.uva.nl SCO Unix 3.2.0
XWarner Losh imp@Solbourne.COM packing algorithm help
XJohn Lundin lundin@urvax.urich.edu VAX VMS
XCliff Manis root@csoftec.csf.com SCO 2.3.1 (386)
XBill Marsh bmarsh@cod.nosc.mil SGI Iris 4D35
XRobert McBroom (?) rm3@ornl.gov DECsystem 5810
XWilliam O'Shaughnessy williamo@hpcupt1.cup.hp.com HPUX
XEnrico Renato Palmerini palmer@vxscaq.cineca.it UNISYS 7000 Sys 5 r2.3
XKeith Petersen w8sdz@simtel20.army.mil Maintainer of Info-ZIP
X Pyramid UCB OSx4.4c
XDavid A Rasmussen dave@convex.csd.uwm.edu Convex C220 with 9.0 OS
XMichael Regoli mr@cica.indiana.edu Ultrix 3.1 VAX 8650
X BSD 4.3 IBM RT/125
X BSD 4.3 MicroVAX 3500
X SunOS 4.0.3 Sun 4/330
XGreg Roelofs roelofs@amelia.nas.nasa.gov BSD 4.3 VAX 11/780
X VMS 5.2 VAX 8600
X UTS 1.2.4 Amdahl 5800
X Ultrix 4.1 DEC 5810
X Unicos 5.1, 6.0.11 Cray
X MS-DOS Microsoft C 6.0
X Irix 3.3.2, SGI Iris 4D
XKai Uwe Rommel rommel@informatik.tu-muenchen.de OS/2
XDave Sisson daves@vtcosy.cns.vt.edu AIX 1.1.1 PS/2 & 3090
XRon Srodawa srodawa@vela.acs.oakland.edu SCO Xenix/386 2.3.3
XBertil Stenstr|m stenis@heron.qz.se HP-UX 7.0 HP9000/835
XArjan de Vet devet@info.win.tue.nl SunOS 4.1, MSC 5.1
XRich Wales wales@cs.ucla.edu SunOS 4.0.3 Sun-3/50
END_OF_FILE
if test 4521 -ne `wc -c <'INFOZIP.WHO'`; then
echo shar: \"'INFOZIP.WHO'\" unpacked with wrong size!
fi
# end of 'INFOZIP.WHO'
fi
if test -f 'crypt.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'crypt.h'\"
else
echo shar: Extracting \"'crypt.h'\" \(1087 characters\)
sed "s/^X//" >'crypt.h' <<'END_OF_FILE'
X/*
X
X Copyright (C) 1990,1991 Mark Adler, Richard B. Wales, and Jean-loup Gailly.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*
X * crypt.h by Mark Adler.
X */
X
X/* Set up portability */
X#include "tailor.h"
X
X/* Define zfwrite() and zputc() functions */
X#ifdef EXPORT
X# define zfwrite fwrite
X# define zputc putc
X#else /* !EXPORT */
X extern int zfwrite OF((voidp *, extent, extent, FILE *));
X extern int zfputc OF((int, FILE *));
X extern char *key;
X# define zputc(b,f) (key!=NULL?zfputc(b,f):putc(b,f))
X#endif /* ?EXPORT */
X
X/* The implode routines now use the same temporary name generator */
Xchar *tempname OF((int));
X
X/* I'm sneaking this in on Rich's code to make my compiler a bit happier */
X#ifdef NeXT
X extern void free(voidp *);
X extern voidp *qsort(voidp *, extent, extent, int (*)());
X extern extent strlen(char *);
X extern int unlink(char *);
X#endif /* NeXT */
END_OF_FILE
if test 1087 -ne `wc -c <'crypt.h'`; then
echo shar: \"'crypt.h'\" unpacked with wrong size!
fi
# end of 'crypt.h'
fi
if test -f 'dir_os2.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'dir_os2.h'\"
else
echo shar: Extracting \"'dir_os2.h'\" \(1975 characters\)
sed "s/^X//" >'dir_os2.h' <<'END_OF_FILE'
X/*
X * @(#) dir.h 1.4 87/11/06 Public Domain.
X *
X * A public domain implementation of BSD directory routines for
X * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield),
X * August 1987
X *
X * Enhanced and ported to OS/2 by Kai Uwe Rommel; added scandir() prototype
X * December 1989, February 1990
X * Change of MAXPATHLEN for HPFS, October 1990
X */
X
X
X#define MAXNAMLEN 256
X#define MAXPATHLEN 256
X
X#define A_RONLY 0x01
X#define A_HIDDEN 0x02
X#define A_SYSTEM 0x04
X#define A_LABEL 0x08
X#define A_DIR 0x10
X#define A_ARCHIVE 0x20
X
X
Xstruct direct
X{
X ino_t d_ino; /* a bit of a farce */
X int d_reclen; /* more farce */
X int d_namlen; /* length of d_name */
X char d_name[MAXNAMLEN + 1]; /* null terminated */
X /* nonstandard fields */
X long d_size; /* size in bytes */
X unsigned d_mode; /* DOS or OS/2 file attributes */
X unsigned d_time;
X unsigned d_date;
X};
X
X/* The fields d_size and d_mode are extensions by me (Kai Uwe Rommel).
X * The find_first and find_next calls deliver this data without any extra cost.
X * If this data is needed, these fields save a lot of extra calls to stat()
X * (each stat() again performs a find_first call !).
X */
X
Xstruct _dircontents
X{
X char *_d_entry;
X long _d_size;
X unsigned _d_mode, _d_time, _d_date;
X struct _dircontents *_d_next;
X};
X
Xtypedef struct _dirdesc
X{
X int dd_id; /* uniquely identify each open directory */
X long dd_loc; /* where we are in directory entry is this */
X struct _dircontents *dd_contents; /* pointer to contents of dir */
X struct _dircontents *dd_cp; /* pointer to current position */
X}
XDIR;
X
X
Xextern int attributes;
X
Xextern DIR *opendir(char *);
Xextern struct direct *readdir(DIR *);
Xextern void seekdir(DIR *, long);
Xextern long telldir(DIR *);
Xextern void closedir(DIR *);
X#define rewinddir(dirp) seekdir(dirp, 0L)
END_OF_FILE
if test 1975 -ne `wc -c <'dir_os2.h'`; then
echo shar: \"'dir_os2.h'\" unpacked with wrong size!
fi
# end of 'dir_os2.h'
fi
if test -f 'globals.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'globals.c'\"
else
echo shar: Extracting \"'globals.c'\" \(2276 characters\)
sed "s/^X//" >'globals.c' <<'END_OF_FILE'
X/*
X
X Copyright (C) 1990,1991 Mark Adler, Richard B. Wales, and Jean-loup Gailly.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*
X * globals.c by Mark Adler.
X */
X
X#define GLOBALS /* include definition of errors[] in zip.h */
X#include "zip.h"
X
X
X/* Handy place to build error messages */
Xchar errbuf[FNMAX+81];
X
X/* Argument processing globals */
Xint recurse = 0; /* 1=recurse into directories encountered */
Xint pathput = 1; /* 1=store path with name */
Xint method = BEST; /* one of BEST, SHRINK (only), or IMPLODE (only) */
Xint dosify = 0; /* 1=make new entries look like MSDOS */
Xint verbose = 0; /* 1=report oddities in zip file structure */
Xint level = 5; /* 0=fastest compression, 9=best compression */
X#ifdef VMS
X int vmsver = 0; /* 1=append VMS version number to file names */
X#endif /* VMS */
Xint linkput = 0; /* 1=store symbolic links as such */
Xint noisy = 1; /* 0=quiet operation */
Xchar *special = NULL; /* List of special suffixes */
Xchar *key = NULL; /* Scramble password if scrambling */
Xchar *tempath = NULL; /* Path for temporary files */
X
X/* Zip file globals */
Xchar *zipfile; /* New or existing zip archive (zip file) */
Xulg zipbeg; /* Starting offset of zip structures */
Xulg cenbeg; /* Starting offset of central directory */
Xstruct zlist far *zfiles = NULL; /* Pointer to list of files in zip file */
Xextent zcount; /* Number of files in zip file */
Xextent zcomlen; /* Length of zip file comment */
Xchar *zcomment; /* Zip file comment (not zero-terminated) */
Xstruct zlist far **zsort; /* List of files sorted by name */
X
X/* Files to operate on that are not in zip file */
Xstruct flist far *found = NULL; /* List of names found */
Xstruct flist far * far *fnxt; /* Where to put next name in found list */
Xextent fcount; /* Count of files in list */
X
X/* Flags for cleaning up after compression routines */
Xint shract = 0; /* Shrink active */
Xint impact = 0; /* Implosion active */
END_OF_FILE
if test 2276 -ne `wc -c <'globals.c'`; then
echo shar: \"'globals.c'\" unpacked with wrong size!
fi
# end of 'globals.c'
fi
if test -f 'makecrc.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'makecrc.c'\"
else
echo shar: Extracting \"'makecrc.c'\" \(2388 characters\)
sed "s/^X//" >'makecrc.c' <<'END_OF_FILE'
X/* Not copyrighted 1990 Mark Adler */
X
X#include <stdio.h>
X
Xmain()
X/*
X Generate a table for a byte-wise 32-bit CRC calculation on the polynomial:
X x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
X
X Polynomials over GF(2) are represented in binary, one bit per coefficient,
X with the lowest powers in the most significant bit. Then adding polynomials
X is just exclusive-or, and multiplying a polynomial by x is a right shift by
X one. If we call the above polynomial p, and represent a byte as the
X polynomial q, also with the lowest power in the most significant bit (so the
X byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
X where a mod b means the remainder after dividing a by b.
X
X This calculation is done using the shift-register method of multiplying and
X taking the remainder. The register is initialized to zero, and for each
X incoming bit, x^32 is added mod p to the register if the bit is a one (where
X x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
X x (which is shifting right by one and adding x^32 mod p if the bit shifted
X out is a one). We start with the highest power (least significant bit) of
X q and repeat for all eight bits of q.
X
X The table is simply the CRC of all possible eight bit values. This is all
X the information needed to generate CRC's on data a byte at a time for all
X combinations of CRC register values and incoming bytes. The table is
X written to stdout as 256 long hexadecimal values in C language format.
X*/
X{
X unsigned long c; /* crc shift register */
X unsigned long e; /* polynomial exclusive-or pattern */
X int i; /* counter for all possible eight bit values */
X int k; /* byte being shifted into crc apparatus */
X
X /* terms of polynomial defining this crc (except x^32): */
X static int p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
X
X /* Make exclusive-or pattern from polynomial */
X e = 0;
X for (i = 0; i < sizeof(p)/sizeof(int); i++)
X e |= 1L << (31 - p[i]);
X
X /* Compute and print table of CRC's, five per line */
X printf(" 0x00000000L");
X for (i = 1; i < 256; i++)
X {
X c = 0;
X for (k = i | 256; k != 1; k >>= 1)
X {
X c = c & 1 ? (c >> 1) ^ e : c >> 1;
X if (k & 1)
X c ^= e;
X }
X printf(i % 5 ? ", 0x%08lxL" : ",\n 0x%08lxL", c);
X }
X putchar('\n');
X return 0;
X}
END_OF_FILE
if test 2388 -ne `wc -c <'makecrc.c'`; then
echo shar: \"'makecrc.c'\" unpacked with wrong size!
fi
# end of 'makecrc.c'
fi
if test -f 'makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'makefile'\"
else
echo shar: Extracting \"'makefile'\" \(4489 characters\)
sed "s/^X//" >'makefile' <<'END_OF_FILE'
X# Makefile for Zip, ZipNote, ZipSplit, and Ship.
X# Note: this makefile leaves out the encryption/decryption part of zip, and
X# completely leaves out the zipcloak program.
X
X# what you can make ...
Xdefault:
X @echo ''
X @echo 'Make what? You must say what system to make Zip for--e.g.'
X @echo '"make bsd". Choices: bsd, bsdold, sysv, sun, next, next10,'
X @echo 'hpux, dnix, cray, 3b1, zilog, aux, convex, aix, and minix.'
X @echo 'See the file zip.doc for more information.'
X @echo ''
X
X# variables (to use the Gnu compiler, change cc to gcc in CC and BIND)
XMAKE = make
XCC = cc
XBIND = cc
XRENAME = mv
X
X# flags
X# CFLAGS flags for C compile
X# LFLAGS1 flags after output file spec, before obj file list
X# LFLAGS2 flags after obj file list (libraries, etc)
XCFLAGS =
XLFLAGS1 =
XLFLAGS2 = -s
X
X# object file lists
XOBJZ = zip.o zipfile.o zipup.o fileio.o util.o tempf.o shrink.o globals.o
XOBJI = implode.o im_lmat.o im_ctree.o im_bits.o
XOBJN = zipnote.o zipfile_.o zipup_.o fileio_.o globals.o
XOBJS = zipsplit.o zipfile_.o zipup_.o fileio_.o globals.o
X
X# suffix rules
X.SUFFIXES:
X.SUFFIXES: _.o .o .c .doc .1
X.c_.o:
X $(RENAME) $< $*_.c
X $(CC) $(CFLAGS) -DUTIL -DEXPORT -c $*_.c
X $(RENAME) $*_.c $<
X.c.o:
X $(CC) $(CFLAGS) -DEXPORT -c $<
X.1.doc:
X nroff -man $< | col -b > $@
X
X# rules for zip, zipnote, zipsplit, and zip.doc.
X$(OBJZ): zip.h ziperr.h tempf.h tailor.h
X$(OBJI): implode.h crypt.h ziperr.h tempf.h tailor.h
X$(OBJN): zip.h ziperr.h tailor.h
X$(OBJS): zip.h ziperr.h tailor.h
Xzip.o zipup.o zipnote.o zipsplit.o: revision.h
Xzips: zip zipnote zipsplit ship
Xzipsman: zip zipnote zipsplit ship zip.doc
Xzip: $(OBJZ) $(OBJI)
X $(BIND) -o zip $(LFLAGS1) $(OBJZ) $(OBJI) $(LFLAGS2)
Xzipnote: $(OBJN)
X $(BIND) -o zipnote $(LFLAGS1) $(OBJN) $(LFLAGS2)
Xzipsplit: $(OBJS)
X $(BIND) -o zipsplit $(LFLAGS1) $(OBJS) $(LFLAGS2)
Xship: ship.c
X $(CC) $(CFLAGS) -o ship $(LFLAGS1) ship.c $(LFLAGS2)
X
X# These symbols, when #defined using -D have these effects on compilation:
X# ZMEM - includes C language versions of memset(), memcpy(), and
X# memcmp() (util.c).
X# DIRENT - use <sys/dirent.h> and getdents() instead of <sys/dir.h>
X# and opendir(), etc. (fileio.c).
X# NODIR - used for 3B1, which has neither getdents() nor opendir().
X# NDIR - use "ndir.h" instead of <sys/dir.h> (fileio.c).
X# UTIL - select routines for utilities (note and split).
X# PROTO - enable function prototypes.
X# RMDIR - remove directories using a system("rmdir ...") call.
X# CONVEX - for Convex make target.
X# AIX - for AIX make target.
X# EXPORT - leave out the encryption code.
X
X# BSD 4.3 (also Unisys 7000--AT&T System V with heavy BSD 4.2)
Xbsd:
X $(MAKE) zips CFLAGS="-O"
X
X# BSD, but missing memset(), memcmp().
Xbsdold:
X $(MAKE) zips CFLAGS="-O -DZMEM"
X
X# AT&T System V, Rel 3. Also SCO, Xenix, OpenDeskTop, ETA-10P*, SGI.
Xsysv:
X $(MAKE) zips CFLAGS="-O -DDIRENT"
X
X# DNIX 5.x: like System V but optimization is messed up.
Xdnix:
X $(MAKE) zips CFLAGS="-DDIRENT"
X
X# Sun OS 4.x: BSD, but use getdents().
Xsun:
X $(MAKE) zips CFLAGS="-O -DDIRENT"
X
X# NeXT 1.0: BSD, but use shared library.
Xnext10:
X $(MAKE) zips CFLAGS="-O" LFLAGS2="-s -lsys_s"
X
X# NeXT 2.0: BSD, but use MH_OBJECT format for smaller executables.
Xnext:
X $(MAKE) zips CFLAGS="-O" LFLAGS2="-s -object"
X
X# HPUX: System V, but use <ndir.h> and opendir(), etc.
Xhpux:
X $(MAKE) zips CFLAGS="-O -DNDIR"
X
X# Cray Unicos 5.1.10 & 6.0.11, Standard C compiler 2.0
Xcray:
X $(MAKE) zips CFLAGS="-O -DDIRENT" CC="scc"
X
X# AT&T 3B1: System V, but missing a few things.
X3b1:
X $(MAKE) zips CFLAGS="-O -DNODIR -DRMDIR"
X
X# zilog zeus 3.21
Xzilog:
X $(MAKE) zips CFLAGS="-O -DZMEM -DNDIR -DRMDIR" CC="scc -i"
X
X# SCO 386 cross compile for MS-DOS
X# Note: zip.exe should be lzexe'd on DOS to reduce its size
Xscodos:
X $(MAKE) zips CFLAGS="-O -Ms -dos -DNO_ASM" LFLAGS1="-Ms -dos" \
X LFLAGS2=""
X $(RENAME) zip zip.exe
X
X# A/UX:
Xaux:
X $(MAKE) zips CFLAGS="-O -DTERMIO"
X
X# Convex C220, OS 9.0
Xconvex:
X $(MAKE) zips CFLAGS="-O2 -rl -DCONVEX"
X
X# AIX Version 3.1 for RISC System/6000
Xaix:
X $(MAKE) zips CC="c89" BIND="c89" \
X CFLAGS="-O -D_POSIX_SOURCE -D_ALL_SOURCE -D_BSD -DAIX"
X
X# MINIX 1.5.10 with Bruce Evans 386 patches and gcc/GNU make
Xminix:
X $(MAKE) zips CFLAGS="-O -DDIRENT -DMINIX" CC=gcc BIND=gcc
X chmem =262144 zip
X
X# clean up after making stuff and installing it
Xclean:
X rm -f *.o
X rm -f zip zipnote zipsplit ship
X
X# This one's for my own use during development.
Xit:
X $(MAKE) zipsman CFLAGS="-O -Wall -DPROTO" LFLAGS2="-s -object"\
X VPATH="${HOME}/Unix/bin"
X
X# end of Makefile
END_OF_FILE
if test 4489 -ne `wc -c <'makefile'`; then
echo shar: \"'makefile'\" unpacked with wrong size!
fi
# end of 'makefile'
fi
if test -f 'makefile.bor' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'makefile.bor'\"
else
echo shar: Extracting \"'makefile.bor'\" \(3300 characters\)
sed "s/^X//" >'makefile.bor' <<'END_OF_FILE'
X# Makefile for Zip, ZipNote, ZipSplit, and Ship, for
X# Borland (Turbo) C++ 1.0 or 2.0.
X# Warning: this file is not suitable for Turbo C 2.0. Use zip.prj instead.
X
X# To use, do "make -fmakefile.bor"
X# If you do not have masm or tasm, or if you are using the compact model,
X# then add -DNO_ASM to CFLAGS and remove im_lm.obj from OBJI
X
X# Warning: the default used here is the small model, which produces
X# faster code, but imposes some limitation on the number of files
X# that zip can process. Compile with the compact model to remove these
X# limitations.
X
X# ------------- Turbo C++, Borland C++ -------------
XMODEL=-ms
X# Change to -mc for compact model
XCFLAGS=-w -w-eff -w-def -w-sig -a -d -G -O -Z $(MODEL) -DEXPORT
XUTILFLAGS=-DUTIL $(CFLAGS) -o
XCC=bcc
XLD=bcc
X# replace bcc with tcc for Turbo C++ 1.0
XLDFLAGS=$(MODEL)
XAS=tasm
XASFLAGS=-ml -t -DDYN_ALLOC
X
X# ------------- Common declarations:
XSTRIP=rem
X# If you don't have lzexe, get it. Then define:
X#STRIP=lzexe
X# This makes a big difference in .exe size (and possibly load time)
X
X# variables
XOBJZ = zip.obj zipfile.obj zipup.obj fileio.obj util.obj tempf.obj shrink.obj\
X globals.obj
XOBJI = implode.obj im_lmat.obj im_ctree.obj im_bits.obj im_lm.obj
X# remove im_lm.obj in above line if you do not have masm
X
XOBJN = zipnote.obj zipfile_.obj zipup_.obj fileio_.obj globals.obj
XOBJS = zipsplit.obj zipfile_.obj zipup_.obj fileio_.obj globals.obj
X
Xzips: zip.exe zipnote.exe zipsplit.exe ship.exe
X
Xzip.obj: zip.h ziperr.h tailor.h revision.h zip.c
X $(CC) -c $(CFLAGS) $*.c
X
Xzipfile.obj: zip.h ziperr.h tailor.h zipfile.c
X $(CC) -c $(CFLAGS) $*.c
X
Xzipup.obj: zip.h ziperr.h tailor.h revision.h zipup.c
X $(CC) -c $(CFLAGS) $*.c
X
Xfileio.obj: zip.h ziperr.h tailor.h fileio.c
X $(CC) -c $(CFLAGS) $*.c
X
Xutil.obj: zip.h ziperr.h tailor.h util.c
X $(CC) -c $(CFLAGS) $*.c
X
Xtempf.obj: tempf.h tailor.h tempf.c
X $(CC) -c $(CFLAGS) $*.c
X
Xshrink.obj: zip.h ziperr.h tempf.h tailor.h shrink.c
X $(CC) -c $(CFLAGS) $*.c
X
Xglobals.obj: zip.h ziperr.h tailor.h globals.c
X $(CC) -c $(CFLAGS) $*.c
X
Xzipnote.obj: zip.h ziperr.h tailor.h revision.h zipnote.c
X $(CC) -c $(CFLAGS) $*.c
X
Xzipsplit.obj: zipsplit.c zip.h ziperr.h tailor.h revision.h
X $(CC) -c $(CFLAGS) $*.c
X
Ximplode.obj: implode.h crypt.h ziperr.h tempf.h tailor.h implode.c
X $(CC) -c $(CFLAGS) $*.c
X
Xim_lmat.obj: implode.h crypt.h ziperr.h tempf.h tailor.h im_lmat.c
X $(CC) -c $(CFLAGS) $*.c
X
Xim_lm.obj: im_lm.asm
X $(AS) $(ASFLAGS) im_lm;
X
Xim_ctree.obj: implode.h crypt.h ziperr.h tempf.h tailor.h im_ctree.c
X $(CC) -c $(CFLAGS) $*.c
X
Xim_bits.obj: implode.h crypt.h ziperr.h tempf.h tailor.h im_bits.c
X $(CC) -c $(CFLAGS) $*.c
X
Xzipfile_.obj: zipfile.c zip.h
X $(CC) -c $(UTILFLAGS)$* zipfile.c
X
Xzipup_.obj: zipup.c zip.h
X $(CC) -c $(UTILFLAGS)$* zipup.c
X
Xfileio_.obj: fileio.c zip.h
X $(CC) -c $(UTILFLAGS)$* fileio.c
X
X# we must cut the command line to fit in the MS/DOS 128 byte limit:
Xzip.exe: $(OBJZ) $(OBJI)
X echo $(OBJZ) > zip.rsp
X echo $(OBJI) >> zip.rsp
X $(LD) $(LDFLAGS) @zip.rsp
X del zip.rsp
X $(STRIP) zip.exe
X
Xzipnote.exe: $(OBJN)
X echo $(OBJN) > zipn.rsp
X $(LD) $(LDFLAGS) @zipn.rsp
X del zipn.rsp
X $(STRIP) zipnote.exe
X
Xzipsplit.exe: $(OBJS)
X echo $(OBJS) > zips.rsp
X $(LD) $(LDFLAGS) @zips.rsp
X del zips.rsp
X $(STRIP) zipsplit.exe
X
Xship.exe: ship.c
X $(CC) $(CFLAGS) ship.c
X $(STRIP) ship.exe
END_OF_FILE
if test 3300 -ne `wc -c <'makefile.bor'`; then
echo shar: \"'makefile.bor'\" unpacked with wrong size!
fi
# end of 'makefile.bor'
fi
if test -f 'makefile.msc' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'makefile.msc'\"
else
echo shar: Extracting \"'makefile.msc'\" \(3286 characters\)
sed "s/^X//" >'makefile.msc' <<'END_OF_FILE'
X# Makefile for Zip, ZipNote, ZipSplit, and Ship, for
X# Microsoft C 5.1 or 6.0.
X
X# To use, do "make makefile.msc"
X# If you do not have masm or tasm, then add -DNO_ASM to CFLAGS and remove
X# im_lm.obj from OBJI
X
X# Warning: the default used here is the small model, which produces
X# faster code, but imposes some limitation on the number of files
X# that zip can process. Compile with the compact model to remove these
X# limitations.
X
X# ------------- Microsoft C 5.1 or 6.0 -------------
XMODEL=-AS
X# Change to -AC for compact model
XCFLAGS=-W3 -Ox -nologo $(MODEL)
XSPECFLAGS=-W3 -Oaict -Gs -nologo $(MODEL) -DEXPORT
XUTILFLAGS=-DUTIL $(CFLAGS) -Fo
XCC=cl
XLD=link
XLDFLAGS=/e/st:0x1000
X# If you use lzexe as recommended, remove /e from LDFLAGS
XAS=masm
X# For MSC 6.0, use: AS=ml
XASFLAGS=-ml -t
X
X# ------------- Common declarations:
XSTRIP=rem
X# If you don't have lzexe, get it. Then define:
X#STRIP=lzexe
X# This makes a big difference in .exe size (and possibly load time)
X
X# variables
XOBJZ = zip.obj zipfile.obj zipup.obj fileio.obj util.obj tempf.obj shrink.obj\
X globals.obj
XOBJI = implode.obj im_lmat.obj im_ctree.obj im_bits.obj im_lm.obj
X# remove im_lm.obj in above line if you do not have masm
X
XOBJN = zipnote.obj zipfile_.obj zipup_.obj fileio_.obj globals.obj
XOBJS = zipsplit.obj zipfile_.obj zipup_.obj fileio_.obj globals.obj
X
Xzips: zip.exe zipnote.exe zipsplit.exe ship.exe
X
Xzip.obj: zip.h ziperr.h tailor.h revision.h zip.c
X $(CC) -c $(CFLAGS) $*.c
X
Xzipfile.obj: zip.h ziperr.h tailor.h zipfile.c
X $(CC) -c $(SPECFLAGS) $*.c
X
Xzipup.obj: zip.h ziperr.h tailor.h revision.h zipup.c
X $(CC) -c $(CFLAGS) $*.c
X
Xfileio.obj: zip.h ziperr.h tailor.h fileio.c
X $(CC) -c $(CFLAGS) $*.c
X
Xutil.obj: zip.h ziperr.h tailor.h util.c
X $(CC) -c $(CFLAGS) $*.c
X
Xtempf.obj: tempf.h tailor.h tempf.c
X $(CC) -c $(CFLAGS) $*.c
X
Xshrink.obj: zip.h ziperr.h tempf.h tailor.h shrink.c
X $(CC) -c $(CFLAGS) $*.c
X
Xglobals.obj: zip.h ziperr.h tailor.h globals.c
X $(CC) -c $(CFLAGS) $*.c
X
Xzipnote.obj: zip.h ziperr.h tailor.h revision.h zipnote.c
X $(CC) -c $(CFLAGS) $*.c
X
X# MSC 5.1 dies on zipsplit with -Ox
Xzipsplit.obj: zipsplit.c zip.h ziperr.h tailor.h revision.h
X $(CC) -c $(SPECFLAGS) $*.c
X
Ximplode.obj: implode.h crypt.h ziperr.h tempf.h tailor.h implode.c
X $(CC) -c $(CFLAGS) $*.c
X
Xim_lmat.obj: implode.h crypt.h ziperr.h tempf.h tailor.h im_lmat.c
X $(CC) -c $(CFLAGS) $*.c
X
Xim_lm.obj: im_lm.asm
X $(AS) $(ASFLAGS) im_lm;
X
Xim_ctree.obj: implode.h crypt.h ziperr.h tempf.h tailor.h im_ctree.c
X $(CC) -c $(CFLAGS) $*.c
X
Xim_bits.obj: implode.h crypt.h ziperr.h tempf.h tailor.h im_bits.c
X $(CC) -c $(CFLAGS) $*.c
X
Xzipfile_.obj: zipfile.c zip.h
X $(CC) -c $(UTILFLAGS)$@ zipfile.c
X
Xzipup_.obj: zipup.c zip.h
X $(CC) -c $(UTILFLAGS)$@ zipup.c
X
Xfileio_.obj: fileio.c zip.h
X $(CC) -c $(UTILFLAGS)$@ fileio.c
X
X# we must cut the command line to fit in the MS/DOS 128 byte limit:
Xzip.exe: $(OBJZ) $(OBJI)
X echo $(OBJZ)+ > zip.rsp
X echo $(OBJI); >> zip.rsp
X $(LD) $(LDFLAGS) @zip.rsp
X del zip.rsp
X $(STRIP) zip.exe
X
Xzipnote.exe: $(OBJN)
X echo $(OBJN); > zipn.rsp
X $(LD) $(LDFLAGS) @zipn.rsp
X del zipn.rsp
X $(STRIP) zipnote.exe
X
Xzipsplit.exe: $(OBJS)
X echo $(OBJS); > zips.rsp
X $(LD) $(LDFLAGS) @zips.rsp
X del zips.rsp
X $(STRIP) zipsplit.exe
X
Xship.exe: ship.c
X $(CC) $(CFLAGS) ship.c
X $(STRIP) ship.exe
END_OF_FILE
if test 3286 -ne `wc -c <'makefile.msc'`; then
echo shar: \"'makefile.msc'\" unpacked with wrong size!
fi
# end of 'makefile.msc'
fi
if test -f 'revision.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'revision.h'\"
else
echo shar: Extracting \"'revision.h'\" \(1198 characters\)
sed "s/^X//" >'revision.h' <<'END_OF_FILE'
X/*
X
X Copyright (C) 1990,1991 Mark Adler, Richard B. Wales, and Jean-loup Gailly.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*
X * revision.h by Mark Adler.
X */
X
X#define REVISION 10
X#define REVDATE "29 September 1991"
X
X/* Copyright notice for binary executables--this notice only applies to
X * those (zip, zipcloak, zipsplit, and zipnote), not to this file
X * (revision.h).
X */
X
X#ifndef NOCPYRT
Xchar *copyright[] = {
X"Copyright (C) 1990,1991 Mark Adler, Richard B. Wales, and Jean-loup Gailly.",
X"Permission is granted to any individual or institution to use, copy, or",
X"redistribute this executable so long as it is not modified and that it is",
X"not sold for profit."
X};
Xchar *disclaimer[] = {
X"",
X"LIKE ANYTHING ELSE THAT'S FREE, ZIP AND ITS ASSOCIATED UTILITIES ARE",
X"PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR",
X"IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES",
X"RESULTING FROM THE USE OF THIS SOFTWARE."
X};
X#endif /* !NOCPYRT */
END_OF_FILE
if test 1198 -ne `wc -c <'revision.h'`; then
echo shar: \"'revision.h'\" unpacked with wrong size!
fi
# end of 'revision.h'
fi
if test -f 'tailor.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'tailor.h'\"
else
echo shar: Extracting \"'tailor.h'\" \(3123 characters\)
sed "s/^X//" >'tailor.h' <<'END_OF_FILE'
X/* tailor.h -- Not copyrighted 1991 Mark Adler */
X
X/* const's are inconsistently used across ANSI libraries--kill for all
X header files. */
X#define const
X
X
X/* Use prototypes and ANSI libraries if __STDC__ */
X#ifdef __STDC__
X# ifndef PROTO
X# define PROTO
X# endif /* !PROTO */
X# define MODERN
X#endif /* __STDC__ */
X
X
X/* Use prototypes and ANSI libraries if Silicon Graphics */
X#ifdef sgi
X# ifndef PROTO
X# define PROTO
X# endif /* !PROTO */
X# define MODERN
X#endif /* sgi */
X
X
X/* Define MSDOS for Turbo C as well as Microsoft C */
X#ifdef __POWERC /* For Power C too */
X# define __TURBOC__
X#endif /* __POWERC */
X#ifdef __TURBOC__
X# ifndef MSDOS
X# define MSDOS
X# endif /* !MSDOS */
X#endif /* __TURBOC__ */
X
X
X/* Use prototypes and ANSI libraries if Microsoft or Borland C */
X#ifdef MSDOS
X# ifndef PROTO
X# define PROTO
X# endif /* !PROTO */
X# define MODERN
X#endif /* MSDOS */
X
X
X/* Turn off prototypes if requested */
X#ifdef NOPROTO
X# ifdef PROTO
X# undef PROTO
X# endif /* PROTO */
X#endif /* NOPROT */
X
X
X/* Used to remove arguments in function prototypes for non-ANSI C */
X#ifdef PROTO
X# define OF(a) a
X#else /* !PROTO */
X# define OF(a) ()
X#endif /* ?PROTO */
X
X
X/* Allow far and huge allocation for small model (Microsoft C or Turbo C) */
X#ifdef MSDOS
X# ifdef __TURBOC__
X# include <alloc.h>
X# else /* !__TURBOC__ */
X# include <malloc.h>
X# define farmalloc _fmalloc
X# define farfree _ffree
X# endif /* ?__TURBOC__ */
X#else /* !MSDOS */
X# define huge
X# define far
X# define near
X# define farmalloc malloc
X# define farfree free
X#endif /* ?MSDOS */
X
X
X/* Define MSVMS if either MSDOS or VMS defined */
X#ifdef MSDOS
X# define MSVMS
X#else /* !MSDOS */
X# ifdef VMS
X# define MSVMS
X# endif /* VMS */
X#endif /* ?MSDOS */
X
X
X/* Define void, voidp, and extent (size_t) */
X#include <stdio.h>
X#ifdef MODERN
X# ifndef M_XENIX
X# include <stddef.h>
X# endif /* !M_XENIX */
X# include <stdlib.h>
X typedef size_t extent;
X typedef void voidp;
X#else /* !MODERN */
X typedef unsigned int extent;
X# define void int
X typedef char voidp;
X#endif /* ?MODERN */
X
X/* Get types and stat */
X#ifdef VMS
X# include <types.h>
X# include <stat.h>
X#else /* !VMS */
X# include <sys/types.h>
X# include <sys/stat.h>
X#endif /* ?VMS */
X
X
X/* Cheap fix for unlink on VMS */
X#ifdef VMS
X# define unlink delete
X#endif /* VMS */
X
X
X/* For Pyramid */
X#ifdef pyr
X# define strrchr rindex
X# define ZMEM
X#endif /* pyr */
X
X
X/* File operations--use "b" for binary if allowed */
X#ifdef MODERN
X# define FOPR "rb"
X# define FOPM "r+b"
X# define FOPW "w+b"
X#else /* !MODERN */
X# define FOPR "r"
X# define FOPM "r+"
X# define FOPW "w+"
X#endif /* ?MODERN */
X
X
X/* Fine tuning */
X#ifndef MSDOS
X# define BSZ 8192 /* Buffer size for files */
X#else /* !MSDOS */
X# define BSZ 4096 /* Keep precious NEAR space */
X /* BSZ can't be 8192 even for compact model because of 64K limitation
X * in im_lmat.c. If you run out of memory when processing a large number
X * files, use the compact model and reduce BSZ to 2048 here and in
X * im_lm.asm.
X */
X#endif /* ?MSDOS */
X
X/* end of tailor.h */
END_OF_FILE
if test 3123 -ne `wc -c <'tailor.h'`; then
echo shar: \"'tailor.h'\" unpacked with wrong size!
fi
# end of 'tailor.h'
fi
if test -f 'tempf.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'tempf.c'\"
else
echo shar: Extracting \"'tempf.c'\" \(4437 characters\)
sed "s/^X//" >'tempf.c' <<'END_OF_FILE'
X/*
X
X Copyright (C) 1990,1991 Mark Adler, Richard B. Wales, and Jean-loup Gailly.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*
X * tempf.c by Mark Adler.
X */
X
X#include "tailor.h"
X#include "tempf.h"
X
Xextern char *tempname OF((int));
X
X#ifdef MODERN
X# include <string.h>
X#else /* !MODERN */
X voidp *malloc();
X# ifndef ZMEM
X char *memcpy();
X# endif /* !ZMEM */
X#endif /* ?MODERN */
X#ifdef ZMEM
X char *memcpy OF((char *, char *, unsigned int));
X#endif /* ZMEM */
Xint unlink OF((char *));
X
X
X/* Define a special memcpy for MSDOS small model */
X#if defined(MSDOS) && (defined(M_I86SM) || defined(__SMALL__))
X# include <dos.h>
X# define memcpy farmemcpy
X void farmemcpy(char far *d, char far *s, unsigned n)
X {
X movedata(FP_SEG(s), FP_OFF(s), FP_SEG(d), FP_OFF(d), n);
X }
X#endif
X
X
XtFILE *topen(c)
Xint c;
X/* Create a new temporary file and return its descriptor. Save the character
X c to be used in the temporary file name, if needed. */
X{
X tFILE *t;
X
X if ((t = (tFILE *)malloc(sizeof(tFILE))) == NULL ||
X (t->b = farmalloc(TMPSIZ)) == NULL)
X return NULL;
X t->p = t->m = 0;
X t->c = c;
X t->f = NULL;
X return t;
X}
X
X
Xint tnew(t)
XtFILE *t; /* temporary file descriptor */
X/* Create a temporary file with a unique name */
X{
X return (t->n = tempname(t->c)) == NULL ||
X (t->f = fopen(t->n, FOPW)) == NULL;
X}
X
X
Xunsigned twrite(b, s, n, t)
Xchar *b; /* buffer to write from */
Xunsigned s; /* size of items */
Xunsigned n; /* number of items */
XtFILE *t; /* temporary file descriptor */
X/* Like fwrite()--will create a temporary file if needed. */
X{
X unsigned j; /* room in memory, items to write */
X long k; /* bytes to write */
X long w; /* bytes written to file */
X
X /* write to memory portion */
X j = TMPSIZ - t->p;
X k = s * (long) n;
X if (j && k)
X {
X j = (long)j > k ? (unsigned)k : j;
X memcpy(t->b + t->p, (char far *)b, j);
X t->p += j;
X if (t->m < t->p)
X t->m = t->p;
X b += j;
X k -= j;
X }
X if (k == 0)
X return n;
X
X /* create temporary file if needed */
X if (t->f == NULL && tnew(t))
X return 0;
X
X /* write to temporary file */
X j = (unsigned)(k / s);
X if (j && fwrite(b, s, j, t->f) != j)
X return 0;
X b += w = s * (long)j;
X k -= w;
X if (k && fwrite(b, (unsigned)k, 1, t->f) != 1)
X return 0;
X return n;
X}
X
X
Xint tflush(t)
XtFILE *t; /* temporary file descriptor */
X/* Like fflush() */
X{
X return t->f == NULL ? 0 : fflush(t->f);
X}
X
X
Xvoid trewind(t)
XtFILE *t; /* temporary file descriptor */
X/* Like rewind() */
X{
X t->p = 0;
X if (t->f != NULL)
X rewind(t->f);
X}
X
X
Xunsigned tread(b, s, n, t)
Xchar *b; /* buffer to read into */
Xunsigned s; /* size of items */
Xunsigned n; /* number of items */
XtFILE *t; /* temporary file descriptor */
X/* Like fread() */
X{
X unsigned j; /* bytes in memory, items to read */
X long k; /* bytes requested */
X long r; /* bytes read from file */
X
X /* read from memory */
X j = t->m - t->p;
X k = s * (long)n;
X if (j && k)
X {
X j = (long)j > k ? (unsigned)k : j;
X memcpy((char far *)b, t->b + t->p, j);
X t->p += j;
X b += j;
X k -= j;
X }
X
X /* read from file if more requested */
X if (k && t->f != NULL)
X {
X j = (unsigned)(k / s);
X if (j)
X {
X r = s * (long)fread(b, s, j, t->f);
X b += r;
X k -= r;
X }
X if (k && k < s)
X k -= fread(b, 1, (unsigned)k, t->f);
X }
X
X /* return complete items read */
X return n - (unsigned)((k + s - 1) / s);
X}
X
X
Xint terror(t)
XtFILE *t; /* temporary file descriptor */
X/* Like ferror() */
X{
X return t->f == NULL ? 0 : ferror(t->f);
X}
X
X
Xint teof(t)
XtFILE *t; /* temporary file descriptor */
X/* Like feof() */
X{
X return t->f == NULL ? t->p == t->m : feof(t->f);
X}
X
X
Xint tclose(t)
XtFILE *t; /* temporary file descriptor */
X/* Like fclose()--frees the memory used by the descriptor and deletes
X the temporary file, if any. */
X{
X int r;
X
X r = 0;
X if (t->f != NULL)
X {
X r = fclose(t->f);
X unlink(t->n);
X free(t->n);
X }
X farfree(t->b);
X free(t);
X return r;
X}
END_OF_FILE
if test 4437 -ne `wc -c <'tempf.c'`; then
echo shar: \"'tempf.c'\" unpacked with wrong size!
fi
# end of 'tempf.c'
fi
if test -f 'tempf.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'tempf.h'\"
else
echo shar: Extracting \"'tempf.h'\" \(2182 characters\)
sed "s/^X//" >'tempf.h' <<'END_OF_FILE'
X/*
X
X Copyright (C) 1990,1991 Mark Adler, Richard B. Wales, and Jean-loup Gailly.
X Permission is granted to any individual or institution to use, copy, or
X redistribute this software so long as all of the original files are included
X unmodified, that it is not sold for profit, and that this copyright notice
X is retained.
X
X*/
X
X/*
X * tempf.h by Mark Adler.
X */
X
X/* These "t" functions behave like their "f" counterparts, except that
X topen() takes one character to (possibly) be used in a temporary file
X name, twrite() can create a temporary file, and tclose() will delete
X the temporary file, if any. tnew() is only defined for use in the
X tputc() macro. It should not be called explicitly. These functions
X use the type tFILE instead of FILE to point to a file descriptor. */
X
X#if !defined(OS2) && (defined(M_I86CM) || defined(__COMPACT__))
X# define TMPSIZ 0x8000 /* memory portion of temporary files */
X /* The MSDOS compact model is to be used only for processing a large
X * number of files. In this case we try to reduce the memory requirements.
X * You can reduce TMPSIZ to 16384 or 8192 if 32K is still too large,
X * but the resulting code will be slower.
X */
X#else
X# define TMPSIZ 0xe000 /* memory portion of temporary files */
X#endif
X
Xtypedef struct {
X char far *b; /* memory part of file */
X unsigned p; /* current read/write pointer for memory part */
X unsigned m; /* bytes in memory part */
X int c; /* character to use in spill file name */
X FILE *f; /* spill file pointer or NULL*/
X char *n; /* spill file name if f not NULL */
X} tFILE;
X
XtFILE *topen OF((int));
Xint tnew OF((tFILE *));
Xunsigned twrite OF((char *, unsigned, unsigned, tFILE *));
Xint tflush OF((tFILE *));
Xvoid trewind OF((tFILE *));
Xunsigned tread OF((char *, unsigned, unsigned, tFILE *));
Xint terror OF((tFILE *));
Xint teof OF((tFILE *));
Xint tclose OF((tFILE *));
X
X#define tputcm(c,t) ((t)->b[(t)->p++]=(c),(t)->m<(t)->p?((t)->m=(t)->p):0,c)
X#define tputcf(c,t) ((t)->f==NULL?(tnew(t)?-1:putc(c,(t)->f)):putc(c,(t)->f))
X#define tputc(c,t) ((t)->p<TMPSIZ?(int)tputcm(c,t):tputcf(c,t))
END_OF_FILE
if test 2182 -ne `wc -c <'tempf.h'`; then
echo shar: \"'tempf.h'\" unpacked with wrong size!
fi
# end of 'tempf.h'
fi
echo shar: End of archive 9 \(of 9\).
cp /dev/null ark9isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 9 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still must unpack the following archives:
echo " " ${MISSING}
fi
exit 0
exit 0 # Just in case...
--
Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD UUCP: uunet!sparky!kent
Phone: (402) 291-8300 FAX: (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.