- printf "%s %s" "$oldfoundry" "$newfoundry" >>rules/foundries.new
- exec 3>rules/$newfoundry,$key.rules
- echo >&3 '# -*- perl -*-'
- echo >&3 '# autogenerated by mkrules'
- echo >&3 'sub {'
+ 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
+ ;;
+ *)
+ exec 3>rules/$newfoundry,$key.rules
+ echo >&3 '# -*- perl -*-'
+ echo >&3 '# autogenerated by mkrules'
+ echo >&3 'sub {'
+ seenrules=$seenrules$newfoundry,$key/
+ ;;
+ esac
+ echo >&3 " # $pcf"