1.1 --- a/makesd-expand-def Mon Jun 10 01:37:46 2019 +0200
1.2 +++ b/makesd-expand-def Mon Jun 10 13:52:32 2019 +0200
1.3 @@ -64,13 +64,19 @@
1.4
1.5 # consolidate
1.6 #
1.7 -# Eliminate duplicate properties, preserving only the final definition.
1.8 +# Eliminate duplicate properties, preserving only the final definition, except
1.9 +# for certain properties.
1.10
1.11 consolidate()
1.12 {
1.13 - sort -k1,1 -t: -s | show_last
1.14 + sort -k1,1 -t: -s | show_last 'expand'
1.15 }
1.16
1.17 +# show_last [ <property> ... ]
1.18 +#
1.19 +# Show only the last property of any given name, preserving duplicate entries
1.20 +# only for any given properties.
1.21 +
1.22 show_last()
1.23 {
1.24 local FIELD LAST LASTLINE
1.25 @@ -85,9 +91,9 @@
1.26 FIELD=`get_field "$LINE"`
1.27
1.28 # With a differing property from any previous one, emit the previous
1.29 - # one.
1.30 + # one. With a preserved property, also emit the previous line.
1.31
1.32 - if [ "$LAST" ] && [ "$FIELD" != "$LAST" ] ; then
1.33 + if [ "$LAST" ] && [ "$FIELD" != "$LAST" ] || is_in "$FIELD" $* ; then
1.34 echo "$LASTLINE"
1.35 fi
1.36