Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/bin/ls



    Date:        Tue, 5 Nov 2024 04:04:19 +0000
    From:        "Jan Schaumann" <jschauma%netbsd.org@localhost>
    Message-ID:  <20241105040419.6C798FC7E%cvs.NetBSD.org@localhost>

  | Note that when '-s' is combined with '-1', the 'total' is _not_ printed.

It is more complex than that (though that is correct, and applies when the
-1 is explicit, or when it is used because output is not to a tty).

ls has 5 output formats, -C -1 -l -m and -x

The "total:" header line is only printed in -C (the default for output
to a terminal, and only with -s), -x (also only with -s), and -l (traditional
long format, when it is almost always printed).   The other 2 formats -1
(the default when output is not a terminal) and -m never print the total
header, with or without -s.

-C and -x are weird, (-x is just -C transposed), and if they actually print
multiple columns, they will also print the totals header.   If only 1 column
is possible (if the line width isn't wide enough for more) then they transform
into -1, and don't print the totals (which they only ever print with -s).
That could perhaps be considered a bug - which would be trivial to fix.
Absurdly trivial for -x (just move a couple of lines), not much harder
for -C (insert a couple of lines).

kre



Home | Main Index | Thread Index | Old Index