]> git.draconx.ca Git - dxcommon.git/commit
gen-strtab.awk: Work around AIX substitution bug.
authorNick Bowler <nbowler@draconx.ca>
Mon, 1 Jan 2024 21:37:55 +0000 (16:37 -0500)
committerNick Bowler <nbowler@draconx.ca>
Mon, 1 Jan 2024 21:48:11 +0000 (16:48 -0500)
commit4a512788e60cda5b4bd5f3151cd2834c9b9f0b32
tree05ee5ed1820e73d77021efb4541aad77bf1c2ea0
parent99a96390b8c18144311c1679ab78461d9ecc7bd4
gen-strtab.awk: Work around AIX substitution bug.

On AIX 7.2 awk, the sub and gsub functions have a bug when the
replacement string contains a "\1" character.  The substituted
strings have \1 characters replaced with amperands, for example:

  aix72% awk 'BEGIN { s="x"; sub("x","\1",s); sub("\1","x",s); print s; }'
  &

Very strange.  The problem is internal to (g)sub, there is no
problem using "\1" characters in other contexts -- including
with the other arguments to (g)sub.  It should be fine to use
"\2" instead which avoids this particular bug.
scripts/gen-strtab.awk