summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1996-06-26 05:54:32 +0000
committerdg <dg@FreeBSD.org>1996-06-26 05:54:32 +0000
commitdb69ec261862eae7b94c6b89e4d7cf5170d42299 (patch)
tree56d8fcb536e158da59c7749832d4099648b2e806 /usr.bin/sed
parente2f426dc1b0fb18a48ef0de15a04f0588e32f27e (diff)
downloadFreeBSD-src-db69ec261862eae7b94c6b89e4d7cf5170d42299.zip
FreeBSD-src-db69ec261862eae7b94c6b89e4d7cf5170d42299.tar.gz
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)
Diffstat (limited to 'usr.bin/sed')
-rw-r--r--usr.bin/sed/compile.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c
index b793d08..7e11382 100644
--- a/usr.bin/sed/compile.c
+++ b/usr.bin/sed/compile.c
@@ -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;
}
OpenPOWER on IntegriCloud