commit 3e130cee6698c3c3f95468a7b8a4e782ea474338
Author: Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Wed Dec 16 19:44:44 2015 +0100
Commit: sin <[email protected]>
CommitDate: Wed Dec 16 20:16:12 2015 +0000
Escape correctly characters in getrhs()
getrhs() must remove \ excepts in the case of & and \d
(where d is a digit), because in this case are sequences
understood by addsub(), so addsub() must be able to see
them.
diff --git a/ed.c b/ed.c
index 9a80eb9..33b4837 100644
--- a/ed.c
+++ b/ed.c
@@ -890,6 +890,10 @@ getrhs(int delim)
s = NULL;
siz = cap = 0;
while ((c = input()) != '\n' && c != EOF && c != delim) {
+ if (c == '\\') {
+ if ((c = input()) == '&' || isdigit(c))
+ s = addchar(c, s, &siz, &cap);
+ }
s = addchar(c, s, &siz, &cap);
}
s = addchar('\0', s, &siz, &cap);