From 5fb55a68c1123398f1ed27c6fc8ee196dc121bc7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 15 Jun 2009 08:49:18 -0700 Subject: [PATCH] Update from tzcode2009i. --- ChangeLog | 4 ++++ timezone/tzselect.ksh | 17 ++++++++++++++++- timezone/zdump.c | 31 +++++++++++++++++++++---------- timezone/zic.c | 26 +++++++++++++++----------- 4 files changed, 56 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index d96e17a1b9..dcd7444dd5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2009-06-15 Ulrich Drepper + * timezone/tzselect.ksh: Update from tzcode2009i. + * timezone/zdump.c: Likewise. + * timezone/zic.c: Likewise. + * timezone/africa: Update from tzdata2009i. * timezone/antarctica: Likewise. * timezone/asia: Likewise. diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh index b99af8273b..57bf707e45 100644 --- a/timezone/tzselect.ksh +++ b/timezone/tzselect.ksh @@ -1,6 +1,6 @@ #! @KSH@ -# '@(#)tzselect.ksh 8.1' +VERSION='@(#)tzselect.ksh 8.2' # Ask the user about the time zone, and output the resulting TZ value to stdout. # Interact with the user via stderr and stdin. @@ -45,6 +45,21 @@ exit 1 } +if [ "$1" = "--help" ]; then + cat <= cuthitime) + if (t >= cuthitime || t >= cuthitime - SECSPERHOUR * 12) break; newt = t + SECSPERHOUR * 12; - if (newt >= cuthitime) - break; - if (newt <= t) - break; newtmp = localtime(&newt); if (newtmp != NULL) newtm = *newtmp; diff --git a/timezone/zic.c b/timezone/zic.c index 5f8028e480..01d9f135bd 100644 --- a/timezone/zic.c +++ b/timezone/zic.c @@ -3,7 +3,7 @@ ** 2006-07-17 by Arthur David Olson. */ -static char elsieid[] = "@(#)zic.c 8.17"; +static char elsieid[] = "@(#)zic.c 8.19"; #include "private.h" #include "locale.h" @@ -156,7 +156,7 @@ static void stringzone(char * result, const struct zone * zp, int ntzones); static void setboundaries(void); static zic_t tadd(zic_t t1, long t2); -static void usage(void); +static void usage(FILE *stream, int status); static void writezone(const char * name, const char * string); static int yearistype(int year, const char * type); @@ -454,13 +454,15 @@ const char * const string; } static void -usage(void) +usage(FILE *stream, int status) { - (void) fprintf(stderr, _("%s: usage is %s \ -[ --version ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\ -\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n"), - progname, progname); - exit(EXIT_FAILURE); + (void) fprintf(stream, _("%s: usage is %s \ +[ --version ] [ --help ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\ +\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n\ +\n\ +Report bugs to tz@elsie.nci.nih.gov.\n"), + progname, progname); + exit(status); } static const char * psxrules; @@ -498,11 +500,13 @@ char * argv[]; if (strcmp(argv[i], "--version") == 0) { (void) printf("%s\n", elsieid); exit(EXIT_SUCCESS); + } else if (strcmp(argv[i], "--help") == 0) { + usage(stdout, EXIT_SUCCESS); } while ((c = getopt(argc, argv, "d:l:p:L:vsy:")) != EOF && c != -1) switch (c) { default: - usage(); + usage(stderr, EXIT_FAILURE); case 'd': if (directory == NULL) directory = optarg; @@ -561,7 +565,7 @@ _("%s: More than one -L option specified\n"), break; } if (optind == argc - 1 && strcmp(argv[optind], "=") == 0) - usage(); /* usage message by request */ + usage(stderr, EXIT_FAILURE); /* usage message by request */ if (directory == NULL) directory = TZDIR; if (yitcommand == NULL) @@ -1991,7 +1995,7 @@ const int zonecount; min_year = max_year = EPOCH_YEAR; if (leapseen) { updateminmax(leapminyear); - updateminmax(leapmaxyear); + updateminmax(leapmaxyear + (leapmaxyear < INT_MAX)); } for (i = 0; i < zonecount; ++i) { zp = &zpfirst[i];