1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-16 18:51:53 +02:00

dsv (setup): make sure file ends with a newline, so that we can "read" it

This commit is contained in:
Werner Almesberger 2010-11-30 19:27:59 -03:00
parent be269982f3
commit f207be6671

34
dsv/dsv
View File

@ -102,20 +102,26 @@ setup()
echo "$n: not found" 2>&1 echo "$n: not found" 2>&1
continue continue
fi fi
while read line; do #
[ "$line" = "${line###}" ] || continue # "read" doesn't recognize lines that don't end with a newline.
tmp=`echo "$line" | awk '/^[^\t ]/ { print $1 }'` # The cat-sed hack below works around this problems.
tail=`echo "$line" | sed 's/^[^\t ]*[\t ]*//'` #
if [ -z "$tmp" ]; then cat -E "$n" | sed 's/[^$]$/&\n/;s/$$//' | {
[ -z "$tail" ] || value="$value $tail" while read line; do
else [ "$line" = "${line###}" ] || continue
set_value tmp=`echo "$line" | awk '/^[^\t ]/ { print $1 }'`
tag=$tmp tail=`echo "$line" | sed 's/^[^\t ]*[\t ]*//'`
value=$tail if [ -z "$tmp" ]; then
fi [ -z "$tail" ] || value="$value $tail"
done <"$n" else
set_value set_value
eof tag=$tmp
value=$tail
fi
done
set_value
eof
}
done done
} }