summaryrefslogtreecommitdiffstats
path: root/man2html/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'man2html/scripts')
-rw-r--r--man2html/scripts/cgi-aux/man/man.aux75
-rw-r--r--man2html/scripts/cgi-aux/man/mansearch.aux49
-rw-r--r--man2html/scripts/cgi-aux/man/mansearchhelp.aux295
-rwxr-xr-xman2html/scripts/cgi-bin/man/man2html109
-rwxr-xr-xman2html/scripts/cgi-bin/man/mansearch192
-rwxr-xr-xman2html/scripts/cgi-bin/man/mansearchhelp32
-rwxr-xr-xman2html/scripts/cgi-bin/man/mansec183
-rwxr-xr-xman2html/scripts/cgi-bin/man/manwhatis208
8 files changed, 1143 insertions, 0 deletions
diff --git a/man2html/scripts/cgi-aux/man/man.aux b/man2html/scripts/cgi-aux/man/man.aux
new file mode 100644
index 0000000..e381b01
--- /dev/null
+++ b/man2html/scripts/cgi-aux/man/man.aux
@@ -0,0 +1,75 @@
+Content-type: text/html
+
+<HTML>
+<HEAD>
+<TITLE>Manual Pages - Main Contents</TITLE>
+<!-- Note: this is not html, but requires preprocessing -->
+<!-- It is used by /home/httpd/cgi-bin/man/man2html -->
+</HEAD>
+<BODY>
+<H1>Manual Pages - Main Contents</H1>
+<HR>
+
+<H2>Name and Section lookup</H2>
+<ISINDEX>
+
+%lynx <i>Start a query</i> by typing an s.
+You can enter a program name, possibly preceded by the section,
+the directories to search (with -M) or a full name.
+For example:
+<UL>
+ <LI><TT>find</TT>
+ <LI><TT>1 find</TT>
+ <LI><TT>-M /usr/man:/usr/X11R6/man:/usr/lib/perl5/man find</TT>
+ <LI><TT>/local/gcc/man/man1/gperf.1</TT>
+</UL>
+
+<HR>
+
+<H2>Index of pages by name and description</H2>
+Sections:
+ <A HREF="%cg/manwhatis?%cg+1">1. User Commands</A>;
+ <A HREF="%cg/manwhatis?%cg+2">2. System Calls</A>;
+ <A HREF="%cg/manwhatis?%cg+3">3. Library Functions</A>;
+ <A HREF="%cg/manwhatis?%cg+4">4. Special Files</A>;
+ <A HREF="%cg/manwhatis?%cg+5">5. File Formats</A>;
+ <A HREF="%cg/manwhatis?%cg+6">6. Games</A>;
+ <A HREF="%cg/manwhatis?%cg+7">7. Miscellany</A>;
+ <A HREF="%cg/manwhatis?%cg+8">8. Administration and Privileged Commands</A>;
+ <A HREF="%cg/manwhatis?%cg+l">l. Postgresql Commands</A>;
+ <A HREF="%cg/manwhatis?%cg+n">n. Tcl Commands</A>.
+<P>
+<HR>
+<H2>Index of pages by name only</H2>
+ <A HREF="%cg/mansec?%cg+1">1. User Commands</A>;
+ <A HREF="%cg/mansec?%cg+2">2. System Calls</A>;
+ <A HREF="%cg/mansec?%cg+3">3. Library Functions</A>;
+ <A HREF="%cg/mansec?%cg+4">4. Special Files</A>;
+ <A HREF="%cg/mansec?%cg+5">5. File Formats</A>;
+ <A HREF="%cg/mansec?%cg+6">6. Games</A>;
+ <A HREF="%cg/mansec?%cg+7">7. Miscellany</A>;
+ <A HREF="%cg/mansec?%cg+8">8. Administration and Privileged Commands</A>;
+ <A HREF="%cg/mansec?%cg+l">l. Postgresql Commands</A>;
+ <A HREF="%cg/mansec?%cg+n">n. Tcl Commands</A>;
+ <A HREF="%cg/mansec?%cg+all">All Sections</A>.
+<P>
+<hr>
+
+<H2>Manual Pages full text search</H2>
+
+<A HREF="%cg/mansearch">
+Search the full text of the Manual Pages.
+</A>
+
+<P>
+<HR>
+
+The original man2html program and scripts are due to
+<A HREF="http://wsinwp01.win.tue.nl:1234/index.html">
+Richard Verhoeven</A> and
+<A HREF="mailto:michael@actrix.gen.nz">
+Michael Hamilton</A>.
+This version is from man-1.6g maintained by <A HREF="mailto:flucifredi@acm.org">
+Federico Lucifredi</A>.
+</body>
+</HTML>
diff --git a/man2html/scripts/cgi-aux/man/mansearch.aux b/man2html/scripts/cgi-aux/man/mansearch.aux
new file mode 100644
index 0000000..f1d19a2
--- /dev/null
+++ b/man2html/scripts/cgi-aux/man/mansearch.aux
@@ -0,0 +1,49 @@
+Content-type: text/html
+
+<HTML>
+<HEAD>
+<TITLE>Manual Pages - Text Search</TITLE>
+<!-- Changed by: Michael Hamilton, 6-Apr-1996 -->
+<!-- Note: this is not html, but requires preprocessing -->
+</HEAD>
+<BODY>
+<H1>Manual Pages - Text Search</H1>
+
+<A HREF="%cg/man2html">Return to Main Contents</A>
+<P>
+<ISINDEX>
+
+%lynx <i>Start a query</i> by typing an s.
+
+Examples:
+<UL>
+ <LI><TT>pwd;directory</TT> - Find both in the same man page.
+ <LI><TT>pwd,directory</TT> - Find either.
+ <LI><TT>pwd directory</TT> - Find the exact phrase.
+ <LI><TT>-F 1 pwd</TT> - Look in section 1 only.
+ <LI><TT>-B glipmse</TT> - Find the best match (allow for misspelling).
+ <LI><TT>-L 0:10 pwd</TT> - Only show the first 10 man pages matched.
+</UL>
+
+<HR>
+<P>
+The index uses the <I>Glimpse</I>
+(<A HREF="%cg/man2html?1+glimpse">glimpse(1)</A>)
+text indexing system. Many of the glimpse
+options, regular expressions, and wildcards are valid:
+see the <A HREF="%cg/mansearchhelp">help page</A> for a summary.
+<P>
+<HR>
+
+<P>
+Glimpse
+was developed by Udi Manber and Burra Gopal of the University of
+Arizona, and Sun Wu of the National Chung-Cheng University, Taiwan.
+You may contact the authors at <A HREF="mailto:glimpse@cs.arizona.edu">
+glimpse@cs.arizona.edu</A>
+<P>
+The Manual Page text search interface was created for Linux by
+<A HREF="mailto:michael@actrix.gen.nz">
+Michael Hamilton</A>.
+</BODY>
+</HTML>
diff --git a/man2html/scripts/cgi-aux/man/mansearchhelp.aux b/man2html/scripts/cgi-aux/man/mansearchhelp.aux
new file mode 100644
index 0000000..200b509
--- /dev/null
+++ b/man2html/scripts/cgi-aux/man/mansearchhelp.aux
@@ -0,0 +1,295 @@
+Content-type: text/html
+
+<HTML>
+<HEAD>
+<TITLE>Manual Pages - Search Help</TITLE>
+<!-- Changed by: Michael Hamilton, 6-Apr-1996 -->
+<!-- Note: this is not html, but requires preprocessing -->
+</HEAD>
+<BODY>
+<H1>Manual Pages - Search Help</H1>
+
+<A HREF="%cg/mansearch">Perform another search</A>
+<BR>
+<A HREF="%cg/man2html">Return to Main Contents</A>
+<P>
+<HR>
+<P>
+The full text index uses the <I>Glimpse</I> text indexing system.
+The
+<A HREF="%cg/man2html?1+glimpse">glimpse(1)</A>
+manual page documents glimpse in full. This summary documents those
+features of glimpse that are valid when searching through the manual pages.
+<P>
+<HR>
+
+<H2>Search Options</H2>
+
+The following search options must be at the start of the search string.
+
+<DL COMPACT>
+
+<DT><B>-</B> <I>#</I>
+<DD>
+<I>#</I> is an integer between 1 and 8
+specifying the maximum number of errors
+permitted in finding the approximate matches (the default is zero).
+Generally, each insertion, deletion, or substitution counts as one error.
+Since the index stores only lower case characters, errors of
+substituting upper case with lower case may be missed.
+
+<DT><B>-B</B>
+<DD>
+Best match mode. (Warning: -B sometimes misses matches. It is safer
+to specify the number of errors explicitly.)
+When -B is specified and no exact matches are found, glimpse
+will continue to search until the closest matches (i.e., the ones
+with minimum number of errors)
+are found.
+In general, -B may be slower than -#, but not by very much.
+Since the index stores only lower case characters, errors of
+substituting upper case with lower case may be missed.
+
+<DT><B>-L <I>x</I> | <I>x</I>:<I>y</I> | <I>x</I>:<I>y</I>:<I>z</I></B>
+<DD>
+A non-zero value of <I>x</I> limits the number of matches
+that will be shown.
+A non-zero value of <I>y</I> limits the number of man pages
+that will be shown.
+A non-zero valye of <I>z</I> will only show pages that have
+less that z matches.
+For example, -L 0:10 will output all matches for the first 10 files that
+contain a match.
+
+<DT><B>-F</B> <I>pattern</I>
+<DD>
+The -F option provides a pattern that restricts the search results to
+those filenames that match the pattern.
+or example, <I>-F 8</I> effectively restricts matches to section 8.
+
+<DT><B>-w</B>
+<DD>
+Search for the pattern as a word - i.e., surrounded by non-alphanumeric
+characters. For example,
+<I>-w -1 car</I> will match cars, but not characters and not
+car10.
+The non-alphanumeric <I>must</I>
+surround the match; they cannot be counted as errors.
+This option does not work with regular expressions.
+
+<DT><B>-W</B>
+<DD>
+The default for Boolean AND queries is that they cover one record
+(the default for a record is one line) at a time.
+For example, glimpse 'good;bad' will output all lines containing
+both 'good' and 'bad'.
+The -W option changes the scope of Booleans to be the whole file.
+Within a file glimpse will output all matches to any of the patterns.
+So, glimpse -W 'good;bad' will output all lines containing 'good'
+<I>or</I> 'bad', but only in files that contain both patterns.
+
+<DT><B>-k</B>
+<DD>
+No symbol in the pattern is treated as a meta character.
+For example, <I>-k a(b|c)*d</I> will find
+the occurrences of a(b|c)*d whereas <I>a(b|c)*d</I>
+will find substrings that match the regular expression 'a(b|c)*d'.
+(The only exception is ^ at the beginning of the pattern and $ at the
+end of the pattern, which are still interpreted in the usual way.
+Use \^ or \$ if you need them verbatim.)
+
+</DL>
+
+<P>
+<HR>
+
+<H2>Patterns</H2>
+
+<I>Glimpse</I>
+supports a large variety of patterns, including simple
+strings, strings with classes of characters, sets of strings,
+wild cards, and regular expressions (see <A HREF="#limitations">LIMITATIONS</A>).
+
+<DL COMPACT>
+<DT><B>Strings </B><DD>
+Strings are any sequence of characters, including the special symbols
+`^' for beginning of line and `$' for end of line.
+The following special characters (
+`<B>$</B>',
+
+`^<B>',</B>
+
+`<B>*</B>',
+
+`<B>[</B>'<B>,</B>
+
+`<B>^</B>',
+
+`<B>|</B>',
+
+`<B>(</B>',
+
+`<B>)</B>',
+
+`<B>!</B>',
+
+and
+`<B>\</B>'
+
+)
+as well as the following meta characters special to glimpse (and agrep):
+`<B>;</B>',
+
+`<B>,</B>',
+
+`<B>#</B>',
+
+`<B>&lt;</B>',
+
+`<B>&gt;</B>',
+
+`<B>-</B>',
+
+and
+`<B>.</B>',
+
+should be preceded by `\' if they are to be matched as regular
+characters. For example, \^abc\\ corresponds to the string ^abc\,
+whereas ^abc corresponds to the string abc at the beginning of a
+line.
+<DT><B>Classes of characters</B><DD>
+a list of characters inside [] (in order) corresponds to any character
+from the list. For example, [a-ho-z] is any character between a and h
+or between o and z. The symbol `^' inside [] complements the list.
+For example, [^i-n] denote any character in the character set except
+character 'i' to 'n'.
+The symbol `^' thus has two meanings, but this is consistent with
+egrep.
+The symbol `.' (don't care) stands for any symbol (except for the
+newline symbol).
+<DT><B>Boolean operations</B><DD>
+<B>Glimpse </B>
+
+supports an `AND' operation denoted by the symbol `;'
+an `OR' operation denoted by the symbol `,',
+or any combination.
+For example,
+<I>glimpse 'pizza;cheeseburger'</I> will output all lines containing
+both patterns.
+<I>glimpse -F 'gnu;\.c$' 'define;DEFAULT'</I>
+will output all lines containing both 'define' and 'DEFAULT'
+(anywhere in the line, not necessarily in order) in
+files whose name contains 'gnu' and ends with .c.
+<I>glimpse '{political,computer};science'</I> will match 'political science'
+or 'science of computers'.
+<DT><B>Wild cards</B><DD>
+The symbol '#' is used to denote a sequence
+of any number (including 0)
+of arbitrary characters (see <A HREF="#limitations">LIMITATIONS</A>).
+The symbol # is equivalent to .* in egrep.
+In fact, .* will work too, because it is a valid regular expression
+(see below), but unless this is part of an actual regular expression,
+# will work faster.
+(Currently glimpse is experiencing some problems with #.)
+<DT><B>Combination of exact and approximate matching</B><DD>
+Any pattern inside angle brackets &lt;&gt; must match the text exactly even
+if the match is with errors. For example, &lt;mathemat&gt;ics matches
+mathematical with one error (replacing the last s with an a), but
+mathe&lt;matics&gt; does not match mathematical no matter how many errors are
+allowed.
+(This option is buggy at the moment.)
+<DT><B>Regular expressions</B><DD>
+Since the index is word based, a regular expression must match
+words that appear in the index for glimpse to find it.
+Glimpse first strips the regular expression from all non-alphabetic
+characters, and searches the index for all remaining words.
+It then applies the regular expression matching algorithm to the
+files found in the index.
+For example, <I>glimpse</I> 'abc.*xyz' will search the index
+for all files that contain both 'abc' and 'xyz', and then
+search directly for 'abc.*xyz' in those files.
+(If you use glimpse -w 'abc.*xyz', then 'abcxyz' will not be found,
+because glimpse
+will think that abc and xyz need to be matches to whole words.)
+The syntax of regular expressions in <B>glimpse</B> is in general the same as
+that for <B>agrep</B>. The union operation `|', Kleene closure `*',
+and parentheses () are all supported.
+Currently '+' is not supported.
+Regular expressions are currently limited to approximately 30
+characters (generally excluding meta characters). Some options
+(-d, -w, -t, -x, -D, -I, -S) do not
+currently work with regular expressions.
+The maximal number of errors for regular expressions that use '*'
+or '|' is 4. (See <A HREF="#limitations">LIMITATIONS</A>.)
+
+</DL>
+
+<HR>
+
+<H2><A NAME="limitations">Limitations</A></H2>
+
+The index of glimpse is word based. A pattern that contains more than
+one word cannot be found in the index. The way glimpse overcomes this
+weakness is by splitting any multi-word pattern into its set of words
+and looking for all of them in the index.
+For example, <B>glimpse 'linear programming'</B> will first consult the index
+to find all files containing both <I>linear</I> and <I>programming</I>,
+and then apply agrep to find the combined pattern.
+This is usually an effective solution, but it can be slow for
+cases where both words are very common, but their combination is not.
+<P>
+
+As was mentioned in the section on PATTERNS above, some characters
+serve as meta characters for glimpse and need to be
+preceded by '\' to search for them. The most common
+examples are the characters '.' (which stands for a wild card),
+and '*' (the Kleene closure).
+So, &quot;glimpse ab.de&quot; will match abcde, but &quot;glimpse ab\.de&quot;
+will not, and &quot;glimpse ab*de&quot; will not match ab*de, but
+&quot;glimpse ab\*de&quot; will.
+The meta character - is translated automatically to a hyphen
+unless it appears between [] (in which case it denotes a range of
+characters).
+<P>
+
+The index of glimpse stores all patterns in lower case.
+When glimpse searches the index it first converts
+all patterns to lower case, finds the appropriate files,
+and then searches the actual files using the original
+patterns.
+So, for example, <I>glimpse ABCXYZ</I> will first find all
+files containing abcxyz in any combination of lower and upper
+cases, and then searches these files directly, so only the
+right cases will be found.
+One problem with this approach is discovering misspellings
+that are caused by wrong cases.
+For example, <I>glimpse -B abcXYZ</I> will first search the
+index for the best match to abcxyz (because the pattern is
+converted to lower case); it will find that there are matches
+with no errors, and will go to those files to search them
+directly, this time with the original upper cases.
+If the closest match is, say AbcXYZ, glimpse may miss it,
+because it doesn't expect an error.
+Another problem is speed. If you search for &quot;ATT&quot;, it will look
+at the index for &quot;att&quot;. Unless you use -w to match the whole word,
+glimpse may have to search all files containing, for example, &quot;Seattle&quot;
+which has &quot;att&quot; in it.
+<P>
+
+There is no size limit for simple patterns and simple patterns
+within Boolean expressions.
+More complicated patterns, such as regular expressions,
+are currently limited to approximately 30 characters.
+Lines are limited to 1024 characters.
+Records are limited to 48K, and may be truncated if they are larger
+than that.
+The limit of record length can be
+changed by modifying the parameter Max_record in agrep.h.
+<P>
+
+Glimpseindex does not index words of size &gt; 64.
+<A NAME="lbAQ">&nbsp;</A>
+
+<HR>
+</BODY>
+</HTML>
diff --git a/man2html/scripts/cgi-bin/man/man2html b/man2html/scripts/cgi-bin/man/man2html
new file mode 100755
index 0000000..7c515d1
--- /dev/null
+++ b/man2html/scripts/cgi-bin/man/man2html
@@ -0,0 +1,109 @@
+#!/bin/sh
+# man2html cgi script - uses /usr/bin/man2html to format man pages
+# auxiliary text files in /home/httpd/cgi-aux/man
+# aeb@cwi.nl - 980109
+
+MAN2HTML="/usr/bin/man2html"
+MANX="/home/httpd/cgi-aux/man/man.aux"
+
+# Do we need lynxcgi URLs? For the moment our criterion is
+# 1) HTTP_USER_AGENT=Lynx* and 2) HTTP_HOST is unset.
+AGENT="${HTTP_USER_AGENT-unknown}"
+
+case "$AGENT" in
+ Lynx*|lynx*)
+ HH="${HTTP_HOST-nohh}"
+ SED="s/%lynx //"
+ ;;
+ *)
+ HH=nolynx
+ SED="/%lynx/d"
+ ;;
+esac
+
+SERVER="${SERVER_NAME-localhost}"
+case "$HH" in
+ nohh)
+ LL="-l"
+ CG="lynxcgi:/home/httpd/cgi-bin/man"
+ ;;
+ *)
+ LL="-H$SERVER"
+ CG="http://$SERVER/cgi-bin/man"
+ ;;
+esac
+
+# Find the required page - expect to be called with "man2html [sec] page".
+# There may a prefixed "-M manpath" option.
+if [ $# -ge 2 -a x"$1" = x-M ]; then
+ MANPATH="$2"
+ export MANPATH
+ shift; shift
+ MP=" using the given MANPATH"
+else
+ MP=""
+fi
+
+# If no arguments given, show a start page.
+if [ $# = 0 ]; then
+ if [ -r $MANX ]; then
+ cat $MANX | sed "s#%cg#$CG#g; $SED"
+ else
+ "$MAN2HTML" -E "man2html: cannot open $MANX"
+ fi
+ exit 0
+fi
+
+if [ $# -gt 2 ]; then
+ "$MAN2HTML" -E "man2html: bad invocation: too many arguments"
+ exit 0
+fi
+
+# A single argument may be an explicitly give path name
+# Otherwise, ask man where to find it
+if [ $# = 1 ]; then
+ case "$1" in
+ /*)
+ PAGE="$1"
+ ;;
+ *)
+ PAGE=`man -w -c "$@" 2>/dev/null`
+ ;;
+ esac
+else
+ PAGE=`man -w -c "$@" 2>/dev/null`
+fi
+
+if [ x"$PAGE" = x ]; then
+ complaint="man2html: cannot find a page"
+ if [ $# = 1 ]; then
+ "$MAN2HTML" -E "$complaint for $1$MP"
+ else
+ "$MAN2HTML" -E "$complaint for $2 in section $1$MP"
+ fi
+ exit 0
+fi
+
+if [ -r "$PAGE" ]
+then
+ case "$PAGE" in
+ *.gz)
+ zcat "$PAGE" | "$MAN2HTML" "$LL" -D "$PAGE"
+ ;;
+ *.bz2)
+ bzcat "$PAGE" | "$MAN2HTML" "$LL" -D "$PAGE"
+ ;;
+ *)
+ "$MAN2HTML" "$LL" "$PAGE"
+ ;;
+ esac
+elif [ -r "$PAGE".gz ]
+then
+ zcat "$PAGE".gz | "$MAN2HTML" "$LL" -D "$PAGE"
+elif [ -r "$PAGE".bz2 ]
+then
+ bzcat "$PAGE".bz2 | "$MAN2HTML" "$LL" -D "$PAGE"
+else
+ "$MAN2HTML" -E "Strange... Cannot find (or read) $PAGE."
+fi
+exit 0
diff --git a/man2html/scripts/cgi-bin/man/mansearch b/man2html/scripts/cgi-bin/man/mansearch
new file mode 100755
index 0000000..2644db6
--- /dev/null
+++ b/man2html/scripts/cgi-bin/man/mansearch
@@ -0,0 +1,192 @@
+#!/bin/sh
+#
+# Interface to a glimpse search of the man pages.
+# Michael Hamilton <michael@actrix.gen.nz>
+# Small changes - aeb, 980109
+#
+
+# Do we need lynxcgi URLs? For the moment our criterion is
+# 1) HTTP_USER_AGENT=Lynx* and 2) HTTP_HOST is unset.
+AGENT="${HTTP_USER_AGENT-unknown}"
+
+case "$AGENT" in
+ Lynx*|lynx*)
+ HH="${HTTP_HOST-nohh}"
+ SED="s/%lynx //"
+ ;;
+ *)
+ HH=nolynx
+ SED="/%lynx/d"
+ ;;
+esac
+
+SERVER="${SERVER_NAME-localhost}"
+case "$HH" in
+ nohh)
+ CG="lynxcgi:/home/httpd/cgi-bin/man"
+ ;;
+ *)
+ CG="http://$SERVER/cgi-bin/man"
+ ;;
+esac
+QUOTE="'"
+export CG QUOTE SED
+
+exec awk '
+function removeopts(string) {
+ gsub(/^[ \t]/, "", string); # Remove leading spaces
+ gsub(/[ \t]$/, "", string); # Remove trailing spaces
+ gsub(/[ \t\\];/, ";", string); # Remove spaces before ;
+ gsub(/[ \t];/, ",", string); # Remove spaces before ,
+ while (match(string, /^-[FLBwk1-8]/)) {
+ if (match(string, /^-[FL]( |.)[^ \t]+[ \t]+/)) { # Option with arg
+ options = options " " substr(string, RSTART, RLENGTH);
+ string = substr(string, RSTART + RLENGTH);
+ }
+ else if (match(string, /^-[Bwk1-8][ \t]+/)) { # Option without arg
+ options = options " " substr(string, RSTART, RLENGTH);
+ string = substr(string, RSTART + RLENGTH);
+ }
+ else if (match(string, /^-[^ \t]/)) { # Remove it
+ string = substr(string, RSTART + RLENGTH);
+ }
+ }
+ return string;
+}
+
+BEGIN {
+
+ searchdocument = "/home/httpd/cgi-aux/man/mansearch.aux";
+ quote = ENVIRON["QUOTE"];
+ cgipath = ENVIRON["CG"];
+ sedcmd = ENVIRON["SED"];
+ truncate_at = 11; # Single page display match limit.
+
+ glimpse_cmd = "glimpse -z -H /var/man2html -y -W -i "
+
+ for (i = 1; i < ARGC; i++) {
+ string = string " " ARGV[i];
+ }
+ # Have to be careful to single quote this
+ # string later.
+ gsub(/[^a-zA-Z0-9-_+ \t\/@%:;,$*|]/, " ", string);
+
+ string = removeopts(string);
+
+ gsub(/[^a-zA-Z0-9-_+ \t\/@%:,]/, " ", options);
+
+ if (!string) {
+ if (system("test -r " searchdocument ) != 0) {
+ print "Content-type: text/html\n\n";
+ print "<head>";
+ print "<title>mansearch - file not found</title>";
+ print "</head>\n<body>";
+ print "Sorry - cannot read " searchdocument ".";
+ print "</body>";
+ exit;
+ }
+ system("sed " quote "s#%cg#" cgipath "#g;" sedcmd quote " " searchdocument );
+ exit;
+ }
+
+ print "Content-type: text/html";
+ print "";
+ print "<HTML>";
+ print "<HEAD>";
+ print "<TITLE>Manual Pages - Search Results: " string "</TITLE>";
+ print "</HEAD>";
+ print "<BODY>";
+
+ print "<H1>Manual Pages - Search Results</H1>";
+ print "<H2>Target text: " options " " string "</H2>";
+
+ print "<A HREF=\"" cgipath "/mansearch\">";
+ print "Perform another search";
+ print "</A><BR>";
+ print "<A HREF=\"" cgipath "/man2html\">";
+ print "Return to Main Contents";
+ print "</A>";
+
+ print "<HR>";
+
+ print "<DL>";
+ # Unless you like being hacked, the single
+ # forward quotes are most important.
+ cmd = glimpse_cmd " " options " " quote string quote " 2>/dev/null" ;
+
+ while ((cmd | getline matchline) > 0) {
+ if (split(matchline, part, ": ") == 1) {
+ continue;
+ }
+ else {
+ fullname = part[1];
+ }
+
+ if (fullname == "glimpse") {
+ print "<DT><B>"fullname"</B>:";
+ }
+ else if (fullname != last_fullname) {
+ mcount++;
+ tcount = 0;
+ last_fullname = fullname ;
+ last_text = "";
+
+ if (match(fullname, ".*/")) {
+ dirname = substr(fullname, 1, RLENGTH);
+ filename = substr(fullname, RLENGTH + 1);
+ if (dirname != last_dirname) {
+ last_dirname = dirname;
+ print "</DL>";
+ print "<H3>Location: " dirname "</H3>";
+ print "<DL>";
+ }
+ }
+ else {
+ filename = fullname;
+ }
+
+ if (match(filename, /\.[^.]+$/)) {
+ ref = substr(filename, 1, RSTART - 1) "+" substr(filename, RSTART + 1);
+ }
+ else {
+ ref = filename;
+ }
+ print "<DT> <a href=\"" cgipath "/man2html?" fullname "\">";
+ textname = filename;
+ sub(/\.(gz)|Z|z$/, "", textname);
+ sub(/\./, "(", textname);
+ textname = textname ")";
+ print textname;
+ print "</A>";
+ }
+
+ text = substr(matchline, length(fullname) + 2);
+ tcount++;
+ if (tcount < truncate_at) {
+ sub(/^ *.[^ ]+ /, "", text);
+ sub(/ +$/, "", text);
+ gsub(/\\f./, "", text);
+ gsub(/\\&/, "", text);
+ gsub(/\\/, "", text);
+ print "<DD>" text;
+ }
+ else if (tcount == truncate_at) {
+ print "<DD> <I>...additional matches not shown.</I>";
+ }
+ }
+
+ print "</DL>";
+ if (mcount == 0) {
+ print "No matches found.";
+ }
+ else if (mcount == 1) {
+ print "<HR>\n<P>1 match found."
+ }
+ else {
+ print "<HR>\n<P>" mcount " matches found."
+ }
+ print "</BODY>";
+ print "</HTML>";
+ exit;
+}' "$@"
+
diff --git a/man2html/scripts/cgi-bin/man/mansearchhelp b/man2html/scripts/cgi-bin/man/mansearchhelp
new file mode 100755
index 0000000..a96e796
--- /dev/null
+++ b/man2html/scripts/cgi-bin/man/mansearchhelp
@@ -0,0 +1,32 @@
+#!/bin/sh
+MAN2HTML=/usr/bin/man2html
+MANSH=/home/httpd/cgi-aux/man/mansearchhelp.aux
+
+# Do we need lynxcgi URLs? For the moment our criterion is
+# 1) HTTP_USER_AGENT=Lynx* and 2) HTTP_HOST is unset.
+AGENT="${HTTP_USER_AGENT-unknown}"
+case "$AGENT" in
+ Lynx*|lynx*)
+ HH="${HTTP_HOST-nohh}"
+ ;;
+ *)
+ HH=nolynx
+ ;;
+esac
+
+SERVER="${SERVER_NAME-localhost}"
+case "$HH" in
+ nohh)
+ CG="lynxcgi:/home/httpd/cgi-bin/man"
+ ;;
+ *)
+ CG="http://$SERVER/cgi-bin/man"
+ ;;
+esac
+
+if [ -r $MANSH ]; then
+ sed s#%cg#$CG#g $MANSH
+else
+ $MAN2HTML -E "man2html: cannot open $MANSH"
+fi
+exit 0
diff --git a/man2html/scripts/cgi-bin/man/mansec b/man2html/scripts/cgi-bin/man/mansec
new file mode 100755
index 0000000..24c189e
--- /dev/null
+++ b/man2html/scripts/cgi-bin/man/mansec
@@ -0,0 +1,183 @@
+#!/usr/bin/awk -f
+#
+# Generate an index into a manual section by using find.
+# Michael Hamilton <michael@actrix.gen.nz>
+# Small changes - aeb, 980109
+#
+BEGIN {
+
+ OFS="";
+
+ if (ARGC != 3) {
+ print "Content-type: text/html\n\n";
+ print "<head>";
+ print "<title>manwhatis - bad call</title>";
+ print "</head>\n<body>";
+ print "manwhatis: wrong number of arguments";
+ print "</body>";
+ exit;
+ }
+ cgipath = ARGV[1];
+ section = ARGV[2];
+
+ if (section !~ /^[1-8ln]$/ && section != "all") {
+ print "Content-type: text/html\n\n";
+ print "<head>";
+ print "<title>Manual - Illegal section</title>";
+ print "<body>";
+ print "Illegal section number '" section "'." ;
+ print "Must be one of 1,2,3,4,5,6,7,8,l,n or all";
+ print "</body>";
+ exit;
+ }
+
+ "echo $PPID" | getline pid;
+
+ if (cgipath ~ /lynxcgi/) {
+ cache_suffix = "l";
+ }
+ else {
+ cache_suffix = "h";
+ }
+
+ cache_dir = "/var/man2html";
+ cache_file = "manindex" cache_suffix "-" section ".html";
+ cache = cache_dir "/" cache_file;
+ cache_tmp = cache "_" pid;
+ buffer_tmp = cache "_items_" pid;
+
+ # Find out the man path
+ "man -w" | getline man_path
+ man_path = man_path ":";
+ gsub(":", " ", man_path);
+ # See if anything is out of date.
+ # Check all man[1-8] dir dates vs cache date
+ if (section == "all") {
+ if (system("test -f " cache) == 0) {
+ cmd = "find " man_path " -maxdepth 1 -name 'man[1-8]' -newer " cache;
+ cmd | getline need_update;
+ }
+ else {
+ need_update = 1;
+ }
+ }
+ else {
+ if (system("test -f " cache) == 0) {
+ cmd = "find " man_path " -maxdepth 1 -name man" section " -newer " cache;
+ cmd | getline need_update;
+ }
+ else {
+ need_update = 1;
+ }
+ }
+
+ if (need_update != "") {
+ if (system("test -w " cache_dir "/.") != 0) {
+ print "Content-type: text/html\n\n";
+ print "<head>";
+ print "<title>mansec - no cache</title>";
+ print "</head>\n<body>";
+ print "Sorry - cannot create index.";
+ print "No writable cache directory " cache_dir " exists.";
+ print "</body>";
+ exit;
+ }
+
+ sec_name[1] = "User Commands";
+ sec_name[2] = "System Calls";
+ sec_name[3] = "Library Functions";
+ sec_name[4] = "Special Files";
+ sec_name[5] = "File Formats";
+ sec_name[6] = "Games";
+ sec_name[7] = "Miscellany";
+ sec_name[8] = "Administration and Privileged Commands";
+ sec_name["all"] = "All available manual pages";
+ num_sections = 8;
+
+ # Print heading
+ print "Content-type: text/html\n\n" > cache_tmp;
+ print "<html>\n<head>" > cache_tmp;
+ print "<title>Manual Pages - Names: " section ". " sec_name[section] "</title>"> cache_tmp;
+ print "</head>\n<body>" > cache_tmp;
+ print "<h1>Manual Pages - Page Names</h1>" > cache_tmp;
+ print "<h2>Section " section ": " sec_name[section] "</h2>" > cache_tmp;
+
+ "hostname" | getline hostname;
+ "date" | getline date;
+ print hostname " (" date ")" > cache_tmp;
+
+ if (section != "all") {
+ sec_sub_dir = "/man" section;
+ }
+ else {
+ sec_sub_dir = "/man*";
+ }
+ gsub(" ", sec_sub_dir " ", man_path);
+
+ print "<p>Manual pages found under " man_path "." > cache_tmp;
+
+ # Find any man[1-8]/filenames
+ while ((("find " man_path " -follow -type f -printf '%f\n' | sort -f ") | getline manpage) > 0) {
+ # Check for new letter of alphabet
+ letter = tolower(substr(manpage,1,1));
+ if (letter != last_letter) {
+ last_letter = letter;
+ letter_index[++num_letters] = letter;
+ # Start a new alphabetic heading
+ print "<h2> <a name=\"", letter, "\">", toupper(letter), "</a></h2>" > buffer_tmp;
+ # Print out alphabetic quick index and other links
+ }
+ # Split page.n into "page" and "n" and generate an entry
+ sub(/[.]([zZ]|(gz))$/, "", manpage);
+ match(manpage, /[.][^.]+$/);
+ title = substr(manpage, 1, RSTART - 1);
+ if (section != "all") {
+ print "<a href=\"" cgipath "/man2html?", section, "+", title, "\">", title, "(", substr(manpage, RSTART + 1), ")</a>" > buffer_tmp;
+ }
+ else {
+ sec = substr(manpage, RSTART + 1)
+ print "<a href=\"" cgipath "/man2html?", sec, "+", title, "\">", title, "(", sec, ")</a>" > buffer_tmp;
+ }
+ }
+
+ close(buffer_tmp);
+
+ print "<p>" > cache_tmp;
+
+ # Print out alphabetic quick index and other links
+ for (i = 1; i <= num_letters; i++) {
+ print "<a href=\"#" letter_index[i] "\">" toupper(letter_index[i]) "</a>" > cache_tmp;
+ }
+
+ print "<p><hr>" > cache_tmp;
+ print "<a href=\"" cgipath "/man2html\">Return to Main Contents</a>" > cache_tmp;
+
+ print "<p>Other sections:" > cache_tmp;
+ for (i=1; i<=num_sections; i++) {
+ if (i != section) { # Dont print an entry for the section we are in
+ print "<a href=\"" cgipath "/mansec?" cgipath "+" i "\">" i ". " sec_name[i] "</a> " > cache_tmp;
+ }
+ }
+ print "<hr><p>" > cache_tmp;
+ # Print out the accumulated index entries
+ while ((getline < buffer_tmp) > 0) print > cache_tmp;
+ print "<hr><p>" > cache_tmp;
+ # Print out alphabetic quick index and other links
+ for (i = 1; i <= num_letters; i++) {
+ print "<a href=\"#" letter_index[i] "\">" toupper(letter_index[i]) "</a>" > cache_tmp;
+ }
+ print "<hr>" > cache_tmp;
+ print "<p><a href=\"" cgipath "/man2html\">Return to Main Contents</a>" > cache_tmp;
+ print "<p>Other sections:" > cache_tmp;
+ for (i=1; i<=num_sections; i++) {
+ if (i != section) { # Dont print an entry for the section we are in
+ print "<a href=\"" cgipath "/mansec?" cgipath "+" i "\">" i ". " sec_name[i] "</a> " > cache_tmp;
+ }
+ }
+ print "</body>\n</html>" > cache_tmp;
+ system("/bin/mv " cache_tmp " " cache);
+ system("/bin/rm -f " buffer_tmp);
+ }
+ system("/bin/cat " cache);
+ exit;
+}
diff --git a/man2html/scripts/cgi-bin/man/manwhatis b/man2html/scripts/cgi-bin/man/manwhatis
new file mode 100755
index 0000000..d14a516
--- /dev/null
+++ b/man2html/scripts/cgi-bin/man/manwhatis
@@ -0,0 +1,208 @@
+#!/usr/bin/awk -f
+#
+# Generate a whatis index into the manual pages by using find to
+# locate all the whatis files.
+# Michael Hamilton <michael@actrix.gen.nz>
+# Small changes - aeb, 980109
+#
+BEGIN {
+
+ OFS="";
+
+ if (ARGC != 3) {
+ print "Content-type: text/html\n\n";
+ print "<head>";
+ print "<title>manwhatis - bad call</title>";
+ print "</head>\n<body>";
+ print "manwhatis: wrong number of arguments";
+ print "</body>";
+ exit;
+ }
+ cgipath = ARGV[1];
+ section = ARGV[2];
+
+ if (section !~ /^[1-8ln]$/) {
+ print "Content-type: text/html\n\n";
+ print "<head>";
+ print "<title>Manual - Illegal section</title>";
+ print "</head>\n<body>";
+ print "Illegal section number '" section "'." ;
+ print "Must be one of 1,2,3,4,5,6,7,8,l,n";
+ print "</body>";
+ exit;
+ }
+
+ if (cgipath ~ /lynxcgi/) {
+ cache_suffix = "l";
+ }
+ else {
+ cache_suffix = "h";
+ }
+
+ cache_dir = "/var/man2html";
+ cache_file = "whatis" cache_suffix "-" section ".html";
+ cache = cache_dir "/" cache_file;
+
+
+ # Find out the man path
+ "man -w" | getline man_path
+ gsub(":", " ", man_path);
+ # See if anything is out of date.
+ if (system("test -f " cache) == 0) {
+ cmd = "find " man_path " -maxdepth 1 -name whatis -newer " cache;
+ cmd | getline need_update;
+ }
+ else {
+ need_update = 1;
+ }
+
+ if (need_update != "") {
+
+ if (system("test -w " cache_dir "/.") != 0) {
+ print "Content-type: text/html\n\n";
+ print "<head>";
+ print "<title>manwhatis - no cache</title>";
+ print "</head>\n<body>";
+ print "Sorry - cannot create index.";
+ print "No writable cache directory " cache_dir " exists.";
+ print "</body>";
+ exit;
+ }
+
+ "echo $PPID" | getline pid;
+
+ cache_tmp = cache "_" pid;
+ sort_tmp = cache_dir "/manwhatis_tmp_" pid ;
+ buffer_tmp = cache_dir "/manwhatis_tmp2_" pid;
+
+ sec_name[1] = "User Commands";
+ sec_name[2] = "System Calls";
+ sec_name[3] = "Library Functions";
+ sec_name[4] = "Special Files";
+ sec_name[5] = "File Formats";
+ sec_name[6] = "Games";
+ sec_name[7] = "Miscellany";
+ sec_name[8] = "Administration and Privileged Commands";
+ num_sections = 8;
+ # Print heading
+ print "Content-type: text/html\n\n" > cache_tmp;
+ print "<html>\n<head>" > cache_tmp;
+ print "<title>Manual Pages - Names and Descriptions: " section ". " sec_name[section] "</title>" > cache_tmp;
+
+ print "</head>\n<body>" > cache_tmp;
+ print "<h1>Manual Pages - Names and Descriptions</h1>" > cache_tmp;
+ print "<h1>Section " section ": " sec_name[section] "</h1>" > cache_tmp;
+ "hostname" | getline hostname;
+ "date" | getline date;
+ print hostname " (" date ")" > cache_tmp;
+ # Find out the man path
+ "man -w" | getline;
+ $1 = $1 ":";
+ gsub(":", " ", $1);
+
+ find_cmd = "find " man_path " -maxdepth 1 -name whatis -printf '%p '";
+ find_cmd | getline whatis_files;
+ close(find_cmd);
+
+ if (whatis_files == "") {
+ print "Content-type: text/html\n\n";
+ print "<head>";
+ print "<title>Manwhatis - Error updating index</title>";
+ print "</head>\n<body>";
+ print "Unable to find whatis files - Sorry."
+ print "</body>";
+ exit;
+ }
+ # Try to parse valid entries - those that contain ([0-9])
+ # Note that egrep is sometimes in /bin, sometimes in /usr/bin
+ extract_cmd = "egrep -h '\\(" section "[A-Za-z]*\\)' " whatis_files ;
+
+ print "<br>Manual pages referenced in " whatis_files "<p>" > cache_tmp;
+
+ # Note that sort sometimes lives in /bin and sometimes in /usr/bin
+ sort_cmd = "sort -f >> " sort_tmp;
+
+ while ( (extract_cmd | getline) > 0 ) {
+ if (bracket_pos = index($0, "(")) {
+ sec_full_num = substr($0, bracket_pos + 1, index($0, ")") - bracket_pos - 1);
+ names = substr($0, 1, bracket_pos - 2);
+ # Get rid of blanks and commas.
+ n = split(names, name_list, " *, *");
+ description = substr($0, bracket_pos + length(sec_full_num) + 2);
+ # Get rid of AT&T
+ gsub("&", "\&amp;", description);
+ # Generate a entry for each name
+ for (i = 1; i <= n; i++) {
+ print name_list[i] " " sec_full_num " " name_list[1] " / " description | sort_cmd;
+ }
+ }
+ }
+ close(extract_cmd);
+ close(sort_cmd);
+
+ while ((getline < sort_tmp) > 0) {
+
+ letter = tolower(substr($1,1,1));
+ if (letter != last_letter) {
+ if (last_letter) {
+ print "</dl><p>" > buffer_tmp;
+ }
+ last_letter = letter;
+ letter_index[++num_letters] = letter;
+ # Terminate list, start a new one
+
+ print "<h2> <a name=\"", letter, "\">", toupper(letter), "</a></h2>\n<dl>" > buffer_tmp ;
+ }
+ # Generate a <dt> for the name
+ if ($3 != last_file || $1 != last_name) { # Don't repeat the same entry link.
+ print "<dt><a href=\"" cgipath "/man2html?", $2, "+", $3, "\">", $1, "(", $2, ")", "</a>" > buffer_tmp;
+ last_file = $3;
+ last_name = $1;
+ }
+ print "<dd>", substr($0, match($0, "/") + 1) > buffer_tmp;
+ }
+ # Finish off last list
+
+ print "\n</dl><p>" > buffer_tmp;
+ close(buffer_tmp);
+
+ system("/bin/rm " sort_tmp);
+
+ # Print out alphabetic quick index and other links
+ for (i = 1; i <= num_letters; i++) {
+ print "<a href=\"#" letter_index[i] "\">" toupper(letter_index[i]) "</a>" > cache_tmp;
+ }
+ print "<hr>" > cache_tmp;
+ print "<a href=\"" cgipath "/man2html\">Return to Main Contents</a>" > cache_tmp;
+
+ print "<p>Other sections:" > cache_tmp;
+ for (i=1; i<=num_sections; i++) {
+ if (i != section) { # Dont print an entry for the section we are in
+ print "<a href=\"" cgipath "/manwhatis?" cgipath "+" i "\">" i ". " sec_name[i] "</a> " > cache_tmp;
+ }
+ }
+ print "<hr><p>" > cache_tmp;
+ # Print out the accumulated contents entries
+ while ((getline < buffer_tmp) > 0) print > cache_tmp;
+ print "<hr><p>" > cache_tmp;
+
+ for (i = 1; i <= num_letters; i++) {
+ print "<a href=\"#" letter_index[i] "\">" toupper(letter_index[i]) "</a>" > cache_tmp;
+ }
+ print "<hr>" > cache_tmp;
+ print "<p><a href=\"" cgipath "/man2html\">Return to Main Contents</a>" > cache_tmp;
+
+ print "<p>Other sections:" > cache_tmp;
+ for (i=1; i<=num_sections; i++) {
+ if (i != section) { # Dont print an entry for the section we are in
+ print "<a href=\"" cgipath "/manwhatis?" cgipath "+" i "\">" i ". " sec_name[i] "</a> " > cache_tmp;
+ }
+ }
+ print "</body>" > cache_tmp;
+ print "</html>" > cache_tmp;
+ system("/bin/mv " cache_tmp " " cache);
+ system("/bin/rm " buffer_tmp);
+ }
+ system("/bin/cat " cache);
+ exit;
+}