1.\" $OpenBSD: cap_mkdb.1,v 1.21 2019/09/02 21:18:41 deraadt Exp $ 2.\" $NetBSD: cap_mkdb.1,v 1.4 1995/03/26 03:59:36 glass Exp $ 3.\" 4.\" Copyright (c) 1992, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)cap_mkdb.1 8.1 (Berkeley) 6/6/93 32.\" 33.Dd $Mdocdate: September 2 2019 $ 34.Dt CAP_MKDB 1 35.Os 36.Sh NAME 37.Nm cap_mkdb 38.Nd create capability database 39.Sh SYNOPSIS 40.Nm cap_mkdb 41.Op Fl v 42.Op Fl f Ar outfile 43.Ar file1 44.Op Ar file2 ... 45.Sh DESCRIPTION 46.Nm 47builds a hashed database out of the 48.Xr cgetent 3 49logical database constructed by the concatenation of the specified 50files. 51.Pp 52The database is named by the basename of the first file argument and 53the string 54.Dq .db . 55The 56.Xr cgetent 3 57routines can access the database in this form much more quickly 58than they can the original text file(s). 59.Pp 60The 61.Dq tc 62capabilities of the records are expanded before the 63record is stored into the database. 64.Pp 65The options are as follows: 66.Bl -tag -width Ds 67.It Fl f Ar outfile 68Specify a different database basename. 69.It Fl v 70Print out the number of capability records in the database. 71.El 72.Pp 73Each record is stored in the database using two different types of keys. 74.Pp 75The first type is a key which consists of the first capability of 76the record (not including the trailing colon 77.Pq Ql \&: ) 78with a data 79field consisting of a special byte followed by the rest of the record. 80The special byte is either a 0 or 1, where a 0 means that the record 81is okay, and a 1 means that there was a 82.Dq tc 83capability in the record 84that couldn't be expanded. 85.Pp 86The second type is a key which consists of one of the names from the 87first capability of the record with a data field consisting a special 88byte followed by the first capability of the record. 89The special byte is a 2. 90.Pp 91In normal operation names are looked up in the database, resulting 92in a key/data pair of the second type. 93The data field of this key/data pair is used to look up a key/data 94pair of the first type which has the real data associated with the 95name. 96.Sh EXIT STATUS 97.Ex -std cap_mkdb 98.Sh SEE ALSO 99.Xr cgetent 3 , 100.Xr dbopen 3 , 101.Xr termcap 5 102