#! /bin/sh
# dircheck -- checker for expire regression testing

case "$1" in
-n)	invert=yes ; shift ;;
esac

for f in `sed 's/.*	//;s:\.:/:g'`
do
	if test " $invert" = " "
	then
		if test ! -f $1/$f
		then
			echo "cannot find $1/$f" >&2
			exit 1
		fi
		it="`cat $1/$f`"
		if test " $it" = " $f" || expr " $it" : ".*:$f:.*" >/dev/null
		then
			: okay
		else
			echo "contents of $1/$f are wrong" >&2
			exit 1
		fi
	else
		if test -f $1/$f
		then
			echo "found $1/$f, shouldn't have" >&2
			exit 1
		fi
	fi
done
exit 0				# for stupid shells
