Re: [sr #111166] ngettext syntax

2025-02-24 Thread Phi Debian
May be some orthogonality regarding %d expecting a string vs num-expr $ a=1234 i=1 $ echo ${a:i+1} 34 $ echo ${a:$((i+1))} 34 $ Why do we have this 'offset' evaluated, you could use the same argument you used for printf that is $((...)) is good enough, add clarity, remove ambiguity and the docco

Re: [sr #111166] ngettext syntax

2025-02-24 Thread Phi Debian
On Mon, Feb 24, 2025 at 4:14 PM Chet Ramey wrote: > > > > > The beast of burden is already done in bash, it does scan the fmt string > > recognise integer conversion specifier fetch the arg 'string' and apply > an > > integer validity test on it, this is on this last operation that the > > validi

Re: [sr #111166] ngettext syntax

2025-02-24 Thread Chet Ramey
On 2/23/25 10:48 PM, Phi Debian wrote: > Again the rule I used for ksh93 is that the next arg for fmt reuse is > max( number_of_unumbered_occurences, highest_numberd_index ) So you make numbered conversion specifiers relative to some max base from the previous scan through the

Re: [sr #111166] ngettext syntax

2025-02-24 Thread Chet Ramey
On 2/22/25 11:17 PM, Phi Debian wrote: - if allowing mix and match numbered/unumbered then stays away from unumbered following a numbered mean the unumbered is last the numbered+1 this is tempting but wrong, i.e '%3$s %s' one would be tempted to say %s is equiv to %4$s, but the width.prec preda

Re: [sr #111166] ngettext syntax

2025-02-24 Thread Chet Ramey
On 2/22/25 6:33 PM, Robert Elz wrote: Further, this spec also violates Chet's rule: chet.ra...@case.edu said: | There is no user who would think that using a numbered conversion specifier | is not an absolute position in the original argument list. which does not apply when the format st

Re: [sr #111166] ngettext syntax

2025-02-24 Thread Chet Ramey
On 2/22/25 5:05 AM, Phi Debian wrote: On Sat, Feb 22, 2025 at 9:49 AM Andreas Schwab > 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

Re: [sr #111166] ngettext syntax

2025-02-24 Thread Chet Ramey
On 2/22/25 4:38 AM, Phi Debian wrote: This way pure unumbered (no mixed indexed) works as before (as we used to) Pure numbered (no unumbered) works as it does in C. Mixed depart from C (as do fmt re-use) and the rule of thumb is easy to remember, count unnumbered as they appears, and numbered a

Re: [sr #111166] ngettext syntax

2025-02-24 Thread Phi Debian
On Mon, Feb 24, 2025 at 8:22 AM Martin D Kealey wrote: > > > On Mon, 24 Feb 2025 at 13:48, Phi Debian wrote: > >> I also forgot to mention that C99 introduced this >> >>There may be no gaps >>in the numbers of arguments specified using '$'; for example, if >> argu‐ >>men

Re: [sr #111166] ngettext syntax

2025-02-23 Thread Martin D Kealey
On Mon, 24 Feb 2025 at 13:48, Phi Debian wrote: > I also forgot to mention that C99 introduced this > >There may be no gaps >in the numbers of arguments specified using '$'; for example, if > argu‐ >ments 1 and 3 are specified, argument 2 must also be specified > some‐

Re: [sr #111166] ngettext syntax

2025-02-23 Thread Phi Debian
On Sun, Feb 23, 2025 at 8:03 PM Chet Ramey wrote: > On 2/22/25 12:38 AM, Phi Debian wrote: > > > The new semantic is simple > > - numbered are indexed args access (easy to understand) > > - unumbered are counting only the unumbered from the fmt string > > > > This way when you don't mix then the

Re: [sr #111166] ngettext syntax

2025-02-23 Thread Chet Ramey
On 2/22/25 12:38 AM, Phi Debian wrote: The new semantic is simple - numbered are indexed args access (easy to understand) - unumbered are counting only the unumbered from the fmt string This way when you don't mix then the both work as expected. This isn't unreasonable. coreutils git chose th

Re: [sr #111166] ngettext syntax

2025-02-23 Thread Chet Ramey
On 2/21/25 7:52 PM, Robert Elz wrote: | There is no user who would think that using a numbered conversion | specifier is not an absolute position in the original argument list. Probably not, but it doesn't matter if the application doesn't mix numbered and unnumbered conversions, and it s

Re: [sr #111166] ngettext syntax

2025-02-22 Thread Phi Debian
On Sun, Feb 23, 2025 at 12:34 AM Robert Elz wrote: > Date:Sat, 22 Feb 2025 09:48:29 +0100 > From:Andreas Schwab > Message-ID: <87r03q5pr6@linux-m68k.org> > > | On Feb 22 2025, Phi Debian wrote: > | > I forgot to mention your trick to nuke the fmt reuse still

Re: [sr #111166] ngettext syntax

2025-02-22 Thread Robert Elz
Date:Sat, 22 Feb 2025 09:48:29 +0100 From:Andreas Schwab Message-ID: <87r03q5pr6@linux-m68k.org> | As long as NL_ARGMAX >= 999. A correction - I just checked the POSIX spec again, and it appears that they copied the text from printf(3) into printf(1) - that sim

Re: [sr #111166] ngettext syntax

2025-02-22 Thread Robert Elz
Date:Sat, 22 Feb 2025 09:48:29 +0100 From:Andreas Schwab Message-ID: <87r03q5pr6@linux-m68k.org> | 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

Re: [sr #111166] ngettext syntax

2025-02-22 Thread Phi Debian
On Sat, Feb 22, 2025 at 9:49 AM Andreas Schwab 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

Re: [sr #111166] ngettext syntax

2025-02-22 Thread Phi Debian
On Fri, Feb 21, 2025 at 8:52 PM Chet Ramey wrote: > On 2/21/25 1:37 PM, Phi Debian wrote: > > > > I got that behavior with Version AJM 93u+m/1.1.0-alpha 2022-07-31. > > I just updated my version using macports and I get the same behavior as > you with Version AJM 93u+m/1.0.10 2024-08-01. So it lo

Re: [sr #111166] ngettext syntax

2025-02-22 Thread Andreas Schwab
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. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC

Re: [sr #111166] ngettext syntax

2025-02-21 Thread Phi Debian
On Sat, Feb 22, 2025 at 1:54 AM Robert Elz wrote: > > > That is, in the example > > printf '%s %3$s %s\n' A B C D > > The updated ksh93 seems to ignore the numbered conversions when counting > the args for the unnumbered ones (so "A C B" (for the first line anyway, > I won't go on about r

Re: [sr #111166] ngettext syntax

2025-02-21 Thread Robert Elz
Date:Fri, 21 Feb 2025 10:55:56 -0500 From:Chet Ramey Message-ID: | That is bizarre and indefensible. Like I said, it isn't what I'd do, but it is easy to see how an implementation might end up like that (and ksh93's might be one of the first of them, which kind of

Re: [sr #111166] ngettext syntax

2025-02-21 Thread Chet Ramey
On 2/21/25 1:37 PM, Phi Debian wrote: Given the following, which POSIX says is unspecified: printf '%s %3$s %s\n' A B C D ksh93-u+m prints "A D", which is just wrong. No matter how you mix numbered and unnumbered specifications, or whether you implement numbered specific

Re: [sr #111166] ngettext syntax

2025-02-21 Thread Phi Debian
On Fri, Feb 21, 2025 at 3:08 PM Chet Ramey wrote: > On 2/20/25 11:44 PM, Phi Debian wrote: > > > > > > On Thu, Feb 20, 2025 at 11:41 PM Chet Ramey > > wrote: > > > > A response to the question about printf supporting %n$ conversion > > specifications I posted

Re: [sr #111166] ngettext syntax

2025-02-21 Thread Chet Ramey
On 2/21/25 10:13 AM, Robert Elz wrote: Date:Fri, 21 Feb 2025 09:08:13 -0500 From:Chet Ramey Message-ID: <59a1d1d0-b6eb-4652-9e77-1fc4c5992...@case.edu> | Given the following, which POSIX says is unspecified: | | printf '%s %3$s %s\n' A B C D | | ks

Re: [sr #111166] ngettext syntax

2025-02-21 Thread Robert Elz
Date:Fri, 21 Feb 2025 09:08:13 -0500 From:Chet Ramey Message-ID: <59a1d1d0-b6eb-4652-9e77-1fc4c5992...@case.edu> | Given the following, which POSIX says is unspecified: | | printf '%s %3$s %s\n' A B C D | | ksh93-u+m prints "A D", which is just wrong. It ac

Re: [sr #111166] ngettext syntax

2025-02-21 Thread Chet Ramey
On 2/20/25 11:44 PM, Phi Debian wrote: On Thu, Feb 20, 2025 at 11:41 PM Chet Ramey > wrote: A response to the question about printf supporting %n$ conversion specifications I posted to savannah. Thanx @chet, I didn't knew this thread. The thread say ksh93

Re: [sr #111166] ngettext syntax

2025-02-20 Thread Phi Debian
On Thu, Feb 20, 2025 at 11:41 PM Chet Ramey wrote: > A response to the question about printf supporting %n$ conversion > specifications I posted to savannah. > Thanx @chet, I didn't knew this thread. The thread say ksh93 is buggy, that's not what I observe with latest patches, but at time of the

Fwd: [sr #111166] ngettext syntax

2025-02-20 Thread Chet Ramey
A response to the question about printf supporting %n$ conversion specifications I posted to savannah. --- Begin Message --- Follow-up Comment #5, sr #66 (group bash): [comment #4 comment #4:] > [comment #3 comment #3:] >> * explicit positional argument selection. Some versions of printf(3)

[sr #111166] ngettext syntax

2024-12-27 Thread anonymous
URL: Summary: ngettext syntax Group: The GNU Bourne-Again SHell Submitter: None Submitted: Fri 27 Dec 2024 07:15:13 PM UTC Category: None Priority: 5 - Nor