From 20597014bd0a3a6afa0244e5ee6531c59bc8fceb Mon Sep 17 00:00:00 2001 From: Philipp Takacs Date: Wed, 21 Nov 2018 23:25:54 +0100 Subject: [PATCH] pick implement rfc2047 --- uip/pick.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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; } -- 1.7.10.4