#!/usr/bin/perl
#
$basepath = ".";
$logname = $ENV{'QUERY_STRING'};

print "Content-type:text/html\n\n";
print <<EndHTML;
<html>
<head>
<title>Harper\'s Tale Online Logs</title>
</head>
<body background="../img/paper.gif" bgcolor="#ffffff" text="#000000"
link=#006600 vlink=#333399>
<img src="../img/ht-topbar.gif" alt="" width=332 height=74><br>
EndHTML
;

if ( -e $logname ) {
    open(INF,"$basepath/$logname");
    @mydat = <INF>;
    close(INF);
    print <<CopyR;
<hr>
<font size=-1>
The World of Pern&#153; is copyright to Anne McCaffrey &copy; 1967.
The Dragonriders of Pern&reg; is a registered copyright.
This is a recorded sesssion, online by permission of the author but
generated by Harper's Tale members on the date indicated, 
for the benefit of members unable to attend.<br>
</font><hr>
CopyR
;
    &do_file(@mydat);
}
else {
    print "<h2>Error</h2>The online log you requested does not exist.  Please notify <a href=\"mailto:kira\@harpers-tale.com\">kira\@harpers-tale.com</a> of this error.<p>\n";
}

print "<p><hr><center><a href=\"/HT/\">Home</a> | <a href=\"index.html\">Archive Index</a><p></center>\n</body></html>\n\n";

sub do_file {
    local(@stuff) = @_;
    $hdr = 0;
    $headct = 1;
    while ($hdr == 0) {
	$inf = shift(@stuff);
	if ($inf eq "" || $headct == 4) {
	    $hdr = 1;
	}
	if ($inf ne "") {
	    print "<h3>$inf</h3>\n";
	}
	$headct = $headct + 1;
    }
    print "<pre>\n";
    foreach $i (@stuff) {
	print $i;
    }
    print "</pre><p>\n";
}
