Date: Fri, 20 Jul 2001 04:50:01 -0700 (PDT) From: jkoshy@freebsd.org (Joseph Koshy) To: freebsd-doc@freebsd.org Subject: Re: docs/28699: strptime(3) %d format specifier not completely documented Message-ID: <200107201150.f6KBo1c88453@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR docs/28699; it has been noted by GNATS. From: jkoshy@FreeBSD.ORG (Joseph Koshy) To: freebsd-gnats-submit@freebsd.org Cc: Subject: Re: docs/28699: strptime(3) %d format specifier not completely documented Date: Fri, 20 Jul 2001 04:41:34 -0700 (PDT) I'm not sure that this isn't a bug. `strftime(3)' states that '%d' generates 2 digits numbers in the range 01--31. Coming to `strptime(3)', looking at file "src/lib/libc/stdtime/strptime.c": ... case 'd': case 'e': /* * The %e specifier is explicitly documented as not * being zero-padded but there is no harm in allowing * such padding. * * XXX The %e specifier may gobble one too many * digits if used incorrectly. */ if (!isdigit((unsigned char)*buf)) return 0; ... We see that '%d' will accept a single digit date ONLY if a preceding format specifier had gobbled up whitespace before it. A format specification with a leading '%d' will fail to recognize a single digit date. We probably need to check that the input to %d is exactly 2 digits long. Regards, Koshy <jkoshy@freebsd.org> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107201150.f6KBo1c88453>