]> diplodocus.org Git - nmh/blobdiff - uip/mhoutsbr.c
Updated MACHINES and SPECS/nmh.spec to reflect packages
[nmh] / uip / mhoutsbr.c
index df23047e6282bc613ca286235c5a7cfc75a01617..88f610dd0f54279b332a168206432c1f41e45ead 100644 (file)
@@ -326,15 +326,15 @@ writeQuoted (CT ct, FILE *out)
 {
     int fd;
     char *cp, *file;
-    char c, buffer[BUFSIZ];
+    char c = '\0', buffer[BUFSIZ];
     CE ce = &ct->c_cefile;
+    int n = 0;
 
     file = NULL;
     if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK)
        return NOTOK;
 
     while (fgets (buffer, sizeof(buffer) - 1, ce->ce_fp)) {
-       int n;
 
        cp = buffer + strlen (buffer) - 1;
        if ((c = *cp) == '\n')
@@ -342,10 +342,9 @@ writeQuoted (CT ct, FILE *out)
 
        if (strncmp (cp = buffer, "From ", sizeof("From ") - 1) == 0) {
            fprintf (out, "=%02X", *cp++ & 0xff);
-           n = 3;
-       } else {
-           n = 0;
+           n += 3;
        }
+
        for (; *cp; cp++) {
            if (n > CPERLIN - 3) {
                fputs ("=\n", out);
@@ -379,11 +378,13 @@ three_print:
                fputs ("=\n", out);
 
            putc ('\n', out);
-       } else {
-           fputs ("=\n", out);
+           n = 0;
        }
     }
 
+    if (c != '\n')
+       putc ('\n', out);
+
     (*ct->c_ceclosefnx) (ct);
     return OK;
 }
@@ -404,7 +405,7 @@ writeBase64ct (CT ct, FILE *out)
     if ((fd = (*ct->c_ceopenfnx) (ct, &file)) == NOTOK)
        return NOTOK;
 
-    result = writeBase64aux (ce->ce_fp, out);
+    result = writeBase64aux (ce->ce_fp, out, (ct->c_type == CT_TEXT));
     (*ct->c_ceclosefnx) (ct);
     return result;
 }