From: Andre Noll Date: Wed, 4 Jun 2008 19:08:22 +0000 (+0200) Subject: Merge commit 'fml/master' X-Git-Tag: v0.0.4~43 X-Git-Url: http://git.tuebingen.mpg.de/?p=adu.git;a=commitdiff_plain;h=2e13d4d57f8836503acc6e5e4897842e2802b539;hp=e3a772746a50bda590d7da852c9e38b208d550a4 Merge commit 'fml/master' --- diff --git a/adu.ggo b/adu.ggo index bfdaf5c..a46de25 100644 --- a/adu.ggo +++ b/adu.ggo @@ -3,7 +3,7 @@ # Licensed under the GPL v2. For licencing details see COPYING. package "adu" -version "0.0.1" +version "0.0.2" purpose "advanced disk usage adu creates a database containing disk usage statistics of a given @@ -204,6 +204,16 @@ details=" format. " +option "print-base-dir" - +#~~~~~~~~~~~~~~~~~~~~~~~~ +"whether to include the base-dir in the output" +flag off +details=" + If this flag is given, all directories printed are prefixed + with the base directory. The default is to print paths relative + to the base dir. +" + option "no-headers" - #~~~~~~~~~~~~~~~~~~~~ "supress descriptions for listings/tables" diff --git a/select.c b/select.c index 59755a6..00b0325 100644 --- a/select.c +++ b/select.c @@ -116,26 +116,30 @@ static int get_dir_name_by_number(uint64_t *dirnum, char **name) char *result = NULL, *tmp; struct osl_row *row; uint64_t val = *dirnum; - struct osl_object obj = {.data = &val, .size = sizeof(val)}; + struct osl_object obj; int ret; again: + obj.data = &val; + obj.size = sizeof(val); ret = osl(osl_get_row(dir_table, DT_NUM, &obj, &row)); if (ret < 0) goto out; - ret = osl(osl_get_object(dir_table, row, DT_NAME, &obj)); - if (ret < 0) - goto out; - if (result) { - tmp = make_message("%s/%s", (char *)obj.data, result); - free(result); - result = tmp; - } else - result = adu_strdup((char *)obj.data); ret = osl(osl_get_object(dir_table, row, DT_PARENT_NUM, &obj)); if (ret < 0) goto out; val = *(uint64_t *)obj.data; + ret = osl(osl_get_object(dir_table, row, DT_NAME, &obj)); + if (ret < 0) + goto out; + if (val || conf.print_base_dir_given) { + if (result) { + tmp = make_message("%s/%s", (char *)obj.data, result); + free(result); + result = tmp; + } else + result = adu_strdup((char *)obj.data); + } if (val) goto again; out: