From 1ed524b2b0f76d43e66c68835ea8c647a0a8beab Mon Sep 17 00:00:00 2001 From: Steve Slaven Date: Tue, 31 Jan 2006 21:55:41 +0000 Subject: 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) 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; } -- cgit v0.10.2