1 /*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Margo Seltzer. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)ndbm.h 5.6 (Berkeley) 04/03/91 11 */ 12 13 #ifndef _NDBM_H_ 14 #define _NDBM_H_ 15 16 #include <sys/cdefs.h> 17 #include <db.h> 18 19 /* Map dbm interface onto db(3). */ 20 #define DBM_RDONLY O_RDONLY 21 22 /* Flags to dbm_store(). */ 23 #define DBM_INSERT 0 24 #define DBM_REPLACE 1 25 26 /* 27 * The db(3) support for ndbm(3) always appends this suffix to the 28 * file name to avoid overwriting the user's original database. 29 */ 30 #define DBM_SUFFIX ".db" 31 32 typedef struct { 33 char *dptr; 34 int dsize; 35 } datum; 36 37 typedef DB DBM; 38 39 __BEGIN_DECLS 40 void dbm_close __P((DBM *)); 41 int dbm_delete __P((DBM *, datum)); 42 datum dbm_fetch __P((DBM *, datum)); 43 datum dbm_firstkey __P((DBM *)); 44 long dbm_forder __P((DBM *, datum)); 45 datum dbm_nextkey __P((DBM *)); 46 DBM *dbm_open __P((const char *, int, int)); 47 int dbm_store __P((DBM *, datum, datum, int)); 48 __END_DECLS 49 50 #endif /* !_NDBM_H_ */ 51