From 10ed969f06ed906bd5429f2b520f93b293a3ae8e Mon Sep 17 00:00:00 2001 From: Duncaen Date: Thu, 16 Feb 2017 16:32:51 +0100 Subject: magrep: match body line by line if -p is specified without -c, -v and -o --- magrep.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'magrep.c') diff --git a/magrep.c b/magrep.c index cd7784a..e6e53cc 100644 --- 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 */ } -- cgit 1.4.1