Commit fc26d92d fc26d92d2fec6139f1b96dc3fec750e7b507e812 by Sergey Poznyakoff

Add support for Berkeley DB >= 3

1 parent 30f5f2ac
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000, 2001, 2002, 2006 Free Software Foundation, Inc.
3 3
4 GNU Mailutils is free software; you can redistribute it and/or modify 4 GNU Mailutils is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -197,7 +197,7 @@ mu_dbm_nextkey (DBM_FILE db, DBM_DATUM key) ...@@ -197,7 +197,7 @@ mu_dbm_nextkey (DBM_FILE db, DBM_DATUM key)
197 return gdbm_nextkey (db, key); 197 return gdbm_nextkey (db, key);
198 } 198 }
199 199
200 #elif defined(WITH_BDB2) 200 #elif defined(WITH_BDB)
201 201
202 #define DB_SUFFIX ".db" 202 #define DB_SUFFIX ".db"
203 203
...@@ -241,7 +241,15 @@ mu_dbm_open (char *name, DBM_FILE *dbm, int flags, int mode) ...@@ -241,7 +241,15 @@ mu_dbm_open (char *name, DBM_FILE *dbm, int flags, int mode)
241 return -1; 241 return -1;
242 } 242 }
243 243
244 #if WITH_BDB == 2
244 rc = db_open (pfname, DB_HASH, f, mode, NULL, NULL, &db); 245 rc = db_open (pfname, DB_HASH, f, mode, NULL, NULL, &db);
246 #else
247 rc = db_create (&db, NULL, 0);
248 if (rc != 0 || db == NULL)
249 return rc;
250 rc = db->open (db, pfname, NULL, DB_HASH, f, mode);
251 #endif
252
245 free (pfname); 253 free (pfname);
246 if (rc) 254 if (rc)
247 return -1; 255 return -1;
......
...@@ -27,7 +27,7 @@ typedef datum DBM_DATUM; ...@@ -27,7 +27,7 @@ typedef datum DBM_DATUM;
27 #define MU_DATUM_SIZE(d) d.dsize 27 #define MU_DATUM_SIZE(d) d.dsize
28 #define MU_DATUM_PTR(d) d.dptr 28 #define MU_DATUM_PTR(d) d.dptr
29 29
30 #elif defined(WITH_BDB2) 30 #elif defined(WITH_BDB)
31 31
32 #include <db.h> 32 #include <db.h>
33 #define USE_DBM 33 #define USE_DBM
......
...@@ -580,8 +580,8 @@ popauth_version (FILE *stream, struct argp_state *state) ...@@ -580,8 +580,8 @@ popauth_version (FILE *stream, struct argp_state *state)
580 { 580 {
581 #if defined(WITH_GDBM) 581 #if defined(WITH_GDBM)
582 # define FORMAT "GDBM" 582 # define FORMAT "GDBM"
583 #elif defined(WITH_BDB2) 583 #elif defined(WITH_BDB)
584 # define FORMAT "Berkeley DB" 584 # define FORMAT "Berkeley DB"
585 #elif defined(WITH_NDBM) 585 #elif defined(WITH_NDBM)
586 # define FORMAT "NDBM" 586 # define FORMAT "NDBM"
587 #elif defined(WITH_OLD_DBM) 587 #elif defined(WITH_OLD_DBM)
......