Merge branch 'vendor/DIFFUTILS'
[dragonfly.git] / contrib / mdocml / mandoc-db.1
1 .\"     $Id: mandoc-db.1,v 1.1 2011/04/04 10:53:15 kristaps Exp $
2 .\"
3 .\" Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4 .\"
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.
8 .\"
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.
16 .\"
17 .Dd $Mdocdate: April 4 2011 $
18 .Dt MANDOC-DB 1
19 .Os
20 .Sh NAME
21 .Nm mandoc-db
22 .Nd index UNIX manuals
23 .Sh SYNOPSIS
24 .Nm
25 .Op Fl d Ar dir
26 .Ar
27 .Sh DESCRIPTION
28 The
29 .Nm
30 utility extracts keywords from
31 .Ux
32 manuals and indexes them for fast retrieval.
33 The arguments are as follows:
34 .Bl -tag -width Ds
35 .It Fl d Ar dir
36 The directory into which to write the keyword and index databases.
37 .It Ar
38 Read input from zero or more files in
39 .Xr mdoc 7
40 or
41 .Xr man 7
42 .Ux
43 manual format.
44 .El
45 .Pp
46 By default,
47 .Nm
48 constructs the
49 .Sx Index Database
50 and
51 .Sx Keyword Database
52 in the current working directory.
53 .Pp
54 If fatal parse errors are encountered, the offending file is printed to
55 stderr, omitted from the index, and the parse continues with the next
56 input file.
57 .Ss Index Database
58 The index database,
59 .Pa mandoc.index ,
60 is a
61 .Xr recno 3
62 database of nil-terminated filenames (record length is non-zero string
63 length plus one) passed to
64 .Nm .
65 Entries are sequentially-numbered, but the filenames are unordered.
66 .Ss Keyword Database
67 The keyword database,
68 .Pa mandoc.db ,
69 is a
70 .Xr btree 3
71 database of nil-terminated keywords (record length is non-zero string
72 length plus one) mapping to a 8-byte binary field consisting of the
73 keyword type and source
74 .Sx Index Database
75 record number.
76 The type, an unsigned 32-bit integer in host order, is one of the
77 following:
78 .Pp
79 .Bl -tag -width Ds -offset indent -compact
80 .It Li 0x01
81 The name of a manual page as given in the NAME section.
82 .It Li 0x02
83 A function prototype name as given in the SYNOPSIS section.
84 .It Li 0x03
85 A utility name as given in the SYNOPSIS section.
86 .It Li 0x04
87 An include file as given in the SYNOPSIS section.
88 .It Li 0x05
89 A variable name as given in the SYNOPSIS section.
90 .El
91 .Pp
92 If a value is encountered outside of this range, the database is
93 corrupt.
94 .Pp
95 The latter four bytes are a host-ordered record number within the
96 .Sx Index Database .
97 .Pp
98 The
99 .Nm
100 utility is
101 .Ud
102 .Sh FILES
103 .Bl -tag -width Ds
104 .It Pa mandoc.db
105 A
106 .Xr btree 3
107 keyword database mapping keywords to a type and file reference in
108 .Pa mandoc.index .
109 .It Pa mandoc.db~
110 Working copy of
111 .Pa mandoc.db .
112 .It Pa mandoc.index
113 A
114 .Xr recno 3
115 database of indexed file-names.
116 .It Pa mandoc.index~
117 Working copy of
118 .Pa mandoc.index .
119 .El
120 .Sh EXIT STATUS
121 .Ex -std
122 .Sh SEE ALSO
123 .Xr mandoc 1
124 .Sh AUTHORS
125 The
126 .Nm
127 utility was written by
128 .An Kristaps Dzonsons Aq kristaps@bsd.lv .
129 .Sh CAVEATS
130 Only
131 .Xr mdoc 7
132 manuals are processed.