Created attachment 196301 [details]
Patch file for strptime.c
I've been running the FreeBSD strptime() function through a few tests and a few of things came up.
1) Some compile warnings were silenced by changing the type of len from int to size_t. Also some compiler-reported possibly uninitialized use, which I don't think are really bugs but best to be safe.
2) %k and %l should allow preceding blanks. The current version requires all digits and throws an error. I have put in a little fix to permit this.
3) %I and %l should generate an error on 0. A small check added for that.
4) %d should generate an error on 0. A small check added for that.
We do have a unit test program that puts the function through its paces.
I'm not aware if FreeBSD has a test suite but if required, I can put together something that can be submitted for inclusion.
"00","%d" is fixed in base r339241 (bug #232072)
"00","%I" and "00","%l" are fixed in base r339346.
I'll take care of the remaining issues reported here, and sorry for missing this initially.
Many thanks, Yuri.
A commit references this bug:
Date: Sat Nov 3 23:37:14 UTC 2018
New revision: 340106
strptime: make %k and %l specifiers match their description in
strftime(3), and allow them to process space-padded input.
Submitted by: email@example.com (original version)
Approved by: kib (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17761