| 1 |
: |
| 2 |
#!/bin/sh |
| 3 |
|
| 4 |
OPTIONS= |
| 5 |
FILES= |
| 6 |
for ARG |
| 7 |
do |
| 8 |
case "$ARG" in |
| 9 |
-*) OPTIONS="$OPTIONS $ARG";; |
| 10 |
*) FILES="$FILES $ARG";; |
| 11 |
esac |
| 12 |
done |
| 13 |
if test -z "$FILES"; then |
| 14 |
echo "Usage: zcmp [cmp_options] file [file]" |
| 15 |
exit 1 |
| 16 |
fi |
| 17 |
set $FILES |
| 18 |
if test $# -eq 1; then |
| 19 |
FILE=`expr $1 : '\(.*\)\.Z' '|' $1` |
| 20 |
zcat $FILE | cmp $OPTIONS - $FILE |
| 21 |
STAT="$?" |
| 22 |
elif test $# -eq 2; then |
| 23 |
case "$1" in |
| 24 |
*.Z) case "$2" in |
| 25 |
*.Z) F=`basename $2 .Z` |
| 26 |
zcat $2 > /tmp/$F.$$ |
| 27 |
zcat $1 | cmp $OPTIONS - /tmp/$F.$$ |
| 28 |
STAT="$?";; |
| 29 |
*) zcat $1 | cmp $OPTIONS - $2;; |
| 30 |
esac;; |
| 31 |
*) case "$2" in |
| 32 |
*.Z) F=`basename $2 .Z` |
| 33 |
zcat $2 > /tmp/$F.$$ |
| 34 |
cmp $OPTIONS $1 /tmp/$F.$$ |
| 35 |
STAT="$?";; |
| 36 |
*) cmp $OPTIONS $1 $2 |
| 37 |
STAT="$?";; |
| 38 |
esac;; |
| 39 |
esac |
| 40 |
exit "$STAT" |
| 41 |
else |
| 42 |
echo "Usage: zcmp [cmp_options] file [file]" |
| 43 |
exit 1 |
| 44 |
fi |