|
@@ -170,7 +170,7 @@ do_savedefconfig () {
|
|
# backslashes as an escape character
|
|
# backslashes as an escape character
|
|
while read -r line
|
|
while read -r line
|
|
do
|
|
do
|
|
- output_lines="$output_lines $line"
|
|
|
|
|
|
+ output_lines="$output_lines%$line"
|
|
done < defconfig
|
|
done < defconfig
|
|
|
|
|
|
for img in $subimages
|
|
for img in $subimages
|
|
@@ -185,43 +185,64 @@ do_savedefconfig () {
|
|
tmp=
|
|
tmp=
|
|
match=
|
|
match=
|
|
|
|
|
|
|
|
+ # "# CONFIG_FOO is not set" should not be divided.
|
|
|
|
+ # Use "%" as a separator, instead of a whitespace.
|
|
|
|
+ # "%" is unlikely to appear in defconfig context.
|
|
|
|
+ save_IFS=$IFS
|
|
|
|
+ IFS=%
|
|
# coalesce common lines together
|
|
# coalesce common lines together
|
|
for i in $output_lines
|
|
for i in $output_lines
|
|
do
|
|
do
|
|
case "$i" in
|
|
case "$i" in
|
|
"[+A-Z]*:$line")
|
|
"[+A-Z]*:$line")
|
|
- tmp="$tmp $unmatched"
|
|
|
|
|
|
+ tmp="$tmp%$unmatched"
|
|
i=$(echo "$i" | \
|
|
i=$(echo "$i" | \
|
|
sed -e "s/^\([^:]\)*/\1$symbol/")
|
|
sed -e "s/^\([^:]\)*/\1$symbol/")
|
|
- tmp="$tmp $i"
|
|
|
|
|
|
+ tmp="$tmp%$i"
|
|
match=1
|
|
match=1
|
|
;;
|
|
;;
|
|
"$line")
|
|
"$line")
|
|
- tmp="$tmp $unmatched"
|
|
|
|
- tmp="$tmp +$symbol:$i"
|
|
|
|
|
|
+ tmp="$tmp%$unmatched"
|
|
|
|
+ tmp="$tmp%+$symbol:$i"
|
|
match=1
|
|
match=1
|
|
;;
|
|
;;
|
|
*)
|
|
*)
|
|
- tmp="$tmp $i"
|
|
|
|
|
|
+ tmp="$tmp%$i"
|
|
;;
|
|
;;
|
|
esac
|
|
esac
|
|
done
|
|
done
|
|
|
|
|
|
|
|
+ # Restore the default separator for the outer for loop.
|
|
|
|
+ IFS=$save_IFS
|
|
|
|
+
|
|
if [ "$match" ]; then
|
|
if [ "$match" ]; then
|
|
output_lines="$tmp"
|
|
output_lines="$tmp"
|
|
unmatched=
|
|
unmatched=
|
|
else
|
|
else
|
|
- unmatched="$unmatched $symbol:$line"
|
|
|
|
|
|
+ unmatched="$unmatched%$symbol:$line"
|
|
fi
|
|
fi
|
|
done < defconfig
|
|
done < defconfig
|
|
done
|
|
done
|
|
|
|
|
|
rm -f defconfig
|
|
rm -f defconfig
|
|
touch defconfig
|
|
touch defconfig
|
|
|
|
+
|
|
|
|
+ save_IFS=$IFS
|
|
|
|
+ IFS=%
|
|
|
|
+
|
|
for line in $output_lines
|
|
for line in $output_lines
|
|
do
|
|
do
|
|
- echo $line >> defconfig
|
|
|
|
|
|
+ case "$line" in
|
|
|
|
+ "")
|
|
|
|
+ # do not output blank lines
|
|
|
|
+ ;;
|
|
|
|
+ *)
|
|
|
|
+ echo $line >> defconfig
|
|
|
|
+ ;;
|
|
|
|
+ esac
|
|
done
|
|
done
|
|
|
|
+
|
|
|
|
+ IFS=$save_IFS
|
|
}
|
|
}
|
|
|
|
|
|
# Usage:
|
|
# Usage:
|