This host is not permitted to access this function.\n"; exit; } my $request = $ENV{QUERY_STRING}; # Uses "keyword" if Internet Keywords is enabled, "kwoff" if they're not. # Interesting -- if you didn't use nscli, you'd still be sending your # mistyped URLs to Netscape. $request =~ s,^keyword/,,; my $word_delimeter = qr/(?:\s+|\+|%20)/; my ($func, $words) = split($word_delimeter, $request, 2); my @words = map { uri_unescape($_) } split($word_delimeter, $words); show_help() if $func eq 'help'; unless (exists $search{$func}) { unshift (@words, $func); $func = 'default'; } if (exists $search{$func}->{SYNONYM}) { $func = $search{$func}->{SYNONYM}; } die "Default action '$func' doesn't exist in \%search\n" unless exists ($search{$func}); my $query = uri_escape (join (" ", @words)); die "No URL listed for $func in $conf\n" unless exists $search{$func}->{URL}; $search{$func}->{URL} =~ s/%%QUERY%%/$query/g; print redirect($search{$func}->{URL}); sub show_help { print <<__HTML__; Content-Type:text/html
__HTML__ for my $key (sort keys %search) { my $text = exists $search{$key}->{SYNONYM} ? "Synonym for $search{$key}->{SYNONYM}" : $search{$key}->{DESC}; printf(" %12s %s\n", $key, $text); } print <<__HTML__;This is free software with ABSOLUTELY NO WARRANTY. This program is released under the same terms as Perl itself (specifically, under your choice of either the GNU Public License version 2, or the Perl Artistic License). Copyright (c) 2002 Rich Lafferty.
__HTML__ exit; }