#!/bin/bsh

# @(#)RCS graphical diff script
# graphical views of rdiffs under IRIX
# this is totally non-portable, requires xdiff and IID
# version 0.1, April 2005
# $Id: grdiff.sh,v 1.6 2005/04/08 07:22:43 david Exp $

VERSION=1.1

# catch command with wrong number of arguments

if [ $# -lt 1 ]; then
        echo "Usage: $0 filetoview1 filetoview2 ..."
        exit 1
fi


for FILE in $@
do
{
    RCSPATH=`dirname $FILE`/RCS/`basename $FILE`,v
    if [ ! -r $RCSPATH ]
    #not already checked into rcs
        then

    	    if [ ! -r $FILE ]
		#file does not exist
			then
				xconfirm -t "$FILE not found" -icon warning -header grdiff -b OK > /dev/null
			else
				xconfirm -t "$FILE is not managed by RCS" -icon warning -header grdiff -b OK > /dev/null
		     fi

else

    TMPFILE=/tmp/$$`basename $FILE`rdiff

 co -u -r$VERSION $FILE && cat $FILE > $TMPFILE && co -u $FILE 
 cat $TMPFILE | xdiff - $FILE
 rm -f $TMPFILE 
fi

} &

done

exit 0

