#!/bin/sh
#
# drft06rr_smtpage - make top DRFT06RR smt web page (drft06rr_smts.html)
#
# This script creates the drft06rr_smts.html file which is the top level web
# page in the DRFT tree. It doesn't care if any of the files and
# images it links to are not there yet.
#
# Paul Wessel, 19-NOV-2001
H=drft06rr
#---------------------------
mkdir -p $H
cd $H
date=`date`
cat << EOF > drft06rr_smts.html
Drift Expedition Leg 6: The Easter/Salas y Gomez/Nazca Survey Seamount Targets
Drift Expedition Leg 6: The Easter/Salas y Gomez/Nazca Survey Seamount Targets
This page provides one-step access to all seamount targets individual web pages. Each of these pages
contains detailed bathymetric maps, 3-D perspective view of multibeam bathymetry, side-scan image, and a list of
all dredge sites on that seamount. The seamount pages are also accessible directly from the box pages they
belong to.

EOF
grep -v '^#' ../drft06rr_smts.lis > $$.lis
n=`cat $$.lis | wc -l`
off=`gmtmath -Q $n 2 DIV CEIL =`
row1=1
row2=`expr $off + 1`
i=1
while [ $i -le $n ]; do
echo "" >> drft06rr_smts.html
line1=`sed -n ${row1}p $$.lis`
echo $line1 | awk '{printf " | Seamount: |  | Inside box: |  | \n", "'$H'", $1, $1, $1, "'$H'", $2, $2, $2}' >> drft06rr_smts.html
row1=`expr $row1 + 1`
i=`expr $i + 1`
if [ $row2 -le $n ]; then
line2=`sed -n ${row2}p $$.lis`
echo $line2 | awk '{printf " Seamount: |  | Inside box: |  | \n", "'$H'", $1, $1, $1, "'$H'", $2, $2, $2}' >> drft06rr_smts.html
row2=`expr $row2 + 1`
i=`expr $i + 1`
else
echo " N/A | N/A | N/A | - | " >> drft06rr_smts.html
fi
echo "
" >> drft06rr_smts.html
done
echo "
" >> drft06rr_smts.html
cat << EOF >> drft06rr_smts.html

Return to Drift Expedition Leg 6 home page
drft06rr_smtpage: Page last updated $date by $USER.
EOF
rm -f $$.lis
cd ..