aboutsummaryrefslogtreecommitdiffstats
path: root/doc/gawk.texi
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2011-07-28 22:12:48 +0300
committerArnold D. Robbins <arnold@skeeve.com>2011-07-28 22:12:48 +0300
commit16de770359370224129f23df745178efe518c02c (patch)
tree478fec9f11a3db6bc760ff82ce66230edc7d273c /doc/gawk.texi
parent75649aeb8a920d7b7b8c9a4197bbe1255981f66b (diff)
downloadegawk-16de770359370224129f23df745178efe518c02c.tar.gz
egawk-16de770359370224129f23df745178efe518c02c.tar.bz2
egawk-16de770359370224129f23df745178efe518c02c.zip
Revert sub/gsub behavior to that of gawk 3.x.
Diffstat (limited to 'doc/gawk.texi')
-rw-r--r--doc/gawk.texi17
1 files changed, 9 insertions, 8 deletions
diff --git a/doc/gawk.texi b/doc/gawk.texi
index b56cbbcf..2891c904 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -15023,8 +15023,6 @@ case of even numbers of backslashes entered at the lexical level.)
The problem with the historical approach is that there is no way to get
a literal @samp{\} followed by the matched text.
-@c We can omit this historical stuff now
-@ignore
@c @cindex @command{awk} language, POSIX version
@cindex POSIX @command{awk}, functions and, @code{gsub()}/@code{sub()}
The 1992 POSIX standard attempted to fix this problem. That standard
@@ -15158,7 +15156,6 @@ in the output literally.
The POSIX standard took much longer to be revised than was expected in 1996.
The 2001 standard does not follow the above rules. Instead, the rules
there are somewhat simpler. The results are similar except for one case.
-@end ignore
The POSIX rules state that @samp{\&} in the replacement string produces
a literal @samp{&}, @samp{\\} produces a literal @samp{\}, and @samp{\} followed
@@ -15209,17 +15206,21 @@ These rules are presented in @ref{table-posix-sub}.
@end ifnottex
@end float
-@ignore
The only case where the difference is noticeable is the last one: @samp{\\\\}
is seen as @samp{\\} and produces @samp{\} instead of @samp{\\}.
Starting with @value{PVERSION} 3.1.4, @command{gawk} followed the POSIX rules
when @option{--posix} is specified (@pxref{Options}). Otherwise,
it continued to follow the 1996 proposed rules, since
-that had been its behavior for many seven years.
-@end ignore
-
-@command{gawk} follows the POSIX rules.
+that had been its behavior for many years.
+
+When @value{PVERSION} 4.0.0, was released, the @command{gawk} maintainer
+made the POSIX rules the default, breaking well over a decade's worth
+of backwards compatibility.@footnote{This was rather naive of him, despite
+there being a note in this section indicating that the next major version
+would move to the POSIX rules.} Needless to say, this was a bad idea,
+and as of @value{PVERSION} 4.0.1, @command{gawk} resumed its historical
+behavior, and only follows the POSIX rules when @option{--posix} is given.
The rules for @code{gensub()} are considerably simpler. At the runtime
level, whenever @command{gawk} sees a @samp{\}, if the following character