Ver código fonte

Fix expansion of several macros per line

Alois Mahdal 6 anos atrás
pai
commit
18675a9c97
1 arquivos alterados com 9 adições e 5 exclusões
  1. 9
    5
      src/include/build.sh

+ 9
- 5
src/include/build.sh Ver arquivo

@@ -47,15 +47,19 @@ __expand_line() {
47 47
     local line=$1   # line to process
48 48
     local mname     # macro name
49 49
     local mvline    # line of macro value
50
+    local xline     # expanded line
51
+    xline=$line
50 52
     for mname in "${!MacroMap[@]}"; do
51 53
         if ! test "${line//$mname}" == "$line"; then
52
-            while IFS= read -r mvline; do
53
-                echo "${line//$mname/$mvline}"
54
-            done <<<"${MacroMap[$mname]}"
55
-            return 0
54
+            xline=$(
55
+                while IFS= read -r mvline; do
56
+                    echo "${line//$mname/$mvline}"
57
+                done <<<"${MacroMap[$mname]}"
58
+            )
56 59
         fi
60
+        line=$xline
57 61
     done
58
-    echo "$line"
62
+    echo "$xline"
59 63
     return 1
60 64
 }
61 65