11e72d8d2Sderaadt #ifdef MY_NDBM 21e72d8d2Sderaadt 31e72d8d2Sderaadt #define DBLKSIZ 4096 41e72d8d2Sderaadt 51e72d8d2Sderaadt typedef struct 61e72d8d2Sderaadt { 71e72d8d2Sderaadt List *dbm_list; /* cached database */ 81e72d8d2Sderaadt Node *dbm_next; /* next key to return for nextkey() */ 9*13571821Stholo 10*13571821Stholo /* Name of the file to write to if modified is set. malloc'd. */ 11*13571821Stholo char *name; 12*13571821Stholo 13*13571821Stholo /* Nonzero if the database has been modified and dbm_close needs to 14*13571821Stholo write it out to disk. */ 15*13571821Stholo int modified; 161e72d8d2Sderaadt } DBM; 171e72d8d2Sderaadt 181e72d8d2Sderaadt typedef struct 191e72d8d2Sderaadt { 201e72d8d2Sderaadt char *dptr; 211e72d8d2Sderaadt int dsize; 221e72d8d2Sderaadt } datum; 231e72d8d2Sderaadt 241e72d8d2Sderaadt /* 251e72d8d2Sderaadt * So as not to conflict with other dbm_open, etc., routines that may 261e72d8d2Sderaadt * be included by someone's libc, all of my emulation routines are prefixed 271e72d8d2Sderaadt * by "my" and we define the "standard" ones to be "my" ones here. 281e72d8d2Sderaadt */ 291e72d8d2Sderaadt #define dbm_open mydbm_open 301e72d8d2Sderaadt #define dbm_close mydbm_close 311e72d8d2Sderaadt #define dbm_fetch mydbm_fetch 321e72d8d2Sderaadt #define dbm_firstkey mydbm_firstkey 331e72d8d2Sderaadt #define dbm_nextkey mydbm_nextkey 34*13571821Stholo #define dbm_store mydbm_store 35*13571821Stholo #define DBM_INSERT 0 36*13571821Stholo #define DBM_REPLACE 1 371e72d8d2Sderaadt 381e72d8d2Sderaadt DBM *mydbm_open PROTO((char *file, int flags, int mode)); 391e72d8d2Sderaadt void mydbm_close PROTO((DBM * db)); 401e72d8d2Sderaadt datum mydbm_fetch PROTO((DBM * db, datum key)); 411e72d8d2Sderaadt datum mydbm_firstkey PROTO((DBM * db)); 421e72d8d2Sderaadt datum mydbm_nextkey PROTO((DBM * db)); 43*13571821Stholo extern int mydbm_store PROTO ((DBM *, datum, datum, int)); 441e72d8d2Sderaadt 451e72d8d2Sderaadt #endif /* MY_NDBM */ 46