diff options
Diffstat (limited to 'usr.sbin/zdump/zdump.c')
-rw-r--r-- | usr.sbin/zdump/zdump.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/usr.sbin/zdump/zdump.c b/usr.sbin/zdump/zdump.c index 9fc235a5dde..0821934b8d5 100644 --- a/usr.sbin/zdump/zdump.c +++ b/usr.sbin/zdump/zdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zdump.c,v 1.13 2016/03/14 15:29:29 mestre Exp $ */ +/* $OpenBSD: zdump.c,v 1.14 2016/03/15 19:50:48 millert Exp $ */ /* ** This file is in the public domain, so clarified as of ** 2009-05-17 by Arthur David Olson. @@ -76,24 +76,16 @@ abbrok(const char * const abbrp, 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; fflush(stdout); fprintf(stderr, "%s: warning: zone \"%s\" abbreviation \"%s\" %s\n", |