add "make help"
[oweals/busybox.git] / coreutils / du.c
index a9f6c28ba24602ab48dec6704a7756a5e9e5e5c7..3778f08954112c06245d9d70b4176c65181c5325 100644 (file)
@@ -56,7 +56,7 @@ static unsigned int disp_k;   /* bss inits to 0 */
 #endif
 
 static int max_print_depth = INT_MAX;
-static int count_hardlinks = INT_MAX;
+static int count_hardlinks = 1;
 
 static int status
 #if EXIT_SUCCESS == 0
@@ -77,7 +77,11 @@ static void print(long size, char *filename)
        bb_printf("%s\t%s\n", make_human_readable_str(size, 512, disp_hr),
                   filename);
 #else
-       bb_printf("%ld\t%s\n", size >> disp_k, filename);
+       if (disp_k) {
+               size++;
+               size >>= 1;
+       }
+       bb_printf("%ld\t%s\n", size, filename);
 #endif
 }
 
@@ -177,7 +181,7 @@ int du_main(int argc, char **argv)
 #else
                disp_k = 0;
 #endif
-       } 
+       }
 #endif
 
        /* Note: SUSv3 specifies that -a and -s options can not be used together
@@ -187,7 +191,7 @@ int du_main(int argc, char **argv)
         * ignore -a.  This is consistent with -s being equivalent to -d 0.
         */
 #ifdef CONFIG_FEATURE_HUMAN_READABLE
-       bb_opt_complementaly = "h-km:k-hm:m-hk:H-L:L-H:s-d:d-s";
+       bb_opt_complementally = "h-km:k-hm:m-hk:H-L:L-H:s-d:d-s";
        opt = bb_getopt_ulflags(argc, argv, "aHkLsx" "d:" "lc" "hm", &smax_print_depth);
        if((opt & (1 << 9))) {
                /* -h opt */
@@ -202,7 +206,7 @@ int du_main(int argc, char **argv)
                        disp_hr = KILOBYTE;
        }
 #else
-       bb_opt_complementaly = "H-L:L-H:s-d:d-s";
+       bb_opt_complementally = "H-L:L-H:s-d:d-s";
        opt = bb_getopt_ulflags(argc, argv, "aHkLsx" "d:" "lc", &smax_print_depth);
 #if !defined CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K
        if((opt & (1 << 2))) {
@@ -234,7 +238,7 @@ int du_main(int argc, char **argv)
        }
        if((opt & (1 << 7))) {
                /* -l opt */
-               count_hardlinks = 1;
+               count_hardlinks = INT_MAX;
        }
        print_final_total = opt & (1 << 8); /* -c opt */