#!/bin/csh

#
# run webclient on an input file and recalculate the
# check sums in the input file.  replace the old file with the
# new one.  move the old file file to old.file.
#

#
# call as retrain file webserver:port
#

#
# this version of retrain assumes that SSLV3 is used to contact the server
#

#
# can we find the file?
#
if (! -e ${1}) then
	echo $0 could not find file ${1}.
	exit
endif

#
# does it have zero length?
#
set ls = `ls -l ${1}`
set length = $ls[5]
if ("$length" == "0") then
	echo $0 found file ${1}, but it has length $length and appears to be empty.
	exit
endif

#
# recompute the checksums
#
echo webclient -S SSLV3:04 -A 60 -f $1 -v ${1}.new -w $2 -t webclient.retrain.trace |& tee webclient.retrain.out
webclient -S SSLV3:04 -A 60 -f $1 -v ${1}.new -w $2 -t webclient.retrain.trace |& tee webclient.retrain.out
echo mv $1 old.$1
mv $1 old.$1
echo mv ${1}.new $1
mv ${1}.new $1
