#!/usr/bin/perl -w
$path="/home/httpd/html/pablotron";

open TOP, "$path/ssi/top.shtml" or die "Couldn't open top.shtml";
open MID, "$path/ssi/mid.shtml" or die "Couldn't open mid.shtml";
open BOT, "$path/ssi/bot.shtml" or die "Couldn't open bot.shtml";
$t .= $_ while (<TOP>);
$m .= $_ while (<MID>);
$b .= $_ while (<BOT>);
close TOP;
close MID;
close BOT;

chdir $path;
print "Content-type: text/html\n\n";

open IN, "download/list" or die "couldn't open list";

while (<IN>)	{
	$file = $_; chop $file;
	$sane = $file;
	$sane =~ s/\W/_/gi;
	if (open DESC, "download/desc/$file")	{
		$desc = "";
		$desc .= $_ while (<DESC>);
		close DESC;
	} else {
		$desc = "no description";
	}
	print "$t\n\n<a name=\"$sane\"><B>$file</B></a>\n$m\n\n$desc\n<BR><BR><a href=\"$file\">Download \"$file\"</a>\n\n$b\n\n<BR>";
}

close IN;

