Move --size-unit and --count-unit from adu.ggo to select.ggo.
authorAndre Noll <maan@systemlinux.org>
Fri, 20 Jun 2008 15:18:13 +0000 (17:18 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 20 Jun 2008 15:18:13 +0000 (17:18 +0200)
adu.ggo
select.c
select.ggo

diff --git a/adu.ggo b/adu.ggo
index 4be9373..55e5c5a 100644 (file)
--- a/adu.ggo
+++ b/adu.ggo
@@ -88,7 +88,7 @@ details="
 "
 
 groupoption "interactive" I
-#~~~~~~~~~~~~~~~~~~~~~
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
 "activate interactive mode"
 group="mode"
 details="
@@ -160,35 +160,6 @@ details="
        Try --select-options \"-h\"
 "
 
-option "size-unit" -
-#~~~~~~~~~~~~~~~~~~~
-"select output format for sizes"
-enum typestr="format"
-values="h","b","k","m","g","t"
-default="h"
-optional
-dependon="select"
-details="
-       Print sizes in the given unit: human-readable, bytes,
-       kilobytes (2^10), megabytes (2^20), gigabytes (2^30), terabytes
-       (2^40). The default is \"h\", i.e. human-readable.
-"
-
-option "count-unit" -
-#~~~~~~~~~~~~~~~~~~~~
-"select output format for counted values"
-enum typestr="format"
-values="h","n","k","m","g","t"
-default="h"
-optional
-dependon="select"
-details="
-       Print the number of files/directories in the given unit:
-       human-readable, number, number/10^3, number/10^6, number/10^12,
-       number/10^15. The default is to print numbers in human-readable
-       format.
-"
-
 option "print-base-dir" -
 #~~~~~~~~~~~~~~~~~~~~~~~~
 "whether to include the base-dir in the output"
index ef63cf3..e095073 100644 (file)
--- a/select.c
+++ b/select.c
@@ -184,8 +184,8 @@ static int user_stats_loop_function(struct osl_row *row, void *data)
                        goto err;
                files = *(uint64_t *)obj.data;
                if (usi->count && (usi->flags & USF_PRINT_FILES)) {
-                       format_count_value(conf.count_unit_arg, files,
-                               conf.count_unit_arg == count_unit_arg_h,
+                       format_count_value(select_conf.count_unit_arg, files,
+                               select_conf.count_unit_arg == count_unit_arg_h,
                                formated_value);
                        printf("\t%s%s", formated_value,
                                (usi->flags & (USF_PRINT_BYTES | USF_PRINT_DIRNAME))?
@@ -202,8 +202,8 @@ static int user_stats_loop_function(struct osl_row *row, void *data)
                        goto err;
                bytes = *(uint64_t *)obj.data;
                if (usi->count && (usi->flags & USF_PRINT_BYTES)) {
-                       format_size_value(conf.size_unit_arg, bytes,
-                               conf.size_unit_arg == size_unit_arg_h,
+                       format_size_value(select_conf.size_unit_arg, bytes,
+                               select_conf.size_unit_arg == size_unit_arg_h,
                                formated_value);
                        printf("%s%s%s",
                                (usi->flags & USF_PRINT_FILES)? "" : "\t",
@@ -258,8 +258,8 @@ static int global_stats_loop_function(struct osl_row *row, void *data)
                        goto err;
                files = *(uint64_t *)obj.data;
                if (gsi->count && (gsi->flags & GSF_PRINT_FILES)) {
-                       format_count_value(conf.count_unit_arg, files,
-                               conf.count_unit_arg == count_unit_arg_h,
+                       format_count_value(select_conf.count_unit_arg, files,
+                               select_conf.count_unit_arg == count_unit_arg_h,
                                formated_value);
                        printf("\t%s%s", formated_value,
                                (gsi->flags & (GSF_PRINT_BYTES | GSF_PRINT_DIRNAME))?
@@ -275,8 +275,8 @@ static int global_stats_loop_function(struct osl_row *row, void *data)
                        goto err;
                bytes = *(uint64_t *)obj.data;
                if (gsi->count && (gsi->flags & GSF_PRINT_BYTES)) {
-                       format_size_value(conf.size_unit_arg, bytes,
-                               conf.size_unit_arg == size_unit_arg_h,
+                       format_size_value(select_conf.size_unit_arg, bytes,
+                               select_conf.size_unit_arg == size_unit_arg_h,
                                formated_value);
                        printf("%s%s%s",
                                (gsi->flags & GSF_PRINT_FILES)? "" : "\t",
@@ -341,9 +341,9 @@ static void print_global_summary(void)
 
        if (conf.no_global_summary_given)
                return;
-       ud = format_count_value(conf.count_unit_arg, num_dirs, 0, d);
-       uf = format_count_value(conf.count_unit_arg, num_files, 0, f);
-       us = format_size_value(conf.size_unit_arg, num_bytes, 0, s);
+       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)
                printf("Global summary "
@@ -361,14 +361,14 @@ static int print_user_summary_line(struct user_info *ui, __a_unused void *data)
                formated_file_count[FORMATED_VALUE_SIZE],
                formated_bytes[FORMATED_VALUE_SIZE ];
 
-       format_count_value(conf.count_unit_arg, ui->dirs,
-               conf.count_unit_arg == count_unit_arg_h,
+       format_count_value(select_conf.count_unit_arg, ui->dirs,
+               select_conf.count_unit_arg == count_unit_arg_h,
                formated_dir_count);
-       format_count_value(conf.count_unit_arg, ui->files,
-               conf.count_unit_arg == count_unit_arg_h,
+       format_count_value(select_conf.count_unit_arg, ui->files,
+               select_conf.count_unit_arg == count_unit_arg_h,
                formated_file_count);
-       format_size_value(conf.size_unit_arg, ui->bytes,
-               conf.size_unit_arg == size_unit_arg_h,
+       format_size_value(select_conf.size_unit_arg, ui->bytes,
+               select_conf.size_unit_arg == size_unit_arg_h,
                formated_bytes);
        printf("\t%s\t%u\t%s\t%s\t%s\n",
                ui->pw_name? ui->pw_name : "?",
@@ -607,12 +607,12 @@ int com_select(void)
                        return ret;
        }
 
-       if (conf.count_unit_arg != count_unit_arg_h)
-               count_unit_buf[1] = count_unit_abbrevs[conf.count_unit_arg];
+       if (select_conf.count_unit_arg != count_unit_arg_h)
+               count_unit_buf[1] = count_unit_abbrevs[select_conf.count_unit_arg];
        else
                count_unit_buf[0] = '\0';
-       if (conf.size_unit_arg != size_unit_arg_h)
-               size_unit_buf[1] = size_unit_abbrevs[conf.size_unit_arg];
+       if (select_conf.size_unit_arg != size_unit_arg_h)
+               size_unit_buf[1] = size_unit_abbrevs[select_conf.size_unit_arg];
        else
                size_unit_buf[0] = '\0';
 
index 33e75fe..a1de3a9 100644 (file)
@@ -67,3 +67,31 @@ default="-"
 details="
        If empty, or not given, use stdout.
 "
+
+option "size-unit" -
+#~~~~~~~~~~~~~~~~~~~
+"select output format for sizes"
+enum typestr="format"
+values="h","b","k","m","g","t"
+default="h"
+optional
+details="
+       Print sizes in the given unit: human-readable, bytes,
+       kilobytes (2^10), megabytes (2^20), gigabytes (2^30), terabytes
+       (2^40). The default is \"h\", i.e. human-readable.
+"
+
+option "count-unit" -
+#~~~~~~~~~~~~~~~~~~~~
+"select output format for counted values"
+enum typestr="format"
+values="h","n","k","m","g","t"
+default="h"
+optional
+details="
+       Print the number of files/directories in the given unit:
+       human-readable, number, number/10^3, number/10^6, number/10^12,
+       number/10^15. The default is to print numbers in human-readable
+       format.
+"
+