+
+void rfc3676_space_stuff (HEADER* hdr) {
+ FILE* in = NULL, *out = NULL;
+ char buf[LONG_STRING];
+ char tmpfile[_POSIX_PATH_MAX];
+
+ if (!hdr || !hdr->content || !hdr->content->filename)
+ return;
+
+ if ((in = safe_fopen (hdr->content->filename, "r")) == NULL)
+ return;
+ mutt_mktemp (tmpfile);
+ if ((out = safe_fopen (tmpfile, "w+")) == NULL) {
+ fclose (in);
+ return;
+ }
+
+ while (fgets (buf, sizeof (buf), in)) {
+ if (ascii_strncmp ("From ", buf, 4) == 0 || buf[0] == ' ') {
+ fputc (' ', out);
+ }
+ fputs (buf, out);
+ }
+ fclose (in);
+ fclose (out);
+ mutt_set_mtime (hdr->content->filename, tmpfile);
+ unlink (hdr->content->filename);
+ m_strreplace(&hdr->content->filename, tmpfile);
+}