q Xr db 3 databases.
p .Nm has three modes of operation to perform upon .Ar dbfile : l -tag -width "delete" -offset indent t 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. t delete Enabled with .Fl d . Deletes the given .Ar key Ns s , and keys described in .Ar infile . t write Enabled with .Fl w . Writes the given .Ar key Ns s and .Ar value Ns s , and keys and values described in .Ar infile (in the latter case, entries are separated by .Ar insep ) . .El
p There are two mandatory arguments: .Ar type is the database type; either .Sq Sy btree or .Sq Sy hash , and .Ar dbfile is the database file to manipulate.
p Options valid for all modes are: l -tag -width Fl -offset indent . t Fl E Ar endian Set the endianness of the database. .Ar endian may be one of: l -tag -width 1n -offset indent -compact t Sy B Big endian t Sy H Host endian t Sy L Little endian .El Defaults to .Sq H (host endian). . t Fl f Ar infile Contains a list of keys (for read and delete), or .Ar insep 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. . t Fl i Keys are converted to lower case before manipulation. . t Fl N Do not include the NUL byte at the end of the key or value. . t Fl q Quiet operation. In read mode, missing keys are not considered to be an error. In delete
q Fl d and write
q Fl w modes, the result of various operations is suppressed. . t Fl T Ar visspec Control how the items specified by the .Fl S option are encoded and .Fl U option are decoded. The .Ar visspec option-argument is a string specifying .Xr strsvisx 3 flags. The string consists of one or more characters: l -tag -width 2n -offset indent -compact t Sy b .Dv VIS_NOSLASH t Sy c .Dv VIS_CSTYLE . Overrides .Sy h and .Sy o . t Sy h .Dv VIS_HTTPSTYLE . Overrides .Sy c and .Sy o . t Sy o .Dv VIS_OCTAL . Overrides .Sy c and .Sy h . t Sy s .Dv VIS_SAFE t Sy t .Dv VIS_TAB t Sy w .Dv VIS_WHITE .El
p .Fl U only supports .Fl T .Sy h .
p See .Xr vis 1 Ns 's corresponding options for the meaning of these characters, and .Xr strsvisx 3 for more detail on the flags. . .El .
p Read mode specific options are: . l -tag -width Fl -offset indent t Fl K Display key. . t Fl O Ar outsep Field separator string between key and value. Defaults to a single tab
q Sq \et . . t Fl S Ar visitem Specify items to .Xr strsvisx 3 encode. The .Ar visitem option-argument is a character specifying if the key
q Ar k , the value
q Ar v or both
q Ar b should be encoded. . . t Fl V Display value. . t Fl X Ar extravis When encoding items with .Fl S option also encode characters in .Ar extravis , per .Xr strsvisx 3 . . .El
p d -ragged -offset indent (If neither of .Fl K or .Fl V is given, both options are enabled.) .Ed .
p Write mode specific options are: l -tag -width Fl -offset indent . t Fl C Create new database, and truncate existing databases. . t Fl D Allow duplicate entries. (Requires .Fl R to be useful.) . t Fl F Ar insep Input field separator string between key and value used when parsing .Ar infile . Defaults to a single space
q Sq . . t Fl m Ar mode Octal mode of created database. Defaults to .Sq 0644 . . t Fl P Ar pagesize Set the page size of the table to .Ar pagesize bytes. If set to .Sq 0 , a database-specific default is determined, based on the block-size of the underlying file-system. Defaults to .Sq 4096 . . t Fl R Overwrite existing entries. If not specified, writing to an existing entry raises an error. . .El
p Write and delete mode specific options are: l -tag -width Fl -offset indent . t Fl U Ar unvisitem Specify items to .Xr strunvisx 3 decode. The .Ar unvisitem option-argument is a character specifying if the key
q Ar k , the value
q Ar v or both
q Ar b
should be decoded.
.
.El
.
.Sh SEE ALSO
.Xr vis 1 ,
.Xr btree 3 ,
.Xr db 3 ,
.Xr hash 3 ,
.Xr strsvisx 3 ,
.Xr strunvisx 3
.Xr makemap 8
.
.Sh HISTORY
The
.Nm
command appeared in
.Nx 2.0 .
.
.Sh AUTHORS
.An Luke Mewburn
.Aq lukem (at] NetBSD.org .