summaryrefslogtreecommitdiff
path: root/smu.c
diff options
context:
space:
mode:
Diffstat (limited to 'smu.c')
-rw-r--r--smu.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/smu.c b/smu.c
index 641303a..30b57ea 100644
--- a/smu.c
+++ b/smu.c
@@ -449,10 +449,12 @@ dosurround(const char *begin, const char *end, int newblock) {
start = begin + l;
p = start - 1;
do {
+ stop = p;
p = strstr(p + 1, surround[i].search);
} while(p && p[-1] == '\\');
- if(!p || p >= end ||
- !(stop = strstr(start, surround[i].search)) || stop >= end)
+ if (p && p[-1] != '\\')
+ stop = p;
+ if(!stop || stop < start || stop >= end)
continue;
fputs(surround[i].before, stdout);
if(surround[i].process)