debian/rules: Use `git' potty wrapper.
[qmail] / cdb.3
CommitLineData
2117e02e
MW
1.TH cdb 3
2.SH NAME
3cdb \- read from a constant database
4.SH SYNTAX
5.B #include <cdb.h>
6
7int \fBcdb_seek(\fP\fIfd,key,len,dlen\fR\fB)\fP;
8
9int \fIfd\fR;
10.br
11char *\fIkey\fR;
12.br
13unsigned int \fIlen\fR;
14.br
15uint32 *\fIdlen\fR;
16.SH DESCRIPTION
17.B cdb_seek
18looks up
19.I key
20in a constant database.
21It returns 1 if
22.I key
23is present,
240 if
25.I key
26is not present,
27or \-1 if there was a read error.
28.I key
29is an array of
30.I len
31characters.
32
33.B cdb_seek
34needs an open file descriptor,
35.IR fd ,
36pointing to the database.
37If
38.B cdb_seek
39returns 1,
40it points
41.I fd
42at the beginning of the data portion of the first record
43indexed by
44.IR key ,
45and it stores the data length in
46.IR dlen.
47.B cdb_seek
48does not provide a way to read subsequent records with the same key.
49
50It's fine to do several
51.B cdb_seek
52lookups with the same open file descriptor.
53Beware, however, that two simultaneous
54.B cdb_seek
55lookups can fail horribly;
56separate processes should not share the same database descriptor.
57Furthermore, any updates after the database was opened
58will be invisible.
59It's rarely a good idea for a long-running program
60to hold a database open.
61.SH "SEE ALSO"
62cdbget(1)