]> git.draconx.ca Git - dxcommon.git/commit
gen-options.awk: Work around busybox regex bug.
authorNick Bowler <nbowler@draconx.ca>
Sun, 8 Jan 2023 04:19:18 +0000 (23:19 -0500)
committerNick Bowler <nbowler@draconx.ca>
Sun, 8 Jan 2023 05:01:03 +0000 (00:01 -0500)
commit0a296c1808200072deea6285f3e9992fca6095dd
treef39ba4c5706c52adf19601c0e442b82ad6068463
parente5d13e101de909b69a33cfe26e243148df8cbf51
gen-options.awk: Work around busybox regex bug.

It appears that busybox awk does not recognize \] in a character class,
interpreting the backslash literally and taking the ] as the end of the
character class:

  % printf '%s\n' ']' '\]' | busybox awk '/^[\]]$/ { print; }'
  \]

  % printf '%s\n' ']' '\]' | gawk '/^[\]]$/ { print; }'
  ]

Busybox does accept []] as meaning "] is part of the character class",
but this syntax is not portable to heirloom (and presumably also Solaris
10) awk, which only works with [\]].  GNU awk accepts either form.

So instead, let's avoid this problematic construct entirely by writing
the test in a different way.
scripts/gen-options.awk