ccan: Correct some poor conventions in _info includes
[ccan] / ccan / list / _info
1 #include "config.h"
2 #include <stdio.h>
3 #include <string.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  *              p.num_children = 0;
42  *              for (i = 2; i < argc; i++) {
43  *                      c = malloc(sizeof(*c));
44  *                      c->name = argv[i];
45  *                      list_add(&p.children, &c->list);
46  *                      p.num_children++;
47  *              }
48  *
49  *              printf("%s has %u children:", p.name, p.num_children);
50  *              list_for_each(&p.children, c, list)
51  *                      printf("%s ", c->name);
52  *              printf("\n");
53  *              return 0;
54  *      }
55  *
56  * License: BSD-MIT
57  * Author: Rusty Russell <rusty@rustcorp.com.au>
58  */
59 int main(int argc, char *argv[])
60 {
61         if (argc != 2)
62                 return 1;
63
64         if (strcmp(argv[1], "depends") == 0) {
65                 printf("ccan/str\n");
66                 printf("ccan/container_of\n");
67                 printf("ccan/check_type\n");
68                 return 0;
69         }
70
71         return 1;
72 }