v20i065: compress - Compress 4.1, Part02/02

Dave Mack csu at alembic.ACS.COM
Wed Jun 26 04:39:11 AEST 1991


Submitted-by: Dave Mack <csu at alembic.ACS.COM>
Posting-number: Volume 20, Issue 65
Archive-name: compress/part02
Environment: UNIX

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 2 (of 2)."
# Contents:  Changes Acks Makefile usermem compress.1 zcmp zcmp.1 zdiff
#   zmore zmore.1 patchlevel.h
# Wrapped by csu at alembic on Thu May 30 16:24:07 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Changes' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Changes'\"
else
echo shar: Extracting \"'Changes'\" \(2126 characters\)
sed "s/^X//" >'Changes' <<'END_OF_FILE'
XModifications for version 4.1: 
X	o Added -r command line flag to allow recursive compression/
X	  decompression of directory trees. As a side-effect, compress
X	  no longer tries to compress/decompress anything that isn't
X	  a regular file. In particular, it ignores symbolic links.
X	o zcat no longer cares whether a filename ends in .Z or
X	  not - it relies on the magic number in the file. If zcat
X	  is given a filename that doesn't end with .Z and the file
X	  referenced doesn't exist, zcat will append a .Z and try
X	  to open that instead.
X	o compress -f will now compress multiply hardlinked files.
X	  Uncompress does not recreate the hard link, it creates
X	  a new file.
X	o Removed compressdir/uncompressdir - no longer needed.
X	o Removed atob/btoa/tarmail/untarmail - my versions are
X	  based on btoa 5.2 which is not compatible with the atob
X	  included with compress4.0.
XCompress version 4.0 improvements:
X	o compress() speedup (10-50%) by changing division hash to xor
X	o decompress() speedup (5-10%)
X	o Memory requirements reduced (3-30%)
X	o Stack requirements reduced to less than 4kb
X	o Removed 'Big+Fast' compress code (FBITS) because of compress speedup
X    	o Portability mods for Z8000 and PC/XT (but not zeus 3.2)
X	o Default to 'quiet' mode
X	o Unification of 'force' flags
X	o Manual page overhaul
X	o Portability enhancement for M_XENIX
X	o Removed text on #else and #endif
X	o Added "-V" switch to print version and options
X	o Added #defines for SIGNED_COMPARE_SLOW
X	o Added Makefile and "usermem" program
X	o Removed all floating point computations
X	o New programs:
X		compressdir - compress all files on a directory
X		uncompressdir - uncompress all files on a directory
X		zcmp - cmp compressed files
X		zdiff - diff compressed files
X	  The following are with thanks to philabs!per:
X		btoa - convert binary to ascii for mailing
X		atob - convert ascii to binary with checksum
X		tarmail - tar, compress, btoa, and mail files
X		untarmail - restore "tarmail" files
X
X		WARNING: These last few programs are not compatible 
X		with the original ones from the net.  The encoding
X		has changed.  See btoa.c for more info.
X
END_OF_FILE
if test 2126 -ne `wc -c <'Changes'`; then
    echo shar: \"'Changes'\" unpacked with wrong size!
fi
# end of 'Changes'
fi
if test -f 'Acks' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Acks'\"
else
echo shar: Extracting \"'Acks'\" \(525 characters\)
sed "s/^X//" >'Acks' <<'END_OF_FILE'
XAcknowledgments:
X
XCompress, Version 4.1
X
XPat Myrto (rwing!pat at cs.washington.edu) deserves the credit
Xfor undoing all the damage I did to this version with respect
Xto System V and for giving me the occasional kick when my
Xchanges clobbered some necessary functionality.
X
XThanks to James A. Woods for permitting me to corrupt his baby
Xand for passing along some tips on ways to improve the performance
Xover 4.0.
X
XThanks to the previous authors whom I didn't contact, for making
Xthe program available originally.
X
X-- 
XDave Mack
END_OF_FILE
if test 525 -ne `wc -c <'Acks'`; then
    echo shar: \"'Acks'\" unpacked with wrong size!
fi
# end of 'Acks'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(2363 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X#
X# Makefile for compress version 4.1
X#
XCC=cc
X#CC=gcc -traditional
X#
X# set your compile flags.
X# set -DVOIDSIG if your signal() function returns a pointer to
X# a function returning void.
X# set BSD4 if you have a generally BSDish system - SunOS, Ultrix, etc.
X# If you're saddled with a system that only allows 14-character
X# filenames, set -DSHORTNAMES
X# include -DDIRENT if your system wants you to #include <dirent.h>
X# instead of <sys/dir.h>
X# The README file describes other flags you may need.
X#
X# CFLAGS for SunOS4.1
XCFLAGS=-O -DVOIDSIG -DBSD4 -DDIRENT
X# CFLAGS for System V Rel 3.x
X#CFLAGS=-O -DSHORTNAMES -DDIRENT
X#
X# BIN is where the executables (compress, uncompress, zcat, zcmp, zdiff
X# and zmore) will be installed.
X#
XBIN=/usr/local/bin
X#
X# MAN says where to install the man page
X#
XMAN=/usr/man/manl
X#
X# MANSUF is the suffix the installed manual page should have
X#
XMANSUF=l
X#
X# LN is how to make links (hard or symbolic) on your system
X#
XLN=ln -s
X#
X# LIBS contains any additional libraries you may need to link.
X# In particular, you may need -lndir or equiv. to get the
X# public domain directory access routines if they aren't in your libc.
X#
XLIBS=
X#
X# END OF CONFIGURATION OPTIONS
X#
X
XSHARSET1=README compress.c
XSHARSET2=Changes Acks Makefile usermem  compress.1 zcmp zcmp.1 \
X	zdiff zmore zmore.1 patchlevel.h
X
Xall: compress
X
Xcompress: USERMEM compress.c
X	$(CC) $(CFLAGS) -DUSERMEM=`cat USERMEM` -o compress compress.c $(LIBS)
X
X# USERMEM may have to be set by hand.  It should contain the amount of
X# available user memory in bytes.  See the README file for more info.
XUSERMEM:
X	sh usermem > USERMEM
X
Xinstall: compress compress.1
X	-mv $(BIN)/compress $(BIN)/compress.old
X	cp compress $(BIN)
X	rm -f $(BIN)/uncompress $(BIN)/zcat
X	$(LN) $(BIN)/compress $(BIN)/uncompress
X	$(LN) $(BIN)/compress $(BIN)/zcat
X	cp compress.1 $(MAN)/compress.$(MANSUF)
X	rm -f $(MAN)/uncompress.$(MANSUF) $(MAN)/zcat.$(MANSUF)
X	$(LN) $(MAN)/compress.$(MANSUF) $(MAN)/uncompress.$(MANSUF)
X	$(LN) $(MAN)/compress.$(MANSUF) $(MAN)/zcat.$(MANSUF)
X	cp zmore zcmp zdiff $(BIN)
X	cp zmore.1 $(MAN)/zmore.$(MANSUF)
X	cp zcmp.1 $(MAN)/zcmp.$(MANSUF)
X	rm -f $(MAN)/zdiff.$(MANSUF)
X	$(LN) $(MAN)/zcmp.$(MANSUF) $(MAN)/zdiff.$(MANSUF)
X
Xclean:
X	rm -f compress uncompress zcat core
X
Xshar:
X	shar -o compress41.shar.1 -n01 -e02 $(SHARSET1)
X	shar -o compress41.shar.2 -n02 -e02 $(SHARSET2)
X
X
X
X
X
END_OF_FILE
if test 2363 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'usermem' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'usermem'\"
else
echo shar: Extracting \"'usermem'\" \(1748 characters\)
sed "s/^X//" >'usermem' <<'END_OF_FILE'
X: This shell script snoops around to find the maximum amount of available
X: user memory.  These variables need to be set only if there is no
X: /usr/adm/messages.  KMEM, UNIX, and CLICKSIZE can be set on the command
X: line, if desired, e.g. UNIX=/unix
XKMEM=/dev/kmem		# User needs read access to KMEM
XUNIX=
X# VAX			CLICKSIZE=512,	UNIX=/vmunix
X# PDP-11		CLICKSIZE=64,	UNIX=/unix
X# CADLINC 68000		CLICKSIZE=4096,	UNIX=/unix
X# Perkin-Elmer 3205	CLICKSIZE=4096,	UNIX=/edition7
X# Perkin-Elmer all others, CLICKSIZE=2048, UNIX=/edition7
XCLICKSIZE=512
Xeval $*
X
XSIZE=0
Xif test -r /usr/adm/messages	# probably the most transportable
Xthen
X    SIZE=`grep avail /usr/adm/messages | sed -n '$s/.*[ 	]//p'`
Xfi
X
Xif test 0$SIZE -le 0		# no SIZE in /usr/adm/messages
Xthen
X    if test -r $KMEM		# Readable KMEM
X    then
X	if test -n "$UNIX"
X	then
X	    : User must have specified it already.
X	elif test -r /vmunix
X	then
X	    UNIX=/vmunix
X	    CLICKSIZE=512	# Probably VAX
X	elif test -r /edition7
X	then
X	    UNIX=/edition7
X	    CLICKSIZE=2048	# Perkin-Elmer: change to 4096 on a 3205
X	elif test -r /unix
X	then
X	    UNIX=/unix		# Could be anything
X	fi
X	if test -n "$UNIX"
X	then
X	    SIZE=`echo maxmem/D | adb $UNIX $KMEM | sed -n '$s/.*[ 	]//p'`
X	    if test 0$SIZE -le 0
X	    then
X		SIZE=`echo physmem/D | adb $UNIX $KMEM | sed -n '$s/.*[ 	]//p'`
X	    fi
X	    SIZE=`expr 0$SIZE '*' $CLICKSIZE`
X	fi
X    fi
Xfi
X
Xcase $UNIX in
X    /vmunix)		# Assume 4.2bsd: check for resource limits
X	MAXSIZE=`csh -c limit | awk 'BEGIN	{ MAXSIZE = 1000000 }
X/datasize|memoryuse/ && NF == 3	{ if ($2 < MAXSIZE) MAXSIZE = $2 }
XEND	{ print MAXSIZE * 1000 }'`
X	if test $MAXSIZE -lt $SIZE
X	then
X	    SIZE=$MAXSIZE
X	fi
X	;;
Xesac
X
Xif test 0$SIZE -le 0
Xthen
X    echo 0;exit 1
Xelse
X    echo $SIZE
Xfi
END_OF_FILE
if test 1748 -ne `wc -c <'usermem'`; then
    echo shar: \"'usermem'\" unpacked with wrong size!
fi
chmod +x 'usermem'
# end of 'usermem'
fi
if test -f 'compress.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'compress.1'\"
else
echo shar: Extracting \"'compress.1'\" \(5306 characters\)
sed "s/^X//" >'compress.1' <<'END_OF_FILE'
X.PU
X.TH COMPRESS 1 local
X.SH NAME
Xcompress, uncompress, zcat \- compress and expand data (version 4.1)
X.SH SYNOPSIS
X.ll +8
X.B compress
X[
X.B \-f
X] [
X.B \-v
X] [
X.B \-c
X] [
X.B \-V
X] [
X.B \-r
X] [
X.B \-b
X.I bits
X] [
X.I "name \&..."
X]
X.ll -8
X.br
X.B uncompress
X[
X.B \-f
X] [
X.B \-v
X] [
X.B \-c
X] [
X.B \-V
X] [
X.I "name \&..."
X]
X.br
X.B zcat
X[
X.B \-V
X] [
X.I "name \&..."
X]
X.SH DESCRIPTION
X.I Compress
Xreduces the size of the named files using adaptive Lempel-Ziv coding.
XWhenever possible,
Xeach file is replaced by one with the extension
X.B "\&.Z,"
Xwhile keeping the same ownership modes, access and modification times.
XIf no files are specified, the standard input is compressed to the
Xstandard output.
XCompressed files can be restored to their original form using
X.I uncompress
Xor
X.I zcat.
X.PP
XThe
X.B \-f
Xoption will force compression of
X.I name.
XIf
X.B \-f
Xis not given and
X.I compress
Xis run in the foreground,
Xthe user is prompted as to whether an existing file should be overwritten.
X.PP
XThe
X.B \-c
Xoption makes
X.I compress/uncompress
Xwrite to the standard output; no files are changed.
XThe nondestructive behavior of
X.I zcat
Xis identical to that of
X.I uncompress
X.B \-c.
X.PP
XIf the
X.B \-r
Xflag is specified, 
X.I compress
Xwill operate recursively. If any of the file names specified on the command
Xline are directories, 
X.I compress
Xwill descend into the directory and compress all the files it finds there.
X.PP
X.I Compress
Xuses the modified Lempel-Ziv algorithm popularized in
X"A Technique for High Performance Data Compression",
XTerry A. Welch,
X.I "IEEE Computer,"
Xvol. 17, no. 6 (June 1984), pp. 8-19.
XCommon substrings in the file are first replaced by 9-bit codes 257 and up.
XWhen code 512 is reached, the algorithm switches to 10-bit codes and
Xcontinues to use more bits until the
Xlimit specified by the
X.B \-b
Xflag is reached (default 16).
X.I Bits
Xmust be between 9 and 16.  The default can be changed in the source to allow
X.I compress
Xto be run on a smaller machine.
X.PP
XAfter the
X.I bits
Xlimit is attained,
X.I compress
Xperiodically checks the compression ratio.  If it is increasing,
X.I compress
Xcontinues to use the existing code dictionary.  However,
Xif the compression ratio decreases,
X.I compress
Xdiscards the table of substrings and rebuilds it from scratch.  This allows
Xthe algorithm to adapt to the next "block" of the file.
X.PP
XNote that the
X.B \-b
Xflag is omitted for
X.I uncompress,
Xsince the 
X.I bits
Xparameter specified during compression
Xis encoded within the output, along with
Xa magic number to ensure that neither decompression of random data nor
Xrecompression of compressed data is attempted. 
X.PP
X.ne 8
XThe amount of compression obtained depends on the size of the
Xinput, the number of
X.I bits
Xper code, and the distribution of common substrings.
XTypically, text such as source code or English
Xis reduced by 50\-60%.
XCompression is generally much better than that achieved by
XHuffman coding (as used in
X.IR pack ),
Xor adaptive Huffman coding
X.RI ( compact ),
Xand takes less time to compute.
X.PP
XUnder the
X.B \-v
Xoption,
Xa message is printed yielding the percentage of
Xreduction for each file compressed.
X.PP
XIf the
X.B \-V
Xoption is specified, the current version and compile options are printed on
Xstderr.
X.PP
XExit status is normally 0;
Xif the last file is larger after (attempted) compression, the status is 2;
Xif an error occurs, exit status is 1.
X.SH "SEE ALSO"
Xpack(1), compact(1)
X.SH "DIAGNOSTICS"
XUsage: compress [\-dfvcV] [\-b maxbits] [file ...]
X.in +8
XInvalid options were specified on the command line.
X.in -8
XMissing maxbits
X.in +8
XMaxbits must follow
X.BR \-b \.
X.in -8
X.IR file :
Xnot in compressed format
X.in +8
XThe file specified to
X.I uncompress
Xhas not been compressed.
X.in -8
X.IR file :
Xcompressed with 
X.I xx
Xbits, can only handle 
X.I yy
Xbits
X.in +8
X.I File
Xwas compressed by a program that could deal with
Xmore 
X.I bits
Xthan the compress code on this machine.
XRecompress the file with smaller
X.IR bits \.
X.in -8
X.IR file :
Xalready has .Z suffix -- no change
X.in +8
XThe file is assumed to be already compressed.
XRename the file and try again.
X.in -8
X.IR file :
Xfilename too long to tack on .Z
X.in +8
XThe file cannot be compressed because its name is longer than
X12 characters.
XRename and try again.
XThis message does not occur on BSD systems.
X.in -8
X.I file
Xalready exists; do you wish to overwrite (y or n)?
X.in +8
XRespond "y" if you want the output file to be replaced; "n" if not.
X.in -8
Xuncompress: corrupt input
X.in +8
XA SIGSEGV violation was detected which usually means that the input file has
Xbeen corrupted.
X.in -8
XCompression: 
X.I "xx.xx%"
X.in +8
XPercentage of the input saved by compression.
X(Relevant only for
X.BR \-v \.)
X.in -8
X-- not a regular file: unchanged
X.in +8
XWhen the input file is not a regular file,
X(e.g. a directory), it is
Xleft unaltered.
X.in -8
X-- has 
X.I xx 
Xother links: unchanged
X.in +8
XThe input file has links; it is left unchanged.  See
X.IR ln "(1)"
Xfor more information.
X.in -8
X-- file unchanged
X.in +8
XNo savings is achieved by
Xcompression.  The input remains virgin.
X.in -8
X.SH "BUGS"
XAlthough compressed files are compatible between machines with large memory,
X.BR \-b \12
Xshould be used for file transfer to architectures with 
Xa small process data space (64KB or less, as exhibited by the DEC PDP
Xseries, the Intel 80286, etc.)
END_OF_FILE
if test 5306 -ne `wc -c <'compress.1'`; then
    echo shar: \"'compress.1'\" unpacked with wrong size!
fi
# end of 'compress.1'
fi
if test -f 'zcmp' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'zcmp'\"
else
echo shar: Extracting \"'zcmp'\" \(760 characters\)
sed "s/^X//" >'zcmp' <<'END_OF_FILE'
X
XOPTIONS=
XFILES=
Xfor ARG
Xdo
X	case "$ARG" in
X	-*)	OPTIONS="$OPTIONS $ARG";;
X	*)	FILES="$FILES $ARG";;
X	esac
Xdone
Xif test -z "$FILES"; then
X	echo "Usage: zcmp [cmp_options] file [file]"
X	exit 1
Xfi
Xset $FILES
Xif test $# -eq 1; then
X	FILE=`expr $1 : '\(.*\)\.Z' '|' $1`
X	zcat $FILE | cmp $OPTIONS - $FILE
X	STAT="$?"
Xelif test $# -eq 2; then
X	case "$1" in
X	*.Z)	case "$2" in
X		*.Z)	F=`basename $2 .Z`
X			zcat $2 > /tmp/$F.$$
X			zcat $1 | cmp $OPTIONS - /tmp/$F.$$
X			STAT="$?";;
X		*)	zcat $1 | cmp $OPTIONS - $2;;
X		esac;;
X	*)	case "$2" in
X		*.Z)	F=`basename $2 .Z`
X			zcat $2 > /tmp/$F.$$
X			cmp $OPTIONS $1 /tmp/$F.$$
X			STAT="$?";;
X		*)	cmp $OPTIONS $1 $2
X			STAT="$?";;
X		esac;;
X	esac
X	exit "$STAT"
Xelse
X	echo "Usage: zcmp [cmp_options] file [file]"
X	exit 1
Xfi
END_OF_FILE
if test 760 -ne `wc -c <'zcmp'`; then
    echo shar: \"'zcmp'\" unpacked with wrong size!
fi
chmod +x 'zcmp'
# end of 'zcmp'
fi
if test -f 'zcmp.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'zcmp.1'\"
else
echo shar: Extracting \"'zcmp.1'\" \(797 characters\)
sed "s/^X//" >'zcmp.1' <<'END_OF_FILE'
X.TH ZCMP 1
X.SH NAME
Xzcmp, zdiff \- compare compressed files
X.SH SYNOPSIS
X.B zcmp
X[ cmp_options ] file1
X[ file2 ]
X.br
X.B zdiff
X[ diff_options ] file1
X[ file2 ]
X.SH DESCRIPTION
X.I  Zcmp
Xand 
X.I zdiff
Xare used to invoke the
X.I cmp
Xor the
X.I diff
Xprogram on compressed files.  All options specified are passed directly to
X.I cmp
Xor
X.IR diff "."
XIf only 1 file is specified, then the files compared are
X.I file1
Xand an uncompressed
X.IR file1 ".Z."
XIf two files are specified, then they are uncompressed (if ending with ".Z")
Xand fed to
X.I cmp
Xor
X.IR diff "."
XThe exit status from 
X.I cmp
Xor
X.I diff
Xis preserved.
X.SH "SEE ALSO"
Xcmp(1), diff(1), zmore(1), zcat(1), compress(1), uncompress(1)
X.SH BUGS
XMessages from the
X.I cmp
Xor
X.I diff
Xprograms refer to temporary filenames instead of those specified.
END_OF_FILE
if test 797 -ne `wc -c <'zcmp.1'`; then
    echo shar: \"'zcmp.1'\" unpacked with wrong size!
fi
# end of 'zcmp.1'
fi
if test -f 'zdiff' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'zdiff'\"
else
echo shar: Extracting \"'zdiff'\" \(724 characters\)
sed "s/^X//" >'zdiff' <<'END_OF_FILE'
X
XOPTIONS=
XFILES=
Xfor ARG
Xdo
X	case "$ARG" in
X	-*)	OPTIONS="$OPTIONS $ARG";;
X	*)	FILES="$FILES $ARG";;
X	esac
Xdone
Xif test -z "$FILES"; then
X	echo "Usage: zdiff [diff_options] file [file]"
X	exit 1
Xfi
Xset $FILES
Xif test $# -eq 1; then
X	FILE=`expr $1 : '\(.*\)\.Z' '|' $1`
X	zcat $FILE | diff $OPTIONS - $FILE
X	STAT="$?"
Xelif test $# -eq 2; then
X	case "$1" in
X	*.Z)	case "$2" in
X		*.Z)	F=`basename $2 .Z`
X			zcat $2 > /tmp/$F.$$
X			zcat $1 | diff $OPTIONS - /tmp/$F.$$
X			STAT="$?";;
X		*)	zcat $1 | diff $OPTIONS - $2;;
X		esac;;
X	*)	case "$2" in
X		*.Z)	zcat $2 | diff $OPTIONS $1 -
X			STAT="$?";;
X		*)	diff $OPTIONS $1 $2
X			STAT="$?";;
X		esac;;
X	esac
X	exit "$STAT"
Xelse
X	echo "Usage: zdiff [diff_options] file [file]"
X	exit 1
Xfi
END_OF_FILE
if test 724 -ne `wc -c <'zdiff'`; then
    echo shar: \"'zdiff'\" unpacked with wrong size!
fi
chmod +x 'zdiff'
# end of 'zdiff'
fi
if test -f 'zmore' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'zmore'\"
else
echo shar: Extracting \"'zmore'\" \(306 characters\)
sed "s/^X//" >'zmore' <<'END_OF_FILE'
XFIRST=1
Xfor FILE
Xdo
X	if test $FIRST -eq 0; then
X		echo "--More--(Next file: $FILE)\c"
X		stty cbreak -echo
X		ANS=`dd bs=1 count=1 2>/dev/null` 
X		stty -cbreak echo
X		echo " "
X		if test "$ANS" = 'e'; then
X			exit
X		fi
X	fi
X	echo "------> $FILE <------"
X	zcat $FILE | more
X	if test -t; then
X		FIRST=0
X	fi
Xdone
END_OF_FILE
if test 306 -ne `wc -c <'zmore'`; then
    echo shar: \"'zmore'\" unpacked with wrong size!
fi
chmod +x 'zmore'
# end of 'zmore'
fi
if test -f 'zmore.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'zmore.1'\"
else
echo shar: Extracting \"'zmore.1'\" \(3702 characters\)
sed "s/^X//" >'zmore.1' <<'END_OF_FILE'
X.TH ZMORE 1
X.SH NAME
Xzmore \- file perusal filter for crt viewing of compressed text
X.SH SYNOPSIS
X.B zmore
X[ name ...  ]
X.SH DESCRIPTION
X.I  Zmore
Xis a filter which allows examination of compressed text files
Xone screenful at a time on a soft-copy terminal.
XIt normally pauses after each screenful, printing --More--
Xat the bottom of the screen.
XIf the user then types a carriage return, one more line is displayed.
XIf the user hits a space,
Xanother screenful is displayed.  Other possibilites are enumerated later.
X.PP
X.I Zmore
Xlooks in the file
X.I /etc/termcap
Xto determine terminal characteristics,
Xand to determine the default window size.
XOn a terminal capable of displaying 24 lines,
Xthe default window size is 22 lines.
X.PP
XOther sequences which may be typed when
X.I zmore
Xpauses, and their effects, are as follows (\fIi\fP is an optional integer
Xargument, defaulting to 1) :
X.PP
X.IP \fIi\|\fP<space>
Xdisplay
X.I i
Xmore lines, (or another screenful if no argument is given)
X.PP
X.IP ^D
Xdisplay 11 more lines (a ``scroll'').
XIf
X.I i
Xis given, then the scroll size is set to \fIi\|\fP.
X.PP
X.IP d
Xsame as ^D (control-D)
X.PP
X.IP \fIi\|\fPz
Xsame as typing a space except that \fIi\|\fP, if present, becomes the new
Xwindow size.  Note that the window size reverts back to the default at the
Xend of the current file.
X.PP
X.IP \fIi\|\fPs
Xskip \fIi\|\fP lines and print a screenful of lines
X.PP
X.IP \fIi\|\fPf
Xskip \fIi\fP screenfuls and print a screenful of lines
X.PP
X.IP "q or Q"
Xquit reading the current file; go on to the next (if any)
X.PP
X.IP e
XWhen the prompt --More--(Next file: 
X.IR file )
Xis printed, this command causes zmore to exit.
X.PP 
X.IP =
XDisplay the current line number.
X.PP
X.IP \fIi\|\fP/expr
Xsearch for the \fIi\|\fP-th occurrence of the regular expression \fIexpr.\fP
XIf the pattern is not found,
X.I zmore
Xgoes on to the next file (if any).
XOtherwise, a screenful is displayed, starting two lines before the place
Xwhere the expression was found.
XThe user's erase and kill characters may be used to edit the regular
Xexpression.
XErasing back past the first column cancels the search command.
X.PP
X.IP \fIi\|\fPn
Xsearch for the \fIi\|\fP-th occurrence of the last regular expression entered.
X.PP
X.IP !command
Xinvoke a shell with \fIcommand\|\fP. 
XThe character `!' in "command" are replaced with the
Xthe previous shell command.  The sequence "\\!" is replaced by "!".
X.PP
X.IP ":q or :Q"
Xquit reading the current file; go on to the next (if any)
X(same as q or Q).
X.PP
X.IP .
X(dot) repeat the previous command.
X.PP
XThe commands take effect immediately, i.e., it is not necessary to
Xtype a carriage return.
XUp to the time when the command character itself is given,
Xthe user may hit the line kill character to cancel the numerical
Xargument being formed.
XIn addition, the user may hit the erase character to redisplay the
X--More-- message.
X.PP
XAt any time when output is being sent to the terminal, the user can
Xhit the quit key (normally control\-\\).
X.I Zmore
Xwill stop sending output, and will display the usual --More--
Xprompt.
XThe user may then enter one of the above commands in the normal manner.
XUnfortunately, some output is lost when this is done, due to the
Xfact that any characters waiting in the terminal's output queue
Xare flushed when the quit signal occurs.
X.PP
XThe terminal is set to
X.I noecho
Xmode by this program so that the output can be continuous.
XWhat you type will thus not show on your terminal, except for the / and !
Xcommands.
X.PP
XIf the standard output is not a teletype, then
X.I zmore
Xacts just like
X.I zcat,
Xexcept that a header is printed before each file.
X.SH FILES
X.DT
X/etc/termcap		Terminal data base
X.SH "SEE ALSO"
Xmore(1), zcat(1), compress(1), uncompress(1)
END_OF_FILE
if test 3702 -ne `wc -c <'zmore.1'`; then
    echo shar: \"'zmore.1'\" unpacked with wrong size!
fi
# end of 'zmore.1'
fi
if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patchlevel.h'\"
else
echo shar: Extracting \"'patchlevel.h'\" \(21 characters\)
sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
X#define PATCHLEVEL 0
END_OF_FILE
if test 21 -ne `wc -c <'patchlevel.h'`; then
    echo shar: \"'patchlevel.h'\" unpacked with wrong size!
fi
# end of 'patchlevel.h'
fi
echo shar: End of archive 2 \(of 2\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked both archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0


-- 
Kent Landfield                   INTERNET: kent at 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 at uunet.uu.net.

exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent at 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 at uunet.uu.net.



More information about the Comp.sources.misc mailing list