1 /* 2 * Copyright (C) 1994-2005 The Free Software Foundation, Inc. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2, or (at your option) 7 * any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 */ 14 15 #ifdef MY_NDBM 16 17 #define DBLKSIZ 4096 18 19 typedef struct 20 { 21 List *dbm_list; /* cached database */ 22 Node *dbm_next; /* next key to return for nextkey() */ 23 24 /* Name of the file to write to if modified is set. malloc'd. */ 25 char *name; 26 27 /* Nonzero if the database has been modified and dbm_close needs to 28 write it out to disk. */ 29 int modified; 30 } DBM; 31 32 typedef struct 33 { 34 char *dptr; 35 int dsize; 36 } datum; 37 38 /* 39 * So as not to conflict with other dbm_open, etc., routines that may 40 * be included by someone's libc, all of my emulation routines are prefixed 41 * by "my" and we define the "standard" ones to be "my" ones here. 42 */ 43 #define dbm_open mydbm_open 44 #define dbm_close mydbm_close 45 #define dbm_fetch mydbm_fetch 46 #define dbm_firstkey mydbm_firstkey 47 #define dbm_nextkey mydbm_nextkey 48 #define dbm_store mydbm_store 49 #define DBM_INSERT 0 50 #define DBM_REPLACE 1 51 52 DBM *mydbm_open (char *file, int flags, int mode); 53 void mydbm_close (DBM * db); 54 datum mydbm_fetch (DBM * db, datum key); 55 datum mydbm_firstkey (DBM * db); 56 datum mydbm_nextkey (DBM * db); 57 extern int mydbm_store (DBM *, datum, datum, int); 58 59 #endif /* MY_NDBM */ 60