Print this page
XXXX Update zdump to better-handle POSIX timezones
*** 140,197 ****
return (tmp);
}
#endif /* !defined TYPECHECK */
static void
! abbrok(abbrp, zone)
! const char * const abbrp;
! const char * const zone;
{
register const char *cp;
int error = 0;
if (warned)
return;
cp = abbrp;
! while (isascii(*cp) && isalpha((unsigned char)*cp))
++cp;
(void) fflush(stdout);
! if (cp - abbrp == 0) {
! /*
! * TRANSLATION_NOTE
! * The first %s prints for the program name (zdump),
! * the second %s prints the timezone name, the third
! * %s prints the timezone abbreviation (tzname[0] or
! * tzname[1]).
! */
(void) fprintf(stderr, gettext("%s: warning: zone \"%s\" "
- "abbreviation \"%s\" lacks alphabetic at start\n"),
- progname, zone, abbrp);
- error = 1;
- } else if (cp - abbrp < 3) {
- (void) fprintf(stderr, gettext("%s: warning: zone \"%s\" "
"abbreviation \"%s\" has fewer than 3 alphabetics\n"),
progname, zone, abbrp);
error = 1;
} else if (cp - abbrp > 6) {
(void) fprintf(stderr, gettext("%s: warning: zone \"%s\" "
! "abbreviation \"%s\" has more than 6 alphabetics\n"),
progname, zone, abbrp);
error = 1;
! }
! if (error == 0 && (*cp == '+' || *cp == '-')) {
! ++cp;
! if (isascii(*cp) && isdigit((unsigned char)*cp))
! if (*cp++ == '1' && *cp >= '0' && *cp <= '4')
! ++cp;
! if (*cp != '\0') {
! (void) fprintf(stderr, gettext("%s: warning: "
! "zone \"%s\" abbreviation \"%s\" differs from "
! "POSIX standard\n"), progname, zone, abbrp);
error = 1;
}
- }
if (error)
warned = TRUE;
}
int
--- 140,176 ----
return (tmp);
}
#endif /* !defined TYPECHECK */
static void
! abbrok(const char * const abbrp, const char * const zone)
{
register const char *cp;
int error = 0;
if (warned)
return;
cp = abbrp;
! while (isalpha(*cp) || isdigit(*cp) || *cp == '-' || *cp == '+')
++cp;
(void) fflush(stdout);
! if (cp - abbrp < 3) {
(void) fprintf(stderr, gettext("%s: warning: zone \"%s\" "
"abbreviation \"%s\" has fewer than 3 alphabetics\n"),
progname, zone, abbrp);
error = 1;
} else if (cp - abbrp > 6) {
(void) fprintf(stderr, gettext("%s: warning: zone \"%s\" "
! "abbreviation \"%s\" has more than 6 characters\n"),
progname, zone, abbrp);
error = 1;
! } else if (*cp != '\0') {
! (void) fprintf(stderr, gettext("%s: warning: zone \"%s\" "
! "abbreviation \"%s\" has characters other than "
! "alphanumerics\n"), progname, zone, abbrp);
error = 1;
}
if (error)
warned = TRUE;
}
int