.TH mkdbm "" "" "Command"
.PC "Build a data base for smail"
.nf
\fB/usr/lib/mail/mkdbm [\-d] [\-f] [\-n] [\-o \fIoutput-file\^\fB] [\-v] [\-y] [\fIfile ...\^\fB]\fR
.PP
.HS
.SH Options:
.IC \fB\-d\fR
Suppress writing the extra `@' record
.IC \fB\-f\fR
Fold the key to lower case before storing it within the data base
.IC \fB\-n\fR
Suppress writing a NUL character at the end of each line
.IC "\fB\-o \fIoutput-file\fR"
Write output into file \fIoutput-file\fR
.IC \fB\-v\fR
Write statistics to the standard output
.IC \fB\-y\fR
Create a YP-compatible output file
.HE
The command
.B mkdbm
generates a data base for
.BR smail .
.PP
It forms the data key from the characters up to, but not including,
a colon (`:') or white-space character.
The data after the colon or white-space character forms
the value associated with the key.
You can use
.B mkdbm
to produce data-base files that can then be read by a
.B smail
router
.B pathalias
or its director
.BR alias-file .
By default, the router and director are configured to use the DBM
file-access protocol.
(For information on routers and directors, see the Lexicon entries for
.B routers
and
.BR directors .)
.PP
For some data bases, you can use
.B mkline
to form single-line records whose comments and extra white space are removed.
The generated data base contains a single NUL character at the
end of each key and value.
.II sendmail
It also generates a single record that contains a `@'
as a key and value; it does so for compatibility with the Berkeley
.B sendmail
command's alias files.
.PP
.B mkdbm
recognizes the following command-line options:
.IP \fB\-d\fR 0.3i
Suppress writing the extra `@' record.
.IP \fB\-f\fR
Fold the key to lower case before storing it within the data base.
.IP \fB\-n\fR
Suppress writing a NUL character at the end of each line.
Please note that this option is incompatible with
.BR smail 's
method of accessing the data-base file.
.IP "\fB\-o \fIoutput-file\fR"
Write output into
.IR output-file .
This option also sets the name for the data base.
If you do not use this option,
.B mkdbm
names the output data base after its first
.I file
argument.
If, in addition, the command line does not name an input
.IR file ,
.B mkmf
names the output file
.BR dbm .
.IP \fB\-v\fR
Write statistics to the standard output.
.IP \fB\-y\fR
.II "Yellow Pages"
Create an output file that is compatible with the Sun Yellow Pages (YP) system.
This obviates the need for keeping a copy of
.B sendmail
on your system to maintain a YP-alias data base.
.PP
If its command line does not name an input
.IR file ,
.B mkdbm
reads the standard input.
.B mkdbm
also reads the standard input if a
.I file
is named `-'; in this way, it can mix data read from the standard input with
material read from files.
.PP
Calling
.B mkdbm
with the arguments
.B \-ynd
generates a data base that is compatible with regular YP data bases.
Using just the argument
.B \-y
generates a data base that is compatible with the YP
.B mail.alias
data base.
.PP
As it creates the data base,
.B mkdbm
builds temporary files in the same directory in which it eventually
builds the output files.
When it has completed its work,
.B mkdbm
removes all data-base files that have the target name,
sleeps for one or two seconds,
then moves the newly written temporary data-base files to the target names.
This method of writing a data-base is not compatible
with the locking method used by Berkeley command
.BR sendmail .
.SH Example
As an example of the use of
.BR mkdbm
consider a file named
.BR paths ,
which contains the routing information:
.DM
	.COM sun!%s
	Stargate.COM ames!cmcl2!uiucdcs!stargate!%s
	ames ames!%s
	.ATT.COM mtune!%s
	mtune mtune!%s
.DE
.PP
Given this file, the command
.DM
	mkdbm \-f paths
.DE
.PP
produces a data base in the files
.B paths.pag
and
.B paths.dir
that contains the above entries but with the keys shifted into lower case.
For example, one entry will contain the key
.B stargate.com
with an associated value of:
.DM
	ames!cmcl2!uiucdcs!stargate!%s
.DE
.SH Files
.IS \fBdbmXXXXXX.pag\fR
.IS \fBdbmXXXXXX.dir\fR
Temporary files, created in the same directory as the output files.
.SH "See Also"
.Xr "commands," commands
.Xr "libgdbm," libgdbm
.Xr "mail [overview]," mail.o
.Xr "mkline," mkline
.Xr "pathalias," pathalias
.Xr "smail" smail
.SH Notes
Copyright \(co 1987, 1988 Ronald S. Karr and Landon Curt Noll.
Copyright \(co 1992 Ronald S. Karr.
.PP
.B mkdbm
is part of the
.B smail
package.
For a full copyright statement, see file
.BR COPYING ,
which is included with source code to
.BR smail ,
or type \fBsmail \-bc\fR
to see the distribution rights and restrictions associated with this software.
