On 2/22/25 5:05 AM, Phi Debian wrote:


On Sat, Feb 22, 2025 at 9:49 AM Andreas Schwab <sch...@linux-m68k.org <mailto:sch...@linux-m68k.org>> wrote:

    On Feb 22 2025, Phi Debian wrote:

     > I forgot to mention your trick to nuke the fmt reuse still works
     >
     > $ printf '%s %s %s %999$s' A B C D E F G
     > A B C

    As long as NL_ARGMAX >= 999.


Sounds like I was over optimistic

$ echo $KSH_VERSION
Version AJM 93u+m/1.1.0-alpha+b5087279 2025-01-15
$ printf '%s %s %999$s\n' 1 2 3 4 5 6 7 8
1 2
$ unset A B C D E F G H
$ printf '%s %s %999$s\n'  A B C D E F G H
./ksh: printf: C: parameter not set
./ksh: printf: D: parameter not set
./ksh: printf: E: parameter not set
./ksh: printf: F: parameter not set
./ksh: printf: G: parameter not set
./ksh: printf: H: parameter not set
A B
$

"11. If an argument operand to be consumed by a conversion specification
     does not exist:

    o If it is a numbered argument conversion specification, printf should
      write a diagnostic message to standard error and exit with non-zero
      status, but may behave as for an unnumbered argument conversion
      specification."

I know "should" is less strict than "shall," but someone might still do it.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to