From owner-freebsd-doc Fri Jul 20 4:50: 6 2001 Delivered-To: freebsd-doc@freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id B400E37B406 for ; Fri, 20 Jul 2001 04:50:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f6KBo1c88453; Fri, 20 Jul 2001 04:50:01 -0700 (PDT) (envelope-from gnats) Date: Fri, 20 Jul 2001 04:50:01 -0700 (PDT) Message-Id: <200107201150.f6KBo1c88453@freefall.freebsd.org> To: freebsd-doc@freebsd.org Cc: From: jkoshy@freebsd.org (Joseph Koshy) Subject: Re: docs/28699: strptime(3) %d format specifier not completely documented Reply-To: jkoshy@freebsd.org (Joseph Koshy) Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message