}
seenrules=/
+seenfoundries=/
while read keyword rest; do
case "$keyword" in
m/^\d+\,(\d+)\b/ or die;
print "key=$_; height=$1\n" or die $!;
exit;
- ' <$good`
+ ' <$bad`
oldfoundry=`perl -ne '
next unless s/^FOUNDRY\s+\"?//;
s/\"?\s+$//;
print or die $!;
exit;
' <$good`
- printf "%s %s" "$oldfoundry" "$newfoundry" >>rules/foundries.new
+ case "$seenfoundries" in
+ */"$oldfoundry,$newfoundry"/*)
+ ;;
+ */"$oldfoundry,"*)
+ echo >&2 "inconsistent foundry mapping"
+ exit 1
+ ;;
+ *)
+ seenfoundries=$seenfoundries$oldfoundry,$newfoundry/
+ printf >>rules/foundries.new \
+ "%s %s\n" "$oldfoundry" "$newfoundry"
+ ;;
+ esac
case "$seenrules" in
*/"$newfoundry,$key"/*)
exec 3>>rules/$newfoundry,$key.rules