#csh
/mit/forms/faxtest/faxmakeblank $$
setenv XFILESEARCHPATH /mit/forms/faxtest/%N
/mit/forms/faxtest/aformdisp /mit/forms/faxtest/widget.def /tmp/fax_raw.$$
if ($status == 0) then
	setenv RECIPIENT	"`cat /tmp/fax_raw.$$ | sed 4,4\\!d`"
	echo "to: $RECIPIENT" >  /tmp/fax_cooked.$$
	echo "from: `whoami`" >>  /tmp/fax_cooked.$$
	echo "" >>  /tmp/fax_cooked.$$

	/mit/forms/faxtest/dumpascii /mit/forms/faxtest/widget.def /tmp/fax_raw.$$ >> /tmp/fax_cooked.$$
	/usr/lib/sendmail -t < /tmp/fax_cooked.$$
	echo "Form has been sent to" "$RECIPIENT"
#	rm /tmp/fax_cooked.$$
else
	echo "Form has been cancelled"
endif
rm /tmp/fax_raw.$$
