diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-11-10 00:21:13 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-11-10 00:52:54 +0200 |
commit | 4926ea635ee23341615c351db3e4949553ca4dfb (patch) | |
tree | a1a8c4aede69cf55b5e27fa1dc1630aeeda70329 /src/main.c | |
parent | 7e4d54bd39368b36e8451d52975052c00e745f7a (diff) | |
download | mailfromd-4926ea635ee23341615c351db3e4949553ca4dfb.tar.gz mailfromd-4926ea635ee23341615c351db3e4949553ca4dfb.tar.bz2 |
Switch to libmu_dbm for DBM support.
* configure.ac (DEFAULT_DB_TYPE): New variable.
Use mu info to determine which DBM is supported.
* lib/Makefile.am (noinst_LIBRARIES): Remove libdbm.a
* lib/mf-dbm.c: remove.
* lib/mf-dbm.h: remove.
* lib/cache.c: Use libmu_dbm functions.
* lib/db.c: Likewise.
* lib/dbcfg.c: Likewise.
* lib/greylist.c: Likewise.
* lib/rate.c: Likewise.
* lib/tbf_rate.c: Likewise.
* src/builtin/db.bi: Likewise.
* src/savsrv.c: Likewise.
* src/srvcfg.c (srv_cfg_param) <database-type>: New statement.
* lib/libmf.h (config_cb_ignore): New proto.
* lib/mfdb.h (db_item_printer_t): Change signature.
* lib/utils.c (config_cb_ignore): New function.
* po/POTFILES.in: Update.
* src/Makefile.am (mailfromd_LDADD)
(calloutd_LDADD): Remove libdbm.a.
* src/calloutd.c: Update.
* src/main.c (mf_cfg_param): lock-retry-count and
lock-retry-timeout are no-op now.
* src/mfdbtool.c: Likewise.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 52 |
1 files changed, 37 insertions, 15 deletions
@@ -39,2 +39,3 @@ #include <mailutils/libargp.h> +#include <mailutils/dbm.h> @@ -46,3 +47,2 @@ #include "filenames.h" -#include "mf-dbm.h" #include "builtin.h" @@ -920,7 +920,6 @@ struct mu_cfg_param mf_cfg_param[] = { - { "lock-retry-count", mu_cfg_size, &lock_retry_count_option, 0, NULL, - N_("Retry acquiring DBM file lock this number of times.") }, - { "lock-retry-timeout", mu_cfg_callback, &lock_retry_timeout_option, 0, - config_cb_time_t, - N_("Set the time span between the two DBM locking attempts."), + { "lock-retry-count", mu_cfg_callback, 0, 0, config_cb_ignore, + N_("Ignored for backward compatibility.") }, + { "lock-retry-timeout", mu_cfg_callback, 0,0, config_cb_ignore, + N_("Ignored for backward compatibility."), N_("time") }, @@ -1005,2 +1004,33 @@ db_format_enumerator(struct db_format *fmt, void *data) +static void +list_db_formats(const char *pfx) +{ + mu_iterator_t itr; + int rc; + const char *defdb = DEFAULT_DB_TYPE; + printf("%s", pfx); + + rc = mu_dbm_impl_iterator(&itr); + if (rc) { + printf("%s\n", _("unknown")); + mu_error("%s", mu_strerror(rc)); + } else { + int i; + for (mu_iterator_first(itr), i = 0; !mu_iterator_is_done(itr); + mu_iterator_next(itr), i++) { + struct mu_dbm_impl *impl; + + mu_iterator_current(itr, (void**)&impl); + if (i) + printf(", "); + else if (!defdb) + defdb = impl->_dbm_name; + printf("%s", impl->_dbm_name); + } + putchar('\n'); + mu_iterator_destroy(&itr); + } + printf("default database type: %s\n", defdb); +} + void @@ -1022,10 +1052,3 @@ mailfromd_show_defaults() #endif - printf("database format: "); -#if defined WITH_GDBM - printf("GDBM"); -#elif defined WITH_BDB - printf("Berkeley DB %d.x", WITH_BDB); -#endif - printf("\n"); - + list_db_formats("supported databases: "); printf("Optional features: "); @@ -1195,3 +1218,2 @@ main(int argc, char **argv) mf_runtime_param_finish(); - libdbm_init(); db_format_setup(); |