SYNTAX
#include "cdmake.h"
int cdb_make_start(struct cdb *c,int fd);
int cdb_make_add(struct cdb *c,char *key,unsigned int keylen,
char *data,unsigend int datalen);
int cdb_make_finish(struct cdb *c);
DESCRIPTION
cdb_make_start generates and intitialises a new cdb named c and makes
it available via file descriptor fd.
cdb_make_add adds entries using the file descriptor fd given as key
with length keylen into the cdb returning the hashed values data with
length datalen.
cdb_make_finish finalises the data structure provided as fd.
RETURN CODES
Usually, the cdb_make_* routines provide a return code of 0 for
successful operations and -1 if anything is going wrong.
EXAMPLE
#include <cdbmake.h>
int fd;
stralloc data = {0};
stralloc key = {0};
struct cdb_make c;
if (cdb_make_start(&c,fd) == -1) die_write();
if (cdb_make_add(&c,key.s,key.len,data.s,data.len) == -1)
die_write();
if (cdb_make_finish(&c) == -1) die_write();
if (fsync(fd) == -1) die_write();
SEE ALSO
cdbread(3)
qlibs:cdbmake(3)
Man(1) output converted with
man2html