1*9508192eSchristos.\" Id: mandoc.db.5,v 1.5 2016/08/01 12:27:15 schwarze Exp 2fec65c98Schristos.\" 3*9508192eSchristos.\" Copyright (c) 2014, 2016 Ingo Schwarze <schwarze@openbsd.org> 4fec65c98Schristos.\" 5fec65c98Schristos.\" Permission to use, copy, modify, and distribute this software for any 6fec65c98Schristos.\" purpose with or without fee is hereby granted, provided that the above 7fec65c98Schristos.\" copyright notice and this permission notice appear in all copies. 8fec65c98Schristos.\" 9fec65c98Schristos.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10fec65c98Schristos.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11fec65c98Schristos.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12fec65c98Schristos.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13fec65c98Schristos.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14fec65c98Schristos.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15fec65c98Schristos.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16fec65c98Schristos.\" 17*9508192eSchristos.Dd August 1, 2016 18fec65c98Schristos.Dt MANDOC.DB 5 19fec65c98Schristos.Os 20fec65c98Schristos.Sh NAME 21fec65c98Schristos.Nm mandoc.db 22fec65c98Schristos.Nd manual page database 23fec65c98Schristos.Sh DESCRIPTION 24fec65c98SchristosThe 25fec65c98Schristos.Nm 26*9508192eSchristosfile format is used to store information about installed manual 27fec65c98Schristospages to facilitate semantic searching for manuals. 28fec65c98SchristosEach manual page tree contains its own 29fec65c98Schristos.Nm 30fec65c98Schristosfile; see 31fec65c98Schristos.Sx FILES 32fec65c98Schristosfor examples. 33fec65c98Schristos.Pp 34fec65c98SchristosSuch database files are generated by 35fec65c98Schristos.Xr makewhatis 8 36fec65c98Schristosand used by 37*9508192eSchristos.Xr man 1 , 38fec65c98Schristos.Xr apropos 1 39fec65c98Schristosand 40fec65c98Schristos.Xr whatis 1 . 41fec65c98Schristos.Pp 42*9508192eSchristosThe file format uses three datatypes: 43*9508192eSchristos.Pp 44*9508192eSchristos.Bl -dash -compact -offset 2n -width 1n 45*9508192eSchristos.It 46*9508192eSchristos32-bit signed integer numbers in big endian (network) byte ordering 47*9508192eSchristos.It 48*9508192eSchristosNUL-terminated strings 49*9508192eSchristos.It 50*9508192eSchristoslists of NUL-terminated strings, terminated by a second NUL character 51fec65c98Schristos.El 52fec65c98Schristos.Pp 53*9508192eSchristosNumbers are aligned to four-byte boundaries; where they follow 54*9508192eSchristosstrings or lists of strings, padding with additional NUL characters 55*9508192eSchristosoccurs. 56*9508192eSchristosSome, but not all, numbers point to positions in the file. 57*9508192eSchristosThese pointers are measured in bytes, and the first byte of the 58*9508192eSchristosfile is considered to be byte 0. 59fec65c98Schristos.Pp 60*9508192eSchristosEach file consists of: 61*9508192eSchristos.Pp 62*9508192eSchristos.Bl -dash -compact -offset 2n -width 1n 63*9508192eSchristos.It 64*9508192eSchristosOne magic number, 0x3a7d0cdb. 65*9508192eSchristos.It 66*9508192eSchristosOne version number, currently 1. 67*9508192eSchristos.It 68*9508192eSchristosOne pointer to the macros table. 69*9508192eSchristos.It 70*9508192eSchristosOne pointer to the final magic number. 71*9508192eSchristos.It 72*9508192eSchristosThe pages table (variable length). 73*9508192eSchristos.It 74*9508192eSchristosThe macros table (variable length). 75*9508192eSchristos.It 76*9508192eSchristosThe magic number once again, 0x3a7d0cdb. 77*9508192eSchristos.El 78*9508192eSchristos.Pp 79*9508192eSchristosThe pages table contains one entry for each physical manual page 80*9508192eSchristosfile, no matter how many hard and soft links it may have in the 81*9508192eSchristosfile system. 82*9508192eSchristosThe pages table consists of: 83*9508192eSchristos.Pp 84*9508192eSchristos.Bl -dash -compact -offset 2n -width 1n 85*9508192eSchristos.It 86*9508192eSchristosThe number of pages in the database. 87*9508192eSchristos.It 88*9508192eSchristosFor each page: 89*9508192eSchristos.Bl -dash -compact -offset 2n -width 1n 90*9508192eSchristos.It 91*9508192eSchristosOne pointer to the list of names. 92*9508192eSchristos.It 93*9508192eSchristosOne pointer to the list of sections. 94*9508192eSchristos.It 95*9508192eSchristosOne pointer to the list of architectures 96*9508192eSchristosor 0 if the page is machine-independent. 97*9508192eSchristos.It 98*9508192eSchristosOne pointer to the one-line description string. 99*9508192eSchristos.It 100*9508192eSchristosOne pointer to the list of filenames. 101*9508192eSchristos.El 102*9508192eSchristos.It 103*9508192eSchristosFor each page, the list of names. 104*9508192eSchristosEach name is preceded by a single byte indicating the sources of the name. 105*9508192eSchristosThe meaning of the bits is: 106*9508192eSchristos.Bl -dash -compact -offset 2n -width 1n 107*9508192eSchristos.It 108*9508192eSchristos0x10: The name appears in a filename. 109*9508192eSchristos.It 110*9508192eSchristos0x08: The name appears in a header line, i.e. in a .Dt or .TH macro. 111*9508192eSchristos.It 112*9508192eSchristos0x04: The name is the first one in the title line, i.e. it appears 113*9508192eSchristosin the first .Nm macro in the NAME section. 114*9508192eSchristos.It 115*9508192eSchristos0x02: The name appears in any .Nm macro in the NAME section. 116*9508192eSchristos.It 117*9508192eSchristos0x01: The name appears in an .Nm block in the SYNOPSIS section. 118*9508192eSchristos.El 119*9508192eSchristos.It 120*9508192eSchristosFor each page, the list of sections. 121*9508192eSchristosEach section is given as a string, not as a number. 122*9508192eSchristos.It 123*9508192eSchristosFor each architecture-dependent page, the list of architectures. 124*9508192eSchristos.It 125*9508192eSchristosFor each page, the one-line description string taken from the .Nd macro. 126*9508192eSchristos.It 127*9508192eSchristosFor each page, the list of filenames relative to the root of the 128*9508192eSchristosrespective manpath. 129*9508192eSchristosThis list includes hard links, soft links, and links simulated 130*9508192eSchristoswith .so 131*9508192eSchristos.Xr roff 7 132*9508192eSchristosrequests. 133*9508192eSchristosThe first filename is preceded by a single byte 134*9508192eSchristoshaving the following significance: 135*9508192eSchristos.Bl -dash -compact -offset 2n -width 1n 136*9508192eSchristos.It 137*9508192eSchristos.Dv FORM_SRC No = 0x01 : 138*9508192eSchristosThe file format is 139fec65c98Schristos.Xr mdoc 7 140fec65c98Schristosor 141*9508192eSchristos.Xr man 7 . 142*9508192eSchristos.It 143*9508192eSchristos.Dv FORM_CAT No = 0x02 : 144*9508192eSchristosThe manual page is preformatted. 145*9508192eSchristos.El 146*9508192eSchristos.It 147*9508192eSchristosZero to three NUL bytes for padding. 148*9508192eSchristos.El 149*9508192eSchristos.Pp 150*9508192eSchristosThe macros table consists of: 151*9508192eSchristos.Pp 152*9508192eSchristos.Bl -dash -compact -offset 2n -width 1n 153*9508192eSchristos.It 154*9508192eSchristosThe number of different macro keys, currently 36. 155*9508192eSchristosThe ordering of macros is defined in 156*9508192eSchristos.In mansearch.h 157*9508192eSchristosand the significance of the macro keys is documented in 158fec65c98Schristos.Xr apropos 1 . 159*9508192eSchristos.It 160*9508192eSchristosFor each macro key, one pointer to the respective macro table. 161*9508192eSchristos.It 162*9508192eSchristosFor each macro key, the macro table (variable length). 163*9508192eSchristos.El 164*9508192eSchristos.Pp 165*9508192eSchristosEach macro table consists of: 166*9508192eSchristos.Pp 167*9508192eSchristos.Bl -dash -compact -offset 2n -width 1n 168*9508192eSchristos.It 169*9508192eSchristosThe number of entries in the table. 170*9508192eSchristos.It 171*9508192eSchristosFor each entry: 172*9508192eSchristos.Bl -dash -compact -offset 2n -width 1n 173*9508192eSchristos.It 174*9508192eSchristosOne pointer to the value of the macro key. 175*9508192eSchristosEach value is a string of text taken from some macro invocation. 176*9508192eSchristos.It 177*9508192eSchristosOne pointer to the list of pages. 178*9508192eSchristos.El 179*9508192eSchristos.It 180*9508192eSchristosFor each entry, the value of the macro key. 181*9508192eSchristos.It 182*9508192eSchristosZero to three NUL bytes for padding. 183*9508192eSchristos.It 184*9508192eSchristosFor each entry, one or more pointers to pages in the pages table, 185*9508192eSchristospointing to the pointer to the list of names, 186*9508192eSchristosfollowed by the number 0. 187fec65c98Schristos.El 188fec65c98Schristos.Sh FILES 189fec65c98Schristos.Bl -tag -width /usr/share/man/mandoc.db -compact 190fec65c98Schristos.It Pa /usr/share/man/mandoc.db 191fec65c98SchristosThe manual page database for the base system. 192fec65c98Schristos.It Pa /usr/X11R6/man/mandoc.db 193fec65c98SchristosThe same for the 194fec65c98Schristos.Xr X 7 195fec65c98SchristosWindow System. 196fec65c98Schristos.It Pa /usr/local/man/mandoc.db 197fec65c98SchristosThe same for 198fec65c98Schristos.Xr packages 7 . 199fec65c98Schristos.El 200*9508192eSchristos.Pp 201*9508192eSchristosA program to dump 202*9508192eSchristos.Nm 203*9508192eSchristosfiles in a human-readable format suitable for 204*9508192eSchristos.Xr diff 1 205*9508192eSchristosis provided in the directory 206*9508192eSchristos.Pa /usr/src/regress/usr.bin/mandoc/db/dbm_dump/ . 207fec65c98Schristos.Sh SEE ALSO 208fec65c98Schristos.Xr apropos 1 , 209fec65c98Schristos.Xr man 1 , 210fec65c98Schristos.Xr whatis 1 , 211fec65c98Schristos.Xr makewhatis 8 212fec65c98Schristos.Sh HISTORY 213fec65c98SchristosA manual page database 214fec65c98Schristos.Pa /usr/lib/whatis 215fec65c98Schristosfirst appeared in 216fec65c98Schristos.Bx 2 . 217fec65c98SchristosThe present format first appeared in 218*9508192eSchristos.Ox 6.1 . 219fec65c98Schristos.Sh AUTHORS 220fec65c98Schristos.An -nosplit 221fec65c98SchristosThe original version of 222fec65c98Schristos.Xr makewhatis 8 223fec65c98Schristoswas written by 224fec65c98Schristos.An Bill Joy 225fec65c98Schristosin 1979. 226fec65c98SchristosThe present database format was designed by 227fec65c98Schristos.An Ingo Schwarze Aq Mt schwarze@openbsd.org 228*9508192eSchristosin 2016. 229