#!/bin/sh
#
#   to adopt xband to your system:
# 
#   specify XBANDPATH    e.g.:  XBANDPATH=/home/mymachine/myhomedir/band
#
#

#################################################################################
#####  path in which xband is installed
#####  can be set by the environment variable XBANDPATH; 
#####
test $XBANDPATH || XBANDPATH=$HOME/source/band

#####  (i.e. files      /usr/lib/xband/*.tcl     etc. exist)

echo "<xband>:  using xband path    $XBANDPATH"

if [ ! -d "$XBANDPATH" ] ; then
  echo "error at xband call:  XBANDPATH=  doesn't exist"
  echo "probably your installation is incomplete, see xband Manual"
  exit
fi

#################################################################################
#####  workaround for X_QueryColors error on several Linux systems
##### 

export XLIB_SKIP_ARGB_VISUALS=1

#################################################################################
#####  set OSTYPE to distinguish between binaries
##### 

# set OSTYPE if not yet available
#test $OSTYPE || OSTYPE=`uname -s` 

if [ -z "$OSTYPE" ] ; then

   case `uname -s` in 
	(*inux*)  OSTYPE=Linux  ;; 
	(*OSF*)   OSTYPE=OSF1   ;; 
	(*ygwin*) OSTYPE=Cygwin ;; 
   esac

fi

echo "<xband>:  OSTYPE = $OSTYPE"

#################################################################################
#####  command to call wishx (must include Tcl, Tk and TclX)
##### 

#################### wishcall="/usr/bin/wish"
#################### "/usr/X11R6/bin/wish"
#################### wishcall="/bin/wish"

wishcall=`which wish`

echo "<xband>:  calling wish from   $wishcall"

export XBANDPATH
export OSTYPE

exec $wishcall -f $XBANDPATH/xband.tcl -n xband $wishcall $XBANDPATH $* 

