Next / Previous / Contents / TCC Help System / NM Tech homepage

2. The path names of man pages

The standard location for man pages is in subdirectories of “/usr/share/man”. These subdirectories' names must start with “man”. A cursory survey of man page directories in various installs found directories named man0p, man1, man1p, man1x, man2, man2x, man3, man3p, man3x, man4, man4x, man5, man5x, man6, man6x, man7, man7x, man8, man8x, man9, man9x, manl, and mann.

The only directory structure that matters is the one on the web server where this script is installed. At this writing (December 2007), the aging infohost server has only man1 through man9, plus mann, with no suffixes. However, this script will be more liberal, in anticipation of future installs that may be more like client machines.

The language of man pages is groff; for details, see the project page at gnu.org.

The actual files are compressed with gzip, so their names end with .gz.

Here are some examples of actual path names:

/usr/share/man/man1/ls.1.gz
/usr/share/man/man1/Magick++-config.1.gz
/usr/share/man/man0p/math.h.0p.gz
/usr/share/man/man3/tan.3.gz
/usr/share/man/man3/Thread::Queue.3pm.gz
/usr/share/man/man3/trace.3x.gz
/usr/share/man/man3/ui.3ssl.gz
/usr/share/man/man3/vars.3pm.gz
/usr/share/man/man1p/nohup.1p.gz
/usr/share/man/man6x/bouncingcow.6x.gz

In order to allow access only to legitimate man pages, this script will limit access to pathnames of this general form:

/usr/share/man/manS/P.SX.gz
S

The section identifier. This must be a single digit from 0 to 9 inclusive, optionally followed by either “p” or “x”.

P

Valid page names must start with a letter or underbar (_). All additional characters must be letters, digits, underbars, or any of the characters {-, +, ., :}.

X

An optional suffix that appears in the file name right before the final “.gz”. This suffix, if any, may contain only letters.