[type/__dma] Convert AWK to loop over same file twice
This commit is contained in:
parent
0932c9ccde
commit
487574c865
2 changed files with 9 additions and 1 deletions
|
@ -88,6 +88,12 @@ BEGIN {
|
|||
FS = "\n"
|
||||
EQS = "[ \t]" # copied from dma/conf.c
|
||||
|
||||
if (ARGV[2]) exit (e=1)
|
||||
|
||||
# Loop over file twice!
|
||||
ARGV[2] = ARGV[1]
|
||||
ARGC++
|
||||
|
||||
# read the "should" state into the `conf` array.
|
||||
while (getline < "/dev/stdin") {
|
||||
word = first($0, EQS)
|
||||
|
@ -165,6 +171,8 @@ NR > FNR {
|
|||
}
|
||||
|
||||
END {
|
||||
if (e) exit
|
||||
|
||||
# print rest of config options (
|
||||
for (word in conf) print_confs(word)
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ then
|
|||
# at the end of the file.
|
||||
|
||||
cat <<-CODE
|
||||
awk $(drop_awk_comments "${__type:?}/files/update_dma_conf.awk") $(quote "${dma_conf}") $(quote "${dma_conf}") <<'EOF' >$(quote "${dma_conf}.tmp") \
|
||||
awk $(drop_awk_comments "${__type:?}/files/update_dma_conf.awk") $(quote "${dma_conf}") <<'EOF' >$(quote "${dma_conf}.tmp") \
|
||||
&& cat $(quote "${dma_conf}.tmp") >$(quote "${dma_conf}")
|
||||
${conf_should}
|
||||
EOF
|
||||
|
|
Loading…
Reference in a new issue