#!/usr/local/bin/perl -w

#
# Makeindex -- part of hypermh, a front end to hypermail for creating
# Web archives of large MH-format mailboxes.  For more information, see
# http://www.circlemud.org/~jelson/software/hypermh.html
#
# Jeremy Elson, jelson@circlemud.org
# March 4, 1997
#

$months[1] = "January";
$months[2] = "February";
$months[3] = "March";
$months[4] = "April";
$months[5] = "May";
$months[6] = "June";
$months[7] = "July";
$months[8] = "August";
$months[9] = "September";
$months[10] = "October";
$months[11] = "November";
$months[12] = "December";

print "<UL>\n";

$total = 0;

for ($year = 1994; $year <= 1997; $year++) {
  print "<LI>$year</LI>\n";

  for ($month = 1; $month <= 12; $month++) {
    $name = sprintf "%4d-%02d", $year, $month;
    open(FILE, "$name/index.html");
    $num = 0;
    while (($line = <FILE>) && $num == 0) {
      if ($line =~ /...Messages:.....([\d]+)/) {
          $num = $1;
      }
    }
    close FILE;
    $total += $num;
    printf "<A HREF=\"%s/index.html\">%s</A> (%d messages)%s\n", $name,
	$months[$month], $num, $month == 12 ? "" : ", ",;
  }
}
print "</UL>\n";

print "<P>Total: $total messages</P>";
