nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

cdb.3 (1156B)


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