diff options
author | Justin Davis <jrcd83@gmail.com> | 2011-09-01 23:08:45 +0200 |
---|---|---|
committer | Justin Davis <jrcd83@gmail.com> | 2011-09-01 23:08:45 +0200 |
commit | a5a5ec54ecfd359c810942a53436d0fbb364ab3d (patch) | |
tree | 3867365b77cfb8649aba17ce497b00c2b4b86c42 /bin | |
parent | c22f17f056a416af601f260f488fe150d44f24d2 (diff) | |
download | genpkg-a5a5ec54ecfd359c810942a53436d0fbb364ab3d.tar.gz genpkg-a5a5ec54ecfd359c810942a53436d0fbb364ab3d.tar.xz |
Create a separate pbcount array to hold the number of field values.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/pbjparse.awk | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/bin/pbjparse.awk b/bin/pbjparse.awk index be75811..88e6cc7 100755 --- a/bin/pbjparse.awk +++ b/bin/pbjparse.awk @@ -17,16 +17,13 @@ END { for (i=2; i<=templcount; i++) tcmd = tcmd "|" templates[i] } else tcmd = "cat" - - for (dblkey in pbvars) { - split(dblkey, keys, SUBSEP) - if (keys[2] != "len") continue - name = keys[1] - len = pbvars[dblkey] + for (name in pbcount) { + len = pbcount[name] + if (len == 0) continue print name | tcmd - for (i=1; i<=len; i++) print pbvars[name,i] | tcmd + for (i=1; i<=len; i++) print pbvars[name, i] | tcmd print "" | tcmd } @@ -102,18 +99,18 @@ function joinfields (start, msg) function remall (field) { - pbvars[field, "len"] = 0 + pbcount[field] = 0 } function pushval (field, val) { if (field == "packager") seenpkgr = 1 - pbvars[$2, ++pbvars[field, "len"]] = val + pbvars[field, ++pbcount[field]] = val } -function remval (field, prefix) +function remval (field, prefix, i, len) { - len = pbvars[field, "len"] + len = pbcount[field] if (len == 0) return 0 for (i=1; i<=len; i++) @@ -121,9 +118,9 @@ function remval (field, prefix) if (i > len) return 0 - while (i < len) { pbvars[field, i] = pbvars[field, i+1]; i++ } + for ( ; i < len; i++) pbvars[field, i] = pbvars[field, i+1] delete pbvars[field, i] - pbvars[field, "len"]-- + pbcount[field]-- return 1 } |