maildrop.makegdbm - quickly create GDBM files for maildrop

SYNOPSIS

maildrop.makegdbm textfile tmpfile gdbmfile

makegdbm textfile tmpfile gdbmfile

DESCRIPTION

The gdbm family of functions in maildrop provides access to the GDBM library - a library of routines that manage simple database files. The library provides a way of quickly storing and looking up key/data pairs.

You can use any program that uses the GDBM library in order to create the GDBM database files. maildrop.makegdbm is a quick utility to create GDBM files from plain text files.

The maildrop.makegdbm command may not be available to you. GDBM support in maildrop is optional, and the system administrator may choose not to install GDBM support and the maildrop.makegdbm command.

The system administrator may also install the alias makegdbm for the maildrop.makegdbm command. The makegdbm alias should only be used manually, scripts should always execute maildrop.makegdbm.

The first argument to maildrop.makegdbm is a plain text file containing key/value pairs. Each line in the text file contains a key value, followed by a tab and a data value. The data value may be omitted, which maildrop.makegdbm will default to "1". For example, the following three lines:

example.com

domain.com<tab>ok

foo.domain.com<tab>bad

Three key/value pairs are created: example.com, value "1"; domain.com, value "ok", and "foo.domain.com", value "bad".

Empty lines in textfile, and lines starting with the # character, are ignored.

textfile can be "-", in which case standard input is used.

gdbmfile is the GDBM file to create. If this file exists, its existing contents are replaced.

tmpfile is a name of a temporary file in the same directory as gdbmfile. tmpfile is used by maildrop.makegdbm to create the GDBM file, then tmpfile is renamed to gdbmfile.

This approach foregoes any need for locking in order to be able to dynamically update GDBM files used by maildrop's gdbm functions. However, maildrop.makegdbm does not use any locks on tmpfile, so multiple instances of maildrop.makegdbm using the same tmpfile are prohibited.

EXAMPLE

  maildrop.makegdbm blacklist /etc/mail/blacklist.tmp /etc/mail/blacklist.dat

Takes blacklist, and creates /etc/mail/blacklist.dat, using /etc/mail/blacklist.tmp as a temporary file.

SEE ALSO

maildrop(1), maildropgdbm(1), gdbm(3)