[TUHS] Command line options and complexity

Greg 'groggy' Lehey grog at lemis.com
Fri Mar 13 11:02:06 AEST 2020


On Wednesday, 11 March 2020 at 23:34:46 -0400, Steve Nickolas wrote:
> On Thu, 12 Mar 2020, Greg 'groggy' Lehey wrote:
>> -S isn't POSIX.  And to implement it without an option would mean
>> removing -h.
>
> -h is a gnuism, isn't it?

It might have originated there, but then I would expect it to be spelt
'--produce-human-readable-output'.  I haven't been able to establish
from the FreeBSD sources or commit logs when it was introduced.  It
would clearly have been a reimplementation.

> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html does
> specify the -S switch.  That's POSIX, isn't it?

So it is!  This was the first option that I wanted to add, back when I
still had practice wheels.  I asked my mentor, and he said "not the
Unix way", so I let it be.  Then Wes Peters came up with the idea, and
I thought he committed it, but it seems that it ultimately came from
Kostas Blekos in 2005, based on the same feature on NetBSD and
OpenBSD.  I wonder when it made it to POSIX.

>> As I mentioned earlier, -t can't be done by a filter without
>> significantly modifying the timestamp output.  That was my rationale
>> for the -D option, which allows sorting by an external filter.
>
> Understandable.
>
> Honestly if the date format weren't standardized as it were, I would've
> standardized on "yyyy-mm-dd,mm:ss" - which wouldn't need special
> processing in order to pump into sort(1).

Yes, that was one of the possibilities I thought of.  Another obvious
one was time_t, which is even easier to process.  And then there's ISO
8601.  That's why it didn't take me long to decide "do it *your* way”
with the -D option.

Greg
--
Sent from my desktop computer.
Finger grog at lemis.com for PGP public key.
See complete headers for address and phone numbers.
This message is digitally signed.  If your Microsoft mail program
reports problems, please read http://lemis.com/broken-MUA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20200313/ab994342/attachment.sig>


More information about the TUHS mailing list