File: zcmp

package info (click to toggle)
ncompress 4.2.4-9.2
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 160 kB
  • ctags: 201
  • sloc: ansic: 1,441; makefile: 35
file content (44 lines) | stat: -rwxr-xr-x 772 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
:
#!/bin/sh

OPTIONS=
FILES=
for ARG
do
	case "$ARG" in
	-*)	OPTIONS="$OPTIONS $ARG";;
	*)	FILES="$FILES $ARG";;
	esac
done
if test -z "$FILES"; then
	echo "Usage: zcmp [cmp_options] file [file]"
	exit 1
fi
set $FILES
if test $# -eq 1; then
	FILE=`expr $1 : '\(.*\)\.Z' '|' $1`
	zcat $FILE | cmp $OPTIONS - $FILE
	STAT="$?"
elif test $# -eq 2; then
	case "$1" in
	*.Z)	case "$2" in
		*.Z)	F=`basename $2 .Z`
			zcat $2 > /tmp/$F.$$
			zcat $1 | cmp $OPTIONS - /tmp/$F.$$
			STAT="$?";;
		*)	zcat $1 | cmp $OPTIONS - $2;;
		esac;;
	*)	case "$2" in
		*.Z)	F=`basename $2 .Z`
			zcat $2 > /tmp/$F.$$
			cmp $OPTIONS $1 /tmp/$F.$$
			STAT="$?";;
		*)	cmp $OPTIONS $1 $2
			STAT="$?";;
		esac;;
	esac
	exit "$STAT"
else
	echo "Usage: zcmp [cmp_options] file [file]"
	exit 1
fi