]> git.draconx.ca Git - dxcommon.git/commit
gen-options.awk: Fix generated help text under mawk.
authorNick Bowler <nbowler@draconx.ca>
Sun, 8 Jan 2023 04:14:56 +0000 (23:14 -0500)
committerNick Bowler <nbowler@draconx.ca>
Sun, 8 Jan 2023 05:01:02 +0000 (00:01 -0500)
commite5d13e101de909b69a33cfe26e243148df8cbf51
tree48a94af3da3d4e7f6fae1ca1f00b492ea76cede6
parent62bc7469bf3ef88c4f81ddf615aa7dabe9ddbf74
gen-options.awk: Fix generated help text under mawk.

It appears that the following construction is not portable:

  % gawk 'BEGIN { a[0] = 0 in a ? 54 : 42; print a[0]; }'
  42

  % mawk 'BEGIN { a[0] = 0 in a ? 54 : 42; print a[0]; }'
  54

In gen-options.awk, this results in results in bogus leading newlines
added to the help text.  It is easy enough to restructure the code
to not do that, separating the test from the assignment.
scripts/gen-options.awk