#!/bin/sh

LIBS=shared
LIBDIR=../lib
PROBLEM=MyProb

if [ $# -lt 1 ] ; then
  echo "usage: $0 MyProb                                       "
  echo " runs MyProb assuming default locations for libraries. "
  echo " Shared object libraries are used.                     "
  exit 1
fi

CURDIR=$PWD

if test ! -f  ./$PROBLEM
then
   echo "Error: cannot find executable for \"$PROBLEM\"."
   exit 1
fi

echo "                                     "
echo "Running executable: \"$PWD/$PROBLEM\""
echo "                                     "

# Define a temporary load library path

SAVE_PATH=$LD_LIBRARY_PATH
LD_LIBRARY_PATH=$LIBDIR
export LD_LIBRARY_PATH
echo   LD_LIBRARY_PATH=$LD_LIBRARY_PATH

if test ! -f  $PROBLEM.spc
then
   echo "Error: No specs file  $PROBLEM.spc  found for \"$PROBLEM\"."
   exit 2
fi

# Execute the example

./$PROBLEM
# \cp -f $PROBLEM.out $CURDIR/ 2> /dev/null

LD_LIBRARY_PATH=$SAVE_PATH
export LD_LIBRARY_PATH
