#! /bin/csh

# This is a typical Unix script for running a program such as MINOS.
# It should be called "run" and marked executable (via chmod +x run).
# Note that file names of the form fort.* may be machine-dependent.
#
# 30 May 1991: Original version written by Philip Gill for a DECstation 3100.
#              DECstation and Sun systems use names like fort.4.
# 15 Dec 1995: HP 9000 systems use names like ftn04.
# 23 Jul 2003: Executables no longer have .exe suffix.

echo ' '
echo 'Current LD_LIBRARY PATH:'
echo $LD_LIBRARY_PATH
echo ' '

if ({$1}x == x) then
     echo './run minos pilot       runs minos with pilot.mps, pilot.spc'
     echo './run minos pilot lp    runs minos with pilot.mps, lp.spc'
     echo 'Be sure LD_LIBRARY_PATH points to minos/lib'
     exit
endif

set PROB = $1
if ({$2}x != x)  then
     set PROB = $2
endif

set SPECS = $PROB
if ({$3}x != x)  then
     set SPECS = $3
endif
echo "Defining $2 files"
echo "Will use $SPECS.spc"

#rm	fort.4	>& /dev/null
#rm	fort.10	>& /dev/null


\cp -fp $SPECS.spc  fort.4	
\cp -fp $PROB.mps   fort.10	
\cp -fp $PROB.basis fort.11  >& /dev/null
ls -l {$PROB}*   
if ($SPECS != $PROB) then 
   ls  -l {$SPECS}*
endif

# Run the specified executable.
./$1

\cp -fp fort.12 $PROB.newbasis  >& /dev/null
\cp -fp fort.9  $PROB.out		

#rm fort.4	
#rm fort.9	>& /dev/null
#rm fort.10	
#rm fort.12	>& /dev/null
