1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#include "config.h"
#include <stdio.h>
#include <string.h>
/**
* ntdb - Next Generation Trivial Database
*
* This package provides an experimental persistent keyword/data store.
* Its main advantage over tdb is that it's 64-bit.
*
* Example:
* #include <stdio.h>
* #include <err.h>
* #include <unistd.h>
* #include <ccan/ntdb/ntdb.h>
*
* int main(int argc, char *argv[])
* {
* NTDB_DATA key = ntdb_mkdata("key", 3);
* NTDB_DATA val = ntdb_mkdata("val", 3);
* struct ntdb_context *ntdb;
*
* ntdb = ntdb_open("example.ntdb", NTDB_DEFAULT,
* O_RDWR | O_CREAT | O_TRUNC, 0600, NULL);
* if (ntdb == NULL)
* errx(1, "failed to open database file");
*
* ntdb_store(ntdb, key, val, NTDB_INSERT);
*
* ntdb_close(ntdb);
*
* return 0;
* }
*
* License: LGPL (v3 or any later version)
* Authors: Rusty Russell
* Andrew Tridgell
* Jeremy Allison
* Jelmer Vernooij
* Volker Lendecke
* Andrew Esh
* Simon McVittie
* Tim Potter
* Maintainer: Rusty Russell <rusty@rustcorp.com.au>
*/
int main(int argc, char *argv[])
{
if (argc != 2)
return 1;
if (strcmp(argv[1], "depends") == 0) {
printf("ccan/asearch\n");
printf("ccan/build_assert\n");
printf("ccan/cast\n");
printf("ccan/compiler\n");
printf("ccan/endian\n");
printf("ccan/hash\n");
printf("ccan/ilog\n");
printf("ccan/likely\n");
printf("ccan/tally\n");
printf("ccan/typesafe_cb\n");
return 0;
}
if (strcmp(argv[1], "testdepends") == 0) {
printf("ccan/failtest\n");
printf("ccan/err\n");
return 0;
}
return 1;
}
|