proposed changes to zic and zdump

Olson, Arthur David (NIH/NCI) olsona at dc37a.nci.nih.gov
Fri Aug 22 00:37:11 UTC 2003


Below are changes to zic and zdump code and documentation to cover
"--version" options;
there's also a zic buglet fix.

If folks are happy I'll incorporate these in the next release (due around
the last Sunday in October,
after any data changes have arrived).

I'm deferring the business of putting identifiers into the output of zic to
identify
the source of the output. There are two areas to ponder:

1.  An output file depends on the version of zic that was used to create it
as well as one or more input files (certainly the file that contains the
relevant
"Zone" line, but also perhaps a leap second file and--potentially at
least--one or
more files that contain "Rule" lines. What information is sufficient?

2.  Does the information need to be reflected in the header of the output
file,
or is it sufficient to just append the information to the end of the
generated output?

				--ado
         

------- zic.8 -------
*** /tmp/geta13698	Thu Aug 21 20:27:02 2003
--- /tmp/getb13698	Thu Aug 21 20:27:02 2003
***************
*** 4,9 ****
--- 4,12 ----
  .SH SYNOPSIS
  .B zic
  [
+ .B \-\-version
+ ]
+ [
  .B \-v
  ] [
  .B \-d
***************
*** 44,49 ****
--- 47,55 ----
  .PP
  These options are available:
  .TP
+ .BI "\-\-version"
+ Output version information and exit.
+ .TP
  .BI "\-d " directory
  Create time conversion information files in the named directory rather
than
  in the standard directory named below.
***************
*** 411,414 ****
  /usr/local/etc/zoneinfo	standard directory used for created files
  .SH "SEE ALSO"
  newctime(3), tzfile(5), zdump(8)
! .\" @(#)zic.8	7.19
--- 417,420 ----
  /usr/local/etc/zoneinfo	standard directory used for created files
  .SH "SEE ALSO"
  newctime(3), tzfile(5), zdump(8)
! .\" @(#)zic.8	7.20

------- zic.c -------
*** /tmp/geta13738	Thu Aug 21 20:27:22 2003
--- /tmp/getb13738	Thu Aug 21 20:27:22 2003
***************
*** 1,8 ****
! #ifndef lint
! #ifndef NOID
! static char	elsieid[] = "@(#)zic.c	7.107";
! #endif /* !defined NOID */
! #endif /* !defined lint */
  
  #include "private.h"
  #include "locale.h"
--- 1,4 ----
! static char	elsieid[] = "@(#)zic.c	7.110";
  
  #include "private.h"
  #include "locale.h"
***************
*** 446,452 ****
  static void
  usage P((void))
  {
! 	(void) fprintf(stderr, _("%s: usage is %s [ -s ] [ -v ] [ -l
localtime ] [ -p posixrules ] \\\n\t[ -d directory ] [ -L leapseconds ] [ -y
yearistype ] [ filename ... ]\n"),
  		progname, progname);
  	(void) exit(EXIT_FAILURE);
  }
--- 442,448 ----
  static void
  usage P((void))
  {
! 	(void) fprintf(stderr, _("%s: usage is %s [ --version ] [ -s ] [ -v
] [ -l localtime ] [ -p posixrules ] \\\n\t[ -d directory ] [ -L leapseconds
] [ -y yearistype ] [ filename ... ]\n"),
  		progname, progname);
  	(void) exit(EXIT_FAILURE);
  }
***************
*** 478,483 ****
--- 474,484 ----
  	(void) textdomain(TZ_DOMAIN);
  #endif /* HAVE_GETTEXT - 0 */
  	progname = argv[0];
+ 	for (i = 1; i < argc; ++i)
+ 		if (strcmp(argv[i], "--version") == 0) {
+ 			(void) printf("%s\n", elsieid);
+ 			(void) exit(EXIT_SUCCESS);
+ 		}
  	while ((c = getopt(argc, argv, "d:l:p:L:vsy:")) != EOF && c != -1)
  		switch (c) {
  			default:
***************
*** 1314,1322 ****
  		return;
  	} else if (noise) {
  		if (rp->r_loyear < min_year_representable)
! 			warning(_("starting year too low to be
represented"));
  		else if (rp->r_loyear > max_year_representable)
! 			warning(_("starting year too high to be
represented"));
  	}
  	if (rp->r_loyear > rp->r_hiyear) {
  		error(_("starting year greater than ending year"));
--- 1315,1323 ----
  		return;
  	} else if (noise) {
  		if (rp->r_loyear < min_year_representable)
! 			warning(_("ending year too low to be represented"));
  		else if (rp->r_loyear > max_year_representable)
! 			warning(_("ending year too high to be
represented"));
  	}
  	if (rp->r_loyear > rp->r_hiyear) {
  		error(_("starting year greater than ending year"));

------- zdump.8 -------
*** /tmp/geta13760	Thu Aug 21 20:27:42 2003
--- /tmp/getb13760	Thu Aug 21 20:27:42 2003
***************
*** 4,9 ****
--- 4,12 ----
  .SH SYNOPSIS
  .B zdump
  [
+ .B \-\-version
+ ]
+ [
  .B \-v
  ] [
  .B \-c
***************
*** 16,21 ****
--- 19,27 ----
  .PP
  These options are available:
  .TP
+ .BI "\-\-version"
+ Output version information and exit.
+ .TP
  .B \-v
  For each
  .I zonename
***************
*** 36,39 ****
  Cut off the verbose output near the start of the given year.
  .SH "SEE ALSO"
  newctime(3), tzfile(5), zic(8)
! .\" @(#)zdump.8	7.3
--- 42,45 ----
  Cut off the verbose output near the start of the given year.
  .SH "SEE ALSO"
  newctime(3), tzfile(5), zic(8)
! .\" @(#)zdump.8	7.4

------- zdump.c -------
*** /tmp/geta13783	Thu Aug 21 20:28:07 2003
--- /tmp/getb13783	Thu Aug 21 20:28:07 2003
***************
*** 1,8 ****
! #ifndef lint
! #ifndef NOID
! static char	elsieid[] = "@(#)zdump.c	7.29";
! #endif /* !defined NOID */
! #endif /* !defined lint */
  
  /*
  ** This code has been made independent of the rest of the time
--- 1,4 ----
! static char	elsieid[] = "@(#)zdump.c	7.31";
  
  /*
  ** This code has been made independent of the rest of the time
***************
*** 162,167 ****
--- 158,168 ----
  	(void) textdomain(TZ_DOMAIN);
  #endif /* HAVE_GETTEXT - 0 */
  	progname = argv[0];
+ 	for (i = 1; i < argc; ++i)
+ 		if (strcmp(argv[i], "--version") == 0) {
+ 			(void) printf("%s\n", elsieid);
+ 			(void) exit(EXIT_SUCCESS);
+ 		}
  	vflag = 0;
  	cutoff = NULL;
  	while ((c = getopt(argc, argv, "c:v")) == 'c' || c == 'v')
***************
*** 171,177 ****
  	if ((c != EOF && c != -1) ||
  		(optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
  			(void) fprintf(stderr,
! _("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"),
  				argv[0], argv[0]);
  			(void) exit(EXIT_FAILURE);
  	}
--- 172,178 ----
  	if ((c != EOF && c != -1) ||
  		(optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
  			(void) fprintf(stderr,
! _("%s: usage is %s [ --version ] [ -v ] [ -c cutoff ] zonename ...\n"),
  				argv[0], argv[0]);
  			(void) exit(EXIT_FAILURE);
  	}



More information about the tz mailing list