ed

simple ed
git clone git://git.2f30.org/ed.git
Log | Files | Refs

commit 19b5ef27501528a6f1f9c5b9127ec41856afb7aa
parent 7796b6f7af5ae303f17d67ea073fc541c27f6da7
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun Dec 13 13:01:58 +0100

Fix getrhs()

When the rhs pattern finish in '\n' we have to back the
character to the input because it will be tested later in
chkprint(), but in the case of finishing in the delim character
we don't have to do it, or it will generate an error in
chkprint().

Diffstat:
ed.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/ed.c b/ed.c @@ -819,17 +819,20 @@ getrhs(int delim) siz = cap = 0; while ((c = input()) != '\n' && c != EOF && c != delim) { if (c == '\\') { - if (isdigit(c = input())) + if (isdigit(c = input())) { back(c); + c = '\\'; + } } s = addchar(c, s, &siz, &cap); } s = addchar('\0', s, &siz, &cap); if (c == EOF) error("invalid pattern delimiter"); - if (c == '\n') + if (c == '\n') { pflag = 'p'; - back(c); + back(c); + } if (!strcmp("%", s)) { free(s);