ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/Search/trunk/search.cgi.in
Revision: 331
Committed: 2004-04-05T15:50:25-07:00 (18 years, 8 months ago) by Douglas Thrift
Original Path: trunk/Search/search.cgi.in
File size: 1194 byte(s)
Log Message:
It's Subversion time!

File Contents

# User Rev Content
1 douglas 232 #!@which_perl@
2     #
3     # Douglas Thrift's Search Engine CGI Script
4     #
5     # Douglas Thrift
6     #
7 Douglas Thrift 331 # $Id$
8 douglas 232
9     use strict;
10     use CGI qw/:standard :cgi/;
11     use File::Temp qw/ tempfile tempdir /;
12    
13     my $prefix = "@prefix@";
14     my $exec_prefix = "@exec_prefix@";
15     my $bindir = "@bindir@";
16     my $search = "$bindir/Search@EXEEXT@";
17    
18     open(TEST, "< $search") || die "$0: cannot open $search";
19     close(TEST);
20    
21     my $page = param('p');
22     my $query = param('q');
23    
24     # These can be edited to customize your configuration:
25     my $data = "$prefix/data";
26     my $index = "$data/*.xml";
27     my $header = "$data/header.html";
28     my $body = "$data/body.html";
29     my $footer = "$data/footer.html";
30     my $notfound = "$data/notfound.html";
31     my $pages = "$data/pages.html";
32     #
33    
34     if ($page == 0)
35     {
36     $page = 1;
37     }
38    
39     my ($temphandle, $temp) = tempfile();
40    
41     open($temphandle, "> $temp") || die "$0: cannot open $temp";
42     print $temphandle "$query\n";
43 douglas 233 close($temphandle);
44 douglas 232
45     open(SEARCH, "$search $index -P $page -h $header -b $body -f $footer -n " .
46     "$notfound -p $pages <$temp |" ) || die "$0: cannot fork $!";
47    
48     print "Content-Type: text/html
49    
50     ";
51    
52     my $line;
53     while($line = <SEARCH>)
54     {
55     chomp($line);
56     print "$line\n";
57     }
58    
59     unlink $temp;
60     close(SEARCH) || die "$0: cannot close $search: $!";

Properties

Name Value
svn:eol-style native
svn:keywords Id