=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sed/compile.c,v retrieving revision 1.18 retrieving revision 1.19 diff -c -r1.18 -r1.19 *** src/usr.bin/sed/compile.c 2004/06/13 17:11:17 1.18 --- src/usr.bin/sed/compile.c 2004/07/09 19:39:40 1.19 *************** *** 1,4 **** ! /* $OpenBSD: compile.c,v 1.18 2004/06/13 17:11:17 deraadt Exp $ */ /*- * Copyright (c) 1992 Diomidis Spinellis. --- 1,4 ---- ! /* $OpenBSD: compile.c,v 1.19 2004/07/09 19:39:40 otto Exp $ */ /*- * Copyright (c) 1992 Diomidis Spinellis. *************** *** 35,41 **** #ifndef lint /* from: static char sccsid[] = "@(#)compile.c 8.2 (Berkeley) 4/28/95"; */ ! static char *rcsid = "$OpenBSD: compile.c,v 1.18 2004/06/13 17:11:17 deraadt Exp $"; #endif /* not lint */ #include --- 35,41 ---- #ifndef lint /* from: static char sccsid[] = "@(#)compile.c 8.2 (Berkeley) 4/28/95"; */ ! static char *rcsid = "$OpenBSD: compile.c,v 1.19 2004/07/09 19:39:40 otto Exp $"; #endif /* not lint */ #include *************** *** 440,445 **** --- 440,446 ---- static char lbuf[_POSIX2_LINE_MAX + 1]; int asize, ref, size; char c, *text, *op, *sp; + int sawesc = 0; c = *p++; /* Terminator character */ if (c == '\0') *************** *** 453,461 **** do { op = sp = text + size; for (; *p; p++) { ! if (*p == '\\') { ! p++; ! if (strchr("123456789", *p) != NULL) { *sp++ = '\\'; ref = *p - '0'; if (s->re != NULL && --- 454,482 ---- do { op = sp = text + size; for (; *p; p++) { ! if (*p == '\\' || sawesc) { ! /* ! * If this is a continuation from the last ! * buffer, we won't have a character to ! * skip over. ! */ ! if (sawesc) ! sawesc = 0; ! else ! p++; ! ! if (*p == '\0') { ! /* ! * This escaped character is continued ! * in the next part of the line. Note ! * this fact, then cause the loop to ! * exit w/ normal EOL case and reenter ! * above with the new buffer. ! */ ! sawesc = 1; ! p--; ! continue; ! } else if (strchr("123456789", *p) != NULL) { *sp++ = '\\'; ref = *p - '0'; if (s->re != NULL &&