Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177538657
D17761.1794663067.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D17761.1794663067.diff
View Options
Index: head/contrib/netbsd-tests/lib/libc/time/t_strptime.c
===================================================================
--- head/contrib/netbsd-tests/lib/libc/time/t_strptime.c
+++ head/contrib/netbsd-tests/lib/libc/time/t_strptime.c
@@ -331,8 +331,19 @@
h_fail("00", "%I");
h_fail("13", "%I");
+
#ifdef __FreeBSD__
- h_fail("00", "%l");
+ h_pass("0", "%k", 1, -1, -1, 0, -1, -1, -1, -1, -1);
+ h_pass("04", "%k", 2, -1, -1, 4, -1, -1, -1, -1, -1);
+ h_pass(" 8", "%k", 2, -1, -1, 8, -1, -1, -1, -1, -1);
+ h_pass("23", "%k", 2, -1, -1, 23, -1, -1, -1, -1, -1);
+ h_fail("24", "%k");
+
+ h_fail("0", "%l");
+ h_pass("1", "%l", 1, -1, -1, 1, -1, -1, -1, -1, -1);
+ h_pass("05", "%l", 2, -1, -1, 5, -1, -1, -1, -1, -1);
+ h_pass(" 9", "%l", 2, -1, -1, 9, -1, -1, -1, -1, -1);
+ h_pass("12", "%l", 2, -1, -1, 12, -1, -1, -1, -1, -1);
h_fail("13", "%l");
#endif
Index: head/lib/libc/stdtime/strptime.c
===================================================================
--- head/lib/libc/stdtime/strptime.c
+++ head/lib/libc/stdtime/strptime.c
@@ -272,17 +272,24 @@
case 'k':
case 'l':
/*
- * Of these, %l is the only specifier explicitly
- * documented as not being zero-padded. However,
- * there is no harm in allowing zero-padding.
+ * %k and %l specifiers are documented as being
+ * blank-padded. However, there is no harm in
+ * allowing zero-padding.
*
- * XXX The %l specifier may gobble one too many
+ * XXX %k and %l specifiers may gobble one too many
* digits if used incorrectly.
*/
+
+ len = 2;
+ if ((c == 'k' || c == 'l') &&
+ isblank_l((unsigned char)*buf, locale)) {
+ buf++;
+ len = 1;
+ }
+
if (!isdigit_l((unsigned char)*buf, locale))
return (NULL);
- len = 2;
for (i = 0; len && *buf != 0 &&
isdigit_l((unsigned char)*buf, locale); buf++) {
i *= 10;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 14, 1:31 PM (1 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41724249
Default Alt Text
D17761.1794663067.diff (1 KB)
Attached To
Mode
D17761: PR230720: strptime: allow blank-padding for %k and %l
Attached
Detach File
Event Timeline