From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5857 Path: news.gmane.org!not-for-mail From: Alec Salazar Newsgroups: gmane.linux.lib.musl.general Subject: Re: XPG4 Date: Thu, 14 Aug 2014 19:48:44 -0400 Message-ID: References: <20140814194632.GK12888@brightrain.aerifal.cx> <20140814234004.GO12888@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113abd4093c4d605009f8b27 X-Trace: ger.gmane.org 1408060145 31574 80.91.229.3 (14 Aug 2014 23:49:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Aug 2014 23:49:05 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-5863-gllmg-musl=m.gmane.org@lists.openwall.com Fri Aug 15 01:48:59 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XI4lN-0005g4-KI for gllmg-musl@plane.gmane.org; Fri, 15 Aug 2014 01:48:57 +0200 Original-Received: (qmail 11342 invoked by uid 550); 14 Aug 2014 23:48:57 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 11334 invoked from network); 14 Aug 2014 23:48:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=G6jXjZd++A6ZyLFF8k5JIq2FVq9qseItAzKIvHPeKTM=; b=U3rj7gDNwEzjJJFhxEhEMDPxvCI3oAuD/1O9+cxKf2wBfd/2OaxOJKQqlCwOxWZ2ic EzD/ZMH5os+XZ90xQiXgdahOeyHHtd+UymnUDc1/A1g+ecWKI1GBTCxaToRTlnahHANo Djh4BroyeDENzEqqbfdAiuaRRVzTMWGDUzWHUh/P89hZnMfz9/fcerVSeXmZzUoo7kf6 3HGybHTUI7dYWjW1rnJil/79M/15wQ0RFQi6qjEjerwGyFx5aQIxxts+G3RDr3GfPR88 QyUsDKn2scZHE+8nGYyINQCtSepth4KBt13MMmg4oyGe/fS0sjiMLWmmFdckVJ21niEp XbNA== X-Received: by 10.140.94.163 with SMTP id g32mr21476520qge.77.1408060125068; Thu, 14 Aug 2014 16:48:45 -0700 (PDT) In-Reply-To: <20140814234004.GO12888@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:5857 Archived-At: --001a113abd4093c4d605009f8b27 Content-Type: text/plain; charset=UTF-8 Yes. D_T_FMT yields a similar output to _DATE_FMT, but it lacks the timezone identifier. So I had thought to use the format specifiers directly and bypass the call to nl_langinfo. I was told that _DATE_FMT was added because Sun made everything up to date with the latest xopen std. I don't yet grok the localization stuff. So, I'm wondering if passing the format specifiers into strftime directly would remove any localizing done by nl_langinfo? On Thu, Aug 14, 2014 at 7:40 PM, Rich Felker wrote: > On Thu, Aug 14, 2014 at 07:28:53PM -0400, Alec Salazar wrote: > > I seem to be taking a wrong turn somewhere. Running find . -type f > -print0 > > | xargs -0 /bin/grep D_FMT in /usr/include for the installed 1.1.4 > yields: > > ../langinfo.h:#define D_FMT 0x20029 > > ../langinfo.h:#define ERA_D_FMT 0x2002E > > Pulling the latest sources and running the same command in gitdir yields: > > ../src/time/strptime.c: s = strptime(s, > nl_langinfo(D_FMT), > > tm); > > ../src/time/strftime.c: item = D_FMT; > > ../include/langinfo.h:#define D_FMT 0x20029 > > ../include/langinfo.h:#define ERA_D_FMT 0x2002E > > Neither directory yields a result for DATE_FMT. Am I botching the > unix-fu, > > barking up the wrong tree or something else entirely? > > Oh, perhaps it's my mistake and the proper name is D_FMT. Or did you > expect _DATE_FMT to give something different from what D_FMT gives? > > Also I think you can just use %x directly to get this, rather than > looking it up via nl_langinfo first. > > Rich > --001a113abd4093c4d605009f8b27 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Yes. D_T_FMT yields a similar output to _DATE_FMT, but it = lacks the timezone identifier. So I had thought to use the format specifier= s directly and bypass the call to nl_langinfo. I was told that _DATE_FMT wa= s added because Sun made everything up to date with the latest xopen std. I= don't yet grok the localization stuff. So, I'm wondering if passin= g the format specifiers into strftime directly would remove any localizing = done by nl_langinfo?


On Thu,= Aug 14, 2014 at 7:40 PM, Rich Felker <dalias@libc.org> wrote:=
On Thu, Aug 14, 2014 at 07:28:53PM -0400, Alec Salazar wrot= e:
> I seem to be taking a wrong turn somewhere. Running find . -type f -pr= int0
> | xargs -0 /bin/grep D_FMT in /usr/include for the installed 1.1.4 yie= lds:
> ../langinfo.h:#define D_FMT 0x20029
> ../langinfo.h:#define ERA_D_FMT 0x2002E
> Pulling the latest sources and running the same comman= d in gitdir yields:
> ../src/time/strptime.c: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0s =3D strptime(s, nl_langinfo(D_FMT),
> tm);
> ../src/time/strftime.c: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0item =3D D_F= MT;
> ../include/langinfo.h:#define D_FMT 0x20029
> ../include/langinfo.h:#define ERA_D_FMT 0x2002E
> Neither directory yields a result for DATE_FMT. Am I b= otching the unix-fu,
> barking up the wrong tree or something else entirely?

Oh, perhaps it's my mistake and the proper name is D_FMT. Or did = you
expect _DATE_FMT to give something different from what D_FMT gives?

Also I think you can just use %x directly to get this, rather than
looking it up via nl_langinfo first.

Rich

--001a113abd4093c4d605009f8b27--