if [ $# -eq 0 -o $# -ge 3 ]
then
	echo " Usage:"
	echo "         ani filename1 [filename2]"
	echo
	echo " filename1 - file to load  and  save b.in if "
	echo "             filename2 not specifed and"
	echo "             file to load b.in if it is specifed" 
	echo " filename2 - file to save  standart b.in file"
	echo
	echo "                            Copyleft by Dark Lord"
	exit 0
fi

cp $1 temp0001.ds
wish b.tcl
if [ $? -eq 1 ] 
then 
	(rm b.sys)
	ani.exe
	ff=1
	ec=""
	i=0
	while `test -z $ec`
	do
		i=`expr $i + 1`
		ec=`ls -s b.sys | cut -c $i`
	done
else
	ff=0
fi

if [ $# -eq 1 ]
then
	cp temp0001.ds $1
else
	cp temp0001.ds $2
fi
rm temp0001.ds

if [ $ff -eq 0 ]
then 
	exit 0
fi

if [ $ec -eq 0 ]
then 
	echo "Program terminated correctly!" > mes.in
else 
	echo "Error detected!" > mes.in 
fi
