<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <HTML ><HEAD ><link rel='stylesheet' type='text/css' href='manpage.css'> <!-- $Id: makedat.sgml,v 1.1 2001/12/23 19:37:14 mrsam Exp $ --> <!-- Copyright 1998 - 2001 Double Precision, Inc. See COPYING for --> <!-- distribution information. --> <meta name="MSSmartTagsPreventParsing" content="TRUE"> <link rel="icon" href="icon.gif" type="image/gif" /> <TITLE >makedat</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"></HEAD ><BODY CLASS="REFENTRY" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><H1 ><A NAME="MAKEDAT" ></A >makedat</H1 ><DIV CLASS="REFNAMEDIV" ><A NAME="AEN10" ></A ><H2 >Name</H2 >makedat -- create GDBM/DB files for maildrop</DIV ><DIV CLASS="REFSYNOPSISDIV" ><A NAME="AEN13" ></A ><H2 >Synopsis</H2 ><P ><B CLASS="COMMAND" >makedat</B > {-src=<VAR CLASS="REPLACEABLE" >textfile</VAR >} {-tmp=<VAR CLASS="REPLACEABLE" >tmpfile</VAR >} {-file=<VAR CLASS="REPLACEABLE" >gdbmfile</VAR >} [-cidr]</P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN23" ></A ><H2 >DESCRIPTION</H2 ><P >The gdbm family of functions in <B CLASS="COMMAND" >maildrop</B > provides access to GDBM/DB databases - simple database files. The gdbm family of functions provide a way of quickly storing and looking up key/data pairs.</P ><P >You can use any program to create GDBM/DB database files. <B CLASS="COMMAND" >makedat</B > is a quick utility to create GDBM or DB files from plain text files.</P ><P >The system administrator selects whether <B CLASS="COMMAND" >maildrop</B > uses GDBM or DB database files and whether <B CLASS="COMMAND" >makedat</B > creates GDBM or DB database files as well.</P ><P >The <B CLASS="COMMAND" >makedat</B > command may not be available to you. GDBM/DB support in <B CLASS="COMMAND" >maildrop</B > is optional, and the system administrator may choose not to install GDBM/DB support and the <B CLASS="COMMAND" >makedat</B > command.</P ><P >To see whether GDBM or DB support is being used, run the command "<B CLASS="COMMAND" >maildrop -v</B >".</P ><P >The <VAR CLASS="REPLACEABLE" >textfile</VAR > argument to <B CLASS="COMMAND" >makedat</B > 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 defaults to "1". For example, the following three lines:</P ><DIV CLASS="INFORMALEXAMPLE" ><P ></P ><A NAME="AEN41" ></A ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >example.com domain.com<tab>ok foo.domain.com<tab>bad</PRE ></TD ></TR ></TABLE ><P ></P ></DIV ><P >Three key/value pairs are created: example.com, value "1"; domain.com, value "ok", and "foo.domain.com", value "bad".</P ><P >Empty lines in <VAR CLASS="REPLACEABLE" >textfile</VAR >, and lines starting with the # character, are ignored.</P ><P ><VAR CLASS="REPLACEABLE" >textfile</VAR > can be "-", in which case standard input is used.</P ><P ><VAR CLASS="REPLACEABLE" >gdbmfile</VAR > is the GDBM/DB file to create. If this file exists, its existing contents are replaced.</P ><P ><VAR CLASS="REPLACEABLE" >tmpfile</VAR > is a name of a temporary file in the same directory as <VAR CLASS="REPLACEABLE" >gdbmfile</VAR >. <VAR CLASS="REPLACEABLE" >tmpfile</VAR > is used by <B CLASS="COMMAND" >makedat</B > to create the GDBM file, then <VAR CLASS="REPLACEABLE" >tmpfile</VAR > is renamed to <VAR CLASS="REPLACEABLE" >gdbmfile</VAR >.</P ><P >This approach foregoes any need for locking in order to be able to dynamically update GDBM/DB files used by <B CLASS="COMMAND" >maildrop</B >'s gdbm functions. However, <B CLASS="COMMAND" >makedat</B > does not use any locks on <VAR CLASS="REPLACEABLE" >tmpfile</VAR >, so multiple instances of <B CLASS="COMMAND" >makedat</B > using the same <VAR CLASS="REPLACEABLE" >tmpfile</VAR > are prohibited.</P ><P >The <VAR CLASS="OPTION" >-cidr</VAR > flag specifies that the key is an IP netblock in CIDR notation. This flag requires the <TT CLASS="APPLICATION" >Net::CIDR</TT > Perl module to be installed separately. Download Net::CIDR from <A HREF="http://www.cpan.org" TARGET="_top" >http://www.cpan.org</A >.</P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN67" ></A ><H2 >BUGS</H2 ><P >There are historical reasons why database functions in maildrop are called gdbm functions. The initial implementation used GDBM functions exclusively. The ability to use the DB library instead of the GDBM library has been added later.</P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN70" ></A ><H2 >EXAMPLE</H2 ><DIV CLASS="INFORMALEXAMPLE" ><P ></P ><A NAME="AEN72" ></A ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >makedat blacklist /etc/mail/blacklist.tmp /etc/mail/blacklist.dat</PRE ></TD ></TR ></TABLE ><P ></P ></DIV ><P >Takes <TT CLASS="FILENAME" >blacklist</TT >, and creates <TT CLASS="FILENAME" >/etc/mail/blacklist.dat</TT >, using <TT CLASS="FILENAME" >/etc/mail/blacklist.tmp</TT > as a temporary file.</P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN78" ></A ><H2 >SEE ALSO</H2 ><P ><A HREF="maildrop.html" TARGET="_top" ><SPAN CLASS="CITEREFENTRY" ><SPAN CLASS="REFENTRYTITLE" >maildrop</SPAN >(1)</SPAN ></A >, <A HREF="maildropgdbm.html" TARGET="_top" ><SPAN CLASS="CITEREFENTRY" ><SPAN CLASS="REFENTRYTITLE" >maildropgdbm</SPAN >(5)</SPAN ></A >.</P ></DIV ></BODY ></HTML >