--

On Thu, 30 Dec 1999 10:10:00   Paul Eggert wrote:
>   From: [EMAIL PROTECTED]
>   Date: Thu, 30 Dec 1999 15:24:33 GMT
>
>   I know ls already has very many options, but I find it
>   indispensable having the file-size field formatted with
>   a thousands separator (e.g. a file size of 1234567890
>   prints as "1,234,567,890").
>
>I think this is a nice idea.
>
>Some comments:
>
>* The thousands separator is locale-dependent, and you should use
>  locale-dependent formatting instead of hardwiring ','.

I first tried using localeconv() to get the
thousands_sep member of the lconv struct, but
the locales that I tried this with all had
thousands_sep set to "".  If this option is
accepted into the fileutils source, I will
address the locale issues.  Perhaps someone
already has a function with smart heuristics
about pulling the thousands separator from the
LC_NUMERIC information.  As a first step for
now, the thousands separator character is
stored in a variable, but I have explicitly
set it to ','.

>
>* It would be nice to combine -K and -h or -H somehow, e.g. to specify
>  that all sizes are in SI megabytes, so that instead of
>
>   -rw-rw-r--    1 user1    user1           14,336 Dec 28 14:45 file3
>   -rw-rw-r--    1 user1    user1    1,101,004,800 Dec 28 14:49 file4
>   -rw-rw-r--    1 user1    user1       35,127,296 Dec 28 14:54 file5
>
>  one would see something like this instead:
>
>   -rw-rw-r--    1 user1    user1        0M Dec 28 14:45 file3
>   -rw-rw-r--    1 user1    user1    1,101M Dec 28 14:49 file4
>   -rw-rw-r--    1 user1    user1       35M Dec 28 14:54 file5
>
>You wrote:
>
>   Note that the -K option automatically widens the file size field
>   from 8 to 13, which allows files up to 9,999,999,999 bytes to align
>   properly in columns.
>
>This doesn't sound consistent to me.  If the normal file size field is
>8 (i.e. max is 99999999), then the -K file size field should be 10
>(i.e. max is 99,999,999).

You are correct -- it isn't consistent, but
I intended that.  I really wanted a wider
field for file size because of the large files
I tend to deal with.

>
>Also, this runs into the problem that the ls output is too wide
>already.  Perhaps the size width should be set automatically from the
>width of the widest file size.
>

I agree that ls output is getting wide, but
without doing something like the -h option, the
file size isn't truncatable.  I really like your
idea of basing the field width on the widest
file size.  From the ls code, though, that
appears to me to be a big change.

Thank you very much for your feedback and
suggestions.  I really appreciate you taking
the time send me your thoughts.


--== Sent via Deja.com http://www.deja.com/ ==--
Share what you know. Learn what you don't.

Reply via email to