On 06/01/08 19:12 -0500, Matt Wozniski wrote:
>
>On Jan 6, 2008 6:52 PM, Dasn <[EMAIL PROTECTED]> wrote:
>>
>> On 06/01/08 17:14 -0500, Matt Wozniski wrote:
>> >
>> >So, there ought to be no problems with
>> >for i in *; do
>> >  printf "%s\0" $i
>> >done
>> >
>>
>> Hmm, I found some tricky stuff this morning, just one
>>
>> $ printf "%s\0" *
>>
>> is enough. Tested in freebsd, obsd, linux.
>> I don't know why and whether it will work on other platforms. :)
>
>Sure; that's not tricky at all, and it works with the caveat I
>mentioned above...  If "printf" is an external binary, this needs to
>go through an exec call, which means we could create a command line +
>environment that's larger than ARG_MAX, causing the call to fail.
>That's much, much less likely to happen when passing a single file
>name.
>
>~Matt

Yes, not tricky :). It was described in SUSV of printf(1):
    9. The format operand shall be reused as often as necessary to
       satisfy the argument operands. 

-- 
Dasn


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui