Print this page
XXXX Update zdump to better-handle POSIX timezones

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/zic/zic.c
          +++ new/usr/src/cmd/zic/zic.c
↓ open down ↓ 2222 lines elided ↑ open up ↑
2223 2223                  return (min_time);
2224 2224          if (dayoff < min_time / SECSPERDAY)
2225 2225                  return (min_time);
2226 2226          if (dayoff > max_time / SECSPERDAY)
2227 2227                  return (max_time);
2228 2228          t = (zic_t)dayoff * SECSPERDAY;
2229 2229          return (tadd(t, rp->r_tod));
2230 2230  }
2231 2231  
2232 2232  static void
2233      -newabbr(string)
2234      -const char * const      string;
     2233 +newabbr(const char * const string)
2235 2234  {
2236 2235          register int    i;
2237 2236  
2238 2237          if (strcmp(string, GRANDPARENTED) != 0) {
2239 2238                  register const char *cp;
2240 2239                  register char *wp;
2241 2240  
2242      -                /*
2243      -                 * Want one to ZIC_MAX_ABBR_LEN_WO_WARN alphabetics
2244      -                 * optionally followed by a + or - and a number from 1 to 14.
2245      -                 */
2246 2241                  cp = string;
2247 2242                  wp = NULL;
2248      -                while (isascii(*cp) && isalpha(*cp))
     2243 +                while (isalpha(*cp) || ('0' <= *cp && *cp <= '9') ||
     2244 +                    *cp == '-' || *cp == '+') {
2249 2245                          ++cp;
2250      -                if (cp - string == 0)
2251      -                        wp = gettext(("time zone abbreviation lacks "
2252      -                            "alphabetic at start"));
2253      -                if (noise && cp - string > 3)
2254      -                        wp = gettext(("time zone abbreviation has more than 3 "
     2246 +                }
     2247 +                if (noise && cp - string < 3)
     2248 +                        wp = gettext(("time zone abbreviation has less than 3 "
2255 2249                              "alphabetics"));
2256 2250                  if (cp - string > ZIC_MAX_ABBR_LEN_WO_WARN)
2257 2251                          wp = gettext(("time zone abbreviation has too many "
2258      -                            "alphabetics"));
     2252 +                            "characters"));
2259 2253                  if (wp == NULL && (*cp == '+' || *cp == '-')) {
2260 2254                          ++cp;
2261 2255                          if (isascii(*cp) && isdigit(*cp))
2262 2256                                  if (*cp++ == '1' && *cp >= '0' && *cp <= '4')
2263 2257                                          ++cp;
2264 2258                  }
2265 2259                  if (*cp != '\0')
2266 2260                          wp = gettext("time zone abbreviation differs from "
2267 2261                              "POSIX standard");
2268 2262                  if (wp != NULL) {
↓ open down ↓ 74 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX