#!/bin/sh
# make an html manual page index for the html'd manual pages
#


do_Header()
{
echo "<TITLE>$1</TITLE>"    
echo                        
echo "<H1>$1</H1>"          
echo "<!" `date` ">"        
echo                        
echo "<BODY>"               
echo                        
echo "<UL>"                 
}

do_Entry()
{
echo "<LI> <A HREF=\"$1\"> $2</A>"    
}

do_Footer()
{
echo "</UL>"                
echo                        
echo "<A HREF=\"../Tcl.html#ManPages\"> Go Up</A>"    
echo "</BODY>"    
}



if [ $# -ne 3 ] ; then
    echo "needs args " 1>&2
    echo " - dirname to scan, " 1>&2
    echo " - relpath to put in html file " 1>&2
    echo " - Header to put in html file " 1>&2
    exit 1
fi

dir=$1
relpath=$2
Hdr=$3
tmpFil=./man$$


do_Header "$Hdr"
sect=""
for i in $1/*
do
    base=`basename $i .html`
echo $base 1>&2
    if [ -z "$sect" ]; then 
        case $base in
        *.n)
            sect=".n"
            ;;
        *.3)
            sect=".3"
            ;;
        esac
    fi

    base=`basename $base $sect`
    do_Entry $i $base
done
do_Footer




