]> Pileus Git - ~andy/fetchmail/blobdiff - rfc822.c
Credit John Beck's fixes.
[~andy/fetchmail] / rfc822.c
index 6f2dbf30fdf9503c0647a3a2c44fb7507f8dd4a1..15b88f05ef476312af280de1d2ec7183ed4768db 100644 (file)
--- a/rfc822.c
+++ b/rfc822.c
@@ -19,12 +19,17 @@ is part of fetchmail and the Unix Cookbook, and are released under the
 MIT license.  Compile with -DMAIN to build the demonstrator.
 
 ******************************************************************************/
+
+#include "config.h"
+
 #include  <stdio.h>
 #include  <ctype.h>
 #include  <string.h>
+#include  <strings.h>
 #include  <stdlib.h>
 
 #include "fetchmail.h"
+#include "sdump.h"
 
 #ifndef MAIN
 #include "i18n.h"
@@ -74,9 +79,10 @@ char *reply_hack(
     }
 
 #ifndef MAIN
-    if (outlevel >= O_DEBUG)
-       report_build(stdout, GT_("About to rewrite %.*s...\n"),
-                       (int)BEFORE_EOL(buf), buf);
+    if (outlevel >= O_DEBUG) {
+       report_build(stdout, GT_("About to rewrite %s...\n"), (cp = sdump(buf, BEFORE_EOL(buf))));
+       xfree(cp);
+    }
 
     /* make room to hack the address; buf must be malloced */
     for (cp = buf; *cp; cp++)
@@ -211,9 +217,12 @@ char *reply_hack(
     }
 
 #ifndef MAIN
-    if (outlevel >= O_DEBUG)
-       report_complete(stdout, GT_("...rewritten version is %.*s.\n"),
-                       (int)BEFORE_EOL(buf), buf);
+    if (outlevel >= O_DEBUG) {
+       report_complete(stdout, GT_("...rewritten version is %s.\n"),
+                       (cp = sdump(buf, BEFORE_EOL(buf))));
+       xfree(cp)
+    }
+
 #endif /* MAIN */
     *length = strlen(buf);
     return(buf);
@@ -430,6 +439,8 @@ int main(int argc, char *argv[])
            break;
        }
 
+    longbuf[0] = '\0';
+
     while (fgets(buf, sizeof(buf)-1, stdin))
     {
        if (buf[0] == ' ' || buf[0] == '\t')