Yet another fix for the line continuation bug in sed. Keith's patch
introduced a new bug. This fix appears to work correctly. Fixes PR#1350. Submitted by: mark@linus.demon.co.uk (Mark Valentine)
This commit is contained in:
parent
4b83b27fea
commit
4f58776644
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=16753
@ -615,7 +615,7 @@ compile_tr(p, transtab)
|
||||
static char *
|
||||
compile_text()
|
||||
{
|
||||
int asize, esc_nl, size;
|
||||
int asize, size;
|
||||
char *text, *p, *op, *s;
|
||||
char lbuf[_POSIX2_LINE_MAX + 1];
|
||||
|
||||
@ -626,15 +626,13 @@ compile_text()
|
||||
op = s = text + size;
|
||||
p = lbuf;
|
||||
EATSPACE();
|
||||
for (esc_nl = 0; *p != '\0'; p++) {
|
||||
if (*p == '\\' && *p++ == '\0') {
|
||||
esc_nl = 1;
|
||||
break;
|
||||
}
|
||||
for (; *p != '\0'; p++) {
|
||||
if (*p == '\\')
|
||||
*p++ = '\0';
|
||||
*s++ = *p;
|
||||
}
|
||||
size += s - op;
|
||||
if (!esc_nl) {
|
||||
if (p[-2] != '\0') {
|
||||
*s = '\0';
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user