Subject: Re: new stdlib?
To: Roger Brooks <R.S.Brooks@liverpool.ac.uk>
From: Berndt Josef Wulf <wulf@ping.net.au>
List: netbsd-help
Date: 02/09/2000 00:08:37
Roger Brooks wrote
> On Tue, 8 Feb 2000, Berndt Josef Wulf wrote:
> 
> >G'day,
> >
> >does anyone know the following construct? It was found in anteater
> >which segfaults at that point.
> >
> >[...]
> > sprintf( c_datestring, "year %1$02d, day %2$02d, month %3$04d",
> >	(int)tmdate.tm_mday, (int)tmdate.tm_mon+1,
> >	(int)tmdate.tm_year+1900 );
> >  string newdate = c_datestring;
> >  return newdate;
> >
> >I've expanded the format string which is constructed earlier
> >in the code. I've never seen the use of a "%1$02d" format string nor have I
> >found any references in books and manuals. When changed to 
> >"%02d" the program runs fine and displays the correct date format.
> >
> >Is there a new stdlib with extentions of the current format string? I am 
> >using egcs-1.1.1 and standard libraries as shipped with NetBSD-1.4.1.
> 
> The "1$" part of the format means the 1st arg.  It's intended to allow
> the format string to control the order in which the args are printed.
> The main use is in NLS support, where a message with 2 or more args
> may need them in a different order to allow for conventional word-order
> in the language in use.

Hi Roger,

many thanks for your reply. Do you know which library or version of
compiler is needed?

The compiler doesn't give any error/warning messages when building the
binaries, but the application will segfault at runtime. 

cheerio Berndt
-- 
Name    : Berndt Josef Wulf            | +++ With BSD on Packet Radio +++
E-Mail  : wulf@ping.net.au             |    tfkiss, tnt, dpbox, wampes
ICQ     : 18196098                     |  VK5ABN, Nairne, South Australia 
URL     : http://www.ping.net.au/~wulf | MBOX : vk5abn@vk5abn.#lmr.#sa.au.oc
Sysinfo : DEC AXPpci33+, NetBSD-1.4    | BBS  : vk5abn.#lmr.#sa.aus.oc