home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 25.ddi / root.2 / usr / ucbinclude / ndbm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  2.5 KB  |  96 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10.  
  11. #ident    "@(#)//usr/ucbinclude/ndbm.h.sl 1.1 4.0 12/08/90 23817 AT&T-USL"
  12.  
  13. /*******************************************************************
  14.  
  15.         PROPRIETARY NOTICE (Combined)
  16.  
  17. This source code is unpublished proprietary information
  18. constituting, or derived under license from AT&T's UNIX(r) System V.
  19. In addition, portions of such source code were derived from Berkeley
  20. 4.3 BSD under license from the Regents of the University of
  21. California.
  22.  
  23.  
  24.  
  25.         Copyright Notice 
  26.  
  27. Notice of copyright on this source code product does not indicate 
  28. publication.
  29.  
  30.     (c) 1986,1987,1988,1989  Sun Microsystems, Inc
  31.     (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  32.               All rights reserved.
  33. ********************************************************************/ 
  34.  
  35. /*
  36.  * Hashed key data base library.
  37.  */
  38.  
  39. #ifndef _NDBM_H
  40. #define _NDBM_H
  41.  
  42. #define PBLKSIZ 1024
  43. #define DBLKSIZ 4096
  44.  
  45. typedef struct {
  46.     int    dbm_dirf;        /* open directory file */
  47.     int    dbm_pagf;        /* open page file */
  48.     int    dbm_flags;        /* flags, see below */
  49.     long    dbm_maxbno;        /* last ``bit'' in dir file */
  50.     long    dbm_bitno;        /* current bit number */
  51.     long    dbm_hmask;        /* hash mask */
  52.     long    dbm_blkptr;        /* current block for dbm_nextkey */
  53.     int    dbm_keyptr;        /* current key for dbm_nextkey */
  54.     long    dbm_blkno;        /* current page to read/write */
  55.     long    dbm_pagbno;        /* current page in pagbuf */
  56.     char    dbm_pagbuf[PBLKSIZ];    /* page file block buffer */
  57.     long    dbm_dirbno;        /* current block in dirbuf */
  58.     char    dbm_dirbuf[DBLKSIZ];    /* directory file block buffer */
  59. } DBM;
  60.  
  61. #define _DBM_RDONLY    0x1    /* data base open read-only */
  62. #define _DBM_IOERR    0x2    /* data base I/O error */
  63.  
  64. #define dbm_rdonly(db)    ((db)->dbm_flags & _DBM_RDONLY)
  65.  
  66. #define dbm_error(db)    ((db)->dbm_flags & _DBM_IOERR)
  67.     /* use this one at your own risk! */
  68. #define dbm_clearerr(db)    ((db)->dbm_flags &= ~_DBM_IOERR)
  69.  
  70. /* for fstat(2) */
  71. #define dbm_dirfno(db)    ((db)->dbm_dirf)
  72. #define dbm_pagfno(db)    ((db)->dbm_pagf)
  73.  
  74. typedef struct {
  75.     char    *dptr;
  76.     int    dsize;
  77. } datum;
  78.  
  79. /*
  80.  * flags to dbm_store()
  81.  */
  82. #define DBM_INSERT    0
  83. #define DBM_REPLACE    1
  84.  
  85. DBM    *dbm_open();
  86. void    dbm_close();
  87. datum    dbm_fetch();
  88. datum    dbm_firstkey();
  89. datum    dbm_nextkey();
  90. long    dbm_forder();
  91. int    dbm_delete();
  92. int    dbm_store();
  93.  
  94.  
  95. #endif /*! _HDBM_H */
  96.