summaryrefslogtreecommitdiff
path: root/lib/ccan/list/_info
blob: a30659c1cf694e0f1350ab9719f86c01b45a5c07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <stdio.h>
#include <string.h>
#include "config.h"

/**
 * list - double linked list routines
 *
 * The list header contains routines for manipulating double linked lists.
 * It defines two types: struct list_head used for anchoring lists, and
 * struct list_node which is usually embedded in the structure which is placed
 * in the list.
 *
 * Example:
 *	#include <err.h>
 *	#include <stdio.h>
 *	#include <stdlib.h>
 *	#include <ccan/list/list.h>
 *
 *	struct parent {
 *		const char *name;
 *		struct list_head children;
 *		unsigned int num_children;
 *	};
 *
 *	struct child {
 *		const char *name;
 *		struct list_node list;
 *	};
 *
 *	int main(int argc, char *argv[])
 *	{
 *		struct parent p;
 *		struct child *c;
 *		unsigned int i;
 *
 *		if (argc < 2)
 *			errx(1, "Usage: %s parent children...", argv[0]);
 *
 *		p.name = argv[1];
 *		list_head_init(&p.children);
 *		p.num_children = 0;
 *		for (i = 2; i < argc; i++) {
 *			c = malloc(sizeof(*c));
 *			c->name = argv[i];
 *			list_add(&p.children, &c->list);
 *			p.num_children++;
 *		}
 *
 *		printf("%s has %u children:", p.name, p.num_children);
 *		list_for_each(&p.children, c, list)
 *			printf("%s ", c->name);
 *		printf("\n");
 *		return 0;
 *	}
 *
 * License: LGPL (v2.1 or any later version)
 * Author: Rusty Russell <rusty@rustcorp.com.au>
 */
int main(int argc, char *argv[])
{
	if (argc != 2)
		return 1;

	if (strcmp(argv[1], "depends") == 0) {
		printf("ccan/container_of\n");
		return 0;
	}

	return 1;
}