#!/bin/csh

############################################################################
#cr                                                                       
#cr            (C) Copyright 1995 The Board of Trustees of the            
#cr                        University of Illinois                         
#cr                         All Rights Reserved                           
#cr                                                                       
############################################################################

############################################################################
# RCS INFORMATION:
#
#       $RCSfile: vmd,v $
#       $Author: billh $        $Locker:  $                $State: Exp $
#       $Revision: 1.8 $      $Date: 1995/05/12 00:49:44 $
#
############################################################################
# DESCRIPTION:
#
# csh script to start up vmd, using an xterm-like window for the console
#
############################################################################

# find where the vmd executable is located
if ( $?VMDDIR) then
else
  setenv VMDDIR $defaultvmddir
endif

# find where .tracker file is located
if ( $?TRACKERDIR) then
else
  setenv TRACKERDIR $VMDDIR
endif

# if the location of the babel binary isn't already defined
#  1st see if it is on the path
if ($?VMDBABELBIN) then
else
  foreach i ($path)
    if (-x $i/babel) then
	setenv VMDBABELBIN $i/babel
	break
    endif
  end
endif

# if not, and if the BABEL_DIR is set, see if the binary is
# in that directory
if ($?VMDBABELBIN) then
else
  if ($?BABEL_DIR) then
    if (-x $BABEL_DIR/babel) then
      setenv VMDBABELBIN $BABEL_DIR/babel
    endif
  endif
endif

#  otherwise, outta luck

# determine type of machine, and run appropriate executable
set MACHARCH=`uname -s`
switch ($MACHARCH)
case *IRIX*:
  set MACHVER=`uname -r | cut -f1 -d.`
  if ( "$MACHVER" == "4" ) then
    setenv MDC_CONSUMER $VMDDIR/mdcomm/md_consumer_IRIX4
    set execname="$vmdbasename"_IRIX4
  else if ( "$MACHVER" == "5" ) then
    setenv MDC_CONSUMER $VMDDIR/mdcomm/md_consumer_IRIX5
    set execname="$vmdbasename"_IRIX5
  else if ( "$MACHVER" == "6" ) then
    setenv MDC_CONSUMER $VMDDIR/mdcomm/md_consumer_IRIX5
    set execname="$vmdbasename"_IRIX5
  else
    echo "Error: Unknown IRIX version $MACHVER"
    exit 1
  endif
  winterm -T "vmd console" -geometry 90x11+596-0 -font Screen11 \
      -c $VMDDIR/$execname $*
breaksw

case *HP-UX*:
  set MACHVER=`uname -r | cut -f2 -d.`
  if ( "$MACHVER" == "09" ) then
    setenv MDC_CONSUMER $VMDDIR/mdcomm/md_consumer_HPUX9
    set execname="$vmdbasename"_HPUX9
  else
    echo "Error: Unknown HP-UX version $MACHVER"
    exit 1
  endif
  hpterm -T "vmd console" -geometry 90x11+596-0 \
      -e $VMDDIR/$execname $*
breaksw

case *:
  echo "Unsupported architecture.  Must be IRIX or HP-UX."
breaksw

endsw
