9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@coraid.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Unescaped "From" in mail items
Date: Wed,  6 Feb 2008 04:57:33 -0500	[thread overview]
Message-ID: <1e125a22d6fc2fbc134994ca1d1b76c2@coraid.com> (raw)
In-Reply-To: <kgrlk5yeiqg.fsf@w-cl28-g34-c.its.monash.edu.au>

> Acme mail now reports multiple messages in the destination folders such
> as:
>
> 111/	$199
> 110/	$349
> 109/	Apple <News@InsideApple.Apple.com>	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 <u.h>
#include <libc.h>
#include <bio.h>

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("");
}


  reply	other threads:[~2008-02-06  9:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-11  8:51 [9fans] 'From' in outgoing mail considered harmful Richard Miller
2008-02-06  5:50 ` [9fans] Unescaped "From" in mail items Adrian Tritschler
2008-02-06  9:57   ` erik quanstrom [this message]
2008-07-20  7:31   ` Russ Cox
2008-07-22  1:21     ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e125a22d6fc2fbc134994ca1d1b76c2@coraid.com \
    --to=quanstro@coraid.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).