commit dfd6f87114f705e830ccc6bb621424840ef7b65c
parent c1d4dfe2d717b53419b21dc403472c034d5eac34
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 29 Nov 2015 22:25:01 +0100
Be even more careful with non finished RE
2a36fc2), was consuming
the \n in regular expressions, causing
that the default print command was not
executed.
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ed.c b/ed.c
@@ -245,10 +245,10 @@ compile()
char c, *bp, delim, buff[REGEXSIZE];
size_t len;
- for (delim = *cmdp++, bp = cmdp; *cmdp; ++cmdp) {
- if ((c = *cmdp) == delim || c == '\n')
- break;
- else if (c == '\\' && *++cmdp == '\0')
+ for (delim = *cmdp++, bp = cmdp; c = *cmdp; ++cmdp) {
+ if (c == '\n')
+ --cmdp;
+ if (c == '\n' || c == delim)
break;
}
if ((len = cmdp - bp) == 0) {