Back to index

courier  0.68.2
bdbobj3.c
Go to the documentation of this file.
00001 /*
00002 ** Copyright 1998 - 1999 Double Precision, Inc.  See COPYING for
00003 ** distribution information.
00004 */
00005 
00006 #include      "config.h"
00007 #include      <string.h>
00008 #include      <stdlib.h>
00009 #include      "bdbobj.h"
00010 
00011 int    bdbobj_delete(struct bdbobj *obj, const char *key, size_t keylen)
00012 {
00013 DBT    dkey, val;
00014 
00015        if (!obj->has_dbf)   return (0);
00016 
00017        memset(&dkey, 0, sizeof(dkey));
00018        memset(&val, 0, sizeof(val));
00019        dkey.data=(void *)key;
00020        dkey.size=keylen;
00021 
00022 #if    DB_VERSION_MAJOR < 2
00023        if ( (*obj->dbf->del)(obj->dbf, &dkey, 0))       return (-1);
00024 #else
00025        if ( (*obj->dbf->del)(obj->dbf, 0, &dkey, 0))    return (-1);
00026 #endif
00027        return (0);
00028 }