1 .\" $Id: man.cgi.8,v 1.5 2014/07/13 09:39:32 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 13 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:
40 An input box for search queries, expecting
41 either a name of a manual page or an
43 using the syntax described in the
45 manual; filling this in is required for each search.
49 button to send a search request from the client to the server.
53 button to undo any changes to the input boxes and the dropdown menus
54 and reset them to the values contained in the
57 Radio buttons to select pages either by name like in
63 A dropdown menu to optionally select a manual section.
64 If one is provided, it has the same effect as the
70 Otherwise, pages from all sections are shown.
72 A dropdown menu to optionally select an architecture.
73 If one is provided, it has the same effect as the
79 By default, pages for all architectures are shown.
81 A dropdown menu to select a manual tree.
82 If the configuration file
83 .Pa /var/www/man/manpath.conf
84 contains only one manpath, the dropdown menu is not shown.
85 By default, the first manpath given in the file is used.
90 program generates five kinds of output pages:
93 This is returned when calling
99 It serves as a starting point for using the program
100 and shows the search form only.
102 Lists are returned when searches match more than one manual page.
103 The first column shows the names and section numbers of manuals
105 The second column shows the one-line descriptions of the manuals.
107 This output format is used when a search matches exactly one
108 manual page, or when a link on a list page or an
110 link on another manual page is followed.
111 .It A no-result page.
112 This is shown when a search request returns no results -
113 eiher because it violates the query syntax, or because
114 the search does not match any manual pages.
116 This cannot happen by merely clicking the
118 button, but only by manually entering an invalid URI.
119 It does not show the search form, but only an error message
120 and a link back to the index page.
123 For each manual tree, create one first-level subdirectory below
125 The name of one of these directories is called a
129 Create a single ASCII text file
130 .Pa /var/www/man/manpath.conf
131 containing the names of these directories, one per line.
132 The directory given first is used as the default manpath.
134 Inside each of these directories, use the same directory and file
135 structure as found below
137 that is, second-level subdirectories
138 .Pa /var/www/man/*/man1 , /var/www/man/*/man2
139 etc. containing source
143 manuals with file name extensions matching the section numbers,
144 second-level subdirectories
145 .Pa /var/www/man/*/cat1 , /var/www/man/*/cat2
146 etc. containing preformatted manuals with the file name extension
148 and optional third-level subdirectories for architectures.
153 database inside each manpath.
155 Configure your web server to execute CGI programs located in
161 proxy daemon is needed to translate FastCGI requests to plain old CGI.
164 uniform resource identifiers are not needed for interactive use,
165 but can be useful for deep linking.
173 The host name and a following slash.
175 The path to the program, normally
176 .Pa cgi-bin/man.cgi/ .
178 To show a single page, a slash, the manpath, another slash,
179 and the name of the requested file, for example
180 .Pa /OpenBSD-current/man1/mandoc.1 .
182 For searches, a query string starting with a question mark
184 .Ar key Ns = Ns Ar value
185 pairs, separated by ampersands, for example
186 .Pa ?manpath=OpenBSD-current&query=mandoc .
200 which is a boolean parameter to select or deselect the
203 For backward compatibility with the traditional
206 is supported as an alias for
210 The web server may pass the following CGI variables to
214 The FQDN of the (possibly virtual) host the HTTP server is running on.
217 headers in HTTP 303 responses.
219 The final part of the URI path passed from the client to the server,
222 and ending before the
226 page to aquire the manpath and filename it needs.
228 The HTTP query string passed from the client to the server.
229 It is the final part of the URI, after the question mark.
232 page to acquire the named parameters it needs.
236 binary relative to the server root, usually
237 .Pa /cgi-bin/man.cgi .
238 This is used for generating URIs to be embedded
239 in generated HTML code and HTTP headers.
247 All the following paths are specified relative to this directory.
248 .It Pa /cgi-bin/man.cgi
251 program relative to the server root.
255 The path to the server document root relative to the server root.
256 This is part of the web server configuration and not specific to
258 .It Pa /htdocs/man-cgi.css
259 A style sheet for general
261 styling, referenced from each generated HTML page.
262 .It Pa /htdocs/man.css
265 HTML styling, referenced from each generated HTML page after
270 data directory containing all the manual trees.
273 .It Pa /man/mandoc/man1/apropos.1 , /man/mandoc/man8/man.cgi.8
274 Manual pages documenting
276 itself, linked from the index page.
277 .It Pa /man/manpath.conf
278 The list of available manpaths, one per line.
279 .It Pa /man/OpenBSD-current/man1/mandoc.1
282 source file located below the
286 .Sh COMPILE-TIME DEFINES
289 An optional path to the directory containing the CSS files,
290 to be specified relative to the server's document root,
291 and to be specified without a trailing slash.
292 When not specified, the CSS files
293 are assumed to be in the document root.
294 This is used in generated HTML code.
298 data directory to be used instead of
300 relative to the web server
302 directory, to be specified without a trailing slash.
303 This is prepended to the manpath when opening
305 and manual page files.
310 CGI program is call-compatible with queries from the traditional
312 script by Wolfram Schneider.
313 However, the output may not be quite the same.
324 first appeared in mdocml-1.12.1 (March 2012).
325 The current SQLite3-based version first appeared in
331 program was written by
332 .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
333 and ported to the SQLite3-based
336 .An Ingo Schwarze Aq Mt schwarze@openbsd.org .