Re: [HACKERS] %2$, %1$ gettext placeholder replacement is not working under Win32

Nicolai Tufar <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.win32,gmane.comp.db.postgresql.devel.general
Message-ID <[email protected]>
On Mon, 17 Jan 2005 14:54:44 -0500, Tom Lane <[email protected]> wrote:
> Also, it looks like src/port/snprintf.c is not %n$ capable either.
> I'm not sure which platforms that affects.
> 
> A possible route to a solution is to upgrade snprintf.c and then use
> it on platforms that don't have this support.  This only fixes those
> cases where we go through snprintf, which is probably not all of the
> affected messages, but it might be enough.  It's not happening for
> 8.0.0 though.

Bad news for the Turks. Turkish language syntax
is lake Latin: the verb is always at the end. Because
of that almost all messages that have two or more 
placeholders are broken under Windows.

The solution you propose seem to be a trivial exercise:
1. write a replacement function, say, pg_snprintf() that 
    would shuffle input arguments, replace %x$ with % 
    and then call libc's snprintf();
2. replace snprintf() in all source files with pg_snprintf();
3. Update Makefiles to use our custom function on broken
    platforms or default to snprinf(). (Or maybe pg_snprintf()
    should be a #define);
4. Tell everyone to use pg_snprintf() instead of snprintf()
     from now on.

I would like volunteer to implement this for 8.1 and
would be honoured if I get a chance to contribute.

>                         regards, tom lane

Best regards,
Nicolai Tufar

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [email protected] so that your
      message can get through to the mailing list cleanly
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.