Move modules to ccan/ tools to tools/
[ccan] / ccan / list / _info.c
1 #include <stdio.h>
2 #include <string.h>
3 #include "config.h"
4
5 /**
6  * list - double linked list routines
7  *
8  * The list header contains routines for manipulating double linked lists.
9  * It defines two types: struct list_head used for anchoring lists, and
10  * struct list_node which is usually embedded in the structure which is placed
11  * in the list.
12  *
13  * Example:
14  *      #include <err.h>
15  *      #include "list/list.h"
16  *
17  *      struct parent {
18  *              const char *name;
19  *              struct list_head children;
20  *              unsigned int num_children;
21  *      };
22  *
23  *      struct child {
24  *              const char *name;
25  *              struct list_node list;
26  *      };
27  *
28  *      int main(int argc, char *argv[])
29  *      {
30  *              struct parent p;
31  *              struct child *c;
32  *              unsigned int i;
33  *
34  *              if (argc < 2)
35  *                      errx(1, "Usage: %s parent children...", argv[0]);
36  *
37  *              p.name = argv[1];
38  *              for (i = 2; i < argc, i++) {
39  *                      c = malloc(sizeof(*c));
40  *                      c->name = argv[i];
41  *                      list_add(&p.children, &c->list);
42  *                      p.num_children++;
43  *              }
44  *
45  *              printf("%s has %u children:", p.name, p.num_children);
46  *              list_for_each(&p.children, c, list)
47  *                      printf("%s ", c->name);
48  *              printf("\n");
49  *              return 0;
50  *      }
51  */
52 int main(int argc, char *argv[])
53 {
54         if (argc != 2)
55                 return 1;
56
57         if (strcmp(argv[1], "depends") == 0) {
58                 printf("ccan/container_of\n");
59                 return 0;
60         }
61
62         return 1;
63 }