Simplify -I lines: change includes to ccan/
[ccan] / tools / ccan_depends.c
1 #include "tools.h"
2 #include <err.h>
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <ccan/str/str.h>
6 #include <ccan/talloc/talloc.h>
7
8 int main(int argc, char *argv[])
9 {
10         char **deps;
11         unsigned int i;
12         bool compile = false;
13         bool recurse = true;
14
15         if (argv[1] && streq(argv[1], "--direct")) {
16                 argv++;
17                 argc--;
18                 recurse = false;
19         }
20         if (argv[1] && streq(argv[1], "--compile")) {
21                 argv++;
22                 argc--;
23                 compile = true;
24         }
25         if (argc != 2)
26                 errx(1, "Usage: ccan_depends [--direct] [--compile] <dir>\n"
27                         "Spits out all the ccan dependencies (recursively unless --direct)");
28
29         if (compile)
30                 deps = get_deps(talloc_autofree_context(), argv[1], recurse);
31         else
32                 deps = get_safe_ccan_deps(talloc_autofree_context(), argv[1],
33                                           recurse);
34
35         for (i = 0; deps[i]; i++)
36                 if (strstarts(deps[i], "ccan/"))
37                         printf("%s\n", deps[i]);
38         return 0;
39 }