2213 --i;
2214 }
2215 if (i < 0 || i >= len_months[isleap(y)][m]) {
2216 if (noise)
2217 warning(gettext("rule goes past start/end of "
2218 "month--will not work with pre-2004 "
2219 "versions of zic"));
2220 }
2221 }
2222 if (dayoff < 0 && !TYPE_SIGNED(zic_t))
2223 return (min_time);
2224 if (dayoff < min_time / SECSPERDAY)
2225 return (min_time);
2226 if (dayoff > max_time / SECSPERDAY)
2227 return (max_time);
2228 t = (zic_t)dayoff * SECSPERDAY;
2229 return (tadd(t, rp->r_tod));
2230 }
2231
2232 static void
2233 newabbr(string)
2234 const char * const string;
2235 {
2236 register int i;
2237
2238 if (strcmp(string, GRANDPARENTED) != 0) {
2239 register const char *cp;
2240 register char *wp;
2241
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 cp = string;
2247 wp = NULL;
2248 while (isascii(*cp) && isalpha(*cp))
2249 ++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 "
2255 "alphabetics"));
2256 if (cp - string > ZIC_MAX_ABBR_LEN_WO_WARN)
2257 wp = gettext(("time zone abbreviation has too many "
2258 "alphabetics"));
2259 if (wp == NULL && (*cp == '+' || *cp == '-')) {
2260 ++cp;
2261 if (isascii(*cp) && isdigit(*cp))
2262 if (*cp++ == '1' && *cp >= '0' && *cp <= '4')
2263 ++cp;
2264 }
2265 if (*cp != '\0')
2266 wp = gettext("time zone abbreviation differs from "
2267 "POSIX standard");
2268 if (wp != NULL) {
2269 wp = ecpyalloc(wp);
2270 wp = ecatalloc(wp, " (");
2271 wp = ecatalloc(wp, string);
2272 wp = ecatalloc(wp, ")");
2273 warning(wp);
2274 ifree(wp);
2275 }
2276 }
2277 i = strlen(string) + 1;
2278 if (charcnt + i > TZ_MAX_CHARS) {
|
2213 --i;
2214 }
2215 if (i < 0 || i >= len_months[isleap(y)][m]) {
2216 if (noise)
2217 warning(gettext("rule goes past start/end of "
2218 "month--will not work with pre-2004 "
2219 "versions of zic"));
2220 }
2221 }
2222 if (dayoff < 0 && !TYPE_SIGNED(zic_t))
2223 return (min_time);
2224 if (dayoff < min_time / SECSPERDAY)
2225 return (min_time);
2226 if (dayoff > max_time / SECSPERDAY)
2227 return (max_time);
2228 t = (zic_t)dayoff * SECSPERDAY;
2229 return (tadd(t, rp->r_tod));
2230 }
2231
2232 static void
2233 newabbr(const char * const string)
2234 {
2235 register int i;
2236
2237 if (strcmp(string, GRANDPARENTED) != 0) {
2238 register const char *cp;
2239 register char *wp;
2240
2241 cp = string;
2242 wp = NULL;
2243 while (isalpha(*cp) || ('0' <= *cp && *cp <= '9') ||
2244 *cp == '-' || *cp == '+') {
2245 ++cp;
2246 }
2247 if (noise && cp - string < 3)
2248 wp = gettext(("time zone abbreviation has less than 3 "
2249 "alphabetics"));
2250 if (cp - string > ZIC_MAX_ABBR_LEN_WO_WARN)
2251 wp = gettext(("time zone abbreviation has too many "
2252 "characters"));
2253 if (wp == NULL && (*cp == '+' || *cp == '-')) {
2254 ++cp;
2255 if (isascii(*cp) && isdigit(*cp))
2256 if (*cp++ == '1' && *cp >= '0' && *cp <= '4')
2257 ++cp;
2258 }
2259 if (*cp != '\0')
2260 wp = gettext("time zone abbreviation differs from "
2261 "POSIX standard");
2262 if (wp != NULL) {
2263 wp = ecpyalloc(wp);
2264 wp = ecatalloc(wp, " (");
2265 wp = ecatalloc(wp, string);
2266 wp = ecatalloc(wp, ")");
2267 warning(wp);
2268 ifree(wp);
2269 }
2270 }
2271 i = strlen(string) + 1;
2272 if (charcnt + i > TZ_MAX_CHARS) {
|