26c3972015-02-14Henrik Grubbström (Grubba) # Check links in tz tables. # Contributed by Paul Eggert.
be7e5f2015-10-04Henrik Grubbström (Grubba) 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" }
26c3972015-02-14Henrik Grubbström (Grubba) 
be7e5f2015-10-04Henrik Grubbström (Grubba) /^Zone/ { 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 }
26c3972015-02-14Henrik Grubbström (Grubba) 
be7e5f2015-10-04Henrik Grubbström (Grubba) /^Link/ { 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 } used[$2] = 1 defined[$3] = $2 } END {
26c3972015-02-14Henrik Grubbström (Grubba)  for (tz in used) {
be7e5f2015-10-04Henrik Grubbström (Grubba)  if (defined[tz] != Zone) {
26c3972015-02-14Henrik Grubbström (Grubba)  printf "%s: Link to non-zone\n", tz status = 1 } } exit status }