* NEWS: Document this. * zic.8: Document more clearly that "Zone" etc. can be abbreviated. * zic.c (line_codes): Remove, replacing with ... (zi_line_codes, leap_line_codes): ... these new constants. (infile): Use them to distinguish context more accurately. Remove no-longer-applicable warning. --- NEWS | 9 +++++++++ zic.8 | 9 ++++++++- zic.c | 16 +++++++++------- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 0a76781..99f5d64 100644 --- a/NEWS +++ b/NEWS @@ -48,6 +48,15 @@ Unreleased, experimental changes Also, zic warns about the undocumented usage with a "last-" prefix, e.g., "last-Fri". + Similarly, zic now accepts the unambiguous abbreviation "L" for + "Link" in ordinary context and for "Leap" in leap-second context. + Conversely, zic no longer accepts non-prefixes such as "La" as + abbreviations for words like "Leap". + + zic no longer accepts leap second lines in ordinary input, or + ordinary lines in leap second input. Formerly, zic sometimes + warned about this undocumented usage and handled it incorrectly. + Several minor changes have been made to the code to make it a bit easier to port to MS-Windows. (Thanks to Kees Dekker for reporting the problems.) diff --git a/zic.8 b/zic.8 index 6fee96d..ab95b08 100644 --- a/zic.8 +++ b/zic.8 @@ -147,7 +147,14 @@ Any line that is blank (after comment stripping) is ignored. Non-blank lines are expected to be of one of three types: rule lines, zone lines, and link lines. .PP -Names (such as month names) must be in English and are case insensitive. +Names must be in English and are case insensitive. +They appear in several contexts, and include month and weekday names +and keywords such as +.BR "maximum" , +.BR "only" , +.BR "Rolling" , +and +.BR "Zone" . A name can be abbreviated by omitting all but an initial prefix; any abbreviation must be unambiguous in context. .PP diff --git a/zic.c b/zic.c index 33cb4e7..ff71af6 100644 --- a/zic.c +++ b/zic.c @@ -298,10 +298,13 @@ struct lookup { static struct lookup const * byword(const char * string, const struct lookup * lp); -static struct lookup const line_codes[] = { +static struct lookup const zi_line_codes[] = { { "Rule", LC_RULE }, { "Zone", LC_ZONE }, { "Link", LC_LINK }, + { NULL, 0 } +}; +static struct lookup const leap_line_codes[] = { { "Leap", LC_LEAP }, { NULL, 0} }; @@ -1114,6 +1117,8 @@ infile(const char *name) } else if (wantcont) { wantcont = inzcont(fields, nfields); } else { + struct lookup const *line_codes + = name == leapsec ? leap_line_codes : zi_line_codes; lp = byword(fields[0], line_codes); if (lp == NULL) error(_("input line of unknown type")); @@ -1130,11 +1135,7 @@ infile(const char *name) wantcont = false; break; case LC_LEAP: - if (name != leapsec) - warning(_("%s: Leap line in non leap" - " seconds file %s"), - progname, name); - else inleap(fields, nfields); + inleap(fields, nfields); wantcont = false; break; default: /* "cannot happen" */ @@ -1586,7 +1587,8 @@ rulesub(struct rule *rp, const char *loyearp, const char *hiyearp, ** Day work. ** Accept things such as: ** 1 - ** last-Sunday + ** lastSunday + ** last-Sunday (undocumented; warn about this) ** Sun<=20 ** Sun>=7 */ -- 2.9.4