#!/bin/csh

#
# We need to check if CKs already exist and stop if they are. We have to 
# do it because MSOPCK program will append more data to an existing
# if it find one. This is not what we want in our case.
#
if ( -e mex_aspera_saf_ex_scan180.sclk.bc || \
     -e mex_aspera_saf_ex_scan180.utc.bc  || \
     -e mex_aspera_saf_ex_scan30.sclk.bc  || \
     -e mex_aspera_saf_ex_scan30.utc.bc   || \
     -e mex_aspera_saf_ex_scan60.sclk.bc  || \
     -e mex_aspera_saf_ex_scan60.utc.bc        ) then
   echo "Cannot run. Output CKs already exists in current directory".
   exit(1)
endif

#
# Run MSOPCK for each input (*.input) -- setup (*.msopck) file pair.
#
msopck mex_aspera_saf_ex_scan180.sclk.msopck \
       mex_aspera_saf_ex_scan180.sclk.input \
       mex_aspera_saf_ex_scan180.sclk.bc

msopck mex_aspera_saf_ex_scan180.utc.msopck \
       mex_aspera_saf_ex_scan180.utc.input \
       mex_aspera_saf_ex_scan180.utc.bc

msopck mex_aspera_saf_ex_scan30.sclk.msopck \
       mex_aspera_saf_ex_scan30.sclk.input \
       mex_aspera_saf_ex_scan30.sclk.bc

msopck mex_aspera_saf_ex_scan30.utc.msopck \
       mex_aspera_saf_ex_scan30.utc.input \
       mex_aspera_saf_ex_scan30.utc.bc

msopck mex_aspera_saf_ex_scan60.sclk.msopck \
       mex_aspera_saf_ex_scan60.sclk.input \
       mex_aspera_saf_ex_scan60.sclk.bc

msopck mex_aspera_saf_ex_scan60.utc.msopck \
       mex_aspera_saf_ex_scan60.utc.input \
       mex_aspera_saf_ex_scan60.utc.bc

exit(0)
