#!/bin/sh

echo "Content-type: text/plain"
echo
echo "CGI test script"
echo 
read input junk
echo
echo $input
echo
input=`echo $input |sed 's/&/ /g'`
echo $input
echo
for i in $input; do
j=`echo $i|sed 's/=.*//'`
if [ $j = "mult" ];then
MULT=`echo $i|sed 's/....=//'`
elif [ $j = "pltorb" ];then
PLTORB=`echo $i|sed 's/......=//'`
elif [ $j = "exetyp" ];then
EXETYP=`echo $i|sed 's/......=//'`
elif [ $j = "icharg" ];then
ICHARG=`echo $i|sed 's/......=//'`
elif [ $j = "molplt" ];then
MOLPLT=`echo $i|sed 's/......=//'`
elif [ $j = "icharg" ];then
ICHARG=`echo $i|sed 's/......=//'`
elif [ $j = "molplt" ];then
MOLPLT=`echo $i|sed 's/......=//'`
elif [ $j = "coord" ];then
COORD=`echo $i|sed 's/.....=//'`
elif [ $j = "mplevl" ];then
MPLEVL=`echo $i|sed 's/......=//'`
fi
done
cat - > inputfiles/ctrlopts << EOF 
 \$CONTRL MULT=$MULT PLTORB=$PLTORB EXETYP=$EXETYP \$END
 \$CONTRL ICHARG=$ICHARG MOLPLT=$MOLPLT COORD=$COORD MPLEVL=$MPLEVL \$END
EOF
chmod 0666 inputfiles/ctrlopts
echo `hostname`
echo
