chiark / gitweb /
mtimeout.c: Accept time unit specification on timeout options.
[misc] / cdb-probe.c
1 #include <errno.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5
6 #include <cdb.h>
7
8 const char *prog;
9
10 static void check(const char *p)
11 {
12   int rc;
13   unsigned l;
14
15   rc = cdb_seek(0, p, strlen(p), &l);
16   if (rc < 0) {
17     fprintf(stderr, "%s: cdb_seek: %s\n", prog, strerror(errno));
18     exit(111);
19   }
20   if (rc) exit(0);
21 }
22
23 int main(int argc, char *argv[])
24 {
25   prog = argv[0];
26   if (argc != 2) {
27     fprintf(stderr, "usage: %s KEY <CDB\n", prog);
28     exit(111);
29   }
30   check(argv[1]);
31   return (1);
32 }