Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F168471176
D48329.id149083.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
905 B
Referenced Files
None
Subscribers
None
D48329.id149083.diff
View Options
diff --git a/bin/ls/ls.1 b/bin/ls/ls.1
--- a/bin/ls/ls.1
+++ b/bin/ls/ls.1
@@ -541,6 +541,9 @@
and
.Pa ..
and other files which start with a dot, depending on other options).
+The
+.Fl h
+option will make the total also provide the number of bytes.
.Pp
The default block size is 512 bytes.
The block size may be set with option
diff --git a/bin/ls/print.c b/bin/ls/print.c
--- a/bin/ls/print.c
+++ b/bin/ls/print.c
@@ -216,7 +216,14 @@
if ((dp->list == NULL || dp->list->fts_level != FTS_ROOTLEVEL) &&
(f_longform || f_size)) {
- (void)printf("total %lu\n", howmany(dp->btotal, blocksize));
+ if (!f_humanval)
+ (void)printf("total %lu\n", howmany(dp->btotal, blocksize));
+ else {
+ (void)humanize_number(buf, 7 /* "1024 KB" */,
+ dp->btotal * 512, "B", HN_AUTOSCALE, HN_DECIMAL);
+
+ (void)printf("total %s\n", buf);
+ }
}
for (p = dp->list; p; p = p->fts_link) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Aug 29, 1:47 PM (19 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37515650
Default Alt Text
D48329.id149083.diff (905 B)
Attached To
Mode
D48329: ls -h: humanize the total as well
Attached
Detach File
Event Timeline
Log In to Comment