sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit 79adf5f3a3210587eb7097d14fe267fde830b3f1
parent 39b99b6b51c3daabb8fd3ca574fa45721c14b81f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed Dec 16 19:44:44 +0100

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.

Diffstat:
ed.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git 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);