|
|
@ -5,13 +5,17 @@
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <errmsg.h>
|
|
|
|
#include <errmsg.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef O_BINARY
|
|
|
|
|
|
|
|
#define O_BINARY
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc,char* argv[]) {
|
|
|
|
int main(int argc,char* argv[]) {
|
|
|
|
int fd;
|
|
|
|
int fd;
|
|
|
|
static struct cdb c;
|
|
|
|
static struct cdb c;
|
|
|
|
errmsg_iam("cdbget");
|
|
|
|
errmsg_iam("cdbget");
|
|
|
|
if (argc<3)
|
|
|
|
if (argc<3)
|
|
|
|
die(1,"usage: cdbget data.cdb key");
|
|
|
|
die(1,"usage: cdbget data.cdb key");
|
|
|
|
fd=open(argv[1],O_RDONLY);
|
|
|
|
fd=open(argv[1],O_RDONLY|O_BINARY);
|
|
|
|
if (fd==-1)
|
|
|
|
if (fd==-1)
|
|
|
|
diesys(1,"open");
|
|
|
|
diesys(1,"open");
|
|
|
|
cdb_init(&c,fd);
|
|
|
|
cdb_init(&c,fd);
|
|
|
|