Skip to content

Commit

Permalink
Revamp @define #140 : fix for busybox awk
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Sep 18, 2023
1 parent 1955c83 commit 197a437
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions dbg.awk
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
function dbgA(name, arr, i,v) { print "--- " name ": "; for (i in arr) { v = arr[i];gsub(SUBSEP,",",i);printf "%6s : %s\n", i, v }}
function dbgAO(name, arr, i) { print "--- " name ": "; for (i = 0; i in arr; i++) printf "%2s : %s\n", i, arr[i] }
function dbgLine( i) { print "--- NR=" NR; for (i=1; i<=NF; i++) printf "%2s : %s\n", i, $i }
function indent(ind) {
printf "%" ind * 2 "s", ""
}
Expand Down
14 changes: 7 additions & 7 deletions makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ function parseCli_2(line, vars, res, pos,c,c1,isDoll,q,var,inDef,defVal,val,w,
# print "var="var
if (var !~ /^[_A-Za-z][_A-Za-z0-9]*$/)
return "wrong var: '" var "'"
w = w ((val = vars[var]) != "" ? val : defVal)
w = (w) ((val = vars[var]) != "" ? val : defVal)
continue
}
w = w c
Expand Down Expand Up @@ -891,13 +891,13 @@ function reparseCli( res,i,err) {
if (err) {
addError("Syntax error: " err)
return -1
} else {
$0 = "" # only for macos 10.15 awk version 20070501
for (i = NF = 0; i in res; i++) {
$(++NF) = res[i]
Quotes[NF] = res[i,"quote"]
}
}
$0 = "" # only for macos 10.15 awk version 20070501
for (i = NF = 0; i in res; i++) {
$(++NF) = res[i]
Quotes[NF] = res[i,"quote"]
}
return 0
}
function quote2(s,force) {
if (index(s,"'")) {
Expand Down

0 comments on commit 197a437

Please sign in to comment.