Print this page
6869 Update zdump to better-handle POSIX timezones
Reviewed by: Jason King <jason.brian.king@gmail.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>

*** 1,10 **** /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - #pragma ident "%Z%%M% %I% %E% SMI" static char elsieid[] = "@(#)zic.c 7.128.1"; /* * #define LEAPSECOND_SUPPORT --- 1,9 ----
*** 2228,2270 **** t = (zic_t)dayoff * SECSPERDAY; return (tadd(t, rp->r_tod)); } static void ! newabbr(string) ! const char * const string; { register int i; if (strcmp(string, GRANDPARENTED) != 0) { 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(*cp) && isalpha(*cp)) ++cp; ! if (cp - string == 0) ! wp = gettext(("time zone abbreviation lacks " ! "alphabetic at start")); ! if (noise && cp - string > 3) ! wp = gettext(("time zone abbreviation has more than 3 " "alphabetics")); ! if (cp - string > ZIC_MAX_ABBR_LEN_WO_WARN) wp = gettext(("time zone abbreviation has too many " ! "alphabetics")); if (wp == NULL && (*cp == '+' || *cp == '-')) { ++cp; if (isascii(*cp) && isdigit(*cp)) if (*cp++ == '1' && *cp >= '0' && *cp <= '4') ++cp; } ! if (*cp != '\0') wp = gettext("time zone abbreviation differs from " "POSIX standard"); if (wp != NULL) { wp = ecpyalloc(wp); wp = ecatalloc(wp, " ("); --- 2227,2263 ---- t = (zic_t)dayoff * SECSPERDAY; return (tadd(t, rp->r_tod)); } static void ! newabbr(const char * const string) { register int i; if (strcmp(string, GRANDPARENTED) != 0) { register const char *cp; register char *wp; cp = string; wp = NULL; ! while (isalpha(*cp) || ('0' <= *cp && *cp <= '9') || ! *cp == '-' || *cp == '+') { ++cp; ! } ! if (noise && cp - string < 3) ! wp = gettext(("time zone abbreviation has less than 3 " "alphabetics")); ! if (wp == NULL && cp - string > ZIC_MAX_ABBR_LEN_WO_WARN) wp = gettext(("time zone abbreviation has too many " ! "characters")); if (wp == NULL && (*cp == '+' || *cp == '-')) { ++cp; if (isascii(*cp) && isdigit(*cp)) if (*cp++ == '1' && *cp >= '0' && *cp <= '4') ++cp; } ! if (wp == NULL && *cp != '\0') wp = gettext("time zone abbreviation differs from " "POSIX standard"); if (wp != NULL) { wp = ecpyalloc(wp); wp = ecatalloc(wp, " (");