From f1d5eaac818cdf932498c402671bef135bff3812 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 20 Jun 2008 17:30:26 +0200 Subject: [PATCH] Move remaining select options from adu.ggo to select.ggo. --- adu.ggo | 62 +----------------------------------------------------- select.c | 22 +++++++++---------- select.ggo | 42 ++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 72 deletions(-) diff --git a/adu.ggo b/adu.ggo index 4d52f82..11a5d00 100644 --- a/adu.ggo +++ b/adu.ggo @@ -146,72 +146,12 @@ details=" users. Decreasing the value causes adu to use slightly less memory. " -############################## -section "Options for --select" -############################## - option "select-options" s #~~~~~~~~~~~~~~~~~~~~~~~~~ -"options for select mode" +"Options for select mode" string typestr="" optional dependon="select" details=" Try --select-options \"-h\" " - -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" -flag off -dependon="select" -details=" - This is mostly useful to feed the output of adu to scripts. -" - -option "global-list" - -#~~~~~~~~~~~~~~~~~~~~~ -"how to print global directory listings" -enum typestr="which" -values="size","file_count","both","none" -default="both" -optional -dependon="select" -details=" - By default adu prints two global directory listings: The - first prints the directory names ordered by the sum of the - sizes of the contained files while the second listing prints - them sorted by the number of files. This option can be used - to print only one or neither of these two listings. -" - -option "no-global-summary" - -#~~~~~~~~~~~~~~~~~~~~~~~~~~~ -"do not print the summary line" -flag off -dependon="select" - -option "user-list" - -#~~~~~~~~~~~~~~~~~~~ -"how to print per-user directory listings" -enum typestr="which" -values="size","file_count","both","none" -default="both" -optional -dependon="select" -details=" - Similar to the global directory listings mentioned above, - adu can print two directory listings per user. This option - controls which of the these should be printed. -" - diff --git a/select.c b/select.c index 801aba4..226c164 100644 --- a/select.c +++ b/select.c @@ -136,7 +136,7 @@ again: ret = osl(osl_get_object(dir_table, row, DT_NAME, &obj)); if (ret < 0) goto out; - pfx = (conf.print_base_dir_given || val)? (char *)obj.data : "."; + pfx = (select_conf.print_base_dir_given || val)? (char *)obj.data : "."; tmp = make_message("%s/%s", pfx, result? result : ""); free(result); result = tmp; @@ -339,13 +339,13 @@ static void print_global_summary(void) enum enum_count_unit ud, uf; enum enum_size_unit us; - if (conf.no_global_summary_given) + if (select_conf.no_global_summary_given) return; ud = format_count_value(select_conf.count_unit_arg, num_dirs, 0, d); uf = format_count_value(select_conf.count_unit_arg, num_files, 0, f); us = format_size_value(select_conf.size_unit_arg, num_bytes, 0, s); - if (!conf.no_headers_given) + if (!select_conf.no_headers_given) printf("Global summary " "(dirs(%c)/files(%c)/size(%c))\n", count_unit_abbrevs[ud], @@ -434,7 +434,7 @@ static void print_user_summary(void) { if (select_conf.no_user_summary_given) return; - if (!conf.no_headers_given) + if (!select_conf.no_headers_given) printf("User summary " "(pw_name/uid/dirs%s/files%s/size%s):\n", count_unit_buf, count_unit_buf, size_unit_buf); @@ -446,7 +446,7 @@ static int print_user_list(struct user_info *ui, __a_unused void *data) { int ret; struct user_stats_info usi; - enum enum_user_list ula = conf.user_list_arg; + enum enum_user_list ula = select_conf.user_list_arg; int print_size_list = (ula == user_list_arg_size || ula == user_list_arg_both); @@ -454,7 +454,7 @@ static int print_user_list(struct user_info *ui, __a_unused void *data) usi.count = select_conf.limit_arg; usi.ui = ui; usi.flags = USF_PRINT_DIRNAME | USF_PRINT_BYTES | USF_COMPUTE_SUMMARY; - if (!conf.no_headers_given) + if (!select_conf.no_headers_given) printf("%s (uid %u), by size%s:\n", ui->pw_name? ui->pw_name : "?", (unsigned)ui->uid, size_unit_buf); @@ -465,7 +465,7 @@ static int print_user_list(struct user_info *ui, __a_unused void *data) printf("\n"); } if (ula == user_list_arg_file_count || ula == user_list_arg_both) { - if (!conf.no_headers_given) + if (!select_conf.no_headers_given) printf("%s (uid %u), by file count%s:\n", ui->pw_name? ui->pw_name : "?", (unsigned)ui->uid, count_unit_buf); @@ -499,14 +499,14 @@ static int print_global_lists(void) { struct global_stats_info gsi; int ret; - enum enum_global_list gla = conf.global_list_arg; + enum enum_global_list gla = select_conf.global_list_arg; int print_size_list = (gla == global_list_arg_size || gla == global_list_arg_both); if (print_size_list) { gsi.count = select_conf.limit_arg; gsi.flags = GSF_PRINT_DIRNAME | GSF_PRINT_BYTES | GSF_COMPUTE_SUMMARY; - if (!conf.no_headers_given) + if (!select_conf.no_headers_given) printf("By size%s:\n", size_unit_buf); ret = adu_loop_reverse(dir_table, DT_BYTES, &gsi, global_stats_loop_function, &gsi.ret, &gsi.osl_errno); @@ -519,7 +519,7 @@ static int print_global_lists(void) gsi.flags = GSF_PRINT_DIRNAME | GSF_PRINT_FILES; if (!print_size_list) gsi.flags |= GSF_COMPUTE_SUMMARY; - if (!conf.no_headers_given) + if (!select_conf.no_headers_given) printf("By file count%s:\n", count_unit_buf); ret = adu_loop_reverse(dir_table, DT_FILES, &gsi, global_stats_loop_function, &gsi.ret, &gsi.osl_errno); @@ -527,7 +527,7 @@ static int print_global_lists(void) return ret; printf("\n"); } - if (gla == global_list_arg_none && !conf.no_global_summary_given) { + if (gla == global_list_arg_none && !select_conf.no_global_summary_given) { /* must compute summary */ gsi.count = select_conf.limit_arg; gsi.flags = GSF_COMPUTE_SUMMARY; diff --git a/select.ggo b/select.ggo index 6538f52..f4d090b 100644 --- a/select.ggo +++ b/select.ggo @@ -112,3 +112,45 @@ option "no-user-summary" - #~~~~~~~~~~~~~~~~~~~~~~~~~~~ "do not print the user summary table" flag off + + +option "user-list" - +#~~~~~~~~~~~~~~~~~~~ +"how to print per-user directory listings" +enum typestr="which" +values="size","file_count","both","none" +default="both" +optional +details=" + Similar to the global directory listings mentioned above, + adu can print two directory listings per user. This option + controls which of the these should be printed. +" +option "no-global-summary" - +#~~~~~~~~~~~~~~~~~~~~~~~~~~~ +"do not print the summary line" +flag off + +option "global-list" - +#~~~~~~~~~~~~~~~~~~~~~ +"how to print global directory listings" +enum typestr="which" +values="size","file_count","both","none" +default="both" +optional +details=" + By default adu prints two global directory listings: The + first prints the directory names ordered by the sum of the + sizes of the contained files while the second listing prints + them sorted by the number of files. This option can be used + to print only one or neither of these two listings. +" +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. +" -- 2.39.5