#!/bin/csh

#Version  4/24/98
#Synopsis: gmat-inf-gc.csh alphabetfile matfile adjust sd outfile

#Convert arguments to variables
set ALPHABETFILE = $1
set MATFILE      = $2
set ADJUST       = $3
set SD           = $4
set OUTFILE      = $5

# Make a temporary directory to run the program in 
set TEMPDIR = GMAT-INF-GC.$$
mkdir $TEMPDIR
cp $MATFILE $TEMPDIR
cp $ALPHABETFILE $TEMPDIR
cd $TEMPDIR

#-------- run patser  -----------

if ($ADJUST == "sa") then 
   set ADJUST = "-sa"
   if ($SD > 0 ) set ADJUST = "$ADJUST -st $SD"
else
   set ADJUST = ""
endif
  
gmat-inf-gc -g1 -a $ALPHABETFILE -m $MATFILE $ADJUST > $OUTFILE

mv  -f $OUTFILE ../$OUTFILE
cd ..

/usr/bin/rm -r $TEMPDIR






