mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-15 03:02:07 +03:00
f553eee842
Merge in DNS/adguard-home from newline-lint to master Squashed commit of the following: commit 2fc0b662b9ac9d954275c5ebe8c140be4cd365be Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Apr 6 14:16:14 2023 +0300 client: rm line commit 10246727179a84094edd17fad5cd6f0a5c38b821 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Apr 6 13:51:06 2023 +0300 all: add newline lint
23 lines
441 B
Awk
23 lines
441 B
Awk
/^[^[:space:]]/ { is_dns = /^dns:/ }
|
|
|
|
/^[[:space:]]+bind_hosts:/ { if (is_dns) prev_line = FNR }
|
|
|
|
/^[[:space:]]+- .+/ {
|
|
if (FNR - prev_line == 1) {
|
|
addrs[addrsnum++] = $2
|
|
prev_line = FNR
|
|
}
|
|
}
|
|
|
|
/^[[:space:]]+port:/ { if (is_dns) port = $2 }
|
|
|
|
END {
|
|
for (i in addrs) {
|
|
if (match(addrs[i], ":")) {
|
|
print "[" addrs[i] "]:" port
|
|
} else {
|
|
print addrs[i] ":" port
|
|
}
|
|
}
|
|
}
|