replace the sed script from pipeto.lib so that wierd character sets aren't mistakenly trashed. russ did all the hard work in identifying the problem. (though i think that just converting the email to utf-8 as it comes in the door might be simplier.) Notes: Thu Oct 18 17:35:03 EDT 2007 geoff upas/deliver does the job (and a little more: logging). we don't want another copy of this logic; there are too many in upas already. Reference: /n/sources/patch/sorry/qfrom Date: Thu Oct 18 22:57:17 CES 2007 Signed-off-by: quanstro@quanstro.net Reviewed-by: geoff --- /sys/src/cmd/upas/qfrom/mkfile Thu Jan 1 00:00:00 1970 +++ /sys/src/cmd/upas/qfrom/mkfile Thu Oct 18 22:54:32 2007 @@ -0,0 +1,13 @@ + +#include +#include + +void +qfrom(int fd) +{ + int l; + char *s; + Biobuf b, bo; + + if(Binit(&b, fd, OREAD) == -1 || + Binit(&bo, 1, OWRITE) == -1) + sysfatal("Binit: %r"); + + while(s = Brdstr(&b, '\n', 0)){ + l = Blinelen(&b); + if(l >= 5 && 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("usage"); +} + +void +main(int argc, char **argv) +{ + int fd; + + ARGBEGIN{ + default: + usage(); + }ARGEND + + if(*argv == 0){ + qfrom(0); + exits(nil); + } + for(; *argv; argv++){ + fd = open(*argv, OREAD); + if(fd < 0) + sysfatal("open: %r"); + qfrom(fd); + close(fd); + } + exits(nil); +}