ls(1): Fix sort-by-size bug
authorJohn Marino <draco@marino.st>
Tue, 8 Dec 2015 22:41:22 +0000 (23:41 +0100)
committerJohn Marino <draco@marino.st>
Tue, 8 Dec 2015 22:46:19 +0000 (23:46 +0100)
commitc98688068db5d766bdb707c4eafdb16daac1cf2d
treeb3927cc9a70f325bf8b7c0650b91d9012e64efd5
parentef2687d455a182ac4297be77c0432959bc6e1127
ls(1): Fix sort-by-size bug

For a reason that escapes me, in order to sort files by size using ls(1),
one had to pass both the size sort switch (-S) and the time sort switch
(-t), otherwise the -S flag would be ignored.  This hacky workaround was
documented in the man page as well.

Let's fix this with code taken from FreeBSD.  The -t and -S switches are
now mutually exclusive.  If someone uses them together, then the last
one wins (e.g. ls -st sorts by mod. time and -ts sorts by file size)
bin/ls/ls.1
bin/ls/ls.c