redoconf: avoid sed -E in _objlist().

Turns out there's a less confusing way to do it using 'case' wildcards
instead.

Reported-by: Wayne Scott <wsc9tt@gmail.com>
This commit is contained in:
Avery Pennarun 2019-02-23 15:44:46 -05:00
commit ea6a7135f1

View file

@ -65,13 +65,18 @@ _pick_src() {
} }
_objlist() { _objlist() {
local suffix="$1" list="$2" base="${2##*/}" local suffix="$1" list="$2"
local base="${2##*/}"
local dir="${2%"$base"}" local dir="${2%"$base"}"
sed -Ee 's/\.(c|cc|cpp|cxx|C|c\+\+)$/'"$suffix/" <"$2" |
while read -r d; do while read -r d; do
[ "$d" = "${d#-}" ] || continue case $d in
echo "$dir$d" -*) ;;
done *.c|*.cc|*.cpp|*.cxx|*.C|*.c++)
echo "$dir${d%.*}$suffix"
;;
*) echo "$dir$d" ;;
esac
done <"$list"
} }
_flaglist() { _flaglist() {