From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <1e125a22d6fc2fbc134994ca1d1b76c2@coraid.com> From: erik quanstrom Date: Wed, 6 Feb 2008 04:57:33 -0500 To: 9fans@cse.psu.edu Subject: Re: [9fans] Unescaped "From" in mail items In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 48ba1df4-ead3-11e9-9d60-3106f5b1d025 > Acme mail now reports multiple messages in the destination folders such > as: > > 111/ $199 > 110/ $349 > 109/ Apple Tue 19 Jun 2007 > iPod Gift Wrapping is now available. > > upas/nedmail reports that the folder has 0 items in it, Acme mail that > it has 136 items. > > Were the messages on the original server invalid before I started, is > acme mail handling them incorrectly when saving, or does upas/fs not > interpret them correctly after they've been saved locally? this depends on your perspective. upas says that's invalid. this is what i use to solve the problem by editing the mail. (sed converts to runes -- that's why it is avoided.) - erik ; cat qfrom.c /* * quote from lines without messing with character encoding. * (might rather just undo the character encoding and use sed.) */ #include #include #include void qfrom(int fd) { Biobuf b, bo; char *s; int l; if(Binit(&b, fd, OREAD) == -1) sysfatal("Binit: %r"); if(Binit(&bo, 1, OWRITE) == -1) sysfatal("Binit: %r"); while(s = Brdstr(&b, '\n', 0)){ l = Blinelen(&b); if(l >= 5) if(memcmp(s, "From ", 5) == 0) Bputc(&bo, ' '); Bwrite(&bo, s, l); free(s); } Bterm(&b); Bterm(&bo); } void usage(void) { fprint(2, "usage: qfrom [files...]\n"); exits(""); } void main(int argc, char **argv) { int fd; ARGBEGIN{ default: usage(); }ARGEND if(*argv == 0){ qfrom(0); exits(""); } for(; *argv; argv++){ fd = open(*argv, OREAD); if(fd == -1) sysfatal("open: %r"); qfrom(fd); close(fd); } exits(""); }