2003-06-26 21:13:44 +04:00
|
|
|
.\" $NetBSD: db.1,v 1.15 2003/06/26 17:13:44 wiz Exp $
|
2002-12-11 16:40:42 +03:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Luke Mewburn of Wasabi Systems.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the NetBSD
|
|
|
|
.\" Foundation, Inc. and its contributors.
|
|
|
|
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
.\" contributors may be used to endorse or promote products derived
|
|
|
|
.\" from this software without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
2003-05-19 04:28:37 +04:00
|
|
|
.Dd May 19, 2003
|
2002-12-11 16:40:42 +03:00
|
|
|
.Dt DB 1
|
|
|
|
.Os
|
|
|
|
.
|
|
|
|
.Sh NAME
|
|
|
|
.Nm db
|
|
|
|
.Nd
|
|
|
|
manipulate
|
2003-06-26 21:13:44 +04:00
|
|
|
.Xr db 3 Ns 's
|
2002-12-11 16:40:42 +03:00
|
|
|
.Xr btree 3
|
|
|
|
and
|
|
|
|
.Xr hash 3
|
|
|
|
databases
|
|
|
|
.
|
|
|
|
.Sh SYNOPSIS
|
2003-02-25 13:34:36 +03:00
|
|
|
.Nm
|
2003-05-20 12:27:39 +04:00
|
|
|
.Op Fl KiNqV
|
2002-12-11 16:40:42 +03:00
|
|
|
.Bk -words
|
2003-05-20 12:27:39 +04:00
|
|
|
.Op Fl E Ar endian
|
2003-05-19 04:27:06 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
2003-05-20 12:27:39 +04:00
|
|
|
.Op Fl f Ar infile
|
2003-05-19 04:27:06 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
2003-05-20 12:27:39 +04:00
|
|
|
.Op Fl O Ar str
|
2003-05-19 04:27:06 +04:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
2003-05-20 12:27:39 +04:00
|
|
|
.Op Fl S Ar chr
|
2002-12-11 16:40:42 +03:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
2003-05-20 12:27:39 +04:00
|
|
|
.Op Fl T Ar str
|
2002-12-11 16:40:42 +03:00
|
|
|
.Ek
|
2003-01-05 16:07:38 +03:00
|
|
|
.Bk -words
|
2003-05-20 12:27:39 +04:00
|
|
|
.Op Fl X Ar str
|
2003-01-05 16:07:38 +03:00
|
|
|
.Ek
|
2002-12-11 16:40:42 +03:00
|
|
|
.Ar type
|
|
|
|
.Ar database
|
|
|
|
.Bk -words
|
|
|
|
.Op Ar key Op Ar \&.\&.\&.
|
|
|
|
.Ek
|
|
|
|
.
|
2003-02-25 13:34:36 +03:00
|
|
|
.Nm
|
2002-12-11 16:40:42 +03:00
|
|
|
.Fl d
|
2003-05-20 12:32:42 +04:00
|
|
|
.Op Fl iNq
|
2002-12-11 16:40:42 +03:00
|
|
|
.Bk -words
|
|
|
|
.Op Fl E Ar endian
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl f Ar infile
|
|
|
|
.Ek
|
2003-05-20 12:27:39 +04:00
|
|
|
.Bk -words
|
|
|
|
.Op Fl U Ar chr
|
|
|
|
.Ek
|
2002-12-11 16:40:42 +03:00
|
|
|
.Ar type
|
|
|
|
.Ar database
|
|
|
|
.Bk -words
|
|
|
|
.Op Ar key Op Ar \&.\&.\&.
|
|
|
|
.Ek
|
|
|
|
.
|
2003-02-25 13:34:36 +03:00
|
|
|
.Nm
|
2002-12-11 16:40:42 +03:00
|
|
|
.Fl w
|
2003-05-20 12:32:42 +04:00
|
|
|
.Op Fl CDiNqR
|
2002-12-11 16:40:42 +03:00
|
|
|
.Bk -words
|
|
|
|
.Op Fl E Ar endian
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
2003-05-20 12:32:42 +04:00
|
|
|
.Op Fl F Ar sep
|
2002-12-11 16:40:42 +03:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
2003-05-20 12:32:42 +04:00
|
|
|
.Op Fl f Ar infile
|
2002-12-11 16:40:42 +03:00
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl m Ar mode
|
|
|
|
.Ek
|
2003-05-20 12:27:39 +04:00
|
|
|
.Bk -words
|
|
|
|
.Op Fl U Ar chr
|
|
|
|
.Ek
|
2002-12-11 16:40:42 +03:00
|
|
|
.Ar type
|
|
|
|
.Ar database
|
|
|
|
.Bk -words
|
|
|
|
.Op Ar key Ar value Op Ar \&.\&.\&.
|
|
|
|
.Ek
|
|
|
|
.
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Nm
|
|
|
|
allows manipulation of
|
|
|
|
.Xr btree 3
|
2002-12-18 23:16:48 +03:00
|
|
|
and
|
2002-12-11 16:40:42 +03:00
|
|
|
.Xr hash 3
|
|
|
|
.Pq Xr db 3
|
|
|
|
databases.
|
|
|
|
.Pp
|
|
|
|
.Nm
|
|
|
|
has three modes of operation:
|
|
|
|
.Bl -tag -width "delete" -offset indent
|
|
|
|
.It read
|
|
|
|
Displays the given
|
|
|
|
.Ar key Ns s ,
|
|
|
|
and keys described in
|
|
|
|
.Ar infile .
|
|
|
|
If no keys and no
|
|
|
|
.Ar infile
|
|
|
|
is specified, the entire database is displayed.
|
|
|
|
This is the default mode of operation.
|
|
|
|
.It delete
|
|
|
|
Enabled with
|
|
|
|
.Fl d .
|
|
|
|
Deletes the given
|
|
|
|
.Ar key Ns s ,
|
|
|
|
and keys described in
|
|
|
|
.Ar infile .
|
|
|
|
.It write
|
|
|
|
Enabled with
|
|
|
|
.Fl w .
|
|
|
|
Writes the given
|
|
|
|
.Ar key Ns s
|
|
|
|
and
|
|
|
|
.Ar value Ns s ,
|
|
|
|
and keys and values described in
|
2002-12-18 23:16:48 +03:00
|
|
|
.Ar infile
|
2002-12-11 16:40:42 +03:00
|
|
|
(in the latter case, entries are separated by
|
2003-05-20 12:32:42 +04:00
|
|
|
.Ar sep ) .
|
2002-12-11 16:40:42 +03:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
There are two mandatory arguments:
|
|
|
|
.Ar type
|
|
|
|
is the database type; either
|
|
|
|
.Sq Sy btree
|
|
|
|
or
|
|
|
|
.Sq Sy hash ,
|
|
|
|
and
|
|
|
|
.Ar database
|
|
|
|
is the database file to manipulate.
|
|
|
|
.Pp
|
|
|
|
Options valid for all modes are:
|
|
|
|
.Bl -tag -width Fl -offset indent
|
|
|
|
.
|
|
|
|
.It Fl E Ar endian
|
|
|
|
Set the endianness of the database.
|
|
|
|
.Ar endian
|
|
|
|
may be one of:
|
|
|
|
.Bl -tag -width 1n -offset indent -compact
|
|
|
|
.It Sy B
|
|
|
|
Big endian
|
|
|
|
.It Sy H
|
|
|
|
Host endian
|
|
|
|
.It Sy L
|
|
|
|
Little endian
|
|
|
|
.El
|
2002-12-22 14:22:49 +03:00
|
|
|
Defaults to
|
|
|
|
.Sq H
|
|
|
|
(host endian).
|
2002-12-11 16:40:42 +03:00
|
|
|
.
|
|
|
|
.It Fl f Ar infile
|
|
|
|
Contains a list of keys
|
|
|
|
(for read and delete), or
|
2003-05-20 12:32:42 +04:00
|
|
|
.Ar sep
|
2002-12-11 16:40:42 +03:00
|
|
|
separated keys and values (for write)
|
|
|
|
to be used as arguments to the given mode.
|
|
|
|
If
|
|
|
|
.Ar infile
|
|
|
|
is
|
|
|
|
.Sq Sy - ,
|
|
|
|
.Dv stdin
|
|
|
|
is used.
|
|
|
|
.
|
2003-05-20 12:27:39 +04:00
|
|
|
.It Fl i
|
|
|
|
Keys are converted to lower case before manipulation.
|
|
|
|
.
|
|
|
|
.It Fl N
|
|
|
|
Do not include the NUL byte at the end of the key or value.
|
|
|
|
.
|
|
|
|
.It Fl q
|
|
|
|
Quiet operation.
|
|
|
|
In read mode, missing keys are not considered to be an error.
|
|
|
|
In delete
|
|
|
|
.Pq Fl d
|
|
|
|
and write
|
|
|
|
.Pq Fl w
|
|
|
|
modes,
|
|
|
|
the result of various operations is suppressed.
|
|
|
|
.
|
2002-12-11 16:40:42 +03:00
|
|
|
.El
|
|
|
|
.
|
|
|
|
.Pp
|
|
|
|
Read mode specific options are:
|
2003-05-20 12:27:39 +04:00
|
|
|
.
|
2002-12-11 16:40:42 +03:00
|
|
|
.Bl -tag -width Fl -offset indent
|
|
|
|
.It Fl K
|
|
|
|
Display key.
|
2003-05-20 12:27:39 +04:00
|
|
|
.
|
|
|
|
.It Fl O Ar str
|
|
|
|
Field separator string between key and value.
|
|
|
|
Defaults to a single tab
|
|
|
|
.Pq Sq \et .
|
|
|
|
.
|
2003-05-19 04:27:06 +04:00
|
|
|
.It Fl S Ar chr
|
|
|
|
Specify items to
|
|
|
|
.Xr strvis 3
|
2003-05-20 12:27:39 +04:00
|
|
|
encode.
|
|
|
|
The
|
2003-05-19 04:27:06 +04:00
|
|
|
.Ar chr
|
|
|
|
option-argument is a character specifying if the key
|
|
|
|
.Pq Ar k ,
|
|
|
|
the value
|
|
|
|
.Pq Ar v
|
|
|
|
or both
|
|
|
|
.Pq Ar b
|
|
|
|
should be encoded.
|
2003-05-20 12:27:39 +04:00
|
|
|
.
|
2003-05-19 04:27:06 +04:00
|
|
|
.It Fl T Ar str
|
|
|
|
Control how the items specified by the
|
|
|
|
.Fl S
|
2003-05-20 12:27:39 +04:00
|
|
|
option are encoded.
|
|
|
|
The
|
2003-05-19 04:27:06 +04:00
|
|
|
.Ar str
|
|
|
|
option-argument is a string specifying
|
|
|
|
.Xr strvis 3
|
2003-05-20 12:27:39 +04:00
|
|
|
options.
|
|
|
|
The string consists of the specification characters
|
2003-05-19 04:27:06 +04:00
|
|
|
.Cm b , c , o ,
|
|
|
|
.Cm s , t ,
|
|
|
|
and
|
|
|
|
.Cm w .
|
|
|
|
See
|
|
|
|
.Xr vis 1 's
|
|
|
|
corresponding options for the meaning of these characters.
|
2003-05-20 12:27:39 +04:00
|
|
|
.
|
|
|
|
.It Fl V
|
|
|
|
Display value.
|
|
|
|
.
|
2003-05-19 04:27:06 +04:00
|
|
|
.It Fl X Ar str
|
|
|
|
When encoding items with
|
|
|
|
.Fl S
|
|
|
|
option also encode characters in
|
|
|
|
.Ar str ,
|
|
|
|
per
|
|
|
|
.Xr svis 3 .
|
2002-12-29 14:17:04 +03:00
|
|
|
.
|
2002-12-11 16:40:42 +03:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
.Bd -ragged -offset indent
|
|
|
|
(If neither of
|
|
|
|
.Fl K
|
|
|
|
or
|
|
|
|
.Fl V
|
|
|
|
is given, both options are enabled.)
|
|
|
|
.Ed
|
|
|
|
.
|
|
|
|
.Pp
|
|
|
|
Write mode specific options are:
|
|
|
|
.Bl -tag -width Fl -offset indent
|
|
|
|
.
|
|
|
|
.It Fl C
|
|
|
|
Create new database, and truncate existing databases.
|
|
|
|
.
|
|
|
|
.It Fl D
|
|
|
|
Allow duplicate entries.
|
|
|
|
(Requires
|
|
|
|
.Fl R
|
|
|
|
to be useful.)
|
|
|
|
.
|
2003-05-20 12:32:42 +04:00
|
|
|
.It Fl F Ar sep
|
2002-12-11 16:40:42 +03:00
|
|
|
Field separator between key and value used when parsing
|
|
|
|
.Ar infile .
|
2002-12-22 14:22:49 +03:00
|
|
|
Defaults to a single space
|
|
|
|
.Pq Sq \ .
|
2002-12-11 16:40:42 +03:00
|
|
|
.
|
|
|
|
.It Fl m Ar mode
|
|
|
|
Octal mode of created database.
|
2002-12-22 14:22:49 +03:00
|
|
|
Defaults to
|
|
|
|
.Sq 0644 .
|
2002-12-11 16:40:42 +03:00
|
|
|
.
|
2003-05-20 12:27:39 +04:00
|
|
|
.It Fl R
|
|
|
|
Overwrite existing entries.
|
|
|
|
If not specified, writing to an existing entry raises an error.
|
|
|
|
.
|
2002-12-11 16:40:42 +03:00
|
|
|
.El
|
2003-05-19 04:27:06 +04:00
|
|
|
.Pp
|
|
|
|
Write and delete mode specific options are:
|
|
|
|
.Bl -tag -width Fl -offset indent
|
|
|
|
.
|
|
|
|
.It Fl U Ar chr
|
|
|
|
Specify items to
|
|
|
|
.Xr strunvis 3
|
2003-05-20 12:27:39 +04:00
|
|
|
decode.
|
|
|
|
The
|
2003-05-19 04:27:06 +04:00
|
|
|
.Ar chr
|
|
|
|
option-argument is a character specifying if the key
|
|
|
|
.Pq Ar k ,
|
|
|
|
the value
|
|
|
|
.Pq Ar v
|
|
|
|
or both
|
|
|
|
.Pq Ar b
|
|
|
|
should be decoded.
|
|
|
|
.
|
|
|
|
.El
|
2002-12-11 16:40:42 +03:00
|
|
|
.
|
|
|
|
.Sh SEE ALSO
|
2003-05-19 04:27:06 +04:00
|
|
|
.Xr vis 1 ,
|
2002-12-11 16:40:42 +03:00
|
|
|
.Xr btree 3 ,
|
|
|
|
.Xr db 3 ,
|
|
|
|
.Xr hash 3 ,
|
2003-05-19 04:27:06 +04:00
|
|
|
.Xr strunvis 3 ,
|
|
|
|
.Xr strvis 3 ,
|
|
|
|
.Xr svis 3 ,
|
2002-12-11 16:40:42 +03:00
|
|
|
.Xr makemap 8
|
|
|
|
.
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
command appeared in
|
2003-01-20 00:25:36 +03:00
|
|
|
.Nx 2.0 .
|
2002-12-11 16:40:42 +03:00
|
|
|
.
|
2002-12-18 23:16:48 +03:00
|
|
|
.Sh AUTHORS
|
2003-02-14 18:59:16 +03:00
|
|
|
.An Luke Mewburn
|
|
|
|
.Aq lukem@NetBSD.org .
|