#! /bin/csh
# shell for running texspell which is TeX and LaTeX's spell
# Author: Kamal Al-Yahya 1984

set flag = ()
unset file

if ($#argv == 0) then
       echo "usage:  texspell [-w -i] file"
       exit(-1)
endif
while ($#argv > 0)
       switch ($argv[1])
               case -*:
                       set flag = ($flag $argv[1])
                       breaksw
               default:
                       set file
                       breaksw
               endsw
       if !($?file) then
               shift argv
       else
               break
       endif
end

if ($#argv == 0) then
       echo "usage:  texspell [-w -i] file"
       exit(-1)
endif
while ($#argv > 0)
               if -e $argv[1] then
                       detex $flag $argv[1] | spell
               else
                       echo "Can't open $argv[1]"
                       exit(-1)
               endif
               shift argv
end
exit(0)