#!/bin/ksh
#
# rcslocked - Report on all locked files.
# 
# Author: Robert E. Bruccoleri, Bristol-Myers Squibb 
#	  Pharmaceutical Research Institute.
#
#	$Id: rcslocked.sh,v 1.1 1992/04/29 15:57:02 root Exp $

usage='usage: rcslocked [file...]
  if no file is specified, then RCS/* is used.'

useall=0
case $# in
0) useall=1
esac

for i do
	case $1 in
	-*) echo >&2 "$usage"; exit 2 ;;
	esac
done

tmp="/tmp"
[ "$TMPDIR" != "" ] && tmp=$TMPDIR

exitcode=0
typeset -L35 name
tmpfile=$tmp/rcsl$$
trap "rm -f $tmpfile" 0

if [ $useall -eq 1 ]
then
	files=`rlog -L -R RCS/*`
else
	files=`rlog -L -R $*`
fi

for i in $files 
do
	rlog $i >$tmpfile
	name=`grep "RCS file:" $tmpfile`
	lock=`grep "locked by:" $tmpfile`
	if [[ "$lock" != "" ]]
	then
		print "$name $lock"
	fi
done

exit $exitcode
