X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fmhoutsbr.c;h=2915afe34bc9c4b1ad4f3af09732e22018b79be4;hb=HEAD;hp=21c2e26318b68f5d5011bcc73f29f2d6a3188ff3;hpb=55eda7c77fdf33b0a7175968471df55e2600379c;p=mmh diff --git a/uip/mhoutsbr.c b/uip/mhoutsbr.c index 21c2e26..2915afe 100644 --- a/uip/mhoutsbr.c +++ b/uip/mhoutsbr.c @@ -161,12 +161,15 @@ static void output_headers(CT ct, FILE *out) { HF hp; + charstring_t body = charstring_create(0); hp = ct->c_first_hf; while (hp) { - fprintf(out, "%s:%s", hp->name, hp->value); + fold(body, strlen(hp->name), hp->value); + fprintf(out, "%s:%s", hp->name, charstring_buffer(body)); hp = hp->next; } + charstring_free(body); } @@ -228,7 +231,7 @@ writeQuoted(CT ct, FILE *out) n = 0; } for (; *cp; cp++) { - if (n > CPERLIN - 3) { + if (n + 1 >= CPERLIN) { fputs("=\n", out); n = 0; } @@ -241,8 +244,16 @@ writeQuoted(CT ct, FILE *out) break; default: - if (*cp < '!' || *cp > '~') + if (*cp < '!' || *cp > '~') { goto three_print; + } + if (n == 0 && *cp == '.') { + /* + ** encode dot at start of line, + ** because it could be alone ... + */ + goto three_print; + } putc(*cp, out); n++; break;