[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#21325: ls : feature request --width=zero
From: |
Pádraig Brady |
Subject: |
bug#21325: ls : feature request --width=zero |
Date: |
Tue, 20 Oct 2015 17:17:16 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
On 20/10/15 03:55, Aaron Davies wrote:
> On Aug 24, 2015, at 3:34 AM, f0rhum <address@hidden> wrote:
>>
>> Le 23/08/2015 23:11, Stephane Chazelas a écrit :
>>
>>> 2015-08-23 13:26:35 +0200, Erik Auerswald:
>>>> Hi,
>>>>
>>>> On Sat, Aug 22, 2015 at 08:58:01PM -0700, Paul Eggert wrote:
>>>>> Pádraig Brady wrote:
>>>>>> Also base64 -w0 has similar meaning.
>>>>> I didn't know that, but I don't like that either. Utilities should
>>>>> use an explicit representation for infinity, if that's what they
>>>>> need. 'Inf', say.
>>>>>
>>>>> In the meantime, the patch that I installed is helpful even if we
>>>>> later add an explicit representation of infinity.
>>>> Using 0 to disable a length or width limit is quite common with networking
>>>> gear. I do not know any example requiring a keyword like "Inf", neither
>>>> UNIX (like) nor other CLIs.
>>> [...]
>>>
>>> Anything using strtod() to parse numbers should understand inf
>>> or infinity (with any vAriATion on the case).
>>>
>>> That's the case of GNU sleep for instance.
>>>
>>> That doesn't apply to integers though.
>>
>> I'm not involved, but just a suggestion if no one thought about this: why
>> not use w-1 ?
>
> here's some more precedent for 0 meaning infinity; from `info sed':
>
>> `-l N'
>> `--line-length=N'
>> Specify the default line-wrap length for the `l' command. A
>> length of 0 (zero) means to never wrap long lines. If not
>> specified, it is taken to be 70.
Right. It comes down to whether the number is considered as a length/width or a
limit.
If a limit, then 0 naturally implies no limit. If a length, then 0 is
meaningless.
So in cases where the output can be optionally wrapped,
IMHO it makes sense to consider 0 as a limit.
I like Bernhard's suggestion of just using `paste -s -d' '`,
however that single spaces items, whereas ls double spaces
(to aid parsing of names with spaces I suppose).
BTW I see the change to allow -w999... also allowed 0,
which results in division by zero later on:
$ src/ls -w0 --color=always
Floating point exception (core dumped)
The attached fixes that and makes -w0 behave as described above,
while operating more efficiently in this mode.
cheers,
Pádraig.
ls-w0.patch
Description: Text Data