#!/bin/sh
##
##  frink.sh -- Frink command line interface
##

#   determine run-time user-interface
case "$1" in
    --gui | --gui-awt ) ui="frink.gui.InteractivePanel"      ;;
    --gui-swing       ) ui="frink.gui.SwingInteractivePanel" ;;
    --gui-pp          ) ui="frink.gui.ProgrammingPanel"      ;;
    *                 ) ui="frink.parser.Frink"              ;;
esac

#   execute program
if [ ".$ui" = ".frink.parser.Frink" -a $# -eq 1 -a ! -f "$1" ]; then
    set -- -e "$@"
fi
if [ ".$ui" = ".frink.parser.Frink" -a \
     -x @l_prefix@/libexec/frink/frink.exe ]; then
    exec @l_prefix@/libexec/frink/frink.exe ${1+"$@"}
else
    export JAVA_PLATFORM="sun-jdk"
    exec @l_prefix@/bin/java -cp @l_prefix@/libexec/frink/frink.jar $ui ${1+"$@"}
fi

