[tz] [PROPOSED 5/7] Fix line number in “link to link” diagnostic

Paul Eggert eggert at cs.ucla.edu
Thu Oct 20 19:44:04 UTC 2022


* NEWS: Mention this.
* zic.c (main): When warning about ‘Zone A ... / Link A B / Link B C’,
complain about the second Link line, which is the link to the link,
not the first Link line, which is fine as-is.
---
 NEWS  | 2 ++
 zic.c | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index a5b680f..64a2d0c 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,8 @@ Unreleased, experimental changes
 
   Changes to code
 
+    Fix line number in zic's diagnostic for a link to a link.
+
     Fix a bug that caused localtime to mishandle timestamps starting
     in the year 2438 when reading data generated by 'zic -b fat' when
     distant-future DST transitions occur at times given in standard
diff --git a/zic.c b/zic.c
index ddfdc79..f280b31 100644
--- a/zic.c
+++ b/zic.c
@@ -954,8 +954,11 @@ _("%s: invalid time range: %s\n"),
 		if (noise)
 			for (j = 0; j < nlinks; ++j)
 				if (strcmp(links[i].l_linkname,
-					links[j].l_target) == 0)
+					   links[j].l_target) == 0) {
+						eat(links[j].l_filename,
+						    links[j].l_linenum);
 						warning(_("link to link"));
+				}
 	}
 	if (lcltime != NULL) {
 		eat(_("command line"), 1);
-- 
2.37.3



More information about the tz mailing list