commit 2a36fc258f74e6abf5462a83bbf1d13d99ed0a1f
parent 5681496a7e2f68031875586154f941ff8aed6e11
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 29 Nov 2015 21:43:57 +0100
Avoid insert '\n' in RE
Ed only accept line oriented regular expressions,
so we have to avoid situations like '?\n' or '/\n',
which only means repeat the last backward or forward
search.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ed.c b/ed.c
@@ -246,7 +246,7 @@ compile()
size_t len;
for (delim = *cmdp++, bp = cmdp; *cmdp; ++cmdp) {
- if ((c = *cmdp) == delim)
+ if ((c = *cmdp) == delim || c == '\n')
break;
else if (c == '\\' && *++cmdp == '\0')
break;