From owner-svn-src-all@FreeBSD.ORG Mon Jun 30 14:52:41 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5757CAC; Mon, 30 Jun 2014 14:52:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43E6E2FF0; Mon, 30 Jun 2014 14:52:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5UEqf0k038498; Mon, 30 Jun 2014 14:52:41 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5UEqfIg038497; Mon, 30 Jun 2014 14:52:41 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201406301452.s5UEqfIg038497@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 30 Jun 2014 14:52:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268043 - stable/10/lib/libc/stdtime X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jun 2014 14:52:41 -0000 Author: pfg Date: Mon Jun 30 14:52:40 2014 New Revision: 268043 URL: http://svnweb.freebsd.org/changeset/base/268043 Log: MFC r267627: strptime: add support for %t and %n Posix strptime() requires support for %t and %n, which were added to the illumos port. Curiously we were skipping white spaces by default in most other cases making %t meaningless. We now skip spaces in the case of the %e specifier as strftime(3) explicitly adds a space for the single digit case. Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html PR: 173421 Obtained from: Illumos (Rev. a11c1571b6942161b0186d0588609448066892c2) Modified: stable/10/lib/libc/stdtime/strptime.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdtime/strptime.c ============================================================================== --- stable/10/lib/libc/stdtime/strptime.c Mon Jun 30 14:15:16 2014 (r268042) +++ stable/10/lib/libc/stdtime/strptime.c Mon Jun 30 14:52:40 2014 (r268043) @@ -1,4 +1,6 @@ /*- + * Copyright (c) 2014 Gary Mills + * Copyright 2011, Nexenta Systems, Inc. All rights reserved. * Copyright (c) 1994 Powerdog Industries. All rights reserved. * * Copyright (c) 2011 The FreeBSD Foundation @@ -224,11 +226,6 @@ label: tm->tm_sec = i; } - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; case 'H': @@ -261,11 +258,6 @@ label: tm->tm_hour = i; - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; case 'p': @@ -335,11 +327,6 @@ label: if (i > 53) return (NULL); - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; case 'w': @@ -352,18 +339,22 @@ label: tm->tm_wday = i; - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; - case 'd': case 'e': /* - * The %e specifier is explicitly documented as not - * being zero-padded but there is no harm in allowing + * With %e format, our strftime(3) adds a blank space + * before single digits. + */ + if (*buf != 0 && + isspace_l((unsigned char)*buf, locale)) + buf++; + /* FALLTHROUGH */ + case 'd': + /* + * The %e specifier was once explicitly documented as + * not being zero-padded but was later changed to + * equivalent to %d. There is no harm in allowing * such padding. * * XXX The %e specifier may gobble one too many @@ -384,11 +375,6 @@ label: tm->tm_mday = i; - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; case 'B': @@ -445,11 +431,6 @@ label: tm->tm_mon = i - 1; - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; case 's': @@ -498,11 +479,6 @@ label: tm->tm_year = i; - if (*buf != 0 && - isspace_l((unsigned char)*buf, locale)) - while (*ptr != 0 && - !isspace_l((unsigned char)*ptr, locale)) - ptr++; break; case 'Z': @@ -559,6 +535,12 @@ label: *GMTp = 1; } break; + + case 'n': + case 't': + while (isspace_l((unsigned char)*buf, locale)) + buf++; + break; } } return ((char *)buf);