home *** CD-ROM | disk | FTP | other *** search
/ BUG 1 / BUGCD1996_0708.ISO / pc / util / minilin / minilin.exe / USR / BIN / ZCMP < prev    next >
Text File  |  1994-05-19  |  770b  |  44 lines

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