summaryrefslogtreecommitdiffstats
path: root/bin/ls
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2004-01-22 04:33:00 +0000
committercperciva <cperciva@FreeBSD.org>2004-01-22 04:33:00 +0000
commit67d46f93771c5d9f40ea22a51eaed742912d9f2a (patch)
tree48d4b2e6fa998840f39caa628eb9abd6707b512e /bin/ls
parent9c74fea4de8e77e9b92b5390dcae4094dc36eba9 (diff)
downloadFreeBSD-src-67d46f93771c5d9f40ea22a51eaed742912d9f2a.zip
FreeBSD-src-67d46f93771c5d9f40ea22a51eaed742912d9f2a.tar.gz
Fix alignment of size field in `ls -lh` -- the width was being computed
from log[10](largest file size), but when outputting in human-friendly format the width is always at most 4. (eg. "123K", " 12K", "1.2K".) PR: bin/59320 Approved by: rwatson (mentor)
Diffstat (limited to 'bin/ls')
-rw-r--r--bin/ls/print.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/ls/print.c b/bin/ls/print.c
index fb8d718..10a19d9 100644
--- a/bin/ls/print.c
+++ b/bin/ls/print.c
@@ -624,9 +624,9 @@ printsize(size_t width, off_t bytes)
unit = unit_adjust(&dbytes);
if (dbytes == 0)
- (void)printf("%*s ", (u_int)width, "0B");
+ (void)printf("%*s ", 4, "0B");
else
- (void)printf("%*.*f%c ", (u_int)width - 1,
+ (void)printf("%*.*f%c ", 3,
dbytes > 10 ? 0 : 1, dbytes, "BKMGTPE"[unit]);
} else
(void)printf("%*jd ", (u_int)width, bytes);
OpenPOWER on IntegriCloud