Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-05-18 08:30:09

0001 /* ndbm.h  -  The include file for ndbm users.  */
0002 
0003 /*  This file is part of GDBM, the GNU data base manager, by Philip A. Nelson.
0004     Copyright (C) 1990-2022 Free Software Foundation, Inc.
0005 
0006     GDBM is free software; you can redistribute it and/or modify
0007     it under the terms of the GNU General Public License as published by
0008     the Free Software Foundation; either version 2, or (at your option)
0009     any later version.
0010 
0011     GDBM is distributed in the hope that it will be useful,
0012     but WITHOUT ANY WARRANTY; without even the implied warranty of
0013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014     GNU General Public License for more details.
0015 
0016     You should have received a copy of the GNU General Public License
0017     along with GDBM. If not, see <http://www.gnu.org/licenses/>.
0018 
0019     You may contact the author by:
0020        e-mail:  phil@cs.wwu.edu
0021       us-mail:  Philip A. Nelson
0022                 Computer Science Department
0023                 Western Washington University
0024                 Bellingham, WA 98226
0025        
0026 *************************************************************************/
0027 
0028 #include <gdbm.h>
0029 
0030 /* Parameters to dbm_store for simple insertion or replacement. */
0031 #define DBM_INSERT  GDBM_INSERT
0032 #define DBM_REPLACE GDBM_REPLACE
0033 
0034 /* The file information header.  */
0035 typedef struct
0036 {
0037   GDBM_FILE file;         /* Actual gdbm file (held in the .pag file */
0038   int dirfd;              /* Descriptor of the .dir file */
0039   datum _dbm_memory;      /* Keeps the last returned key */
0040   char *_dbm_fetch_val;   /* Keeps the dptr of the last fetched datum */
0041   gdbm_error _dbm_errno;  /* Error code from the last failed call */
0042 } DBM;
0043 
0044 /* Used internally by the library */
0045 #define __gdbm_error_to_ndbm(dbm)               \
0046   do                                \
0047     {                               \
0048       if (gdbm_errno && gdbm_errno != GDBM_ITEM_NOT_FOUND)  \
0049     (dbm)->_dbm_errno = gdbm_errno;             \
0050     }                               \
0051   while (0)
0052 
0053 /* These are the routines */
0054 
0055 extern DBM  *dbm_open (char *file, int flags, int mode);
0056 extern void  dbm_close (DBM *dbf);
0057 extern datum     dbm_fetch (DBM *dbf, datum key);
0058 extern int   dbm_store (DBM *dbf, datum key, datum content, int flags);
0059 extern int   dbm_delete (DBM *dbf, datum key);
0060 extern datum     dbm_firstkey (DBM *dbf);
0061 extern datum     dbm_nextkey (DBM *dbf);
0062 extern int       dbm_error (DBM *dbf);
0063 extern void      dbm_clearerr (DBM *dbf);
0064 extern int   dbm_dirfno (DBM *dbf);
0065 extern int   dbm_pagfno (DBM *dbf);
0066 extern int   dbm_rdonly (DBM *dbf);