1.Dd December 15, 2011 2.Dt MAN.CGI 7 3.Os 4.Sh NAME 5.Nm man.cgi 6.Nd cgi for manpage query and display 7.Sh SYNOPSIS 8.Nm 9.Sh DESCRIPTION 10The 11.Nm 12script queries and displays manual pages. 13It interfaces with 14.Xr mandocdb 8 15databases cached with 16.Xr catman 8 . 17.Pp 18To use 19.Nm , 20create a manual cache in 21.Xr catman 8 . 22Assign this directory to the environment variable 23.Ev CACHE_DIR , 24defaulting to 25.Pa /cache/man.cgi . 26Copy the 27.Pa man.cgi 28script into your CGI directory (see 29.Sx FILES 30for other relevant files). 31.Pp 32Multiple 33.Xr catman 8 34trees may be managed by 35.Nm : 36directories under 37.Ev CACHE_DIR 38containing 39.Pa etc/catman.conf 40are identified as 41.Qq manroots . 42The path of a manroot under 43.Ev CACHE_DIR 44is converted to a name by replacing path separators with spaces. 45.Pp 46Thus, if 47.Ev CACHE_DIR 48is the default 49.Pa /cache/man.cgi , 50the web-server is jailed to 51.Pa /var/www , 52and cache subdirectories 53.Pa ./foo/1 54and 55.Pa ./bar/2 56contain 57.Pa etc/catman.conf , 58.Nm 59will assign these to manroots 60.Qq foo 1 61and 62.Qq bar 2 , 63respectively. 64These names will appear as choices when searching for manuals. 65.Pp 66If 67.Nm 68finds only one manroot, or none, then the selection box is omitted. 69If no manroot is specified during search, the first manroot is used by 70default. 71.Sh ENVIRONMENT 72.Bl -tag -width Ds 73.It Ev CACHE_DIR 74The absolute path of the 75.Xr catman 8 76cache directory. 77This must not have a trailing slash. 78.It Ev CSS_DIR 79Prepended to CSS file links in outputted HTML files. 80This must not have a trailing slash. 81.El 82.Sh FILES 83.Bl -tag -width Ds 84.It Pa etc/catman.conf 85Built by 86.Xr catman 8 87and must exist at least once under the configuration directory root. 88.It Pa man.css 89Should be visible in the server document root or within 90.Ev CSS_DIR . 91Included in each page after 92.Pa man-cgi.css , 93ostensibly for 94.Xr mandoc 1 95HTML output styling. 96.It Pa man.cgi.css 97Should be visible in the server document root or within 98.Ev CSS_DIR . 99Included in each page, ostensibly for general 100.Nm 101styling. 102.El 103.Sh COMPATIBILITY 104The 105.Nm 106script is call-compatible with queries from the traditional 107.Pa man.cgi 108script by Wolfram Schneider. 109However, the results may not be quite the same. 110.Sh SEE ALSO 111.Xr catman 8 , 112.Xr mandocdb 8 113.Sh AUTHORS 114The 115.Nm 116utility was written by 117.An Kristaps Dzonsons , 118.Mt kristaps@bsd.lv . 119.Sh CAVEATS 120If you're running in a jailed web-server, make sure the 121.Pa /tmp 122directory exists and is writable. 123The databases may need this for scratch space. 124