aboutsummaryrefslogtreecommitdiff
path: root/timezone/zdump.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-06-15 08:49:18 -0700
committerUlrich Drepper <drepper@redhat.com>2009-06-15 08:49:18 -0700
commit5fb55a68c1123398f1ed27c6fc8ee196dc121bc7 (patch)
treefe614ff75417623f25232d27176cbe64c0749ee7 /timezone/zdump.c
parenta468a1d4a934bdfef77214acb46e6d3b397eb9c0 (diff)
downloadglibc-5fb55a68c1123398f1ed27c6fc8ee196dc121bc7.tar
glibc-5fb55a68c1123398f1ed27c6fc8ee196dc121bc7.tar.gz
glibc-5fb55a68c1123398f1ed27c6fc8ee196dc121bc7.tar.bz2
glibc-5fb55a68c1123398f1ed27c6fc8ee196dc121bc7.zip
Update from tzcode2009i.
Diffstat (limited to 'timezone/zdump.c')
-rw-r--r--timezone/zdump.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/timezone/zdump.c b/timezone/zdump.c
index 82c91e485e..7122bbf891 100644
--- a/timezone/zdump.c
+++ b/timezone/zdump.c
@@ -1,4 +1,9 @@
-static char elsieid[] = "@(#)zdump.c 8.6";
+/*
+** This file is in the public domain, so clarified as of
+** 2009-05-17 by Arthur David Olson.
+*/
+
+static char elsieid[] = "@(#)zdump.c 8.9";
/*
** This code has been made independent of the rest of the time
@@ -230,6 +235,17 @@ const char * const zone;
warned = TRUE;
}
+static void
+usage(const char *progname, FILE *stream, int status)
+{
+ (void) fprintf(stream,
+_("%s: usage is %s [ --version ] [ --help ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n\
+\n\
+Report bugs to tz@elsie.nci.nih.gov.\n"),
+ progname, progname);
+ exit(status);
+}
+
int
main(argc, argv)
int argc;
@@ -266,6 +282,8 @@ char * argv[];
if (strcmp(argv[i], "--version") == 0) {
(void) printf("%s\n", elsieid);
exit(EXIT_SUCCESS);
+ } else if (strcmp(argv[i], "--help") == 0) {
+ usage(progname, stdout, EXIT_SUCCESS);
}
vflag = 0;
cutarg = NULL;
@@ -275,10 +293,7 @@ char * argv[];
else cutarg = optarg;
if ((c != EOF && c != -1) ||
(optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
- (void) fprintf(stderr,
-_("%s: usage is %s [ --version ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n"),
- progname, progname);
- exit(EXIT_FAILURE);
+ usage(progname, stderr, EXIT_FAILURE);
}
if (vflag) {
if (cutarg != NULL) {
@@ -349,13 +364,9 @@ _("%s: usage is %s [ --version ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n"),
(void) strncpy(buf, abbr(&tm), (sizeof buf) - 1);
}
for ( ; ; ) {
- if (t >= 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;