BINSCRIPTS = \
cdb-assign cdb-list check-sender \
- unfwd splitconf
+ unfwd splitconf z
SBINSCRIPTS = \
shadowfix
SCRIPTS = $(BINSCRIPTS) $(SBINSCRIPTS)
BINPROGS = \
- not \
+ not \
cdb-probe cdb-check-domain \
gorp \
locking if-mtu
xtitle.so
MAN1 = \
- not.1 \
+ not.1 z.1 \
cdb-assign.1 cdb-list.1 cdb-probe.1 cdb-check-domain.1 \
gorp.1 \
unfwd.1 splitconf.1 locking.1 if-mtu.1
--- /dev/null
+#! /bin/bash
+
+me="${0##*/}"
+
+if [ $# -lt 1 ]; then
+ echo >&2 "Usage: $me command [args]"
+ exit 1
+fi
+
+tmp=${TMPDIR-/tmp}/zz.$$
+mkdir -m700 $tmp || exit 1
+
+# --- Snarfle the arguments ---
+
+declare -a cmd
+declare -i i seq
+
+cmd[0]="$1"; shift
+
+i=1 seq=0
+for j; do
+ file="$1"; shift
+ case "$file" in
+ *.Z|*.z|*.gz)
+ gunzip -c "$file" >$tmp/zz.$seq
+ file=$tmp/zz.$seq
+ seq=seq+1
+ ;;
+ *.bz2)
+ bunzip2 -c "$file" >$tmp/zz.$seq
+ file=$tmp/zz.$seq
+ seq=seq+1
+ ;;
+ esac
+ cmd[i]="$file"
+ i=i+1
+done
+
+# --- Run the program ---
+
+"${cmd[@]}"; stat=$?
+rm -rf $tmp
+exit $?
--- /dev/null
+.TH z 1 "18 February 1999" "Edgeware tools"
+.SH NAME
+z \- run shell commands on compressed files
+.SH SYNOPSIS
+.B z
+.I command
+.RI [ arguments ...]
+.SH DESCRIPTION
+The
+.B z
+script examines the shell command passed to it for filenames which look
+as if they're compressed files. For each one that it finds, it
+decompresses the file into a temporary place, and replaces the
+compressed file's name in the command line with the name of the
+decompressed version. When the command terminates,
+.B z
+deletes the decompressed files and exits.
+.SH BUGS
+The
+.B z
+program is a very simple
+.B bash
+shell script. As a result there are a number of limitations:
+.PP
+Changes made to the temporary decompressed files are ignored: the
+original is left unchanged.
+.PP
+Nonexistent files cause errors to be reported.
+.PP
+The decompressed versions of files are always created with default
+owner, group and permissions (as set by the current euid, egid and umask
+settings).
+.SH AUTHOR
+Mark Wooding (mdw@nsict.org).