#!/bin/csh -f

setenv HD /data/globec

echo Content-type: text/html
echo ""

cd /jgofsopt/$REMOTE_HOST
set path=($path[1] . $HD/bin $path[2-])
set tmp=$PATH_INFO
setenv OBJ $tmp:r
unsetenv PATH_INFO
if ( "$QUERY_STRING" != "" ) then
  setenv OBJ "$OBJ($QUERY_STRING)"
endif

echo "<pre>"
echo $OBJ

eval `$HD/htmlbin/bin/postit`

set list=(View Window Xaxis Yaxis Plottype Xvar Xvaropt Yvar Yvaropt Breakopt Text plot)

set Eraseoption=Erase

while ( $#script )

  foreach g (1 2 3 4 5 6 7 8 9 10 11)

  if ( "$script[1]" != "$list[$g]" ) then
    echo "Script error " $script
    exit
  endif
  @ h = $g + 1

  set tmp=""
  shift script
  while ( "$script[1]" != "$list[$h]" && $#script )
    set tmp=($tmp \"$script[1]\")
    shift script
    end
  set stuff="set $list[$g]=($tmp)"
  eval "$stuff"
  end

  source $HD/htmlbin/bin/dofullsubr2

  set Eraseoption=Add_to_plot
  shift script
end

rm *.gif
setenv TMP `date '+%H%M%S'`

$HD/htmlbin/bin/tekgif <plot.tek > temp$TMP.gif
echo \<p\>\<img src=\"/tmp/$REMOTE_HOST/temp$TMP.gif\"\>\<p\>
