This is one that Russ suggested a while back. It changes the save behavior of acme mail so that ^From will be escaped with a space. This keeps readers of the mbox format from getting confused about message boundaries. Reference: /n/sources/patch/applied/acme_mail_save Date: Wed Apr 15 21:08:51 CES 2009 Signed-off-by: blstuart@bellsouth.net --- /acme/mail/src/dat.h Wed Apr 15 21:06:38 2009 +++ /acme/mail/src/dat.h Wed Apr 15 21:06:35 2009 @@ -118,6 +118,7 @@ extern void mkreply(Message*, char*, char*, Plumbattr*, char*); extern void delreply(Message*); +extern int write2(int, int, char*, int, int); extern int mesgadd(Message*, char*, Dir*, char*); extern void mesgmenu(Window*, Message*); --- /acme/mail/src/mesg.c Wed Apr 15 21:07:21 2009 +++ /acme/mail/src/mesg.c Wed Apr 15 21:07:16 2009 @@ -571,12 +571,10 @@ } free(t); - all = emalloc(n+k+1); - memmove(all, unixheader, k); - memmove(all+k, raw, n); - memmove(all+k+n, "\n", 1); - n = k+n+1; - free(unixheader); + all = emalloc(n+2); + memmove(all, raw, n); + memmove(all+n, "\n\0", 1); + n = n+1; free(raw); ret = 1; s = estrdup(s); @@ -586,10 +584,12 @@ if(ofd < 0){ fprint(2, "Mail: can't open %s: %r\n", s); ret = 0; - }else if(seek(ofd, 0LL, 2)<0 || write(ofd, all, n)!=n){ + }else if(seek(ofd, 0LL, 2)<0 || write(ofd, unixheader, k)!=k + || write2(-1, ofd, all, n, 1)= 0) + m = write(fd, buf, n); if(ofd <= 0) - return; + return m; - if(nofrom == 0){ - write(ofd, buf, n); - return; - } + if(nofrom == 0) + return write(ofd, buf, n); /* need to escape leading From lines to avoid corrupting 'outgoing' mailbox */ for(p=buf; *p; p+=m){ @@ -374,6 +373,7 @@ } n -= m; } + return p-buf; } void