#!/bin/bash

# -----------------------------------------------------------------
# RPC Project :
# Run RPC_alitime_4_vectime : time alignment of 4 rff vectime files
# P. Robert, ScientiDev, Jan 2021
# -----------------------------------------------------------------

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

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

if test $# != $Narg || test $hh = 1
   then
   echo "$appli : time alignment of 4 rff vectime files"
   echo "$appli   require $Narg argument(s), ex:"
   echo "$appli   VT1.rff VT2.rff VT3.rff VT4.rff"
   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
echo $2 >> $appli.in
echo $3 >> $appli.in
echo $4 >> $appli.in

echo " "

# run appli.exe 

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