]> git.ozlabs.org Git - ccan/blobdiff - tools/ccan_depends.c
Proper recursive dependencies (came from libantithread work)
[ccan] / tools / ccan_depends.c
diff --git a/tools/ccan_depends.c b/tools/ccan_depends.c
new file mode 100644 (file)
index 0000000..982d13b
--- /dev/null
@@ -0,0 +1,21 @@
+#include "tools.h"
+#include <err.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "string/string.h"
+
+int main(int argc, char *argv[])
+{
+       char **deps;
+       unsigned int i;
+
+       if (argc != 2)
+               errx(1, "Usage: ccan_depends <dir>\n"
+                       "Spits out all the ccan dependencies (recursively)");
+
+       deps = get_deps(NULL, argv[1]);
+       for (i = 0; deps[i]; i++)
+               if (strstarts(deps[i], "ccan/"))
+                       printf("%s\n", deps[i]);
+       return 0;
+}