1 #ifdef MY_NDBM 2 3 #define DBLKSIZ 4096 4 5 typedef struct 6 { 7 List *dbm_list; /* cached database */ 8 Node *dbm_next; /* next key to return for nextkey() */ 9 10 /* Name of the file to write to if modified is set. malloc'd. */ 11 char *name; 12 13 /* Nonzero if the database has been modified and dbm_close needs to 14 write it out to disk. */ 15 int modified; 16 } DBM; 17 18 typedef struct 19 { 20 char *dptr; 21 int dsize; 22 } datum; 23 24 /* 25 * So as not to conflict with other dbm_open, etc., routines that may 26 * be included by someone's libc, all of my emulation routines are prefixed 27 * by "my" and we define the "standard" ones to be "my" ones here. 28 */ 29 #define dbm_open mydbm_open 30 #define dbm_close mydbm_close 31 #define dbm_fetch mydbm_fetch 32 #define dbm_firstkey mydbm_firstkey 33 #define dbm_nextkey mydbm_nextkey 34 #define dbm_store mydbm_store 35 #define DBM_INSERT 0 36 #define DBM_REPLACE 1 37 38 DBM *mydbm_open PROTO((char *file, int flags, int mode)); 39 void mydbm_close PROTO((DBM * db)); 40 datum mydbm_fetch PROTO((DBM * db, datum key)); 41 datum mydbm_firstkey PROTO((DBM * db)); 42 datum mydbm_nextkey PROTO((DBM * db)); 43 extern int mydbm_store PROTO ((DBM *, datum, datum, int)); 44 45 #endif /* MY_NDBM */ 46