proposed changes to zic and zdump
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); }
At Thu, 21 Aug 2003 20:37:11 -0400, "Olson, Arthur David (NIH/NCI)" <olsona@dc37a.nci.nih.gov> writes:
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?
As far as zic goes, the important thing is not the version number of zic itself; it is the version number of the algorithm that zic uses. For example, if zic is modified purely to add a new "--version" option, the algorithm version shouldn't change, since the new option can't possibly affect the contents of the output files.
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?
The latter, I'd say. Personally, I'd prefer not to have version information in the output of zic, as the version info makes it more of a pain to do proper regression testing. So I'd like zic to have an option to disable this new feature. Better yet, why not add a zic option to enable this new feature, and leave it disabled by default? That is a more conservative approach, as it makes it less likely that this new feature will break things.
At 8:37 PM -0400 8/21/03, Olson, Arthur David (NIH/NCI) wrote:
Below are changes to zic and zdump code and documentation to cover "--version" options; there's also a zic buglet fix.
I think that a new "--version" option is a good enhancement. In addition, being able to determine the overall release number (e.g. 2003a) of the tz database would be very useful. Could the zic and zdump executables report the release number with a particular option such as "--release"? It is common for Windows and Macintosh applications to be able to specify both a version number (e.g. 7.19) and a release number (e.g. 2003a). Sometimes this release number stored in a file or variable outside of the executable file. Unfortunately, I do not have a strong unix development background and I'm not sure if there is a standard way to report a release number for a set of executables and data files.
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
My suggestion is that the output files do not use store version information in the header. I think that the output files should contain only data and not include meta data. (Previously, I had agree with someone on the list that suggested using the header for version information).
참여자 (3)
-
Chuck Soper -
Olson, Arthur David (NIH/NCI) -
Paul Eggert