#!/bin/sh
#
# Constants that must be adjusted
#
SRC_DIR=Code
#
#######################################################################
if test -f .lastinstall
  then
     y=`cat .lastinstall`
     case $y in
         1|3|4)
           SUFFIX=c;;
         2)
           SUFFIX=C;;
         *)
           echo "Unknown compiler used for installation."
           exit 1;;
     esac
  else
     echo "make install must be executed first."
     exit 1
fi

#######################################################################
echo "Choose a main program from the following list."
echo
cat Examples/EXAMPLES
echo
echo "Make your choice. \c"
read a
case $a in
    0)
      echo "Give the name of your example file."
      echo "(Full pathname from current position.)"
      read a
      cp $a $SRC_DIR/main.$SUFFIX ;;
    *)
      if test -f Examples/vb${a}.c
        then
           cp Examples/vb${a}.c $SRC_DIR/main.$SUFFIX
        else
           echo "That was an illegal choice!"
           exit 1
      fi
esac
#######################################################################
#
echo
echo "Compilation will now start."
echo
cd $SRC_DIR
make tst
echo 
