don't save EOF in buffer, don't sign-extend 0xff to match EOF.
[unix-history] / usr / src / include / ndbm.h
CommitLineData
2a683113 1/* ndbm.h 4.3 84/08/28 */
d1e097f8
RC
2
3/*
2a683113 4 * Hashed key data base library.
d1e097f8
RC
5 */
6#define PBLKSIZ 1024
7#define DBLKSIZ 4096
8
9typedef struct {
2a683113
RC
10 int dbm_dirf; /* open directory file */
11 int dbm_pagf; /* open page file */
12 int dbm_flags; /* flags, see below */
13 long dbm_maxbno; /* last ``block'' in page file */
14 long dbm_bitno;
15 long dbm_hmask;
16 long dbm_blkno; /* current page to read/write */
17 long dbm_pagbno; /* current page in pagbuf */
18 char dbm_pagbuf[PBLKSIZ]; /* page file block buffer */
19 long dbm_dirbno; /* current block in dirbuf */
20 char dbm_dirbuf[DBLKSIZ]; /* directory file block buffer */
d1e097f8
RC
21} DBM;
22
2a683113
RC
23#define _DBM_RDONLY 0x1 /* data base open read-only */
24#define _DBM_IOERR 0x2 /* data base I/O error */
25
26#define dbm_rdonly(db) ((db)->dbm_flags & _DBM_RDONLY)
27
28#define dbm_error(db) ((db)->dbm_flags & _DBM_IOERR)
29 /* use this one at your own risk! */
30#define dbm_clearerr(db) ((db)->dbm_flags &= ~_DBM_IOERR)
d1e097f8
RC
31
32typedef struct {
33 char *dptr;
34 int dsize;
35} datum;
36
2a683113
RC
37/*
38 * flags to dbm_store()
39 */
40#define DBM_INSERT 0
41#define DBM_REPLACE 1
d1e097f8 42
2a683113
RC
43DBM *dbm_open();
44void dbm_close();
45datum dbm_fetch();
46datum dbm_firstkey();
47datum dbm_nextkey();
48long dbm_forder();
49int dbm_delete();
50int dbm_store();