1 .\" $Id: man.cgi.8,v 1.2 2014/07/11 21:30:52 schwarze Exp $
3 .\" Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 .Dd $Mdocdate: July 11 2014 $
22 .Nd CGI program to search and display manual pages
26 CGI program searches for manual pages on a WWW server
27 and displays them to HTTP clients,
28 providing functionality equivalent to the
33 It can use multiple manual trees in parallel.
34 .Ss HTML search interface
35 At the top of each generated HTML page,
37 displays a search form containing these elements:
42 button to send a search request from the client to the server,
43 to be clicked after filling in the following input box(es).
45 An input box for search queries, expecting an
47 using the syntax described in the
49 manual; filling this in is required for each search.
51 An input box for an optional section number.
52 If one is provided, it has the same effect as the
56 Otherwise, pages from all sections are shown.
58 An input box for an optional architecture name.
59 If one is provided, it has the same effect as the
63 By default, pages for all architectures are shown.
65 A dropdown menu to select a manual tree.
66 If the configuration file
67 .Pa /var/www/man/manpath.conf
68 contains only one manpath, the dropdown menu is not shown.
69 By default, the first manpath given in the file is used.
73 button to undo any changes to the input boxes and the dropdown menu
74 and reset them to the values contained in the
80 program generates five kinds of output pages:
83 This is returned when calling
89 It serves as a starting point for using the program
90 and shows the search form only.
92 Lists are returned when searches match more than one manual page.
93 The first column shows the names and section numbers of manuals
95 The second column shows the one-line descriptions of the manuals.
97 This output format is used when a search matches exactly one
98 manual page, or when a link on a list page or an
100 link on another manual page is followed.
101 .It A no-result page.
102 This is shown when a search request returns no results -
103 eiher because it violates the query syntax, or because
104 the search does not match any manual pages.
106 This cannot happen by merely clicking the
108 button, but only by manually entering an invalid URI.
109 It does not show the search form, but only an error message
110 and a link back to the index page.
113 For each manual tree, create one first-level subdirectory below
115 The name of one of these directories is called a
119 Create a single ASCII text file
120 .Pa /var/www/man/manpath.conf
121 containing the names of these directories, one per line.
122 The directory given first is used as the default manpath.
124 Inside each of these directories, use the same directory and file
125 structure as found below
127 that is, second-level subdirectories
128 .Pa /var/www/man/*/man1 , /var/www/man/*/man2
129 etc. containing source
133 manuals with file name extensions matching the section numbers,
134 second-level subdirectories
135 .Pa /var/www/man/*/cat1 , /var/www/man/*/cat2
136 etc. containing preformatted manuals with the file name extension
138 and optional third-level subdirectories for architectures.
143 database inside each manpath.
145 Configure your web server to execute CGI programs located in
151 proxy daemon is needed to translate FastCGI requests to plain old CGI.
154 uniform resource identifiers are not needed for interactive use,
155 but can be useful for deep linking.
163 The host name and a following slash.
165 The path to the program, normally
166 .Pa cgi-bin/man.cgi/ .
168 A page name, which can be
170 which is the default and can be omitted,
177 only, a slash, the manpath, another slash,
178 and the name of the requested file, for example
179 .Pa /OpenBSD-current/man1/mandoc.1 .
183 only, a query string starting with a question mark
185 .Ar key Ns = Ns Ar value
186 pairs, separated by ampersands, for example
187 .Pa ?manpath=OpenBSD-current&expr=mandoc .
202 For backward compatibility with the traditional
205 is supported as an alias for
213 The web server may pass the following CGI variables to
217 An optional path to the directory containing the CSS files,
218 to be specified relative to the server's document root,
219 and to be specified without a trailing slash.
220 When not specified, the CSS files
221 are assumed to be in the document root.
222 This is used in generated HTML code.
224 The FQDN of the (possibly virtual) host the HTTP server is running on.
227 headers in HTTP 303 responses.
231 data directory to be used instead of
233 relative to the web server
235 directory, to be specified without a trailing slash.
236 This is prepended to the manpath when opening
238 and manual page files.
240 The final part of the URI path passed from the client to the server,
243 and ending before the
247 page to aquire the manpath and filename it needs.
249 The HTTP query string passed from the client to the server.
250 It is the final part of the URI, after the question mark.
253 page to acquire the named parameters it needs.
257 binary relative to the server root, usually
258 .Pa /cgi-bin/man.cgi .
259 This is used for generating URIs to be embedded
260 in generated HTML code and HTTP headers.
268 All the following paths are specified relative to this directory.
269 .It Pa /cgi-bin/man.cgi
272 program relative to the server root.
276 The path to the server document root relative to the server root.
277 This is part of the web server configuration and not specific to
279 .It Pa /htdocs/man-cgi.css
280 A style sheet for general
282 styling, referenced from each generated HTML page.
283 .It Pa /htdocs/man.css
286 HTML styling, referenced from each generated HTML page after
291 data directory containing all the manual trees.
294 .It Pa /man/manpath.conf
295 The list of available manpaths, one per line.
296 .It Pa /man/OpenBSD-current/man1/mandoc.1
299 source file located below the
306 CGI program is call-compatible with queries from the traditional
308 script by Wolfram Schneider.
309 However, the results may not be quite the same.
320 first appeared in mdocml-1.12.1 (March 2012).
321 The current SQLite3-based version first appeared in
327 program was written by
328 .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
329 and ported to the SQLite3-based
332 .An Ingo Schwarze Aq Mt schwarze@openbsd.org .