#! /usr/bin/perl # # J. Uckelman (uckelman@nomic.net) # 15 January 2001 # my @query = split /=|&/, $ENV{'QUERY_STRING'}; chdir '..'; my $pattern = ''; my $case = 0; my @page = (); while ($tmp = shift @query) { if ($tmp eq 'pattern') { $pattern = shift @query; } elsif ('on' eq shift @query) { if ($tmp eq 'case') { $case = 1; } elsif ($tmp eq 'rules') { push @ARGV, ; push @page, "\u$tmp"; } elsif ($tmp eq 'events') { push @ARGV, ; push @page, "\u$tmp"; } elsif ($tmp eq 'proposals') { push @ARGV, ; push @page, "\u$tmp"; } elsif ($tmp eq 'motions') { push @ARGV, ; push @page, "\u$tmp"; } elsif ($tmp eq 'judgments') { push @ARGV, ; push @page, "\u$tmp"; } elsif ($tmp eq 'roster') { push @ARGV, ; push @page, "\u$tmp"; } elsif ($tmp eq 'officer') { push @ARGV, ; push @page, "\u$tmp"; } elsif ($tmp eq 'standings') { push @ARGV, ; push @page, "\u$tmp"; } elsif ($tmp eq 'lists') { push @ARGV, ; push @page, "\u$tmp"; } elsif ($tmp eq 'scripts') { push @ARGV, ; push @page, "\u$tmp"; } } } $pattern =~ s/%(..)/pack("c", hex($1))/ge; $pattern =~ s/\+/ /g; print < Search Results

Results for search '$pattern' END print ' (case ', $case ? '' : 'in', 'sensitive) in ', (join ', ', @page), ':

'; my $line = ''; my @file = (); my $output = ''; while (<>) { $line = $_; $line =~ s/<.*?>/ /g; if (($line =~ m/$pattern/o and $case) or ($line =~ m/$pattern/io and (! $case))) { if ((join ' ', @file) !~ m/$ARGV/) { push @file, $ARGV; $output .= "

$ARGV
"; } if ($case) { $line =~ s/$pattern/$&<\/b>/og; } else { $line =~ s/$pattern/$&<\/b>/iog; } $output .= "$line
"; } } if (! $#ARGV) { print '

No pages selected for search.'; } else { print ($output eq '' ? '

No matches' : $output); } print < END