diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-06-14 21:18:36 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-06-14 21:18:36 +0300 |
commit | 6d5e4b7a4a8839d9406702ab30af62054078d3af (patch) | |
tree | 3a82a9f8318f093777454284a849512ff992bb5d /builtin.c | |
parent | e30696930a6335cee3cae0edad156bb4016ff993 (diff) | |
download | egawk-6d5e4b7a4a8839d9406702ab30af62054078d3af.tar.gz egawk-6d5e4b7a4a8839d9406702ab30af62054078d3af.tar.bz2 egawk-6d5e4b7a4a8839d9406702ab30af62054078d3af.zip |
Fix long runs of backslashes in sub/gsub.
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -2876,8 +2876,10 @@ set_how_many: leave alone, it goes into the output */ } else { /* gawk default behavior since 1996 */ - if (strncmp(scan, "\\\\\\&", 4) == 0) { + if (strncmp(scan, "\\\\\\&", 4) == 0 + || strncmp(scan, "\\\\\\\\", 4) == 0) { /* 2016: fixed */ /* \\\& --> \& */ + /* \\\\ --> \\ */ repllen -= 2; scan += 3; } else if (strncmp(scan, "\\\\&", 3) == 0) { @@ -2982,10 +2984,12 @@ set_how_many: *bp++ = *scan; } else { /* gawk default behavior since 1996 */ - if (strncmp(scan, "\\\\\\&", 4) == 0) { + if (strncmp(scan, "\\\\\\&", 4) == 0 + || strncmp(scan, "\\\\\\\\", 4) == 0) { /* 2016: fixed */ /* \\\& --> \& */ + /* \\\\ --> \\ */ *bp++ = '\\'; - *bp++ = '&'; + *bp++ = scan[3]; scan += 3; } else if (strncmp(scan, "\\\\&", 3) == 0) { /* \\& --> \<string> */ |