Improve "depends" awk statement

We can save a set of braces by using "continue". Also removed a spurious
variable assignment.
This commit is contained in:
Steven Penny 2014-05-20 22:51:36 -05:00
parent a1cf729b51
commit d124c46078
1 changed files with 7 additions and 9 deletions

16
apt-cyg
View File

@ -285,19 +285,17 @@ case "$command" in
END {
p[1] = query
d[query] = 0
i = 1
while (length(p)) {
key = p[length(p)]
depth = d[key]
delete p[length(p)]
if (!s[key]++) {
printf "%*s%s\n", depth, "", key
split(a[key], r)
delete r[1]
for (req in r) {
p[length(p) + 1] = r[req]
d[r[req]] = depth + 1
}
if (s[key]++) continue
printf "%*s%s\n", depth, "", key
split(a[key], r)
delete r[1]
for (req in r) {
p[length(p) + 1] = r[req]
d[r[req]] = depth + 1
}
}
}