Back to index

lightning-sunbird  0.9+nobinonly
Functions
ndbm.c File Reference
#include "watcomfx.h"
#include <sys/param.h>
#include <stdio.h>
#include <string.h>
#include "ndbm.h"
#include "hash.h"

Go to the source code of this file.

Functions

DBMdbm_open (const char *file, int flags, int mode)
void dbm_close (DBM *db)
datum dbm_fetch (DBM *db, datum key)
datum dbm_firstkey (DBM *db)
datum dbm_nextkey (DBM *db)
int dbm_delete (DBM *db, datum key)
int dbm_store (DBM *db, datum key, datum content, int flags)
int dbm_error (DBM *db)
int dbm_clearerr (DBM *db)
int dbm_dirfno (DBM *db)

Function Documentation

int dbm_clearerr ( DBM db)

Definition at line 180 of file ndbm.c.

{
       HTAB *hp;

       hp = (HTAB *)db->internal;
       hp->dbmerrno = 0;
       return (0);
}

Here is the call graph for this function:

void dbm_close ( DBM db)

Definition at line 82 of file ndbm.c.

{
       (void)(db->close)(db);
}
int dbm_delete ( DBM db,
datum  key 
)

Definition at line 145 of file ndbm.c.

{
       int status;

       status = (db->del)(db, (DBT *)&key, 0);
       if (status)
              return (-1);
       else
              return (0);
}
int dbm_dirfno ( DBM db)

Definition at line 190 of file ndbm.c.

{
       return(((HTAB *)db->internal)->fp);
}
int dbm_error ( DBM db)

Definition at line 171 of file ndbm.c.

{
       HTAB *hp;

       hp = (HTAB *)db->internal;
       return (hp->dbmerrno);
}

Here is the call graph for this function:

datum dbm_fetch ( DBM db,
datum  key 
)

Definition at line 93 of file ndbm.c.

{
       datum retval;
       int status;

       status = (db->get)(db, (DBT *)&key, (DBT *)&retval, 0);
       if (status) {
              retval.dptr = NULL;
              retval.dsize = 0;
       }
       return (retval);
}
datum dbm_firstkey ( DBM db)

Definition at line 112 of file ndbm.c.

{
       int status;
       datum retdata, retkey;

       status = (db->seq)(db, (DBT *)&retkey, (DBT *)&retdata, R_FIRST);
       if (status)
              retkey.dptr = NULL;
       return (retkey);
}
datum dbm_nextkey ( DBM db)

Definition at line 129 of file ndbm.c.

{
       int status;
       datum retdata, retkey;

       status = (db->seq)(db, (DBT *)&retkey, (DBT *)&retdata, R_NEXT);
       if (status)
              retkey.dptr = NULL;
       return (retkey);
}
DBM* dbm_open ( const char *  file,
int  flags,
int  mode 
)

Definition at line 65 of file ndbm.c.

{
       HASHINFO info;
       char path[MAXPATHLEN];

       info.bsize = 4096;
       info.ffactor = 40;
       info.nelem = 1;
       info.cachesize = 0;
       info.hash = NULL;
       info.lorder = 0;
       (void)strcpy(path, file);
       (void)strcat(path, DBM_SUFFIX);
       return ((DBM *)__hash_open(path, flags, mode, &info, 0));
}

Here is the call graph for this function:

int dbm_store ( DBM db,
datum  key,
datum  content,
int  flags 
)

Definition at line 163 of file ndbm.c.

{
       return ((db->put)(db, (DBT *)&key, (DBT *)&content,
           (flags == DBM_INSERT) ? R_NOOVERWRITE : 0));
}