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

my $filename = $ENV{'QUERY_STRING'};

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

print "<html><head><title>$filename</title></head><body><pre>\n";

if(-e $filename){
	if(open FILE, "<$filename"){			
		while(<FILE>){
			s/&/&amp;/g;
			s/</&lt;/g;
			s/>/&gt;/g;
			print;
		}
		close FILE;
	} else {
		print "$filename could not be opened: $!\n";
	}
} else {
	print "$filename does not exist.\n";
}

print "</pre></body></html>";
