#!/bin/csh -x
#----------------------------------------------------------------------
#
#       listhd.com
#
#       Script to list the header parameters in a FITS file to
#	an output file.
#
#--------------------------------------------------------------------
#                          REVISION HISTORY
#--------------------------------------------------------------------
#  MOD             PR
# LEVEL   DATE   NUMBER  User  Description
# ----- -------- ------  ------ -------------------------------------
#
#  001  08/05/97 33432   MSwam  created
#  002  08/29/97 35137   Rose   removed .cshrc loggin
#  003  01/13/98 34499.3 MSwam  use new LISTHEAD syntax
#  004  02/20/98 35847   WMiller Set redirections for noclobber
#
#----------------------------------------------------------------------
#
echo " "
echo "`date`"
echo "---------------- Starting LISTHD ----------------------------" >>! $TRLDIR/$OSF_DATASET.trx
echo "`date`" >>! $TRLDIR/$OSF_DATASET.trx

# list the FITS header parameters to an output file
listhead $INPATH/$OSF_DATASET.fits -f $OUTPATH/$OSF_DATASET.hdr >>&! $TRLDIR/$OSF_DATASET.trx
set savestat = $status
if ( $savestat == 1 ) then
    echo "ERROR: unable to list header for $INPATH/$OSF_DATASET.fits" >>! $TRLDIR/$OSF_DATASET.trx
else
    echo "SUCCESS listing header for $INPATH/$OSF_DATASET.fits to $OUTPATH/$OSF_DATASET.hdr" >>! $TRLDIR/$OSF_DATASET.trx
endif
echo "---------------- Ending LISTHD ------------------------------" >>! $TRLDIR/$OSF_DATASET.trx
echo " "
exit $savestat
