From: Mark Wooding Date: Tue, 10 Jan 2012 23:59:05 +0000 (+0000) Subject: mkrules: Handle multiple files with the same metrics. X-Git-Url: https://git.distorted.org.uk/~mdw/xfonts-traditional/commitdiff_plain/fe6a7d791ffe20cb0cf74a22e2c024dc6319574e mkrules: Handle multiple files with the same metrics. If we had two PCF files with the same metrics previously, we'd overwrite the rules file from the first with a new file from the second. Keep track of which files we've written during the run, and append to them if we've already started writing. Finish them all up at the end. Signed-off-by: Mark Wooding --- diff --git a/mkrules b/mkrules index 5b07879..b55b397 100755 --- a/mkrules +++ b/mkrules @@ -24,6 +24,8 @@ chars () { done } +seenrules=/ + while read keyword rest; do case "$keyword" in '#'|'') continue ;; @@ -53,13 +55,21 @@ while read keyword rest; do exit; ' <$good` 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 "$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" ;; endrules) - echo >&3 '}' exec 3>rules/$rulefile.rules +done + mv rules/foundries.new rules/foundries