#! /bin/csh -f
# Last modified on Tue Jun 18 23:44:57 PDT 1991 by stolfi
#==================================================
# Runs slitex 
# Usage: slitexrun [-nofilter] file
#==================================================

unset nofilter
set flags = ""
set texmacdir = `search -P".:..:../..:../../.." tex-macros`
set texmacdir = `expandpath ${texmacdir}`
set bindir = `search -P".:..:../..:../../.." bin`
while ( $#argv > 1 )
  if ( "$1" == "-nofilter" ) then
    set nofilter
    shift
  else
    echo "Usage: $0 [-nofilter] file"
    exit(1)
  endif
end

if ( $#argv != 1 ) then
  echo "Usage: $0 [-nofilter] file"
  exit(1)
endif

set f = "$1:r"
if ( ! ( -r $f.tex ) ) then
  echo "${0}: cannot find $f.tex"
  exit(1)
endif

echo '+---------------- -- - --  -'
echo '| '$f
echo '+--------------- --- --  -'

setenv TEXINPUTS ".:${texmacdir}:/usr/local/lib/tex/"
echo "TEXINPUTS = "$TEXINPUTS

if ( $?nofilter ) then
  ( echo 'x' | slitex $f ) \
    | ${bindir}/tex-error-filter $f
else
  ( echo 'x' | slitex $f )
endif

# END



