tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
`ls -1s` doesn't print "total"
Hi,
It looks like `ls -1s` (single-column + '-s') does not
print the "total" summary. The manual page describes
both flags as follows:
-1 (The numeric digit "one"). Force output
to be one entry per line. This is the default
when output is not to a terminal.
-s Display the number of file system blocks
actually used by each file [...]
If the output is to a terminal, a total sum
for all the file sizes is output on a line
before the listing.
I.e., there is no note of '-1' changing the behavior
of '-s'.
Current output:
$ ls -1s
4 CVS
4 Makefile
84 a.out
12 cmp.c
8 extern.h
24 ls.1
36 ls.c
8 ls.h
4 main.c
28 print.c
12 util.c
Expected output:
$ ls -1s
total 224
4 CVS
4 Makefile
84 a.out
12 cmp.c
8 extern.h
24 ls.1
36 ls.c
8 ls.h
4 main.c
28 print.c
12 util.c
The fix is trivial (see attached), but I wanted to
check whether perhaps this was done by intent and
there's a reason why we're not printing the total when
using `-1`?
-Jan
Index: print.c
===================================================================
RCS file: /cvsroot/src/bin/ls/print.c,v
retrieving revision 1.57
diff -b -u -r1.57 print.c
--- print.c 17 May 2020 23:34:11 -0000 1.57
+++ print.c 3 Nov 2024 19:30:11 -0000
@@ -117,6 +117,9 @@
{
FTSENT *p;
+ if (!f_leafonly)
+ printtotal(dp); /* "total: %u\n" */
+
for (p = dp->list; p; p = p->fts_link) {
if (IS_NOPRINT(p))
continue;
Home |
Main Index |
Thread Index |
Old Index