#!/bin/csh
# ----------------------------------------------------------------------------
# 1) get remote file using wget in tmp/ subdir
# 2) compare downloaded file with current
#
# EXIT 0: nothing new
#      1: error
#      2: updated
# ----------------------------------------------------------------------------

echo ""
echo "######################################################################"
echo "# FIRST data"
echo "######################################################################"
set d1st = /ftp/cats/VIII/92
if (-d $d1st) then
    rm -f /tmp/1st.html
    test -r $d1st/index.html.gz && gunzip $d1st/index.html.gz
    echo "#...Verify FIRST"
    wget -O - http://sundog.stsci.edu/first/catalogs/ > /tmp/1st.html
    cmp /tmp/1st.html $d1st/index.html
    if ($status) then
        echo "#***FIRST Catalog (VIII/92) description modified?"
        wc /tmp/1st.html $d1st/index.html | acut -i'    ' -c1-
    else
        echo "#===No change in FIRST ($d1st)"
        exit 0
    endif
endif

exit 2
