#! /bin/sh
############################################################################
#                                                                          #
# The contents of this file are subject to the WebStone Public License     #
# Version 1.0 (the "License"); you may not use this file except in         #
# compliance with the License. You may obtain a copy of the License        #
# at http://www.mindcraft.com/webstone/license10.html                      #
#                                                                          #
# Software distributed under the License is distributed on an "AS IS"      #
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See      #
# the License for the specific language governing rights and limitations   #
# under the License.                                                       #
#                                                                          #
# The Original Code is WebStone 2.5.                                       #
#                                                                          #
# The Initial Developer of the Original Code is Silicon Graphics, Inc.     #
# and Mindcraft, Inc.. Portions created by Silicon Graphics. and           #
# Mindcraft. are Copyright (C) 1995#1998 Silicon Graphics, Inc. and        #
# Mindcraft, Inc. All Rights Reserved.                                     #
#                                                                          #
# Contributor(s): ______________________________________.                  #
#                                                                          #
############################################################################
# @(#) checkfilelist 2.2@(#)

#
# NAME
#	checkfilelist - try retrieving files from server
#
# SYNOPSIS
#	checkfilelist servername portno filelist
#
#

if test "$#" -lt 3 ; then
   echo "usage: $0 servername portno filelist"
   exit 2
fi

HOSTNAME=$1 ; export HOSTNAME
PORTNO=$2   ; export PORTNO
FILELIST=$3 ; export FILELIST

grep '^/' $FILELIST | cut -f1 |
(
while read URL
do
    export URL
    echo ">>>>> $URL"
    (
	telnet $HOSTNAME $PORTNO << _EOF_
GET $URL HTTP/1.0

_EOF_
    ) 2> /dev/null | head -5 | grep 'HTTP/1.0'
    killall telnet
done
)
