#! /bin/sh

images=
if test "$1" && test "$1" = "-i"; then
    images=yes
    shift
fi

thisdir="`pwd`"
title="`basename $thisdir`"
if [ ! -z "$1" ]; then
  title="$1"
fi

echo "<html><head><title>$title</title></head><body>"
for f in *; do 
  if test ! -z "`echo $f | grep '^index\.html'`"; then
    continue
  fi
  if test "$images"; then
      echo "<p><a href=\"$f\"><img src=\"$f\"></a></p>"
  else
      echo "<p><a href=\"$f\">$f</a></p>"
  fi
done
echo "</body></html>"
