10 Eylül 2021 Cuma tarihinde Robert Elz via austin-group-l at The Open
Group <austin-group-l@opengroup.org> yazdı:
>
> When %n$ was added to those implementations of printf which support it,
> it seems to have been added in the simplest way possible - printf simply
> picks the identified arg, instead of the "next" one, and the implementation
> is more or less finished.   Generally the implementations remember the
> highest
> n in any %n$ and that identifies the number of args to remove before
> determining if any remain and the format string should be rescanned.
>

Wouldn't it be more useful if, in printf(1), `n' in `%n$' referred to the
nth argument in the current set of arguments being processed? For example,
the command:

    printf '%2$s %1$s\n' a b c d

would print:

    b a
    d c

And the command:

    printf '%3$s %1$s\n' a b c d

would print:

     a
     c

That is, the empty string would be taken for the third argument.


-- 
Oğuz
  • Adding %n$ conversi... Robert Elz via austin-group-l at The Open Group
    • Re: Adding %n$... Oğuz via austin-group-l at The Open Group
      • Re: Adding... Joerg Schilling via austin-group-l at The Open Group
        • Re: Ad... Harald van Dijk via austin-group-l at The Open Group
          • Re... Joerg Schilling via austin-group-l at The Open Group
            • ... Harald van Dijk via austin-group-l at The Open Group
              • ... Joerg Schilling via austin-group-l at The Open Group
                • ... Harald van Dijk via austin-group-l at The Open Group
                • ... Joerg Schilling via austin-group-l at The Open Group
                • ... Harald van Dijk via austin-group-l at The Open Group
                • ... Stephane Chazelas via austin-group-l at The Open Group
                • ... Joerg Schilling via austin-group-l at The Open Group

Reply via email to