X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fdepends.c;h=2bf11415bd2e632290fa1e63a4efd3bd13add985;hp=7eac9da419a17233e28d0e5dbb1aed4a7c9907f1;hb=15290c3feb9b61967311659a865fb3b5d05b1a49;hpb=d4ace4a572234de67d1421a444c38bb4fdcbef43 diff --git a/tools/depends.c b/tools/depends.c index 7eac9da4..2bf11415 100644 --- a/tools/depends.c +++ b/tools/depends.c @@ -1,5 +1,7 @@ -#include "talloc/talloc.h" -#include "string/string.h" +#include +#include +#include +#include #include "tools.h" #include #include @@ -110,6 +112,10 @@ static char **get_one_safe_deps(const void *ctx, char *str; unsigned int len; + /* Ignore lines starting with # (e.g. #include) */ + if (lines[i][0] == '#') + continue; + /* Start of line, or after ". */ if (strstarts(lines[i], "ccan/")) str = lines[i]; @@ -173,13 +179,21 @@ get_all_deps(const void *ctx, const char *dir, return deps; } -char **get_deps(const void *ctx, const char *dir) +char **get_deps(const void *ctx, const char *dir, bool recurse) { + if (!recurse) { + unsigned int num; + return get_one_deps(ctx, dir, &num); + } return get_all_deps(ctx, dir, get_one_deps); } -char **get_safe_ccan_deps(const void *ctx, const char *dir) +char **get_safe_ccan_deps(const void *ctx, const char *dir, bool recurse) { + if (!recurse) { + unsigned int num; + return get_one_safe_deps(ctx, dir, &num); + } return get_all_deps(ctx, dir, get_one_safe_deps); }