Tracing for tdb operations.
[ccan] / ccan / list / _info
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 <stdio.h>
16  *      #include <stdlib.h>
17  *      #include <ccan/list/list.h>
18  *
19  *      struct parent {
20  *              const char *name;
21  *              struct list_head children;
22  *              unsigned int num_children;
23  *      };
24  *
25  *      struct child {
26  *              const char *name;
27  *              struct list_node list;
28  *      };
29  *
30  *      int main(int argc, char *argv[])
31  *      {
32  *              struct parent p;
33  *              struct child *c;
34  *              unsigned int i;
35  *
36  *              if (argc < 2)
37  *                      errx(1, "Usage: %s parent children...", argv[0]);
38  *
39  *              p.name = argv[1];
40  *              list_head_init(&p.children);
41  *              for (i = 2; i < argc; i++) {
42  *                      c = malloc(sizeof(*c));
43  *                      c->name = argv[i];
44  *                      list_add(&p.children, &c->list);
45  *                      p.num_children++;
46  *              }
47  *
48  *              printf("%s has %u children:", p.name, p.num_children);
49  *              list_for_each(&p.children, c, list)
50  *                      printf("%s ", c->name);
51  *              printf("\n");
52  *              return 0;
53  *      }
54  *
55  * Licence: LGPL (2 or any later version)
56  */
57 int main(int argc, char *argv[])
58 {
59         if (argc != 2)
60                 return 1;
61
62         if (strcmp(argv[1], "depends") == 0) {
63                 printf("ccan/container_of\n");
64                 return 0;
65         }
66
67         return 1;
68 }