#!/bin/csh -f

if ($#argv < 1)  then
  echo "Cannot run ScribApp with the given args $argv!"
  exit 1
endif

if (! $?1 || $?1 == "") then
  echo "Cannot run ScribApp without specifying an application name as first argument!"
  exit 1
endif

set app_name = $1

if (! $?ICEM_ACN || $?ICEM_ACN == "") then
  echo "Cannot run ScripApp without ICEM_ACN set!"
  exit 1
endif

if (! $?ICEM_SCRIB || $?ICEM_SCRIB == "") then
  setenv ICEM_SCRIB $ICEM_ACN/lib/scrib
endif

setenv TCL_LIBRARY $ICEM_ACN/lib/tcl8.3.3
setenv TK_LIBRARY  $ICEM_ACN/lib/tk8.3.3

set wish_app = $ICEM_ACN/bin/wish8.3.3

if !( -e $wish_app ) then 
  echo "Cannot find Wish application ($wish_app) to run ScribApp!"
  exit 1
endif

$wish_app $ICEM_SCRIB/app/main.tcl $app_name
