X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Flstack%2F_info;fp=ccan%2Flstack%2F_info;h=5b270bccf02fd1c17b3281efebff43a443dd3e75;hb=eb5cf99742db1b02cc5cac4be19226b58009a106;hp=0000000000000000000000000000000000000000;hpb=e6944616bf0a671a0cf538c324b44f93f56b293a;p=ccan diff --git a/ccan/lstack/_info b/ccan/lstack/_info new file mode 100644 index 00000000..5b270bcc --- /dev/null +++ b/ccan/lstack/_info @@ -0,0 +1,57 @@ +#include "config.h" +#include +#include + +/** + * lstack - Simple, singly-linked-list stack implementation + * + * This code provides a simple implementation of the Stack abstract + * data type in terms of a singly linked list. + * + * License: BSD-MIT + * Author: David Gibson + * + * Example: + * #include + * + * struct arg { + * const char *arg; + * struct lstack_link sl; + * }; + * + * int main(int argc, char *argv[]) + * { + * int i; + * struct arg *a; + * LSTACK(argstack); + * + * for (i = 0; i < argc; i++) { + * a = malloc(sizeof(*a)); + * a->arg = argv[i]; + * lstack_push(&argstack, a, sl); + * } + * + * printf("Command line arguments in reverse:\n"); + * + * while (!lstack_empty(&argstack)) { + * a = lstack_pop(&argstack, struct arg, sl); + * printf("Argument: %s\n", a->arg); + * free(a); + * } + * + * return 0; + * } + */ +int main(int argc, char *argv[]) +{ + /* Expect exactly one argument */ + if (argc != 2) + return 1; + + if (strcmp(argv[1], "depends") == 0) { + printf("ccan/container_of\n"); + return 0; + } + + return 1; +}