svn commit: r309572 - releng/10.3/contrib/tzcode/zic

Gleb Smirnoff glebius at FreeBSD.org
Mon Dec 5 23:13:17 UTC 2016


Author: glebius
Date: Mon Dec  5 23:13:16 2016
New Revision: 309572
URL: https://svnweb.freebsd.org/changeset/base/309572

Log:
  Merge r307359 from stable/10:
  
      Incorporate a change from OpenBSD by millert at OpenBSD.org
  
      Don't warn about valid time zone abbreviations.  POSIX
      through 2000 says that an abbreviation cannot start with ':', and
      cannot contain ',', '-', '+', NUL, or a digit.  POSIX from 2001
      on changes this rule to say that an abbreviation can contain only
      '-', '+', and alphanumeric characters from the portable character
      set in the current locale.  To be portable to both sets of rules,
      an abbreviation must therefore use only ASCII letters."  Adapted
      from tzcode2015f.
  
  Errata Notice:	EN-16:19.tzcode
  Submitted by:	bapt
  Approved by:	so

Modified:
  releng/10.3/contrib/tzcode/zic/zdump.c
  releng/10.3/contrib/tzcode/zic/zic.c
Directory Properties:
  releng/10.3/   (props changed)

Modified: releng/10.3/contrib/tzcode/zic/zdump.c
==============================================================================
--- releng/10.3/contrib/tzcode/zic/zdump.c	Mon Dec  5 23:12:22 2016	(r309571)
+++ releng/10.3/contrib/tzcode/zic/zdump.c	Mon Dec  5 23:13:16 2016	(r309572)
@@ -212,24 +212,16 @@ const char * const	zone;
 		return;
 	cp = abbrp;
 	wp = NULL;
-	while (isascii((unsigned char) *cp) && isalpha((unsigned char) *cp))
+	while (isascii((unsigned char) *cp) &&
+		(isalnum((unsigned char)*cp) || *cp == '-' || *cp == '+'))
 		++cp;
-	if (cp - abbrp == 0)
-		wp = _("lacks alphabetic at start");
-	else if (cp - abbrp < 3)
-		wp = _("has fewer than 3 alphabetics");
+	if (cp - abbrp < 3)
+		wp = _("has fewer than 3 characters");
 	else if (cp - abbrp > 6)
-		wp = _("has more than 6 alphabetics");
-	if (wp == NULL && (*cp == '+' || *cp == '-')) {
-		++cp;
-		if (isascii((unsigned char) *cp) &&
-			isdigit((unsigned char) *cp))
-				if (*cp++ == '1' && *cp >= '0' && *cp <= '4')
-					++cp;
-		if (*cp != '\0')
-			wp = _("differs from POSIX standard");
-	}
-	if (wp == NULL)
+		wp = _("has more than 6 characters");
+	else if (*cp)
+		wp = "has characters other than ASCII alphanumerics, '-' or '+'";
+	else
 		return;
 	(void) fflush(stdout);
 	(void) fprintf(stderr,

Modified: releng/10.3/contrib/tzcode/zic/zic.c
==============================================================================
--- releng/10.3/contrib/tzcode/zic/zic.c	Mon Dec  5 23:12:22 2016	(r309571)
+++ releng/10.3/contrib/tzcode/zic/zic.c	Mon Dec  5 23:13:16 2016	(r309572)
@@ -2615,29 +2615,15 @@ const char * const	string;
 		register const char *	cp;
 		register char *		wp;
 
-		/*
-		** Want one to ZIC_MAX_ABBR_LEN_WO_WARN alphabetics
-		** optionally followed by a + or - and a number from 1 to 14.
-		*/
 		cp = string;
 		wp = NULL;
 		while (isascii((unsigned char) *cp) &&
-			isalpha((unsigned char) *cp))
+			(isalnum((unsigned char)*cp) || *cp == '-' || *cp == '+'))
 				++cp;
-		if (cp - string == 0)
-wp = _("time zone abbreviation lacks alphabetic at start");
 		if (noise && cp - string > 3)
-wp = _("time zone abbreviation has more than 3 alphabetics");
+wp = _("time zone abbreviation has more than 3 characters");
 		if (cp - string > ZIC_MAX_ABBR_LEN_WO_WARN)
-wp = _("time zone abbreviation has too many alphabetics");
-		if (wp == NULL && (*cp == '+' || *cp == '-')) {
-			++cp;
-			if (isascii((unsigned char) *cp) &&
-				isdigit((unsigned char) *cp))
-					if (*cp++ == '1' &&
-						*cp >= '0' && *cp <= '4')
-							++cp;
-		}
+wp = _("time zone abbreviation has too many characters");
 		if (*cp != '\0')
 wp = _("time zone abbreviation differs from POSIX standard");
 		if (wp != NULL) {


More information about the svn-src-all mailing list