#!/bin/sh

# Convert man pages to html files.

cd man3
for page in *.3;do
  if [ "`wc -l $page | awk '{print $1}'`" -gt 1 ]; then
    html="../html/`echo $page | sed -e 's/.3$/.html/'`"
    man2html $page > $html
    for ref in "libtecla(3)" "cpl_complete_word(3)" "ef_expand_file(3)" "gl_get_line(3)" "pca_lookup_file(3)" "enhance(3)"; do
      link="`echo $ref | sed 's/(3)/.html/'`"
      ed -s $html << EOF
	1,\$s|$ref|<a href="$link">&</a>|g
	w
	q
EOF
    done
  fi
done

# Convert the change log into a web page.

cd ../html
echo '<HEAD><TITLE>The tecla library change log</TITLE></HEAD>' > changes.html
echo '<BODY bgcolor=add8e6><PRE>' >> changes.html
cat ../CHANGES >> changes.html
echo '</PRE></BODY>' >> changes.html

# Do the same to the release-notes file.

cd ../html
echo '<HEAD><TITLE>The tecla library release notes</TITLE></HEAD>' > release.html
echo '<BODY bgcolor=add8e6><PRE>' >> release.html
cat ../RELEASE.NOTES >> release.html
echo '</PRE></BODY>' >> release.html
