home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / uccs / root.14 / udk / usr / include / ndbm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-19  |  3.5 KB  |  133 lines

  1. /*
  2.  * Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved. 
  3.  *                                                                         
  4.  *        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE               
  5.  *                   SANTA CRUZ OPERATION INC.                             
  6.  *                                                                         
  7.  *   The copyright notice above does not evidence any actual or intended   
  8.  *   publication of such source code.                                      
  9.  */
  10.  
  11. #ident    "@(#)sgs-head:common/head/ndbm.h    1.1"
  12.  
  13. /*
  14.  *    Copyright (c) 1982, 1986, 1988
  15.  *    The Regents of the University of California
  16.  *    All Rights Reserved.
  17.  *    Portions of this document are derived from
  18.  *    software developed by the University of
  19.  *    California, Berkeley, and its contributors.
  20.  */
  21.  
  22.  
  23. /*******************************************************************
  24.  
  25.         PROPRIETARY NOTICE (Combined)
  26.  
  27. This source code is unpublished proprietary information
  28. constituting, or derived under license from AT&T's UNIX(r) System V.
  29. In addition, portions of such source code were derived from Berkeley
  30. 4.3 BSD under license from the Regents of the University of
  31. California.
  32.  
  33.  
  34.  
  35.         Copyright Notice 
  36.  
  37. Notice of copyright on this source code product does not indicate 
  38. publication.
  39.  
  40.     (c) 1986,1987,1988,1989  Sun Microsystems, Inc
  41.     (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  42.               All rights reserved.
  43. ********************************************************************/ 
  44.  
  45. /*
  46.  * Hashed key data base library - XPG4 V2 definition.
  47.  */
  48.  
  49. #ifndef _NDBM_H
  50. #define _NDBM_H
  51.  
  52. #ifdef __cplusplus
  53. extern "C" {
  54. #endif
  55.  
  56.  
  57.  
  58. #define _PBLKSIZ 4096
  59. #define _DBLKSIZ 4096
  60.  
  61. typedef struct {
  62.     int    dbm_dirf;        /* open directory file */
  63.     int    dbm_pagf;        /* open page file */
  64.     int    dbm_flags;        /* flags, see below */
  65.     long    dbm_maxbno;        /* last ``bit'' in dir file */
  66.     long    dbm_bitno;        /* current bit number */
  67.     long    dbm_hmask;        /* hash mask */
  68.     long    dbm_blkptr;        /* current block for dbm_nextkey */
  69.     int    dbm_keyptr;        /* current key for dbm_nextkey */
  70.     long    dbm_blkno;        /* current page to read/write */
  71.     long    dbm_pagbno;        /* current page in pagbuf */
  72.     char    dbm_pagbuf[_PBLKSIZ];    /* page file block buffer */
  73.     long    dbm_dirbno;        /* current block in dirbuf */
  74.     char    dbm_dirbuf[_DBLKSIZ];    /* directory file block buffer */
  75. } DBM;
  76.  
  77.  
  78.  
  79. #ifndef _SIZE_T
  80. #define _SIZE_T
  81. typedef    unsigned int    size_t;        /* len param for string funcs */
  82. #endif
  83.  
  84. #ifndef _MODE_T
  85. #define _MODE_T
  86. typedef    unsigned long    mode_t;            /* file attribute type    */
  87. #endif
  88.  
  89. typedef struct {
  90.     void    *dptr;   /* changed to void * for XPG4 V2 */
  91.     size_t    dsize;   /* changed to size_t for XPG4 V2 */
  92. } datum;
  93.  
  94. /*
  95.  * flags to dbm_store()
  96.  */
  97. #define DBM_INSERT    0
  98. #define DBM_REPLACE    1
  99.  
  100.  
  101. int dbm_clearerr(DBM *);
  102. void dbm_close(DBM *);
  103. int dbm_delete(DBM *, datum);
  104. int dbm_error(DBM *);
  105. datum dbm_fetch(DBM *, datum);
  106. datum dbm_firstkey(DBM *);
  107. datum dbm_nextkey(DBM *);
  108. DBM * dbm_open(const char *, int, mode_t);
  109. int dbm_store(DBM  *, datum, datum, int);
  110.  
  111. /* non XPG4 V2 function */
  112. long    dbm_forder( DBM *, datum );
  113.  
  114. /* macro definitions */
  115.  
  116. #define _DBM_RDONLY    0x1    /* data base open read-only */
  117. #define _DBM_IOERR    0x2    /* data base I/O error */
  118.  
  119. #define dbm_rdonly(db)    ((db)->dbm_flags & _DBM_RDONLY)
  120.  
  121. #define dbm_error(db)    ((db)->dbm_flags & _DBM_IOERR)
  122.     /* use this one at your own risk! */
  123. #define dbm_clearerr(db)    ((db)->dbm_flags &= ~_DBM_IOERR)
  124.  
  125. /* for fstat(2) */
  126. #define dbm_dirfno(db)    ((db)->dbm_dirf)
  127. #define dbm_pagfno(db)    ((db)->dbm_pagf)
  128.  
  129. #ifdef __cplusplus
  130. }
  131. #endif
  132. #endif /*! _HDBM_H */
  133.