aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2006-01-31 21:55:41 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2006-01-31 21:55:41 (GMT)
commit1ed524b2b0f76d43e66c68835ea8c647a0a8beab (patch)
tree861fc45d09089887dc4c8cdb5067f563224cbda1
parentda398dd788268e57c19358540d45815a56f39091 (diff)
downloadpowwow-1ed524b2b0f76d43e66c68835ea8c647a0a8beab.zip
powwow-1ed524b2b0f76d43e66c68835ea8c647a0a8beab.tar.gz
powwow-1ed524b2b0f76d43e66c68835ea8c647a0a8beab.tar.bz2
1. Allows empty-line matching using regexp.
E.g.: gagging of all empty lines #action %empty ^$= 2. Fixes the bug in parameter copy for regexp actions. powwow did not set any matched regex params after finding an empty match (Elestir)
-rw-r--r--main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/main.c b/main.c
index a9d6fc7..ca4d2cf 100644
--- a/main.c
+++ b/main.c
@@ -811,7 +811,7 @@ static void process_singleline __P2 (char **,pbuf, int *,psize)
size = len;
}
}
- if (!len && (!*linestart || (!search_action(linestart, 0) || opt_autoprint))) {
+ if (!len && ((!search_action(linestart, 0) || opt_autoprint))) {
if (line0 < lines - 1)
line0++;
if (tcp_fd != tcp_main_fd) /* sub connection */
@@ -1104,7 +1104,8 @@ static int match_regexp_action __P4 (void *,regexp, char *,line, int *,match_s,
for (n = 1; n < NUMPARAM; n++)
match_s[n] = match_e[n] = 0;
for (n = 0; n <= (int)((regex_t *)regexp)->re_nsub &&
- reg_match[n].rm_so != -1 && n < NUMPARAM - 1; n++) {
+ n < NUMPARAM - 1; n++) {
+ if (reg_match[n].rm_so == -1) continue;
match_s[n+1] = reg_match[n].rm_so;
match_e[n+1] = reg_match[n].rm_eo;
}