#!/bin/sh

####
#### A script to run xchek
####

##
## read global and user configuration files if they exist
##
if [ -f /etc/xchek.conf ] ; then 
    . /etc/xchek.conf
fi

if [ -f $HOME/.xchekrc ] ; then
    . $HOME/.xchekrc 
fi

###
### find xchek root directory
###

PRG="$0"
XCHEK_ROOT=`dirname $PRG`/..

###
### go to the root directory
###
pushd $XCHEK_ROOT > /dev/null

###
### setup environment variables
###
if [ -z "$ROOT" ] ; then
 source ./bin/env.sh `pwd` > /dev/null
fi

###
### now we are ready to run
###
if [ "$DEBUG" == "no" ] ; then
    unset ASSERT
else
    ASSERT=-ea
fi
MEMORY_MIN=${MEMORY_MIN:-64m}
MEMORY_MAX=${MEMORY_MAX:-64m}

java $ASSERT -Xms$MEMORY_MIN -Xmx$MEMORY_MAX $JAVA_OPT edu.toronto.cs.gui.XChekGUI

###
### return to parent directory
###
popd > /dev/null



