#!/bin/sh
#
# A simple shell script to invoke the O'Hugs interpreter and set the
# path to the prelude file.
#
# Mark P. Jones, 1996.  Derived from the corresponding script for Gofer
# which was written by Mark Jones and edited by Jonathan Bowen, Oxford
# University, August 1993.
#
# O prefix added by Johan Nordlander, 1999.

# Location of Hugs files - site specific
ROOT=`dirname $0`
INSTLIB=/usr/local/lib/ohugs

# The default Hugs search path:
OHUGSPATH=${OHUGSPATH-$ROOT/lib:$ROOT/libhugs:$INSTLIB/lib:$INSTLIB/libhugs}
export OHUGSPATH

# Preferred command line argument settings:
OHUGSARGS=${OHUGSARGS-""}

# The next few lines try to guess a suitable setting for the EDITLINE
# variable.  If your favourite editor is not dealt with here, or if
# the version of sh that I'm using is incompatible with every other
# shell out there, you may need to modify (or remove) this section:
#
EDIT=${EDITOR-vi}
case `basename $EDIT` in
    emacs | vi | elvis )  EDITLINE="$EDIT +%d %s";;
    none               )  ;;
    *                  )  EDITLINE=$EDIT;;
esac

OHUGSEDIT=${OHUGSEDIT-$EDITLINE}
export OHUGSEDIT

# Avoid dependencies on this peculiar variable:
LD_LIBRARY_PATH=
export LD_LIBRARY_PATH

# Finally, start the interpreter running:
if [ -x $ROOT/src/ohugs ]; then
  EXE=$ROOT/src/ohugs
else
  EXE=$INSTLIB/ohugs
fi
exec $EXE $OHUGSARGS "$@"
