#! /bin/sh

goal="detection of file changing while archiving"
bru=${BRU:-bru}

# Parse our args.  Options include:
#
#	-s	Print our one line test goal and quit
#

while true
do
	case $1 in
		-d)	dflag="on"
			shift
			;;
		-g)	echo $goal
			exit 0
			;;
		*bru*)	bru=$1
			shift
			;;
		*)	break
			;;
	esac
done

if [ "$dflag" != "on" ]
then
	trap "rm -rf junkfile bru.out ; exit 1" 1 2 13 15
fi

# First clean up any stuff that may be left from a previous test.

rm -f junkfile bru.out

# Run test.  Alway recompile to avoid problems with imported binaries
# from "foreign" machines.

cc -o change change.c
cc -o makejunk makejunk.c

./makejunk junkfile
./change junkfile&

$bru -cvf bru.out junkfile
echo "bru exit status was $?"

if [ "$dflag" != "on" ]
then
	rm -rf junkfile bru.out
fi

exit 0




