diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
commit | 6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch) | |
tree | 850c71039563c16a5d563c47e7ba2ab645baf198 /lib/tdb2/_info | |
parent | 6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff) | |
parent | 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff) | |
download | samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.gz samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.bz2 samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.zip |
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16
Diffstat (limited to 'lib/tdb2/_info')
-rw-r--r-- | lib/tdb2/_info | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/lib/tdb2/_info b/lib/tdb2/_info new file mode 100644 index 0000000000..7213d67a22 --- /dev/null +++ b/lib/tdb2/_info @@ -0,0 +1,91 @@ +#include <string.h> +#include <stdio.h> + +/** + * tdb2 - [[WORK IN PROGRESS!]] The trivial (64bit transactional) database + * + * The tdb2 module provides an efficient keyword data mapping (usually + * within a file). It supports transactions, so the contents of the + * database is reliable even across crashes. + * + * Example: + * #include <ccan/tdb2/tdb2.h> + * #include <ccan/str/str.h> + * #include <err.h> + * #include <stdio.h> + * + * static void usage(const char *argv0) + * { + * errx(1, "Usage: %s fetch <dbfile> <key>\n" + * "OR %s store <dbfile> <key> <data>", argv0, argv0); + * } + * + * int main(int argc, char *argv[]) + * { + * struct tdb_context *tdb; + * TDB_DATA key, value; + * enum TDB_ERROR error; + * + * if (argc < 4) + * usage(argv[0]); + * + * tdb = tdb_open(argv[2], TDB_DEFAULT, O_CREAT|O_RDWR,0600, NULL); + * if (!tdb) + * err(1, "Opening %s", argv[2]); + * + * key.dptr = (void *)argv[3]; + * key.dsize = strlen(argv[3]); + * + * if (streq(argv[1], "fetch")) { + * if (argc != 4) + * usage(argv[0]); + * error = tdb_fetch(tdb, key, &value); + * if (error) + * errx(1, "fetch %s: %s", + * argv[3], tdb_errorstr(error)); + * printf("%.*s\n", value.dsize, (char *)value.dptr); + * free(value.dptr); + * } else if (streq(argv[1], "store")) { + * if (argc != 5) + * usage(argv[0]); + * value.dptr = (void *)argv[4]; + * value.dsize = strlen(argv[4]); + * error = tdb_store(tdb, key, value, 0); + * if (error) + * errx(1, "store %s: %s", + * argv[3], tdb_errorstr(error)); + * } else + * usage(argv[0]); + * + * return 0; + * } + * + * Maintainer: Rusty Russell <rusty@rustcorp.com.au> + * + * Author: Rusty Russell + * + * License: LGPLv3 (or later) + */ +int main(int argc, char *argv[]) +{ + if (argc != 2) + return 1; + + if (strcmp(argv[1], "depends") == 0) { + printf("ccan/asprintf\n"); + printf("ccan/hash\n"); + printf("ccan/likely\n"); + printf("ccan/asearch\n"); + printf("ccan/compiler\n"); + printf("ccan/build_assert\n"); + printf("ccan/ilog\n"); + printf("ccan/failtest\n"); + printf("ccan/tally\n"); + printf("ccan/typesafe_cb\n"); + printf("ccan/cast\n"); + printf("ccan/endian\n"); + return 0; + } + + return 1; +} |