#!/bin/csh -f

# (C) Copyright International Business Machines Corporation 23 January 
# 1990.  All Rights Reserved. 
#  
# See the file USERAGREEMENT distributed with this software for full 
# terms and conditions of use. 

if (! $?HROOTDIR{} ) then
  setenv HROOTDIR ~hermes
endif
if (! $?HARCH{} ) then
  setenv HARCH `arch`
  switch ($HARCH)
    case sun3*:
    case sun4*:
      if (-e /usr/include/dlfcn.h) then
	if (! -d $HROOTDIR/mchbin/${HARCH}) setenv HARCH ${HARCH}_nodl
      else
	setenv HARCH ${HARCH}_nodl
      endif
  endsw
endif

if (-d $HROOTDIR/mchbin/$HARCH) then
  if (! $?HPATH) setenv HPATH .:$HROOTDIR/chbin:$HROOTDIR/bin
endif

if ( $?HALTSYS ) then
  set firstchoice="$HROOTDIR/mbin/$HARCH/$HALTSYS/hermes"
  set secondchoice="$HROOTDIR/mbin/$HALTSYS/hermes"
else
  set firstchoice="$HROOTDIR/mbin/$HARCH/hermes"
  set secondchoice="$HROOTDIR/mbin/hermes"
endif

if (! $?HSHELL) set HSHELL=shell
if ($#argv == 0) set argv=($HSHELL)
if (-e $firstchoice) then
  exec $firstchoice $*
else if (-e $secondchoice) then
  exec $secondchoice $*
else
  echo "Unable to locate Hermes interpreter binary"
  exit 1
endif
