ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/Search/search.cgi.unix
Revision: 194
Committed: 2003-07-11T00:54:47-07:00 (21 years, 11 months ago) by douglas
File size: 1070 byte(s)
Log Message:
Added Id tags to a bunch of files. $Id$!

File Contents

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

Properties

Name Value
svn:executable *