ccan_depends.c 685 B

1234567891011121314151617181920212223242526272829303132
  1. #include "tools.h"
  2. #include <err.h>
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include "string/string.h"
  6. #include "talloc/talloc.h"
  7. int main(int argc, char *argv[])
  8. {
  9. char **deps;
  10. unsigned int i;
  11. bool compile = false;
  12. if (argv[1] && streq(argv[1], "--compile")) {
  13. argv++;
  14. argc--;
  15. compile = true;
  16. }
  17. if (argc != 2)
  18. errx(1, "Usage: ccan_depends [--compile] <dir>\n"
  19. "Spits out all the ccan dependencies (recursively)");
  20. if (compile)
  21. deps = get_deps(talloc_autofree_context(), argv[1]);
  22. else
  23. deps = get_safe_ccan_deps(talloc_autofree_context(), argv[1]);
  24. for (i = 0; deps[i]; i++)
  25. if (strstarts(deps[i], "ccan/"))
  26. printf("%s\n", deps[i]);
  27. return 0;
  28. }