#!/bin/bash

# ----------------------------------------------------------------
# RPC Project :
# Run RPC_compute_sat_orbit_param: Compute orbital parameters
#                                  of a Earth satellite from data
#
# P. Robert, LPP, 2011-03-21
# ----------------------------------------------------------------

appli=`basename $0`
appli36=`echo "$appli                                 " | cut -c1-36`
Narg=1
echo " -------------------------------------------------------------------"
echo $appli $*

if( (test $# = 1 ) && (test $1 = -h ) ) ; then hh=1 ; else hh=0 ; fi

if test $# != $Narg || test $hh = 1
   then
    # On n'a pas le bon nombre d'arguments ou on demande un "help"
    echo 
    echo "$appli : Compute elliptical orbital parameters of a Earth satellite"
    echo "----------------------"
    echo ""
    echo "Arguments of rpc_$appli must be:"
    echo "$appli rff_in"
    echo "     rff_in : trajectory positions of S/C in GEI system"
    echo "The input  file correspond to the argument,"
    echo "The output file correspond to the result of the command execution,"
    echo "and will be created in the current directory"
    echo ""
 if test $hh = 1 ; then exit 0 ; fi
   echo "$appli36 : *** ERROR ! Command aborted." >&2
   exit 1
fi

datim1=`date +%F'  '%H':'%M':'%S `
julsec1=`date +%s`

# remove RPC_ from RPC command

appli=`echo $appli | cut -c5-`

# creating appli.in from arguments list

if test -f $appli.in ; then \mv $appli.in $appli.in.old ; fi
    
echo $1   > $appli.in


# run appli.exe 

. run_appli.bash $appli
err=$?
exit $err
