#!/bin/sh
#

cd /textfiles/everbackward/links/

O=/textfiles/everbackward/links/index.html

cat /textfiles/everbackward/links/links.header            >$O

for list in *.links
    do

# Make the Heading for a section by yanking the top line of the file.

    TITLE=`head -1 $list`

    echo "<TABLE WIDTH=100%><TR>"                                            >>$O
    echo "<TD ALIGN=CENTER COLSPAN=2 BGCOLOR=#004400><B>"                    >>$O
    echo "<FONT FACE=\"Courier New,Courier\" COLOR=\"#00FF00\" SIZE=\"+1\">" >>$O
    echo "$TITLE</B></TD></TR></TABLE>"                                      >>$O
 
# Now, make each individual entry by yanking a line, putting the first word
# as the address, and then the rest as the description.
 
    echo "<TABLE WIDTH=80%>"                                                 >>$O

    while read LINE ;do
    
      URL=`echo $LINE | cut -f1 -d' '`
      DESC=`echo $LINE | cut -f2- -d' '`
      NOTHEADER=`echo $LINE | grep -v http `

      if [ -z "$NOTHEADER" ]
         then

         echo "<TR><TD ALIGN=LEFT BGCOLOR=#003300><B>"                            >>$O
         echo "<FONT FACE=\"Courier New,Courier\" COLOR=\"#00EE00\">"             >>$O
         echo "<A HREF=\"$URL\">$URL</A>"                                         >>$O
         echo "</B></TD><TR><TD BGCOLOR=#000000><BLOCKQUOTE>"                     >>$O
         echo "<FONT FACE=\"Courier New,Courier\" COLOR=\"#00AA00\">"             >>$O
         echo "$DESC"                                                             >>$O
         echo "<TR><TD>&nbsp;"                                                    >>$O
      fi

    done < $list

    echo "</TABLE>"                                                          >>$O

    done

cat /textfiles/everbackward/links/links.footer           >>$O
