#!/bin/sh
#
#  Splus HELPSTART  [-url help-url] [helpset]...
#
## To view S-PLUS help which you have installed on your web server:
#  Splus HELPSTART -url http://<your webserver>/<S-PLUS help dir>
#
## To view help files for an S-PLUS library such as maps:
# Splus HELPSTART -url http://www.insightful.com/ library/maps/.Data/__Jhelp/maps.hs
# Splus HELPSTART `Splus SHOME`/library/maps/.Data/__Jhelp/maps.hs
#
## To view help files for an S-PLUS module which is installed in 
## your S-PLUS tree.
# Splus HELPSTART `Splus SHOME`/module/wavelets/.Data/__Jhelp/wavelets.hs
# Splus HELPSTART -url http://www.insightful.com/ file:`Splus SHOME`/module/spatial/.Data/__Jhelp/spatial.hs
#
## To view your own S-PLUS help files:
# Splus HELPSTART /homes/mclark/Swork/myproj/.Data/__Jhelp/myproj.hs
# Splus HELPSTART -url http://www.insightful.com/ file:/homes/mclark/Swork/myproj/.Data/__Jhelp/myproj.hs
#
while [ $# -gt 0 ]
do
        case $1 in
        -url)
                shift
                S_HELP_HOST=$1;export S_HELP_HOST
                shift
        ;;
        -*)
                echo "$0: unrecognized option $1" >&2
                echo "Usage:" >&2
                echo " $S_PROG_NAME $0 [-url help-url] [helpset]..." >&2
                exit 1
        ;;
        *)
                break
        ;;
        esac
done
# If running from a client installation but -url is not specified then
# access help files on the Insightful website.
if [ ! -f $SHOME/splus/lib/javahelp/default.hs -a "X$S_HELP_HOST" = "X" ]; then
	S_HELP_HOST=http://www.insightful.com/
	echo "Viewing S-PLUS help files on $S_HELP_HOST"
fi
# By default display S-PLUS Java GUI and menu library helpsets
#if [ "X$S_HELP_HOST" = "X" ]; then
#	HELPSETS="$SHOME/doc/help/guihelp/splus6unix.hs $SHOME/library/menu/.Data/__Jhelp/menu.hs"
#else
#	HELPSETS="doc/help/guihelp/splus6unix.hs library/menu/.Data/__Jhelp/menu.hs"
#fi

${SHOME}/java/jre/bin/java -classpath ${CLASSPATH} -Dsplus.shome=${SHOME} \
 -Dsplus.help.host=${S_HELP_HOST} com.insightful.splus.SplusHelpViewer $HELPSETS "$@" &
echo "Starting the S-PLUS Java help system."
