Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
bzdiff77 linesDownload Raw Back to bin
1#!/bin/sh2# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh3 4# Bzcmp/diff wrapped for bzip2, 5# adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.6 7# Bzcmp and bzdiff are used to invoke the cmp or the  diff  pro-8# gram  on compressed files.  All options specified are passed9# directly to cmp or diff.  If only 1 file is specified,  then10# the  files  compared  are file1 and an uncompressed file1.gz.11# If two files are specified, then they are  uncompressed  (if12# necessary) and fed to cmp or diff.  The exit status from cmp13# or diff is preserved.14 15PATH="/usr/bin:/bin:$PATH"; export PATH16prog=`echo $0 | sed 's|.*/||'`17case "$prog" in18  *cmp) comp=${CMP-cmp}   ;;19  *)    comp=${DIFF-diff} ;;20esac21 22OPTIONS=23FILES=24for ARG25do26    case "$ARG" in27    -*)	OPTIONS="$OPTIONS $ARG";;28     *)	if test -f "$ARG"; then29            FILES="$FILES $ARG"30        else31            echo "${prog}: $ARG not found or not a regular file"32	    exit 133        fi ;;34    esac35done36if test -z "$FILES"; then37	echo "Usage: $prog [${comp}_options] file [file]"38	exit 139fi40set $FILES41if test $# -eq 1; then42	FILE=`echo "$1" | sed 's/.bz2$//'`43	bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE"44	STAT="$?"45 46elif test $# -eq 2; then47	case "$1" in48        *.bz2)49                case "$2" in50	        *.bz2)51			F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`52			tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || {53			      echo 'cannot create a temporary file' >&254			      exit 155			}56                        bzip2 -cdfq "$2" > "$tmp"57                        bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp"58                        STAT="$?"59			/bin/rm -f "$tmp";;60 61                *)      bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"62                        STAT="$?";;63                esac;;64        *)      case "$2" in65	        *.bz2)66                        bzip2 -cdfq "$2" | $comp $OPTIONS "$1" -67                        STAT="$?";;68                *)      $comp $OPTIONS "$1" "$2"69                        STAT="$?";;70                esac;;71	esac72else73	echo "Usage: $prog [${comp}_options] file [file]"74	exit 175fi76exit "$STAT"77 
codekingpro/portable-devtools · Team Ai