diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/df.c | 23 | ||||
-rw-r--r-- | coreutils/du.c | 7 | ||||
-rw-r--r-- | coreutils/ls.c | 4 |
3 files changed, 24 insertions, 10 deletions
diff --git a/coreutils/df.c b/coreutils/df.c index c37b188..624ad94 100644 --- a/coreutils/df.c +++ b/coreutils/df.c @@ -92,7 +92,10 @@ int df_main(int argc, char **argv) if (disp_units_hdr == NULL) { #if ENABLE_FEATURE_HUMAN_READABLE disp_units_hdr = xasprintf("%s-blocks", - make_human_readable_str(df_disp_hr, 0, !!(opt & OPT_POSIX))); + /* print df_disp_hr, show no fractionals, + * use suffixes if OPT_POSIX is set in opt */ + make_human_readable_str(df_disp_hr, 0, !!(opt & OPT_POSIX)) + ); #else disp_units_hdr = xasprintf("%lu-blocks", df_disp_hr); #endif @@ -189,21 +192,27 @@ int df_main(int argc, char **argv) #if ENABLE_FEATURE_HUMAN_READABLE printf(" %9s ", + /* f_blocks x f_bsize / df_disp_hr, show one fractional, + * use suffixes if df_disp_hr == 0 */ make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr)); printf(" %9s " + 1, + /* EXPR x f_bsize / df_disp_hr, show one fractional, + * use suffixes if df_disp_hr == 0 */ make_human_readable_str((s.f_blocks - s.f_bfree), s.f_bsize, df_disp_hr)); printf("%9s %3u%% %s\n", - make_human_readable_str(s.f_bavail, s.f_bsize, df_disp_hr), - blocks_percent_used, mount_point); + /* f_bavail x f_bsize / df_disp_hr, show one fractional, + * use suffixes if df_disp_hr == 0 */ + make_human_readable_str(s.f_bavail, s.f_bsize, df_disp_hr), + blocks_percent_used, mount_point); #else printf(" %9lu %9lu %9lu %3u%% %s\n", - kscale(s.f_blocks, s.f_bsize), - kscale(s.f_blocks - s.f_bfree, s.f_bsize), - kscale(s.f_bavail, s.f_bsize), - blocks_percent_used, mount_point); + kscale(s.f_blocks, s.f_bsize), + kscale(s.f_blocks - s.f_bfree, s.f_bsize), + kscale(s.f_bavail, s.f_bsize), + blocks_percent_used, mount_point); #endif } } diff --git a/coreutils/du.c b/coreutils/du.c index ec283f8..730d6d1 100644 --- a/coreutils/du.c +++ b/coreutils/du.c @@ -58,14 +58,17 @@ static void print(unsigned long size, const char *filename) { /* TODO - May not want to defer error checking here. */ #if ENABLE_FEATURE_HUMAN_READABLE - printf("%s\t%s\n", make_human_readable_str(size, 512, G.disp_hr), + printf("%s\t%s\n", + /* size x 512 / G.disp_hr, show one fractional, + * use suffixes if G.disp_hr == 0 */ + make_human_readable_str(size, 512, G.disp_hr), filename); #else if (G.disp_k) { size++; size >>= 1; } - printf("%ld\t%s\n", size, filename); + printf("%lu\t%s\n", size, filename); #endif } diff --git a/coreutils/ls.c b/coreutils/ls.c index a067aa3..38cabca 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -829,7 +829,9 @@ static NOINLINE unsigned list_single(const struct dnode *dn) } else { if (all_fmt & LS_DISP_HR) { column += printf("%9s ", - make_human_readable_str(dn->dstat.st_size, 1, 0)); + /* print st_size, show one fractional, use suffixes */ + make_human_readable_str(dn->dstat.st_size, 1, 0) + ); } else { column += printf("%9"OFF_FMT"u ", (off_t) dn->dstat.st_size); } |