#!/bin/sh
export Tcl="/usr/bin/tclsh"
if [ "x$1" = "x" ] ; then
  echo "simplify-bld requires an input file argument"
  exit 1
fi
if [ "x$Tcl" = "x" ] ; then
	echo 'tclsh not found';
	echo 'Please rerun configure with \"--with-tclsh=/path/to/your/tclsh\" added'
	exit 1;
fi

if [ -f /usr/share/ccafe-0.8.8/simplify-bld.tcl ] ; then
	Simp=/usr/share/ccafe-0.8.8/simplify-bld.tcl;
fi
if [ -f /usr/share/simplify-bld.tcl ] ; then
	Simp=/usr/share/simplify-bld.tcl;
fi
if [ -f /usr/bin/simplify-bld.tcl ] ; then
	Simp=/usr/bin/simplify-bld.tcl;
fi

if [ 'x$Simp' = 'x' ] ; then
	echo 'simplify-bld.tcl not found in pwd';
	exit 1;
fi

exec $Tcl $Simp -- $*
exit 0
