#!/afs/athena/contrib/perl/p

require '/afs/sipb/user/mkgray/bin/http.pl';
&http'httpd();

sub http'user_input {
    local($n, $text) =@_;
    $file = substr($text, index($text, '?')+1);

    print("Looking for '$file'\n");
    if(open(HR, "$ENV{'HOME'}/.httprc")){
	while(<HR>){
	    split;
	    $anchor = join(' ', @_[1..$#_]);
	    print(STDOUT "Checking $file against $_[0]\n");
	    if($file =~ /$_[0]/){
		print(STDOUT "Got this: $anchor\n");
		&http'tell("<ISINDEX><h1>LocalHost</h1><p>$anchor\n", $n);
		$found=1;
	    }
	}
    }
    else{
	print(STDOUT "Hey! No httprc file!\n");
    }
    if(!$found){
	print(STDOUT "Nothin!\n");
	&http'tell("<ISINDEX><h1>LocalHost</h1>\n", $n);
    }
    &http'disconnect($n);
}
