6 * stringmap - Macros for mapping strings to things
8 * stringmap provides a generic string map via macros.
10 * Features which are sorely lacking in this version of stringmap are deletion and traversal.
14 * #include <ccan/stringmap/stringmap.h>
16 * static const char *get_string(void) {
17 * static char buffer[4096];
19 * if (!fgets(buffer, sizeof(buffer), stdin))
21 * tail = strchr(buffer, 0);
22 * if (tail>buffer && tail[-1]=='\n')
30 * stringmap(int) map = stringmap_new(NULL);
33 * while ((string = get_string()) != NULL) {
34 * int *count = stringmap_lookup(map, string);
37 * printf("\"%s\" is new\n", string);
38 * count = stringmap_enter(map, string);
43 * printf("\"%s\" has been entered %d times\n", string, *count);
46 * stringmap_free(map);
51 * Authors: Joey Adams, Anders Magnusson
54 int main(int argc, char *argv[])
56 /* Expect exactly one argument */
60 if (strcmp(argv[1], "depends") == 0) {
61 printf("ccan/block_pool\n");