aboutsummaryrefslogtreecommitdiff
path: root/timezone/zdump.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-08-06 05:40:57 +0000
committerUlrich Drepper <drepper@redhat.com>2005-08-06 05:40:57 +0000
commitc872f5cc633744c9b37044cdf1833b6c42f7ab92 (patch)
tree7fae91a29dfcffd315c32002fbbcba76fdf2bd67 /timezone/zdump.c
parentbf3534a59e15fd3f1da67d2a0d75f713010a4996 (diff)
downloadglibc-c872f5cc633744c9b37044cdf1833b6c42f7ab92.tar
glibc-c872f5cc633744c9b37044cdf1833b6c42f7ab92.tar.gz
glibc-c872f5cc633744c9b37044cdf1833b6c42f7ab92.tar.bz2
glibc-c872f5cc633744c9b37044cdf1833b6c42f7ab92.zip
Update from tzcode2005k.
Diffstat (limited to 'timezone/zdump.c')
-rw-r--r--timezone/zdump.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/timezone/zdump.c b/timezone/zdump.c
index 2fcce38c06..78cc28ef65 100644
--- a/timezone/zdump.c
+++ b/timezone/zdump.c
@@ -1,4 +1,4 @@
-static char elsieid[] = "@(#)zdump.c 7.64";
+static char elsieid[] = "@(#)zdump.c 7.65";
/*
** This code has been made independent of the rest of the time
@@ -144,8 +144,10 @@ static time_t absolute_min_time;
static time_t absolute_max_time;
static size_t longest;
static char * progname;
+static int warned;
static char * abbr P((struct tm * tmp));
+static void abbrok P((const char * abbr, const char * zone));
static long delta P((struct tm * newp, struct tm * oldp));
static void dumptime P((const struct tm * tmp));
static time_t hunt P((char * name, time_t lot, time_t hit));
@@ -191,6 +193,44 @@ time_t * tp;
}
#endif /* !defined TYPECHECK */
+static void
+abbrok(abbr, zone)
+const char * const abbr;
+const char * const zone;
+{
+ register int i;
+ register const char * cp;
+ register char * wp;
+
+ if (warned)
+ return;
+ cp = abbr;
+ wp = NULL;
+ while (isascii(*cp) && isalpha(*cp))
+ ++cp;
+ if (cp - abbr == 0)
+ wp = _("lacks alphabetic at start");
+ if (cp - abbr < 3)
+ wp = _("has fewer than 3 alphabetics");
+ if (cp - abbr > 6)
+ wp = _("has more than 6 alphabetics");
+ if (wp == NULL && (*cp == '+' || *cp == '-')) {
+ ++cp;
+ if (isascii(*cp) && isdigit(*cp))
+ if (*cp++ == '1' && *cp >= '0' && *cp <= '4')
+ ++cp;
+ }
+ if (*cp != '\0')
+ wp = _("differs from POSIX standard");
+ if (wp == NULL)
+ return;
+ (void) fflush(stdout);
+ (void) fprintf(stderr,
+ "%s: warning: zone \"%s\" abbreviation \"%s\" %s\n",
+ progname, zone, abbr, wp);
+ warned = TRUE;
+}
+
int
main(argc, argv)
int argc;
@@ -216,7 +256,7 @@ char * argv[];
INITIALIZE(cutlotime);
INITIALIZE(cuthitime);
#if HAVE_GETTEXT
- (void) setlocale(LC_MESSAGES, "");
+ (void) setlocale(LC_ALL, "");
#ifdef TZ_DOMAINDIR
(void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
#endif /* defined TEXTDOMAINDIR */
@@ -297,6 +337,7 @@ _("%s: usage is %s [ --version ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n"),
show(argv[i], now, FALSE);
continue;
}
+ warned = FALSE;
t = absolute_min_time;
show(argv[i], t, TRUE);
t += SECSPERHOUR * HOURSPERDAY;
@@ -527,6 +568,8 @@ int v;
}
}
(void) printf("\n");
+ if (tmp != NULL && *abbr(tmp) != '\0')
+ abbrok(abbr(tmp), zone);
}
static char *