#!/bin/csh -f
#
# add $1 as an RCS symbolic revision name to all RCS files in the
# hierarchy.
#
if ($#argv < 1) then
	echo "usage: versify <version>"
	exit 1
endif
echo "finding RCS filenames..."
find . -name \*,v -print >/tmp/rcslist.$$
echo "pre-processing RCS files..."
rlog -h `cat /tmp/rcslist.$$` | awk 'BEGIN {rev = ""; file = ""} \
$1 ~ /^RCS$/ { if (file != "") print "rcs -nFOOREV:" rev " " file; \
   		file = $3; rev = "" } \
$1 ~ /^head:$/ { rev = $2 } \
END { if (file != "") print "rcs -nFOOREV:" rev " " file}' |sed -e s/FOOREV/$1/ >/tmp/doit.sh.$$
rm -f /tmp/rcslist.$$
sh -x /tmp/doit.sh.$$
rm -f /tmp/doit.sh.$$
exit 0
