From 96cf8dffe4f7b0b910f790066ae622dc429eb522 Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Tue, 9 Jul 2024 13:02:45 +0200 Subject: initial commit of version 23 --- man/cdbmake.3 | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 man/cdbmake.3 (limited to 'man/cdbmake.3') diff --git a/man/cdbmake.3 b/man/cdbmake.3 new file mode 100644 index 0000000..7e7fd3e --- /dev/null +++ b/man/cdbmake.3 @@ -0,0 +1,61 @@ +.TH qlibs:cdbmake 3 +.SH NAME +cdmake \- generate and fill a constant database +.SH SYNTAX +.B #include \(dqcdmake.h\(dq + +int \fBcdb_make_start\fP(struct cdb *\fIc\fR,int \fIfd\fR); +.br +int \fBcdb_make_add\fP(struct cdb *\fIc\fR,char *\fIkey\fR,unsigned int \fIkeylen\fR, + char *\fIdata\fR,unsigend int \fIdatalen\fR); +.br +int \fBcdb_make_finish\fP(struct cdb *\fIc\fR); +.SH DESCRIPTION +.B cdb_make_start +generates and intitialises a new cdb named +.I c +and makes it available via file descriptor +.IR fd . + +.B cdb_make_add +adds entries using the file descriptor +.I fd +given as +.I key +with length +.I keylen +into the cdb returning the hashed values +.I data +with length +.IR datalen . + +.B cdb_make_finish +finalises the data structure provided as +.IR fd . + +.SH "RETURN CODES" +Usually, the +.B cdb_make_* +routines provide a return code of +.I 0 +for successful operations and +.I -1 +if anything is going wrong. + +.SH EXAMPLE +#include + + 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(); + +.SH "SEE ALSO" +cdbread(3) -- cgit v1.2.3