#
# KEHOME/bin/opencyc
# Sep/15/2003 Oct/29/2005
# Oct/28/2006 OpenCyc 1.0
# Nov/6/2006 start browser in background first

# start local opencyc server
#     usage: opencyc server world
#
# browse local opencyc kb
#     usage: opencyc browser world

. systype.env
echo opencyc $@ >&2

if [ -n "$1" ]
then program="$1"
else program="server"
fi
if [ -n "$2" ]
then world="$2"
else world="local"
fi

url="http://localhost:3602/cgi-bin/cyccgi/cg?cb-start"
case "$systype" in
Linux)
	iexplore="/usr/bin/netscape";;
Cygwin|Interix)
	iexplore="/pf/Internet Explorer/iexplore.exe";;
Windows|WinXP|Win98)
	iexplore="/pf/Internet Explorer/iexplore.exe";;
esac

case "$program" in
browser)
	"$iexplore" "$url" ;;
esac &

case "$program" in
browser)
	echo "## You may need to refresh browser after server is initialized ##" >&2;
	run-cyc.sh $world;;
server)
	run-cyc.sh $world;;
*)
	echo "usage: opencyc server world";
	echo "usage: opencyc browser world";;
esac

#