#! /bin/sh

# rcsmiss -- check for files not being revisioned 
# $Id: rcsmiss,v 2.1 1998/07/09 02:38:39 cdua Exp cdua $
# Carlos Duarte, 970514/980707

#trap -- 'rm -f /tmp/xpto' EXIT SIGINT

USAGE="\
usage: $0 [-h] [-q] [dirs...]

  -h      this help
  -q      be quiet 
  -n      just show what would be done

  check files not being revisioned, i.e. files x, that 
  does not have a corresponding x,v
"

while : ; do
	case x"$1" in
	x-h)	echo "$USAGE"; exit 1 ;;
	x-q)	Q=Q ;;
	x-n)	CMD=cat ;;
	x--)	shift; break ;;
	x-?)	echo "invalid option -- `echo $1|cut -c2-`"
		echo "$USAGE"; exit 1 ;;
	*)	break ;;
	esac
	shift
done

## if _must_ accept on extra argument after options
#if test $# -eq 0; then echo "$USAGE"; exit 1; fi

QQ=' is not being revision controled'
test Q$Q != Q && \
QQ=''

test $# -eq 0 && set -- . 
for i
do 
	ls -al $i | awk '
BEGIN {
	while ((getline < ".rcsign") > 0) x[$0] = 1
	while ((getline < ".rcsignore") > 0) x[$0] = 1
	while ((getline < ".rcsmiss") > 0) x[$0] = 1

	x[".rcsign"] = 1
	x[".rcsignore"] = 1
	x[".rcsmiss"] = 1
}
x[$NF] == 0 { print }' | sed "
1d
/^l/d
/^-/!d
s/^.* //
s@.*@if test -f $i/RCS/&,v;then :;elif test -f $i/&,v;then :;\
else echo $i/&$QQ;fi@" 
done | ${CMD-sh}
