manual-index.cgi revision bc8fd1b0b1afdf89b8d28eefa8cd74e26ba97986
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# ====================================================================
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# The Apache Software License, Version 1.1
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# Copyright (c) 2000-2002 The Apache Software Foundation. All rights
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# Redistribution and use in source and binary forms, with or without
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# modification, are permitted provided that the following conditions
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# 1. Redistributions of source code must retain the above copyright
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# notice, this list of conditions and the following disclaimer.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# 2. Redistributions in binary form must reproduce the above copyright
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# notice, this list of conditions and the following disclaimer in
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# the documentation and/or other materials provided with the
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# distribution.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# 3. The end-user documentation included with the redistribution,
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# if any, must include the following acknowledgment:
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# "This product includes software developed by the
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# Apache Software Foundation (http://www.apache.org/)."
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# Alternately, this acknowledgment may appear in the software itself,
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# if and wherever such third-party acknowledgments normally appear.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# 4. The names "Apache" and "Apache Software Foundation" must
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# not be used to endorse or promote products derived from this
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# software without prior written permission. For written
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# permission, please contact apache@apache.org.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# 5. Products derived from this software may not be called "Apache",
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# nor may "Apache" appear in their name, without prior written
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# permission of the Apache Software Foundation.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# SUCH DAMAGE.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# ====================================================================
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# This software consists of voluntary contributions made by many
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# individuals on behalf of the Apache Software Foundation. For more
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# information on the Apache Software Foundation, please see
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# originally written by Ken Coar <Coar@DECUS.Org> in May 1997
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# This script either displays a form in order to find documents in which
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# a word appears, or displays the results of such a search. It is
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# called as a CGI script.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# [FILE]PATH_INFO is the prefix to add to to the files names found in
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# the index (URL prefix, not filesystem prefix), and QUERY_STRING is the
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# word to be found.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# You may need to tweak the following line to point to the correct
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# location of the index file on your system (it's in the
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# apache/htdocs/manual directory of the Apache distribution tree).
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# You shouldn't have to modify anything else.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# If we have a FILEPATH_INFO or PATH_INFO, it's there to remap the
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# documents to the manual root directory. If this script is already in
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# that directory, this isn't needed.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek$prefix = $ENV{'FILEPATH_INFO'} || $ENV{'PATH_INFO'};
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek$prefix .= "/" if ($prefix && ($prefix !~ m:/$:));
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# QUERY_STRING, if present, contains the word for which we are to
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# search. We also use its [non]presence to determine wha we display.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# Make sure our HTTP header makes it to the server by causing Perl to do
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# a fflush() after every write to STDOUT.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# Fine, now buffering can go back to normal.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# Set up the HTML page title
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek$title .= ": Results for \"$word\"" if ($word);
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# We'll re-use the HTML scalar several times; we use it with here
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# documents for multi-line static HTML code. Lets' do the standard page
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek <TITLE>$title
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek BGCOLOR="#FFFFFF"
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek TEXT="#000000"
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek LINK="#0000FF"
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek VLINK="#000080"
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek ALINK="#FF0000"
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek <DIV ALIGN="CENTER">
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek SRC="${prefix}images/sub.gif"
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek <H1 ALIGN="CENTER">
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek Apache Documentation Search
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek This script performs a very simple search across the Apache
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek documentation for any single case-insensitive word. No combinations,
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek wildcards, regular expressions, word-stubbing, or other fancy options
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek are supported; this is just to help you find topics quickly. Only
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek those pages which include the <EM>exact</EM> word you type will be
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek Documents containing the search word are <EM>not</EM> listed in any
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek sort of priority order.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek <ISINDEX PROMPT="Enter word to find and press ENTER: ">
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# Now set up the next section, which is only displayed if we've been
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# given a word to find.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek Results of Search for <SAMP>$word</SAMP>
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# We enblock the next section so problems can drop out to the common
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# closure code.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek # Try and open the index file; complain bitterly if we can't.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek # Read the entire index in and turn it into an hash for the
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek # The dictionary is all lowercase words. Smash our query value
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek printf (" <P>\n <EM>Sorry, no matches found.</EM>\n </P>\n");
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek # Found an entry, so turn the hash value (a comma-separated list
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek # of relative file names) into an array for display.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek # Incidentally, tell the user how many there are.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek printf (" <P>Total of %d match", scalar (@files));
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek # Right. Now display the files as they're listed.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek# Back to common code - the exit path. Display the page trailer.
7b1019a6d29ccb7999dc76cba3dde1c627e8e609Jerry Jelinek SRC="/images/apache_home.gif"