GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
cdb_find(3) FreeBSD Library Functions Manual cdb_find(3)

cdb_find - look up a key in a constant database

#include <libowfat/cdb.h>
#include <libowfat/uint32.h>

int cdb_find(struct cdb *c,char *key,unsigned long int keylen);
int cdb_datalen(struct cdb *c);
int cdb_datapos(struct cdb *c);
int cdb_findnext(struct cdb *c,char *key,unsigned long int keylen);

cdb_find looks for key. If cdb_find returns 0, the database does not contain that key; stop. If cdb_find returns -1, there was a read error; abort.

cdb_datalen returns the length of the data associated with the key. Use it to allocate a pointer p with enough space to hold the data.

cdb_datapos returns the position of the data inside the file. Use it as argument to cdb_read to retrieve the data.

There may be several records under a single key. You can use cdb_findnext to find the next record under this key.

static struct c;

if (cdb_find(&c,key,strlen(key)>0) { char *buf=alloca(cdb_datalen(&c)); cdb_read(&c,buf,cdb_datalen(&c),cdb_datapos(&c)); write(1,buf,cdb_datalen(&c));
}

cdb_read(3), cdb_init(3), cdb_free(3), cdbmake(1)

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.