home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / compress / gnuzip_.zip / ZCMP.IN < prev    next >
Text File  |  1993-03-28  |  792b  |  45 lines

  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.     gzip -cd $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.             gzip -cd $2 > /tmp/$F.$$
  27.             gzip -cd $1 | cmp $OPTIONS - /tmp/$F.$$
  28.             STAT="$?";;
  29.         *)    gzip -cd $1 | cmp $OPTIONS - $2;;
  30.         esac;;
  31.     *)    case "$2" in
  32.         *.Z)    F=`basename $2 .Z`
  33.             gzip -cd $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
  45.