#!/bin/csh -f
# 
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (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.mozilla.org/MPL/
# 
# 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 browser-buster.
# 
# The Initial Developer of the Original Code is Netscape Comm.
# Inc.  Portions created by Netscape are
# Copyright (C) Netscape.  All
# Rights Reserved.
# 
# Contributor(s):
#  Chris Hofmann <chofmann@netscape.com>
# 

# usage rotate_pages30 30 28 [directory/]

#list_pages
#list_other_pages

set pull_time=$1  #when a new page is requested from the browser
set rotate_time=$2  #when the new page is generated

if ($#argv == 3) then
  set test_directory=$3
else
  set test_directory=""
endif

set test_url=test_url_"$pull_time".html
foreach url ( `ls -1 ${test_directory}url.* | sort -n -t . +1` )

#set urllink=""
#set urllink={$url}.html
#rm $urllink
#echo '<html>' > $urllink
#echo '<head>' >> $urllink
#echo '</head>' >> $urllink
#echo '<body>' >> $urllink
#echo '<a href="' >> $urllink
#cat $url >> $urllink
#echo '" TARGET=another_win>' >> $urllink
#cat $url >> $urllink
#echo '</a>' >> $urllink
#echo '</body>' >> $urllink
#echo '</html>' >> $urllink

date +"%b %e %T" > timestamp.txt

# echo '"Content-type: text/html"' > $test_url
echo '' > $test_url
echo '' >> $test_url
echo '<head>' >> $test_url


echo '<title>page loader test page '$url' </title>' >> $test_url
echo '<META HTTP-EQUIV="Pragma" CONTENT="no-cache">' >> $test_url 
echo '<meta http-equiv="refresh" content="'$pull_time'">' >> $test_url
echo '</head>' >> $test_url
#echo '<body>' >> $test_url



# echo '<script language="JavaScript">' >> $test_url
# echo  'location = "'`cat $url`'"' >> $test_url
# echo '</script>' >> $test_url


echo '<frameset rows="40,*">' >> $test_url
echo '<frameset cols="75%,15%,10%">' >> $test_url
echo '<FRAME name=no1  SRC="'$url'">' >> $test_url
echo '<FRAME name=no2  SRC="'t.html'">' >> $test_url
echo '<FRAME name=no3  SRC="'count.html'">' >> $test_url
echo '</FRAMESET>' >> $test_url
echo '<FRAME name=no4  SRC="' >> $test_url
cat $url >> $test_url
echo '">' >> $test_url
echo '</FRAMESET>' >> $test_url
# echo '</body>' >> $test_url


#cp $page test_page.html
 sleep $rotate_time

end

