diff options
author | Roland McGrath <roland@gnu.org> | 2005-10-17 05:14:28 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2005-10-17 05:14:28 +0000 |
commit | 8185122e2ed56f8fc91e95f6975cb5bb6b0e1932 (patch) | |
tree | 9298bff05a3f59fe6c2897f0ccef0aebf172e323 | |
parent | 23592423fb658494acb44c7935729792ea7c00aa (diff) |
2005-09-17 Andreas Jaeger <aj@suse.de>
* timezone/zdump.c: Include ctype.h.
2005-09-06 Ulrich Drepper <drepper@redhat.com>
* timezone/africa: Update from tzdata2005m.
* timezone/asia: Likewise.
* timezone/australasia: Likewise.
* timezone/backward: Likewise.
* timezone/europe: Likewise.
* timezone/northamerica: Likewise.
* timezone/southamerica: Likewise.
* timezone/zone.tab: Likewise.
* timezone/zdump.c: Update from tzcode2005m.
2005-08-05 Ulrich Drepper <drepper@redhat.com>
* timezone/checktab.awk: Update from tzcode2005k.
* timezone/private.h: Likewise.
* timezone/scheck.c: Likewise.
* timezone/tzselect.ksh: Likewise.
* timezone/zdump.c: Likewise.
* timezone/zic.c: Likewise.
* timezone/africa: Update from tzdata2005k.
* timezone/antarctica: Likewise.
* timezone/asia: Likewise.
* timezone/australasia: Likewise.
* timezone/europe: Likewise.
* timezone/iso3166.tab: Likewise.
* timezone/leapseconds: Likewise.
* timezone/northamerica: Likewise.
* timezone/solar87: Likewise.
* timezone/solar88: Likewise.
* timezone/solar89: Likewise.
* timezone/southamerica: Likewise.
* timezone/zone.tab: Likewise.
-rw-r--r-- | timezone/zdump.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/timezone/zdump.c b/timezone/zdump.c index 2fcce38c06..d767d75fb7 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.66"; /* ** This code has been made independent of the rest of the time @@ -12,6 +12,7 @@ static char elsieid[] = "@(#)zdump.c 7.64"; #include "time.h" /* for struct tm */ #include "stdlib.h" /* for exit, malloc, atoi */ #include "float.h" /* for FLT_MAX and DBL_MAX */ +#include <ctype.h> /* for isascii, isalpha, isdigit */ #ifndef ZDUMP_LO_YEAR #define ZDUMP_LO_YEAR (-500) @@ -144,8 +145,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 +194,43 @@ time_t * tp; } #endif /* !defined TYPECHECK */ +static void +abbrok(abbr, zone) +const char * const abbr; +const char * const zone; +{ + 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 * |