diff options
author | Justin Davis <jrcd83@gmail.com> | 2011-09-01 22:33:54 +0200 |
---|---|---|
committer | Justin Davis <jrcd83@gmail.com> | 2011-09-01 22:33:54 +0200 |
commit | 1ec36ebc97a6c546d1ef0acc545d4636d36b89a1 (patch) | |
tree | f6757c70043d10fcbf2d9427c5836c996ecd0f3b /bin | |
parent | 2d34f8b70b39e985d562e8e08c9a7cc5bd732f8a (diff) | |
download | genpkg-1ec36ebc97a6c546d1ef0acc545d4636d36b89a1.tar.gz genpkg-1ec36ebc97a6c546d1ef0acc545d4636d36b89a1.tar.xz |
Ignore whitespace and add better error reporting for bad input.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/pbjparse.awk | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/bin/pbjparse.awk b/bin/pbjparse.awk index 8ba5372..be75811 100755 --- a/bin/pbjparse.awk +++ b/bin/pbjparse.awk @@ -83,15 +83,13 @@ function parsepbj ( cmd) # cmd is a "local" var tcmd = joinfields(2) templates[++templcount] = tcmd } - else if ($1 == "") ; # ignore blank lines - else { - print "ignoring line " FNR ": " $0 | "cat 1>&2" - } + else if ($1 ~ /^[ \t]*$/) ; # ignore lines of whitespace + else die("invalid input: " $0) } function die (msg) { - printf "%s:%s.%d:%s\n", PROG, FILENAME, FNR, msg | "cat 1>&2" + printf "%s: error: %s:%d %s\n", PROG, FILENAME, FNR, msg | "cat 1>&2" exit 1 } |