aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-01-21 17:47:14 +0100
committerLeah Neukirchen <leah@vuxu.org>2017-01-21 17:47:14 +0100
commit1918eb7ba9e4f0e3e60c6ad961d2050b1d34d3ad (patch)
tree8207e298bc85500b918721393656477553822f61
parent55ded86ad5f87865b5bf5b4eded8a1730cea524c (diff)
downloadmblaze-1918eb7ba9e4f0e3e60c6ad961d2050b1d34d3ad.tar.gz
mhdr: print_addresses: first decode RFC2047, then parse address
-rw-r--r--mhdr.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/mhdr.c b/mhdr.c
index 25f5a89..fc295f2 100644
--- a/mhdr.c
+++ b/mhdr.c
@@ -61,21 +61,22 @@ void
print_addresses(char *s)
{
char *disp, *addr;
+ char sdec[4096];
+
+ if (dflag) {
+ blaze822_decode_rfc2047(sdec, s, sizeof sdec, "UTF-8");
+ sdec[sizeof sdec - 1] = 0;
+ s = sdec;
+ }
+
while ((s = blaze822_addr(s, &disp, &addr))) {
if (Hflag && (disp || addr))
printf("%s\t", curfile);
- if (disp && addr) {
- if (dflag) {
- char d[4096];
- blaze822_decode_rfc2047(d, disp, sizeof d,
- "UTF-8");
- printf("%s <%s>\n", d, addr);
- } else {
- printf("%s <%s>\n", disp, addr);
- }
- } else if (addr) {
+
+ if (disp && addr)
+ printf("%s <%s>\n", disp, addr);
+ else if (addr)
printf("%s\n", addr);
- }
}
}