commit b37011789a7487f9e89c5bfc3951a1b90c506418
parent 2cb6506991da516f7a9fda8f08d21379aaa56495
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 13 Dec 2015 21:57:11 +0100
Use REG_NEWLINE in regcomp
We have strings with '\n' at the end, but we don't include
the '\n' in REs linke /$/, so we have to use the REG_NEWLINE
of POSIX to cover these cases.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ed.c b/ed.c
@@ -371,7 +371,7 @@ compile(int delim)
regfree(pattern);
if (!pattern && (!(pattern = malloc(sizeof(*pattern)))))
error("out of memory");
- if ((ret = regcomp(pattern, lastre, 0))) {
+ if ((ret = regcomp(pattern, lastre, REG_NEWLINE))) {
regerror(ret, pattern, buf, sizeof(buf));
error(buf);
}