]> git.draconx.ca Git - dxcommon.git/commit
Rework backslash substitutions in awk scripts.
authorNick Bowler <nbowler@draconx.ca>
Sun, 3 Dec 2023 04:13:24 +0000 (23:13 -0500)
committerNick Bowler <nbowler@draconx.ca>
Sun, 3 Dec 2023 06:07:51 +0000 (01:07 -0500)
commit95d8e7745d9b00097d50d9903d62c48268324e7a
tree69261d5ec1fd7763ed5d768554ee907bf4fa1639
parent075a8578cc9467d07ccff7688bfd0f4855712e1c
Rework backslash substitutions in awk scripts.

It appears that even using plain "\\" in a replacement string for sub
and gsub is still problematic.  Most awks handle this OK (returning a
literal backslash) provided the next character is not a backslash, but
on ULTRIX 4.5 nawk eats the next character regardless and interprets
it as a backslash-escape sequence, oops.

So let's try something a bit different.  We can ask awk what it does
with "\\\\", and use either "\\\\" or "\\" depending on the answer.

Hopefully this actually works everywhere.
scripts/gen-options.awk
scripts/gen-strtab.awk
scripts/gen-tree.awk