|MAN.CGI(8)||System Manager's Manual||MAN.CGI(8)|
man.cgiCGI program searches for manual pages on a WWW server and displays them to HTTP clients, providing functionality equivalent to the man(1) and apropos(1) utilities. It can use multiple manual trees in parallel.
man.cgidisplays a search form containing these elements:
The expression is broken into words at whitespace. Whitespace characters and backslashes can be escaped by prepending a backslash. The effect of prepending a backslash to another character is undefined; in the current implementation, it has no effect.
-soption. Otherwise, pages from all sections are shown.
-Soption. By default, pages for all architectures are shown.
man.cgiprogram generates five kinds of output pages:
PATH_INFOand without a
QUERY_STRING. It serves as a starting point for using the program and shows the search form only.
Xrlink on another manual page is followed.
man.cgi. Create a single ASCII text file /var/www/man/manpath.conf containing the names of these directories, one per line. The directory given first is used as the default manpath.
Inside each of these directories, use the same directory and file structure as found below /usr/share/man, that is, second-level subdirectories /var/www/man/*/man1, /var/www/man/*/man2 etc. containing source mdoc(7) and man(7) manuals with file name extensions matching the section numbers, second-level subdirectories /var/www/man/*/cat1, /var/www/man/*/cat2 etc. containing preformatted manuals with the file name extension ‘0’, and optional third-level subdirectories for architectures. Use makewhatis(8) to create a mandoc.db(5) database inside each manpath.
man.cgi, first copy
cgi.h.example to cgi.h and
edit it according to your needs. It contains the following compile-time
man.cgidata directory relative to the web server chroot(2) directory, to be specified with a leading slash and without a trailing slash. It needs to have at least one component; the root directory cannot be used for this purpose. The files manpath.conf, header.html, and footer.html are looked up in this directory. It is also prepended to the manpath when opening mandoc.db(5) and manual page files.
After editing cgi.h, run
and copy the resulting binary to the proper location, for example using the command:
In addition to that, make sure the default manpath contains the files man1/apropos.1 and man8/man.cgi.8, or the documentation links at the bottom of the index page will not work.
man.cgiuniform resource identifiers are not needed for interactive use, but can be useful for deep linking. They consist of:
SCRIPT_NAME, preceded by a slash unless empty.
arch, corresponding to apropos(1)
-S, respectively, and
apropos, which is a boolean parameter to select or deselect the apropos(1) query mode. For backward compatibility with the traditional
sektionis supported as an alias for
man.cgican only contain the following characters:
In particular, this applies to all manpaths and architecture names.
PATH_INFO. This is ignored by
man.cgi. When constructing URIs for links and redirections, the
SCRIPT_NAMEpreprocessor constant is used instead.
SCRIPT_NAMEand ending before the
QUERY_STRING. It is used by the
showpage to acquire the manpath and filename it needs.
searchpage to acquire the named parameters it needs.
man.cgiprogram inside the web server chroot(2) directory. A different name can be chosen, but in any case, it needs to be configured in httpd.conf(5).
man.cgidata directory containing all the manual trees. Can be overridden by
man.cgireports an internal server error and exits without doing anything.
man.cgiCGI program is call-compatible with queries from the traditional man.cgi script by Wolfram Schneider. However, the output looks quite different.
man.cgibased on mandoc(1) first appeared in mdocml-1.12.1 (March 2012). The current mandoc.db(5) database format first appeared in OpenBSD 6.1.
man.cgiprogram was written by Kristaps Dzonsons <email@example.com> and is maintained by Ingo Schwarze <firstname.lastname@example.org>, who also designed and implemented the database format.
|May 20, 2018||OpenBSD 6.4|