summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2016-10-08 17:46:29 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2016-10-08 17:46:29 +0000
commita35c698d879c2d4c6e016661d468d7c04cd93516 (patch)
tree427dbc56728a2c80dd50e9449d85b14d22a09ca1 /contrib
parent10e8bf63b0f2dc304c24fd4dd898c0441ac8369f (diff)
downloadsrc-test2-a35c698d879c2d4c6e016661d468d7c04cd93516.tar.gz
src-test2-a35c698d879c2d4c6e016661d468d7c04cd93516.zip
Notes
Diffstat (limited to 'contrib')
-rw-r--r--contrib/tzcode/zic/zdump.c24
-rw-r--r--contrib/tzcode/zic/zic.c20
2 files changed, 11 insertions, 33 deletions
diff --git a/contrib/tzcode/zic/zdump.c b/contrib/tzcode/zic/zdump.c
index 2878a707cd33..01111fec2c99 100644
--- a/contrib/tzcode/zic/zdump.c
+++ b/contrib/tzcode/zic/zdump.c
@@ -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,
diff --git a/contrib/tzcode/zic/zic.c b/contrib/tzcode/zic/zic.c
index 5fb8b53c4352..00043b7940e7 100644
--- a/contrib/tzcode/zic/zic.c
+++ b/contrib/tzcode/zic/zic.c
@@ -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) {