my $code; 

sub getError
{
	($err,$n)=@_;
	my $file="./defpages";

	if ($ENV{HTTP} eq "0.9")
		{ $n=1; }
	
	if ( -e "$file/$err.html" )
		{ $file.="/$err.html"; }
	else	{ $file.="/404.html"; }

	return $file if ($n);

	$code=fileCode();

	return $file;
}

sub printCode
{
	($code)=@_;
	if ($code eq "404") {
		print "HTTP/1.1 404 Not Found\r\n";
	} elsif ($code eq "400") {
		print "HTTP/1.1 400 Bad Request\r\n";
	} elsif ($code eq "401") {
		print "HTTP/1.1 401 Unauthorized\r\n";
	} elsif ($code eq "403") {
		print "HTTP/1.1 403 Forbidden\r\n";
	} elsif ($code eq "200") {
		print "HTTP/1.1 200 OK\r\n";
	} elsif ($code eq "DIR") {
		print "HTTP/1.1 200 OK\r\n";
	} elsif ($code eq "302") {
		print "HTTP/1.1 302 Redirect\r\n";
	} else {print "UNKNOWN($code)\r\n"; }
}

return 1;
