mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit 1918eb7ba9e4f0e3e60c6ad961d2050b1d34d3ad
parent 55ded86ad5f87865b5bf5b4eded8a1730cea524c
Author: Leah Neukirchen <leah@vuxu.org>
Date:   Sat, 21 Jan 2017 17:47:14 +0100

mhdr: print_addresses: first decode RFC2047, then parse address

Diffstat:
mhdr.c | 23++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git 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); - } } }