ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/Search/search.cgi.unix
Revision: 34
Committed: 2003-01-16T15:29:13-08:00 (22 years, 5 months ago) by douglas
File size: 1007 byte(s)
Log Message:
Changed dtsearch to dtse.

File Contents

# Content
1 #!/usr/bin/perl
2 #
3 # Douglas Thrift's Search Engine CGI Script
4 #
5 # Douglas Thrift
6 #
7
8 # Perl pragma
9 use strict;
10 use CGI qw/:standard :cgi/;
11 use File::Temp qw/ tempfile tempdir /;
12
13 my $root = "/usr/local/dtse";
14 my $data = "$root/data";
15 my $search = "$root/bin/Search";
16 my $index = "$data/*.xml";
17 my $page = param('p');
18 my $query = param('q');
19 my $header = "$data/header.html";
20 my $body = "$data/body.html";
21 my $footer = "$data/footer.html";
22 my $notfound = "$data/notfound.html";
23 my $pages = "$data/pages.html";
24
25 print "Content-type: text/html
26
27 ";
28
29 if ($page == 0)
30 {
31 $page = 1;
32 }
33
34 my ($temphandle, $temp) = tempfile();
35
36 open($temphandle, "> $temp") || die "$0: cannot open $temp";
37 print $temphandle "$query\n";
38 close $temphandle;
39
40 open(SEARCH, "$search $index -P $page -h $header -b $body -f $footer -n " .
41 "$notfound -p $pages <$temp |" ) || die "$0: cannot fork $!";
42
43 my $line;
44 while($line = <SEARCH>)
45 {
46 chomp($line);
47 print "$line\n";
48 }
49
50 close(SEARCH) || die "$0: cannot close $search: $!";
51 unlink $temp;

Properties

Name Value
svn:executable *