1: /*
   2:  * Copyright (c) 1983 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)ndbm.h	5.1 (Berkeley) 5/30/85
   7:  */
   8: 
   9: /*
  10:  * Hashed key data base library.
  11:  */
  12: #define PBLKSIZ 1024
  13: #define DBLKSIZ 4096
  14: 
  15: typedef struct {
  16:     int dbm_dirf;       /* open directory file */
  17:     int dbm_pagf;       /* open page file */
  18:     int dbm_flags;      /* flags, see below */
  19:     long    dbm_maxbno;     /* last ``bit'' in dir file */
  20:     long    dbm_bitno;      /* current bit number */
  21:     long    dbm_hmask;      /* hash mask */
  22:     long    dbm_blkptr;     /* current block for dbm_nextkey */
  23:     int dbm_keyptr;     /* current key for dbm_nextkey */
  24:     long    dbm_blkno;      /* current page to read/write */
  25:     long    dbm_pagbno;     /* current page in pagbuf */
  26:     char    dbm_pagbuf[PBLKSIZ];    /* page file block buffer */
  27:     long    dbm_dirbno;     /* current block in dirbuf */
  28:     char    dbm_dirbuf[DBLKSIZ];    /* directory file block buffer */
  29: } DBM;
  30: 
  31: #define _DBM_RDONLY 0x1 /* data base open read-only */
  32: #define _DBM_IOERR  0x2 /* data base I/O error */
  33: 
  34: #define dbm_rdonly(db)  ((db)->dbm_flags & _DBM_RDONLY)
  35: 
  36: #define dbm_error(db)   ((db)->dbm_flags & _DBM_IOERR)
  37:     /* use this one at your own risk! */
  38: #define dbm_clearerr(db)    ((db)->dbm_flags &= ~_DBM_IOERR)
  39: 
  40: /* for flock(2) and fstat(2) */
  41: #define dbm_dirfno(db)  ((db)->dbm_dirf)
  42: #define dbm_pagfno(db)  ((db)->dbm_pagf)
  43: 
  44: typedef struct {
  45:     char    *dptr;
  46:     int dsize;
  47: } datum;
  48: 
  49: /*
  50:  * flags to dbm_store()
  51:  */
  52: #define DBM_INSERT  0
  53: #define DBM_REPLACE 1
  54: 
  55: DBM *dbm_open();
  56: void    dbm_close();
  57: datum   dbm_fetch();
  58: datum   dbm_firstkey();
  59: datum   dbm_nextkey();
  60: long    dbm_forder();
  61: int dbm_delete();
  62: int dbm_store();

Defined macros

DBLKSIZ defined in line 13; used 1 times
  • in line 28
DBM_INSERT defined in line 52; never used
DBM_REPLACE defined in line 53; never used
PBLKSIZ defined in line 12; used 1 times
  • in line 26
_DBM_IOERR defined in line 32; used 2 times
_DBM_RDONLY defined in line 31; used 1 times
  • in line 34
dbm_clearerr defined in line 38; never used
dbm_dirfno defined in line 41; never used
dbm_error defined in line 36; never used
dbm_pagfno defined in line 42; never used
dbm_rdonly defined in line 34; never used
Last modified: 1985-05-30
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 950
Valid CSS Valid XHTML 1.0 Strict