#!/bin/sh
#
# Author: Peter Keel <killer@discordia.ch>
# Generate index.html out of a directory of HTMLs, names according to 
# the <TITLE>-tags of the documents. Is not very intelligent and will
# neither recognize directories nor multiple <TITLE>s.
#
rm index.html
cat << EOM > index.html
<HTML>
  <HEADER>
  <TITLE>Index</TITLE>
  </HEADER>
<BODY>
<H2>Machine generated indexing file</H2>
<P>
EOM
grep -i "<TITLE>" *.html | awk -F: '
                {
                gsub(/<[Tt][Ii][Tt][Ll][Ee]>/,"", $2)
		gsub(/<\/[Tt][Ii][Tt][Ll][Ee]>/,"", $2)
                printf("<IMG SRC=\"/images/icons/ball1.gif\"> <A HREF=\"%s\">%s</A><BR>\n", $1, $2)
                }
               ' >> index.html
cat << EOM >> index.html
</BODY>
</HTML>
EOM
