1/*++
2/* NAME
3/*	mkmap_cdb 3
4/* SUMMARY
5/*	create or open database, CDB style
6/* SYNOPSIS
7/*	#include <mkmap.h>
8/*
9/*	MKMAP	*mkmap_cdb_open(path)
10/*	const char *path;
11/*
12/* DESCRIPTION
13/*	This module implements support for creating DJB's CDB "constant
14/*	databases".
15/*
16/*	mkmap_cdb_open() take a file name, append the ".cdb.tmp" suffix,
17/*	create the named DB database.  On close, this file renamed to
18/*	file name with ".cdb" suffix appended (without ".tmp" part).
19/*	This routine is a CDB-specific helper for the more
20/*	general mkmap_open() interface.
21/*
22/*	All errors are fatal.
23/* SEE ALSO
24/*	dict_cdb(3), CDB dictionary interface.
25/* LICENSE
26/* .ad
27/* .fi
28/*	The Secure Mailer license must be distributed with this software.
29/* AUTHOR(S)
30/*	Written by Michael Tokarev <mjt@tls.msk.ru> based on mkmap_db by
31/*	Wietse Venema
32/*	IBM T.J. Watson Research
33/*	P.O. Box 704
34/*	Yorktown Heights, NY 10598, USA
35/*--*/
36
37/* System library. */
38
39#include <sys_defs.h>
40
41#ifdef HAS_CDB
42
43/* Utility library. */
44
45#include <mymalloc.h>
46#include <dict.h>
47
48/* Application-specific. */
49
50#include "mkmap.h"
51#include <dict_cdb.h>
52
53/* This is a dummy module, since CDB has all the functionality
54 * built-in, as cdb creation requires one global lock anyway. */
55
56MKMAP *mkmap_cdb_open(const char *unused_path)
57{
58    MKMAP  *mkmap = (MKMAP *) mymalloc(sizeof(*mkmap));
59    mkmap->open = dict_cdb_open;
60    mkmap->after_open = 0;
61    mkmap->after_close = 0;
62    return (mkmap);
63}
64
65#endif /* HAS_CDB */
66