]> git.tuebingen.mpg.de Git - adu.git/blobdiff - adu.c
Honor the --limit option.
[adu.git] / adu.c
diff --git a/adu.c b/adu.c
index 26039ce7a35a2a7fc96bfd897eec08d2ddc3febd..93305d5ee865ed458b97c5149465d9a603811ea1 100644 (file)
--- a/adu.c
+++ b/adu.c
@@ -538,7 +538,7 @@ static int global_stats_loop_function(struct osl_row *row, void *data)
                        num_dirs++;
                }
        }
-       if (gsi->count)
+       if (gsi->count > 0)
                gsi->count--;
        return 1;
 }
@@ -626,7 +626,7 @@ static int user_stats_loop_function(struct osl_row *row, void *data)
                }
 
        }
-       if (usi->count)
+       if (usi->count > 0)
                usi->count--;
        return 1;
 }
@@ -637,7 +637,7 @@ static void print_user_stats(void)
 
        FOR_EACH_USER(ui) {
                struct user_stats_info usi = {
-                       .count = 10,
+                       .count = conf.limit_arg,
                        .ui = ui
                };
                if (!ui->table)
@@ -651,7 +651,7 @@ static void print_user_stats(void)
                osl_rbtree_loop_reverse(ui->table, UT_BYTES, &usi,
                        user_stats_loop_function);
                printf("---------- dirs containing most files ------------\n");
-               usi.count = 10;
+               usi.count = conf.limit_arg,
                usi.flags = USF_PRINT_DIRNAME | USF_PRINT_FILES;
                osl_rbtree_loop_reverse(ui->table, UT_FILES, &usi,
                        user_stats_loop_function);
@@ -662,7 +662,7 @@ static int print_statistics(void)
 {
        int ret;
        struct global_stats_info gsi = {
-               .count = 10,
+               .count = conf.limit_arg,
                .flags = GSF_PRINT_DIRNAME | GSF_PRINT_BYTES | GSF_COMPUTE_SUMMARY
        };
 
@@ -671,7 +671,7 @@ static int print_statistics(void)
                global_stats_loop_function);
        if (ret < 0 && ret != -E_LOOP_COMPLETE)
                return ret;
-       gsi.count = 10;
+       gsi.count = conf.limit_arg;
 
        gsi.flags = GSF_PRINT_DIRNAME | GSF_PRINT_FILES;
        printf("---------- dirs containing most files ------------\n");