1.\"	$MirOS: src/usr.bin/cap_mkdb/cap_mkdb.1,v 1.4 2006/10/28 19:32:58 tg Exp $
2.\"	$OpenBSD: cap_mkdb.1,v 1.13 2003/06/03 02:56:06 millert Exp $
3.\"	$NetBSD: cap_mkdb.1,v 1.4 1995/03/26 03:59:36 glass Exp $
4.\"
5.\" Copyright (c) 1992, 1993
6.\"	The Regents of the University of California.  All rights reserved.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\" 3. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"	@(#)cap_mkdb.1	8.1 (Berkeley) 6/6/93
33.\"
34.Dd October 28, 2006
35.Dt CAP_MKDB 1
36.Os
37.Sh NAME
38.Nm cap_mkdb
39.Nd create capability database
40.Sh SYNOPSIS
41.Nm cap_mkdb
42.Op Fl civ
43.Op Fl f Ar outfile
44.Ar file1
45.Op Ar file2 ...
46.Sh DESCRIPTION
47.Nm
48builds a hashed database out of the
49.Xr getcap 3
50or
51.Xr terminfo 5
52logical database constructed by the concatenation of the specified
53files.
54.Pp
55The database is named by the basename of the first file argument and
56the string
57.Dq .db .
58The
59.Xr getcap 3
60routines can access the database in this form much more quickly
61than they can the original text file(s).
62.Pp
63The
64.Dq tc
65capabilities of the records are expanded before the
66record is stored into the database.
67.Pp
68The options are as follows:
69.Bl -tag -width Ds
70.It Fl c
71The last
72.Pq Dq description
73field of the first capability of the record is not stored
74as an indirect record, following both the
75.Xr termcap 5
76and
77.Xr terminfo 5
78specifications.
79Do not use this option if processing other capability databases, such as the
80.Xr vgrind 1
81language descriptions, whose records' first field do not contain a comment.
82.It Fl f Ar outfile
83Specify a different database basename.
84.It Fl i
85Expect the capability records to be parsed to be in
86.Xr terminfo 5
87format.
88.It Fl v
89Print out the number of capability records in the database.
90.El
91.Pp
92Each record is stored in the database using two different types of keys.
93.Pp
94The first type is a key which consists of the first capability of
95the record (not including the trailing colon
96.Pq Ql \&: )
97with a data
98field consisting of a special byte followed by the rest of the record.
99The special byte is either a 0 or 1, where a 0 means that the record
100is okay, and a 1 means that there was a
101.Dq tc
102capability in the record
103that couldn't be expanded.
104.Pp
105The second type is a key which consists of one of the names from the
106first capability of the record with a data field consisting a special
107byte followed by the first capability of the record.
108The special byte is a 2.
109.Pp
110In normal operation names are looked up in the database, resulting
111in a key/data pair of the second type.
112The data field of this key/data pair is used to look up a key/data
113pair of the first type which has the real data associated with the
114name.
115.Pp
116The
117.Nm
118utility exits 0 on success or >0 if an error occurred.
119.Sh FILES
120.Bl -tag -width /usr/share/misc/terminfo.db -compact
121.It Pa /usr/share/misc/termcap
122uncompiled terminal capabilities file
123.It Pa /usr/share/misc/termcap.db
124terminal capabilities database
125.It Pa /usr/share/misc/terminfo.db
126terminal information database
127.It Pa /etc/termcap
128symbolic link to
129.Pa /usr/share/misc/termcap
130.El
131.Sh SEE ALSO
132.Xr dbopen 3 ,
133.Xr getcap 3 ,
134.Xr termcap 5 ,
135.Xr terminfo 5
136