checklinks.awk revision 309576
1309576Sglebius# Check links in tz tables. 2309576Sglebius 3309576Sglebius# Contributed by Paul Eggert. This file is in the public domain. 4309576Sglebius 5309576SglebiusBEGIN { 6309576Sglebius # Special marker indicating that the name is defined as a Zone. 7309576Sglebius # It is a newline so that it cannot match a valid name. 8309576Sglebius # It is not null so that its slot does not appear unset. 9309576Sglebius Zone = "\n" 10309576Sglebius} 11309576Sglebius 12309576Sglebius/^Zone/ { 13309576Sglebius if (defined[$2]) { 14309576Sglebius if (defined[$2] == Zone) { 15309576Sglebius printf "%s: Zone has duplicate definition\n", $2 16309576Sglebius } else { 17309576Sglebius printf "%s: Link with same name as Zone\n", $2 18309576Sglebius } 19309576Sglebius status = 1 20309576Sglebius } 21309576Sglebius defined[$2] = Zone 22309576Sglebius} 23309576Sglebius 24309576Sglebius/^Link/ { 25309576Sglebius if (defined[$3]) { 26309576Sglebius if (defined[$3] == Zone) { 27309576Sglebius printf "%s: Link with same name as Zone\n", $3 28309576Sglebius } else if (defined[$3] == $2) { 29309576Sglebius printf "%s: Link has duplicate definition\n", $3 30309576Sglebius } else { 31309576Sglebius printf "%s: Link to both %s and %s\n", $3, defined[$3], $2 32309576Sglebius } 33309576Sglebius status = 1 34309576Sglebius } 35309576Sglebius used[$2] = 1 36309576Sglebius defined[$3] = $2 37309576Sglebius} 38309576Sglebius 39309576SglebiusEND { 40309576Sglebius for (tz in used) { 41309576Sglebius if (defined[tz] != Zone) { 42309576Sglebius printf "%s: Link to non-zone\n", tz 43309576Sglebius status = 1 44309576Sglebius } 45309576Sglebius } 46309576Sglebius 47309576Sglebius exit status 48309576Sglebius} 49