lsfile=/tmp/srmls.$$
difffile=/tmp/rdiff.$$
date=`date`
srmls /dev/srmp:/TOOLS > $lsfile
if [ $? -eq 1 ]
then
	echo "Can't access #5:/TOOLS from your machine."
	exit 1
fi

for i in `ls RCS`
do
	rcsfile=`basename $i ,v`
	srmfile=`grep $rcsfile.TEXT $lsfile`
	if [ "$srmfile" = "" ]
	then
		continue;
	fi
	echo "#5:/TOOLS/$srmfile --> $rcsfile"
	srmcp -p /dev/srmp:/TOOLS/$srmfile $rcsfile
	expand $rcsfile > /tmp/tmp$$
	mv /tmp/tmp$$ $rcsfile
	normalize $rcsfile

	echo comparing $rcsfile with RCS
	rcsdiff $rcsfile > $difffile 2> /dev/null
	if [ -s $difffile ]
	then
		echo $rcsfile has changed, updating into rcs...
		rcs -l $rcsfile
		ci $rcsfile <<-@
		automatic update from $0 on $date
		@
	else
		echo $rcsfile has not changed.
		rm -f $rcsfile
	fi
	echo 
done
rm -f $difffile $lsfile
exit 0
