summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOğuz <oguzismailuysal@gmail.com>2022-10-23 09:51:37 -0700
committerJim Meyering <meyering@fb.com>2022-10-23 10:52:23 -0700
commitf5abeba48e4c93fc8df4c81e7ae2a61f469ed5e1 (patch)
tree065d02a623ed44f29e9609a8d82533e9c74b8a97
parentc9a1669bcbdaa73e4da3c5f03f94beaaaca95e99 (diff)
downloadsed-f5abeba48e4c93fc8df4c81e7ae2a61f469ed5e1.tar.gz
sed: handle the unspecified "n as delimiter alias" case more sensibly
Print the less-surprising variant in a corner case of POSIX-unspecified behavior. Before, this would print "n". Now, it prints "X": printf n | sed 'sn\nnXn'; echo * sed/compile.c (match_slash): Remove special handling of 'n'. Reported in https://bugs.gnu.org/40242
-rw-r--r--sed/compile.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/sed/compile.c b/sed/compile.c
index 1942f3b..f96fbca 100644
--- a/sed/compile.c
+++ b/sed/compile.c
@@ -557,8 +557,6 @@ match_slash (int slash, int regex)
ch = inchar ();
if (ch == EOF)
break;
- else if (ch == 'n' && regex)
- ch = '\n';
else if (ch != '\n' && (ch != slash || (!regex && ch == '&')))
add1_buffer (b, '\\');
}