From: Philipp Takacs Date: Wed, 21 Nov 2018 22:25:54 +0000 (+0100) Subject: pick implement rfc2047 X-Git-Tag: mmh-0.4~10^2~1 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=20597014bd0a3a6afa0244e5ee6531c59bc8fceb;p=mmh pick implement rfc2047 --- diff --git a/uip/pick.c b/uip/pick.c index 7f0d3a9..aba0c02 100644 --- a/uip/pick.c +++ b/uip/pick.c @@ -1088,7 +1088,7 @@ GREPaction(struct field *f, int msgnum, void *data) { struct grep_data *g = data; int ret; - char *buf; + char buf[BUFSIZ]; if (!g->header && *f->name) { return FALSE; @@ -1099,15 +1099,18 @@ GREPaction(struct field *f, int msgnum, void *data) return FALSE; } - ret = regexec(g->preg, f->value, 0, NULL, 0) == REG_NOMATCH; + if(decode_rfc2047(f->value, buf, sizeof(buf))) { + ret = regexec(g->preg, buf, 0, NULL, 0); + } else { + ret = regexec(g->preg, f->value, 0, NULL, 0); + } switch (ret) { case 0: return TRUE; case REG_NOMATCH: return FALSE; default: - buf = mh_xcalloc(BUFSIZ, sizeof(char)); - regerror(ret, g->preg, buf, BUFSIZ*sizeof(char)); + regerror(ret, g->preg, buf, sizeof(buf)); fprintf(stderr, "%s\n", buf); return FALSE; }