aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-03-07 03:48:02 +0000
committerEric Andersen <andersen@codepoet.org>2001-03-07 03:48:02 +0000
commit651f8c04ef62ec4987156933ac4e1cc8d313562a (patch)
tree2db2611e4e682a2530e6f31e4bd5fbebe5d7b5eb /coreutils
parent6c563bc1a13d3910097594f9ed34cd325baeef60 (diff)
downloadbusybox-651f8c04ef62ec4987156933ac4e1cc8d313562a.tar.gz
Fix up ls.c to ensure human readable works properly in all cases
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/ls.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index d8666152e..f9e0b2538 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -186,7 +186,7 @@ static unsigned short column_width = COLUMN_WIDTH;
static int status = EXIT_SUCCESS;
#ifdef BB_FEATURE_HUMAN_READABLE
-unsigned long ls_disp_hr = KILOBYTE;
+unsigned long ls_disp_hr = 0;
#endif
static int my_stat(struct dnode *cur)
@@ -610,7 +610,7 @@ int list_single(struct dnode *dn)
break;
case LIST_BLOCKS:
#ifdef BB_FEATURE_HUMAN_READABLE
- fprintf(stdout, "%5s ", format(dn->dstat.st_blocks>>1, 1));
+ fprintf(stdout, "%5s ", format(dn->dstat.st_blocks>>1, (ls_disp_hr==TRUE)? 0: 1));
#else
#if _FILE_OFFSET_BITS == 64
printf("%4lld ", dn->dstat.st_blocks>>1);
@@ -647,7 +647,7 @@ int list_single(struct dnode *dn)
printf("%4d, %3d ", (int)MAJOR(dn->dstat.st_rdev), (int)MINOR(dn->dstat.st_rdev));
} else {
#ifdef BB_FEATURE_HUMAN_READABLE
- fprintf(stdout, "%9s ", format(dn->dstat.st_size, ls_disp_hr));
+ fprintf(stdout, "%9s ", format(dn->dstat.st_size, (ls_disp_hr==TRUE)? 0: 1));
#else
#if _FILE_OFFSET_BITS == 64
printf("%9lld ", dn->dstat.st_size>>1);
@@ -779,7 +779,7 @@ extern int ls_main(int argc, char **argv)
style_fmt = STYLE_LONG;
list_fmt |= LIST_LONG;
#ifdef BB_FEATURE_HUMAN_READABLE
- ls_disp_hr = 1;
+ ls_disp_hr = FALSE;
#endif
break;
case 'n': list_fmt |= LIST_ID_NUMERIC; break;
@@ -826,7 +826,7 @@ extern int ls_main(int argc, char **argv)
case 'w': terminal_width= atoi(optarg); break;
#endif
#ifdef BB_FEATURE_HUMAN_READABLE
- case 'h': ls_disp_hr = 0; break;
+ case 'h': ls_disp_hr = TRUE; break;
#endif
case 'k': break;
default: