[TUHS] Command line options and complexity

Dave Horsfall dave at horsfall.org
Fri Mar 13 20:45:21 AEST 2020


Meant for the list (and don't get me started on Reply All)...

-- Dave

---------- Forwarded message ----------
Date: Fri, 13 Mar 2020 21:43:51 +1100 (EST)
From: Dave Horsfall <dave at horsfall.org>
To: Greg 'groggy' Lehey <grog at lemis.com>
Subject: Re: [TUHS] Command line options and complexity

On Fri, 13 Mar 2020, Greg 'groggy' Lehey wrote:

>> -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.

It's in "df" as well, praise Cthulu:

     aneurin# df -h
     Filesystem     Size    Used   Avail Capacity  Mounted on
     /dev/ad0s1a    496M    302M    154M    66%    /
     devfs          1.0K    1.0K      0B   100%    /dev
     tmpfs          1000    272K    999M     0%    /tmp
     /dev/ad0s1d    2.9G    1.4G    1.2G    54%    /usr
     /dev/ad0s1e    989M    581M    329M    64%    /var
     /dev/ad0s1f    3.9G    2.2G    1.4G    62%    /home
     /dev/ad0s1g    8.9G    8.0G    127M    98%    /usr/local
     fdescfs        1.0K    1.0K      0B   100%    /dev/fd
     procfs         4.0K    4.0K      0B   100%    /proc

(Memo to self: see where all the room has gone in /usr/local, as that's where I 
assigned the leftover space after the other partitions.)

No, I've never liked stuffing everything under the root file system as both the 
Mac and Penguin do; fill the root file system and you're hosed (and I also have 
an itch about /tmp being there as it's a world-writable directory).

>> 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.

Years ago I wrote a simple script "lss" which did the sort after being
howled down on one of the FreeBSD lists; what a surprise to see "-S"...

Heck, back in my UNSW days I suggested extending stty() to cover non-TTY 
devices and got trashed by the AGSM/ElecEng mob; well well, look at ioctl() 
when it appeared.

-- Dave


More information about the TUHS mailing list