summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1996-06-19 11:20:07 +0000
committerdg <dg@FreeBSD.org>1996-06-19 11:20:07 +0000
commit707c90b7b6748fd4ef06a7ee1f78806ae3ea30c8 (patch)
tree6b63469f36a81e92a3dd71afd468778cfc08bdda /usr.bin/sed
parent30b42b6dfff6513bc654b0bc6f1388eda0d8ea77 (diff)
downloadFreeBSD-src-707c90b7b6748fd4ef06a7ee1f78806ae3ea30c8.zip
FreeBSD-src-707c90b7b6748fd4ef06a7ee1f78806ae3ea30c8.tar.gz
Fix from Keith Bostic <bostic@bsdi.com> for bug in sed dealing with
continuation lines. Submitted by: Keith Bostic via Kirk McKusick
Diffstat (limited to 'usr.bin/sed')
-rw-r--r--usr.bin/sed/compile.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c
index 9f13fd7..b793d08 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, size;
+ int asize, esc_nl, size;
char *text, *p, *op, *s;
char lbuf[_POSIX2_LINE_MAX + 1];
@@ -626,13 +626,15 @@ compile_text()
op = s = text + size;
p = lbuf;
EATSPACE();
- for (; *p; p++) {
- if (*p == '\\')
- p++;
+ for (esc_nl = 0; *p != '\0'; p++) {
+ if (*p == '\\' && *p++ == '\0') {
+ esc_nl = 1;
+ break;
+ }
*s++ = *p;
}
size += s - op;
- if (p[-2] != '\\') {
+ if (!esc_nl) {
*s = '\0';
break;
}
OpenPOWER on IntegriCloud