summaryrefslogtreecommitdiff
path: root/modules_dep
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2011-08-01 18:29:42 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2011-08-01 18:31:09 -0500
commited54f77f3f0004b67d3d3f57bb8feaa3c6f0baa9 (patch)
tree04c69c1f509d3428749ccf9afc024dc403905a28 /modules_dep
parent98b88d97f00aa751c5e19fc353939b714a56c059 (diff)
add optional verbose mesage in module_dep
Diffstat (limited to 'modules_dep')
-rw-r--r--modules_dep/modules_dep.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/modules_dep/modules_dep.c b/modules_dep/modules_dep.c
index 67fe0b9..6fedab0 100644
--- a/modules_dep/modules_dep.c
+++ b/modules_dep/modules_dep.c
@@ -22,6 +22,8 @@ struct module
int gmake;
};
+static int verbose;
+
#define SHOW_F_PARENTS (int)(1<<0)
#define SHOW_F_CHILDREN (int)(1<<1)
#define SHOW_F_UNIQUE (int)(1<<2)
@@ -31,7 +33,7 @@ static int _compare_module(struct module** a, struct module** b)
return strcmp((*a)->name, (*b)->name);
}
-static struct module* _load_module_deps(char* filename, int verbose)
+static struct module* _load_module_deps(char* filename)
{
FILE* fp;
struct module* module = NULL;
@@ -158,8 +160,8 @@ int gmake_module = 0;
fprintf(stderr, "error Parsing %s (%s)\n", filename, tail_indicator);
exit(1);
}
- module->list_parents = malloc(len);
- memcpy(module->list_parents, children_start, len);
+ module->list_parents = malloc(len + 1);
+ memcpy(module->list_parents, children_start, len + 1);
}
}
else
@@ -225,6 +227,11 @@ struct module_ref* mr;
cursor = module->list_parents;
while(cursor && *cursor)
{
+ if(verbose)
+ {
+ fprintf(stderr, "parent for %s :|%s|\n", module->name, cursor);
+ }
+
parent = _lookup_module(cursor, modules, nb_modules);
if(parent)
{
@@ -349,7 +356,6 @@ char* base_module_name = NULL;
int show = 0;
struct module** modules;
int nb_modules = 0;
-int verbose = 0;
/* we will have no more modules that there are arguments (in fact we should have 3 less than) */
modules = calloc(argc, sizeof(struct module*));
@@ -408,7 +414,7 @@ int verbose = 0;
{
struct module* module;
- module = _load_module_deps(argv[i], verbose);
+ module = _load_module_deps(argv[i]);
if(module)
{
modules[nb_modules++] = module;