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