aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-01-21 17:44:34 +0100
committerLeah Neukirchen <leah@vuxu.org>2017-01-21 17:44:34 +0100
commit55ded86ad5f87865b5bf5b4eded8a1730cea524c (patch)
tree89112e62eeb532b67acdb3bade7e0a2ed1b1af12
parentcf36745b0c46b1203778ddc40b537905ff3a5d03 (diff)
downloadmblaze-55ded86ad5f87865b5bf5b4eded8a1730cea524c.tar.gz
maddr: addr: first decode RFC2047, then parse address
-rw-r--r--maddr.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/maddr.c b/maddr.c
index cf6298f..b2dcc44 100644
--- a/maddr.c
+++ b/maddr.c
@@ -32,20 +32,19 @@ addr(char *file)
v = blaze822_chdr(msg, h);
if (v) {
char *disp, *addr;
+ char vdec[1024];
+ blaze822_decode_rfc2047(vdec, v, sizeof vdec - 1, "UTF-8");
+ vdec[sizeof vdec - 1] = 0;
+ v = vdec;
+
while ((v = blaze822_addr(v, &disp, &addr))) {
if (disp && addr && strcmp(disp, addr) == 0)
disp = 0;
if (disp && addr) {
- char dispdec[1024];
- blaze822_decode_rfc2047(dispdec, disp,
- sizeof dispdec - 1, "UTF-8");
- dispdec[sizeof dispdec - 1] = 0;
-
if (aflag)
printf("%s\n", addr);
else
- printf("%s <%s>\n",
- dispdec, addr);
+ printf("%s <%s>\n", disp, addr);
} else if (addr) {
printf("%s\n", addr);
}