[hackers] [sbase][PATCH v2] Fix pattern substitution

2016-01-07 Thread Roberto E. Vargas Caballero
Ed was falling doing substitution different of the first or all (s//%/, s//%/\1, s//%/g), because it was not adding the matches which were not going to be substituted. --- ed.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/ed.c b/ed.c index 77aad1

[hackers] [sbase][PATCH] Stop matching when lastmatch points to '\n'

2016-01-07 Thread Roberto E. Vargas Caballero
This situation happens with something like s/$/test/, where rm_so == rm_eo == 0. Without this check, ed keeps looping forever. --- ed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ed.c b/ed.c index 69c7422..9dc6fda 100644 --- a/ed.c +++ b/ed.c @@ -1007,7 +1007,7 @@ subline(