home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / archiver / ncmp424s / zdiff < prev    next >
Encoding:
Text File  |  1993-07-08  |  736 b   |  43 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: zdiff [diff_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 | diff $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 | diff $OPTIONS - /tmp/$F.$$
  28.             STAT="$?";;
  29.         *)    zcat $1 | diff $OPTIONS - $2;;
  30.         esac;;
  31.     *)    case "$2" in
  32.         *.Z)    zcat $2 | diff $OPTIONS $1 -
  33.             STAT="$?";;
  34.         *)    diff $OPTIONS $1 $2
  35.             STAT="$?";;
  36.         esac;;
  37.     esac
  38.     exit "$STAT"
  39. else
  40.     echo "Usage: zdiff [diff_options] file [file]"
  41.     exit 1
  42. fi
  43.