#!/bin/sh -

# This script will start ACT on a UNIX system.  This script should
# be left in the same directory as the rest of the ACT
# distribution, so that the java class files can be found.  If
# necessary a symbolic link can be made to this script from
# /usr/local/bin/ or elsewhere.


# $Header: /nfs/disk222/yeastpub/Repository/agctimpl/act,v 1.4 2000/08/31 11:05:38 kmr Exp $

# resolve links - $0 may be a link
PRG=$0
progname=`basename $0`

while [ -h "$PRG" ] ; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '.*/.*' > /dev/null; then
    PRG="$link"
  else
    PRG="`dirname $PRG`/$link"
  fi
done

ACT_HOME=`dirname "$PRG"`/.


if [ "$CLASSPATH" = "" ]
then
    CLASSPATH=$ACT_HOME
else
    CLASSPATH=$ACT_HOME:$CLASSPATH
fi

export CLASSPATH


ACT_PROPERTIES="-Dartemis.environment=UNIX"

MEM="-mx150m -ms20m"

if [ "$ACT_JVM_FLAGS" = "" ]
then
    FLAGS="$MEM -noverify"
else
    FLAGS="$MEM -noverify $ACT_JVM_FLAGS"
fi


QUIET=no

if [ $# = 0 ]
then
    :
else
    if [ x$1 = x-h -o x$1 = x--help ]
    then
        cat <<EOF
usage: $0 [EMBL/GENBANK/SEQUENCE file] [EMBL/GENBANK/SEQUENCE file] [crunch file]
EOF
        exit 0
    fi


    while test $# != 0
    do
        case $1 in
        -options) FLAGS="$FLAGS -Dextra_options=$2"; shift ;;
        -D*) FLAGS="$FLAGS $1" ;;
        -fast) FLAGS="$FLAGS -fast" ;;
        -quiet) QUIET=yes ; FLAGS="$FLAGS -Drun_quietly=true" ;;
        *) break ;;
        esac
        shift
    done
fi

if [ "$JAVA_VM" = "" ]
then
    JAVA=java
else
    JAVA=$JAVA_VM
fi


if [ $QUIET = no ]
then
    echo starting ACT with flags: $FLAGS 1>&2
fi

$JAVA $FLAGS $ACT_PROPERTIES Dad $*
