#!/bin/csh -f

# This script is responsible for running the scripts you have set up for
# each site.  Probably primarily to get the new listings of files/abstracts

# The raw list of stuff found, and the shortened up version.  The short
# version trims out all the files that weren't posted this month.  
# Helpful for viewing.
set out = $FTPEXTRAS/lists/archive.dir
set out2 = $FTPEXTRAS/lists/archive.dir.short

# This block looks at your .netrc. For each place listed, it checks to 
# see if you have a script file set up. If so, run it. Else go on to
# the next site.  
echo > $out 
echo SITE '****    '  `date` >> $out
echo SITE '****' >>  $out
foreach place (`cat $HOME/.netrc | cut -c9-40`)
if (-e $FTPEXTRAS/scripts/script.$place) then
echo trying $place
echo SITE '******************************************************' >>$out
echo SITE $place >>$out
echo SITE '******************************************************' >>$out
ftp -v $place < $FTPEXTRAS/scripts/script.$place >>$out
endif
end

# This line filters out all the gunk and leaves only the relevant stuff.
# i.e. this months files + formatting stuff.
cat $out | sed -n -e /`date +%h`'[01-9 ]*:/p' -e /SITE/p -e /directory/p -e /later/p > $out2 

# If you always use only the short version, you could delete $out at
# this point.  It would limit the functionality of a few other commands
# but would save space.  Check your usage of: ftpmenu,ftpnew
# before using this line.
# rm $out

