Home | History | Annotate | Line # | Download | only in util
      1 /*	$NetBSD: mkmap_cdb.c,v 1.3 2025/02/25 19:15:52 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 (at) 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 
     58 MKMAP  *mkmap_cdb_open(const char *unused_path)
     59 {
     60     MKMAP  *mkmap = (MKMAP *) mymalloc(sizeof(*mkmap));
     61 
     62     mkmap->open = dict_cdb_open;
     63     mkmap->after_open = 0;
     64     mkmap->after_close = 0;
     65     return (mkmap);
     66 }
     67 
     68 #endif					/* HAS_CDB */
     69