diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 13:53:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 13:53:43 +0000 |
commit | f873a6ab324edf3c9a66d29ba3ab0e3dc6c21e0a (patch) | |
tree | d99dab2786b89a9ca35f59f4c88749649ad859e7 /checklinks.awk | |
parent | Initial commit. (diff) | |
download | tzdata-f873a6ab324edf3c9a66d29ba3ab0e3dc6c21e0a.tar.xz tzdata-f873a6ab324edf3c9a66d29ba3ab0e3dc6c21e0a.zip |
Adding upstream version 2024a.upstream/2024aupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'checklinks.awk')
-rw-r--r-- | checklinks.awk | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/checklinks.awk b/checklinks.awk new file mode 100644 index 0000000..82a5fea --- /dev/null +++ b/checklinks.awk @@ -0,0 +1,70 @@ +# Check links in tz tables. + +# Contributed by Paul Eggert. This file is in the public domain. + +BEGIN { + # Special marker indicating that the name is defined as a Zone. + # It is a newline so that it cannot match a valid name. + # It is not null so that its slot does not appear unset. + Zone = "\n" +} + +/^Z/ { + if (defined[$2]) { + if (defined[$2] == Zone) { + printf "%s: Zone has duplicate definition\n", $2 + } else { + printf "%s: Link with same name as Zone\n", $2 + } + status = 1 + } + defined[$2] = Zone +} + +/^L/ { + if (defined[$3]) { + if (defined[$3] == Zone) { + printf "%s: Link with same name as Zone\n", $3 + } else if (defined[$3] == $2) { + printf "%s: Link has duplicate definition\n", $3 + } else { + printf "%s: Link to both %s and %s\n", $3, defined[$3], $2 + } + status = 1 + } + if (backcheck && FILENAME != backcheck && $3 != "GMT") { + printf "%s: Link should be in '%s'\n", $3, backcheck + status = 1 + } + if ($4 == "#=") { + shortcut[$5] = $3 + } + used[$2] = 1 + defined[$3] = $2 +} + +END { + for (tz in used) { + if (defined[tz] != Zone) { + if (!defined[tz]) { + printf "%s: Link to nowhere\n", tz + status = 1 + } else if (DATAFORM != "vanguard") { + printf "%s: Link to link\n", tz + status = 1 + } + } + } + for (tz in shortcut) { + if (defined[shortcut[tz]] != defined[tz]) { + target = (!defined[tz] ? "absence" \ + : defined[tz] == "\n" ? "zone" \ + : defined[tz]) + printf "%s: target %s disagrees with %s's target %s\n", \ + tz, target, shortcut[tz], defined[shortcut[tz]] + status = 1 + } + } + + exit status +} |