kern/137307: [libc] [patch] Enhance strptime(3) to support %U and %W

Green, Paul Paul.Green at stratus.com
Tue Aug 25 17:20:02 UTC 2009


The following reply was made to PR kern/137307; it has been noted by GNATS.

From: "Green, Paul" <Paul.Green at stratus.com>
To: <bug-followup at FreeBSD.org>
Cc: "Green, Paul" <Paul.Green at stratus.com>
Subject: Re: kern/137307: [libc] [patch] Enhance strptime(3) to support %U and %W
Date: Tue, 25 Aug 2009 12:33:21 -0400

 This is a multi-part message in MIME format.
 
 ------_=_NextPart_001_01CA25A1.C230115A
 Content-Type: multipart/alternative;
 	boundary="----_=_NextPart_002_01CA25A1.C230115A"
 
 
 ------_=_NextPart_002_01CA25A1.C230115A
 Content-Type: text/plain;
 	charset="us-ascii"
 Content-Transfer-Encoding: quoted-printable
 
 This is a follow-up to problem report kern/137307 regarding proposed
 changes to the strptime function.
 
 Shortly after I submitted the report, I discovered that I had submitted
 the old version of the t_strptime.c test program.  The version that I
 submitted is coded with the assumption that the tm_yday member of
 "struct tm" is 1-origin.  In fact, it is 0-origin.  The modified code
 for strptime.c that I submitted is correct; only the test case was
 wrong.
 
 This new version of t_strptime.c also adds some guards so that the tests
 for %U and %W are not normally compiled; you must change the value of
 the ALLOW_UW_TESTS macro from 0 to 1 to run them.  This makes it easier
 to run the tests on a system that doesn't implement the new features.
 
 I have attached a uni-diff that corrects t_strptime.c.
 
 I apologize for my mistake.
 
 Thanks
 PG
  <<t_strptime.diff.txt>>=20
 
 
 ------_=_NextPart_002_01CA25A1.C230115A
 Content-Type: text/html;
 	charset="us-ascii"
 Content-Transfer-Encoding: quoted-printable
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
 <HTML>
 <HEAD>
 <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
 charset=3Dus-ascii">
 <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
 6.5.7654.12">
 <TITLE>Re: kern/137307: [libc] [patch] Enhance strptime(3) to support %U =
 and %W</TITLE>
 </HEAD>
 <BODY>
 <!-- Converted from text/rtf format -->
 
 <P><FONT SIZE=3D2 FACE=3D"Arial">This is a follow-up to problem report =
 kern/137307 regarding proposed changes to the strptime function.</FONT>
 </P>
 
 <P><FONT SIZE=3D2 FACE=3D"Arial">Shortly after I submitted the report, I =
 discovered that I had submitted the old version of the t_strptime.c test =
 program.&nbsp; The version that I submitted is coded with the assumption =
 that the tm_yday member of &quot;struct tm&quot; is 1-origin.&nbsp; In =
 fact, it is 0-origin.&nbsp; The modified code for strptime.c that I =
 submitted is correct; only the test case was wrong.</FONT></P>
 
 <P><FONT SIZE=3D2 FACE=3D"Arial">This new version of t_strptime.c also =
 adds some guards so that the tests for %U and %W are not normally =
 compiled; you must change the value of the ALLOW_UW_TESTS macro from 0 =
 to 1 to run them.&nbsp; This makes it easier to run the tests on a =
 system that doesn't implement the new features.</FONT></P>
 
 <P><FONT SIZE=3D2 FACE=3D"Arial">I have attached a uni-diff that =
 corrects t_strptime.c.</FONT>
 </P>
 
 <P><FONT SIZE=3D2 FACE=3D"Arial">I apologize for my mistake.</FONT>
 </P>
 
 <P><FONT SIZE=3D2 FACE=3D"Tahoma">Thanks</FONT>
 
 <BR><FONT SIZE=3D2 FACE=3D"Tahoma">PG</FONT>
 
 <BR><FONT FACE=3D"Arial" SIZE=3D2 COLOR=3D"#000000"> =
 &lt;&lt;t_strptime.diff.txt&gt;&gt; </FONT>
 </P>
 
 </BODY>
 </HTML>
 ------_=_NextPart_002_01CA25A1.C230115A--
 
 ------_=_NextPart_001_01CA25A1.C230115A
 Content-Type: text/plain;
 	name="t_strptime.diff.txt"
 Content-Transfer-Encoding: base64
 Content-Description: t_strptime.diff.txt
 Content-Disposition: attachment;
 	filename="t_strptime.diff.txt"
 
 LS0tIHRfc3RycHRpbWUuYmFkLmMJMjAwOS0wNy0zMCAxNjoyODoyMC4wMDAwMDAwMDAgLTA0MDAK
 KysrIHRfc3RycHRpbWUuYwkyMDA5LTA4LTI1IDEyOjE5OjIxL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IyIik7CisjZW5kaWYKICAgICAg
 dHJ5MSAoIldlZWsgZGF5IG51bWJlciIsICIldyIsICI0IiwgICAgICAgIG9mZnNldG9mIChzdHJ1
 Y3QgdG0sIHRtX3dkYXkpLCA0KTsKKyNpZiBBTExPV19VV19URVNUUwogICAgICB0cnk4ICgiV2Vl
 ayBudW1iZXIgTW9uPTAiLCAiJVkgJVciLCAiMjAwOSAyMiIpOworI2VuZGlmCiAgICAgIHRyeTEg
 KCJZZWFyIGluIGNlbnR1cnkiLCAgIiV5IiwgICI5IiwgICAgICBvZmZzZXRvZiAoc3RydWN0IHRt
 LCB0bV95ZWFyKSwgMTA5KTsKICAgICAgdHJ5MSAoIlllYXIgaW4gY2VudHVyeSIsICAiJVkiLCAg
 IjIwMDkiLCAgIG9mZnNldG9mIChzdHJ1Y3QgdG0sIHRtX3llYXIpLCAxMDkpOwogCisjaWYgQUxM
 T1dfVVdfVEVTVFMKICAgICAgdHJ5VSAoIlUgY29udmVyc2lvbiIsICIlWSAlVSIsICJyYW5nZSIp
 OworI2VuZGlmCiAKICAgICAgaWYgKGZhaWx1cmVzKQogICAgICAgICAgIHByaW50ZiAoIiVkIHRl
 c3RzIGZhaWxlZC5cbiIsIGZhaWx1cmVzKTsK
 
 ------_=_NextPart_001_01CA25A1.C230115A--


More information about the freebsd-bugs mailing list