X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fstrset%2F_info;fp=ccan%2Fstrset%2F_info;h=81e8f53cca08b73a3c1322d2da1cb6b7d4064c9a;hb=ab83de953730f5e5e571dbf69ffb3cc685a102dc;hp=0000000000000000000000000000000000000000;hpb=0845e79650c9257aa0ddef8ff99fd815b5edffac;p=ccan diff --git a/ccan/strset/_info b/ccan/strset/_info new file mode 100644 index 00000000..81e8f53c --- /dev/null +++ b/ccan/strset/_info @@ -0,0 +1,71 @@ +#include +#include "config.h" + +/** + * strset - an ordered set of strings + * + * This code implements an ordered set of string as a critbit tree. See: + * + * http://cr.yp.to/critbit.html + * http://github.com/agl/critbit (which this code is based on) + * + * Note that ccan/htable is faster and uses less memory, but doesn't provide + * ordered or prefix operations. + * + * Example: + * // Print all words in order. + * #include + * #include + * #include + * #include + * + * static bool dump(const char *member, void *unused) + * { + * printf("%s ", member); + * return false; + * } + * + * int main(void) + * { + * struct strset words; + * char *file, *word; + * + * strset_init(&words); + * file = grab_fd(NULL, 0, NULL); + * if (!file) + * err(1, "Reading stdin"); + * + * for (word = strtok(file, " \t\r\n"); + * word; + * word = strtok(NULL, " \t\r\n")) { + * strset_set(&words, word); + * } + * strset_iterate(&words, dump, NULL); + * printf("\n"); + * return 0; + * } + * // Given "foo bar" outputs "bar foo " + * // Given "foo foo bar" outputs "bar foo " + * + * License: Public domain (but some dependencies are LGPL!) + * Author: Rusty Russell + * Ccanlint: + * license_depends_compat FAIL + */ +int main(int argc, char *argv[]) +{ + /* Expect exactly one argument */ + if (argc != 2) + return 1; + + if (strcmp(argv[1], "depends") == 0) { + printf("ccan/ilog\n" + "ccan/likely\n" + "ccan/short_types\n" + "ccan/str\n" + "ccan/typesafe_cb\n"); + return 0; + } + + return 1; +}