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