#!/bin/ksh

#/* Part of the Maestro sequencer software package.
# * Copyright (C) 2011-2015  Operations division of the Canadian Meteorological Centre
# *                          Environment Canada
# *
# * Maestro is free software; you can redistribute it and/or
# * modify it under the terms of the GNU Lesser General Public
# * License as published by the Free Software Foundation,
# * version 2.1 of the License.
# *
# * Maestro is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# * Lesser General Public License for more details.
# *
# * You should have received a copy of the GNU Lesser General Public
# * License along with this library; if not, write to the
# * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# * Boston, MA 02111-1307, USA.
# */

arguments=$*

eval `cclargs_lite $0 \
  -c        ""                    ""                           "[cfg to run         ]" \
  -o        ""                    ""                           "[output results     ]" \
  -i        ""                    ""                           "[input config to eval     ]" \
  -v        ""                    ""                           "[verbose mode     ]" \
  -h        ""                    ""                           "[Display help       ]" \
  ++ $arguments`                                                                                                                                                                                                                   

. $c 

if [[ $v != "" ]] ; then  
  set -x
fi

ksh -n $i || (echo "Syntax error in input file."; exit 1)
$SEQ_UTILS_BIN/varsed.py -i $i 1>$TMPDIR/tmpvarsed.$$
while read LINE ; do eval echo $LINE ; done < $TMPDIR/tmpvarsed.$$ > $o 2>/dev/null
rm -f $TMPDIR/tmpvarsed.$$
