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.
This commit is contained in:
Roberto E. Vargas Caballero 2015-12-16 19:44:44 +01:00 committed by sin
parent a65e180e5e
commit 3e130cee66

4
ed.c
View File

@ -890,6 +890,10 @@ getrhs(int delim)
s = NULL; s = NULL;
siz = cap = 0; siz = cap = 0;
while ((c = input()) != '\n' && c != EOF && c != delim) { 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(c, s, &siz, &cap);
} }
s = addchar('\0', s, &siz, &cap); s = addchar('\0', s, &siz, &cap);