# 10/03/88 DEW:modified to update the revision log.

newcifile=newciupdates # this must be the same as newci
flagfile=/src/paws/src/turninprogress  # this must be the same as newci
				       # and rcs2pws
versionfile=revlog3.24
admpath=/src/paws/adm
date=`date`
month=`expr substr "$date" 5 3`
day=`expr substr "$date" 9 2 | tr ' ' 0`
logfile=/src/paws/log/newrev.$month$day

srcdir=/src/paws/src
if [ "$LOGNAME" = root ]; then
	echo DO NOT RUN ME AS ROOT	
	exit 1
fi

doclean=1
if [ $# -ge 1 ]
then
	if [ $1 = nocheck ]
	then
		doclean=0
	fi
fi

if [ $doclean -eq 1 ]
then
	chkrcsclean
	if [ $? -eq 1 ]
	then
		echo chkrcsclean failure
		exit 1
	fi
fi

echo 'Bring all paws RCS files up to the same (higher) rev.'
revision=`rlog -h /src/paws/adm/RCS/$versionfile,v |grep "^head" |cut -d" " -f2-`
echo "The last RCS revision number was: $revision"
echo 'New RCS revision number? \c'
read revision
if [ "$revision" = "" ]; then
	echo DO NOT RUN ME IN BACKGROUND
	exit 1
fi
echo 'PAWS version at this level (e.g. 3.2h)? \c'
read version
trap '' 1
(
for i in $srcdir/fp40/[a-z]*; do
  if [ ! -d $i ]
  then
	echo "$i is not a directory.  skipping..."
	continue
  fi
  cd $i
  for j in $i/RCS/*,v; do
    base=`basename $j ,v`
    co -l $base 
    ci -f -r$revision $base <<!
Automatic bump of revision number for PWS version $version
!
  done
done
cd $admpath
mv $newcifile $versionfile
cat $versionfile | lp
rcs -l $versionfile
ci -r$revision $versionfile <<!
History of rcs updates made in the PWS version immediately preceeding $version
!

rm -f $flagfile


echo "******************"
echo "* allnewrev done *"
echo "******************"
echo "Check $logfile for errors."
) >$logfile 2>&1 &
