mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit 10ed969f06ed906bd5429f2b520f93b293a3ae8e
parent 11e62a17c55c2199a3925c4ea19e9a96c383b7c8
Author: Duncaen <mail@duncano.de>
Date:   Thu, 16 Feb 2017 16:32:51 +0100

magrep: match body line by line if -p is specified without -c, -v and -o

Diffstat:
magrep.c | 14++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/magrep.c b/magrep.c @@ -84,9 +84,19 @@ match_part(int depth, struct message *msg, char *body, size_t bodylen) strcasecmp(charset, "utf-8") == 0 || strcasecmp(charset, "utf8") == 0 || strcasecmp(charset, "us-ascii") == 0) { - (void) bodylen; /* XXX */ - if (match(curfile, "/", body)) + if (pflag && !cflag && !oflag && !vflag) { + char *s, *p; + for (p = s = body; p < body+bodylen+1; p++) { + if (*p == '\r' || *p == '\n') { + *p = 0; + if (p-s > 1 && match(curfile, "/", s)) + r = MIME_STOP; + s = p+1; + } + } + } else if (match(curfile, "/", body)) { r = MIME_STOP; + } } else { /* XXX decode here */ }