~ubuntu-branches/ubuntu/trusty/lxr-cvs/trusty

« back to all changes in this revision

Viewing changes to find

  • Committer: Bazaar Package Importer
  • Author(s): Giacomo Catenazzi
  • Date: 2004-01-27 20:34:44 UTC
  • Revision ID: james.westby@ubuntu.com-20040127203444-kb8xobdp8j1z8owi
Tags: upstream-0.9.2
ImportĀ upstreamĀ versionĀ 0.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
# $Id: find,v 1.8 2002/03/18 14:55:43 mbox Exp $
 
3
 
 
4
# find   --     Find files
 
5
#
 
6
#       Arne Georg Gleditsch <argggh@ifi.uio.no>
 
7
#       Per Kristian Gjermshus <pergj@ifi.uio.no>
 
8
#
 
9
#
 
10
# This program is free software; you can redistribute it and/or modify
 
11
# it under the terms of the GNU General Public License as published by
 
12
# the Free Software Foundation; either version 2 of the License, or
 
13
# (at your option) any later version.
 
14
#
 
15
# This program is distributed in the hope that it will be useful,
 
16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
# GNU General Public License for more details.
 
19
 
20
# You should have received a copy of the GNU General Public License
 
21
# along with this program; if not, write to the Free Software
 
22
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
23
 
 
24
######################################################################
 
25
 
 
26
$CVSID = '$Id: find,v 1.8 2002/03/18 14:55:43 mbox Exp $ ';
 
27
 
 
28
use lib do { $0 =~ m{(.*)/} ? "$1/lib" : "lib" };
 
29
 
 
30
use LXR::Common qw(:html);
 
31
use LXR::Config;
 
32
 
 
33
sub find {
 
34
 
 
35
    print("<p align=\"center\">\n",
 
36
          "Search for files (by name) using regular expressions.\n",
 
37
          "<br>(Need some <a href=\"search-help.html\">Hints</a> ",
 
38
          "on performing searches?)</p>\n");
 
39
 
 
40
    print ("<form method=\"get\" action=\"find\">\n");
 
41
 
 
42
    foreach ($config->allvariables) {
 
43
        if ($config->variable($_) ne $config->vardefault($_)) {
 
44
            print("<input type=\"hidden\" name=\"",$_, "\" ",
 
45
                  "value=\"", $config->variable($_), "\">\n");
 
46
        }
 
47
    }                          
 
48
    
 
49
    print("<b>Find file: </b><input type=\"text\" name=\"string\" ",
 
50
          "value=\"",$searchtext,"\" size=\"50\">\n",
 
51
          "<input type=\"submit\" value=\"search\">\n",
 
52
          "</form>\n");
 
53
 
 
54
 
 
55
    if ($searchtext ne "") {
 
56
        unless (open(FILELLISTING,$config->glimpsedir."/.glimpse_filenames")) {
 
57
            &warning("Could not open .glimpse_filenames.");
 
58
            return;
 
59
        }
 
60
        print("<hr>\n");
 
61
        $sourceroot = $config->sourceroot;
 
62
        while($file = <FILELLISTING>) {
 
63
            $file =~ s/^$sourceroot//;
 
64
            if($file =~ /$searchtext/) {
 
65
                print(&fileref("$file", "find-file", "/$file"),"<br>\n");
 
66
            }
 
67
        }
 
68
    }
 
69
}
 
70
 
 
71
httpinit;
 
72
 
 
73
$searchtext = $HTTP->{'param'}->{'string'};
 
74
 
 
75
&makeheader('find');
 
76
&find;
 
77
&makefooter('find');
 
78
 
 
79
httpclean;
 
80