xref: /netbsd-src/usr.bin/man/man.conf.5 (revision c24f08c1083a951ad0f16e653302cf1ec7601219)
1.\"	$NetBSD: man.conf.5,v 1.30 2022/06/19 18:51:06 gutteridge Exp $
2.\"
3.\" Copyright (c) 1989, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"	@(#)man.conf.5	8.5 (Berkeley) 1/2/94
31.\"
32.Dd June 18, 2022
33.Dt MAN.CONF 5
34.Os
35.Sh NAME
36.Nm man.conf
37.Nd configuration file for manual pages
38.Sh DESCRIPTION
39The
40.Nm
41file contains the default configuration used by
42.Xr man 1 ,
43.Xr apropos 1 ,
44.Xr whatis 1 ,
45.Xr catman 8 ,
46and
47.Xr makemandb 8
48to find manual pages and information about manual pages (e.g., the
49.Xr whatis 1
50database).
51.Pp
52Manual pages are located by searching an ordered set of directories
53called the
54.Dq man path
55for a file that matches the name of the requested page.
56Each directory in the search path usually has a set of subdirectories
57in it (though this is not required).
58When subdirectories are used, there are normally two subdirectories
59for each section of the manual.
60One subdirectory contains formatted copies of that section's manual
61pages that can be directly displayed to a terminal, while the other
62section subdirectory contains unformatted copies of the pages (see
63.Xr nroff 1
64and
65.Xr mdoc 7 ) .
66Formatted manual pages are normally named with a trailing
67.Ql \&.0
68suffix.
69.Pp
70The
71.Nm
72file contains comment and configuration lines.
73Comment lines start with the
74.Ql #
75character.
76Blank lines are also treated as comment lines.
77Configuration lines consist of a configuration keyword followed by a
78configuration string.
79There are two types of configuration keywords: control keywords and
80section keywords.
81Control keywords must start with the
82.Ql _
83character.
84The following control keywords are currently defined:
85.Bl -tag -width Ic
86.It Ic _build
87Identifies the set of suffixes used for manual pages that must be
88formatted for display and the command that should be used to format
89them.
90Manual file names, regardless of their format, are expected to end in a
91.Dq \&.*
92pattern, i.e. a
93.Ql \&.
94followed by some suffix.
95The first field of a
96.Ic _build
97line contains a man page suffix specification.
98The suffix specification may contain the normal shell globbing characters
99.Po
100.Em not
101including csh-style curly braces
102.Pc .
103The rest of the
104.Ic _build
105line is a shell command line whose standard
106output is a formatted manual page that can be directly displayed to
107the user.
108There should be exactly one occurrence of the string
109.Ql %s
110in the shell command line, and it will
111be replaced by the name of the file which is being formatted.
112.It Ic _crunch
113Used by
114.Xr catman 8
115to determine how to crunch formatted pages
116which originally were compressed man pages.
117The first field lists a suffix which indicates what kind of compression was
118used to compress the man page.
119The rest of the line must be a shell command line, used to compress the
120formatted pages.
121There should be exactly one occurrence of the string
122.Ql %s
123in the shell command line, and it will
124be replaced by the name of the output file.
125.It Ic _default
126Contains the system-wide default man path used to search for man pages.
127.It Ic _mandb
128Defines the full pathname (not just a directory path) for a database to
129be used by the
130.Xr apropos 1
131and
132.Xr whatis 1
133commands.
134The pathname may contain the normal shell globbing characters,
135including csh-style curly braces;
136to escape a shell globbing character,
137precede it with a backslash
138.Pq Ql \e .
139.It Ic _subdir
140Contains the list (in search order) of section subdirectories which will
141be searched in any man path directory named with a trailing slash
142.Pq Ql /
143character.
144This list is also used, even if there is no trailing slash character,
145when a path is specified to the
146.Xr man 1
147utility by the user, by the
148.Ev MANPATH
149environment variable, or by the
150.Fl M
151and
152.Fl m
153options.
154.It Ic _suffix
155identifies the set of suffixes used for formatted man pages
156(the
157.Ql \&.0
158suffix is normally used here).
159Formatted man pages can be directly displayed to the user.
160Each suffix may contain the normal shell globbing characters
161.Po
162.Em not
163including csh-style curly braces
164.Pc .
165.It Ic _version
166Contains the version of the configuration file.
167.It Ic _ Ns Aq Ar machine
168Defines additional paths to be searched for the particular
169.Ar machine
170hardware name whose literal value is taken from
171.Xr uname 1
172.Fl m .
173For example, on an amd64, the
174.Ic _amd64
175control keyword is used, where
176.Ql x86
177is supplied by default as an alternate machine path to also search.
178.El
179.Pp
180Section configuration lines in
181.Nm
182consist of a section keyword naming the section and a configuration
183string that defines the directory or subdirectory path that the section's
184manual pages are located in.
185The path may contain the normal shell globbing characters,
186including csh-style curly braces;
187to escape a shell globbing character,
188precede it with a backslash
189.Pq Ql \e .
190Section keywords must not start with the
191.Ql _
192character.
193.Pp
194A section path may contain either a list of absolute directories or
195a list of relative directories (but not both).
196Relative directory paths are treated as a list of subdirectories that
197are appended to the current man path directory being searched.
198Section configuration lines with absolute directory paths (starting with
199.Ql / )
200completely replace the current man search path directory with their
201content.
202.Pp
203Section configuration lines with absolute directory paths ending
204with a trailing slash character are expected to contain subdirectories
205of manual pages, (see the keyword
206.Ic _subdir
207above).
208The
209.Ic _subdir
210subdirectory list is not applied to absolute section directories
211if there is no trailing slash.
212.Pp
213In addition to the above rules, the
214.Xr man 1
215command also always checks in each directory that it searches for
216a subdirectory with the same name as the current machine type.
217If a machine-specific subdirectory is found, it is also searched
218before the parent directory is.
219This allows the manual to contain machine-specific man pages.
220Note that the machine subdirectory does not need to be specified
221in the
222.Nm
223file.
224.Pp
225Multiple specifications for all types of
226.Nm
227configuration lines are
228cumulative and the entries are used in the order listed in the file;
229multiple entries may be listed per line, as well.
230.Sh FILES
231.Bl -tag -width Pa -compact
232.It Pa /etc/man.conf
233Standard manual configuration file.
234.El
235.Sh EXAMPLES
236Given the following
237.Nm
238file:
239.Bd -literal -offset indent
240_version	BSD.2
241_subdir		cat[123]
242_suffix		.0
243_build		.[1-9]	nroff -man %s
244_build		.tbl	tbl %s | nroff -man
245_i386		x86
246_default	/usr/share/man/
247sect3		/usr/share/man/{old/,}cat3
248.Ed
249.Pp
250By default, the command
251.Dq Li man mktemp
252will search for
253.Pa mktemp. Ns Aq Ar digit
254and
255.Pa  mktemp.tbl
256in the directories
257.Pa /usr/share/man/cat1 ,
258.Pa /usr/share/man/cat2 ,
259and
260.Pa /usr/share/man/cat3 .
261If on a machine of type
262.Dq vax ,
263the subdirectory
264.Pa vax
265in each
266directory would be searched as well, before the directory was
267searched.
268.Pp
269If
270.Pa mktemp.tbl
271was found first, the command
272.Dq Li tbl Ao Ar manual page Ac Li \&| nroff -man
273would be run to build a man page for display to the user.
274.Pp
275The command
276.Dq Li man sect3 mktemp
277would search the directories
278.Pa /usr/share/man/old/cat3
279and
280.Pa /usr/share/man/cat3 ,
281in that order, for
282the mktemp manual page.
283If a subdirectory with the same name as the current machine type
284existed in any of them, it would be searched as well, before each
285of them were searched.
286.Sh SEE ALSO
287.Xr apropos 1 ,
288.Xr machine 1 ,
289.Xr man 1 ,
290.Xr whatis 1 ,
291.Xr whereis 1 ,
292.Xr fnmatch 3 ,
293.Xr glob 3 ,
294.Xr catman 8 ,
295.Xr makemandb 8
296