:
#	@(#) oacmp 25.1 92/02/24 
#
#	Copyright (C) 1987-1992 The Santa Cruz Operation, Inc.
#		All Rights Reserved.
#	The information in this file is provided for the exclusive use of
#	the licensees of The Santa Cruz Operation, Inc.  Such users have the
#	right to use, modify, and incorporate this code into other products
#	for purposes authorized by the license agreement provided they include
#	this notice and the associated copyright notice with any such product.
#	The information in this file is provided "AS IS" without warranty.
#

OALIB=${OALIB-"/usr/lib/oa"}
PATH=$OALIB/utilbin:$PATH

 # run ourself thru oash 
eval oainit 2>/dev/null || (oash $0; kill $$)
. `findfile shell_strs`

EscWasHit() { 
	oadeinit
	exit
}

 #OACMP1="Select type of file to compare"
 #OACMP2="Text File"
 #OACMP3="Binary File"
 #OACMP4="Directory"
 #OACMP5="Enter First Filename: "
 #OACMP6="Enter Second Filename: "
 #OACMP7="Enter First Directory: "
 #OACMP8="Enter Second Directory: "

 # The length of box (num of columns) used to display OACMP2, OACMP3, OACMP4.
 # The title of the box is OACMP1.
 #CMP_NUMCOLS=44
wmopen 1 3 $CMP_NUMCOLS 4 16 
wmove 1 
wmtitle "$OACMP1"  
wmmessage -r "$PRESSRET" 
pp "$OACMP2" "$OACMP3" "$OACMP4"
Choice=$PP_NUM
case "$Choice" in 
	-1) 	EscWasHit ;;
	2)	OACMP5=$OACMP7 		# compare directories	
		OACMP6=$OACMP8
		Type=-D ;;
esac

wmopen 2 15 60 7 1  
wmmessage -r "$PRESSRET" 
ppfile -p"$OACMP5" $Type 
[ -z "$PP_DIR$PP_FILE" ] && EscWasHit
File1=$PP_DIR$PP_FILE

wmopen 3 15 60 8 19  
wmmessage -r "$PRESSRET" 
ppfile -p"$OACMP6" $Type 
[ -z "$PP_DIR$PP_FILE" ] && EscWasHit
File2=$PP_DIR$PP_FILE

TEMP=/tmp/cmp$$
 #OACMP9="\n    Files are the same."
case "$Choice" 
in
	0)	diff $File1 $File2 > $TEMP 2>&1;;  
	1)	cmp -l $File1 $File2 > $TEMP 2>&1;;
	2)	dircmp $File1 $File2 > $TEMP 2>&1;;
esac

if test ! -s $TEMP; then
	echo $OACMP9 >> $TEMP
fi

 #OACMP10='<< ${File1} vs ${File2} >>'
wmopen 4 20 70 2 5
eval wmtitle \"$OACMP10\"
scan -e"$EOFMSG" $TEMP
rm -f $TEMP 
oadeinit
