[comp.unix.programmer] mbox format?

bagchi@eecs.umich.edu (Ranjan Bagchi) (06/25/91)

	Potential dumb question...  how is "mailbox format"
defined?  I've got a program that I'd like to dump data
this way, but I can't find a definition, and havn't been
able to fake it effectively yet.
 
	RTFM's welcome...but I"ve looked once already..
 
	-rj
--
--------------------------------------------------------------------------------
Ranjan Bagchi - asleep......  |    v,i,j,k,l,s,a[99];
bagchi@eecs.umich.edu         |    main()   {
-------------------------------       for(scanf("%d",&s);*a-s;v=a[j*=v]-a[i],k=i<s,j+=(v=j<s&&(!k&&!!printf(2+"\n\n%c"-(!l<<!j)," #Q"[l^v?(l^j)&1:2])&&++l||a[i]<s&&v&&v-i+j&&v+i-j))&&!(l%=s),v||(i==j?a[i+=k]=0:++a[i])>=s*k&&++a[--i]) ;
					}  /* Osovlanski and Nissenbaum */
--------------------------------------------------------------------------------

berg@physik.tu-muenchen.de (Stephen R. van den Berg) (06/28/91)

The most common mailbox format (sendmail, smail or compatible environment)
is defined as follows:

Every occurrence of the following "Regular Expression" marks the beginning
of a new mail message:
\n\nFrom +[^\t\n ]+ +[^\n\t]

Any mailbox file should start with a line conforming too:
From +[^\t\n ]+ +[^\n\t]

No, I did not find this in the manual, I just figured this out by trial
and error from the /usr/ucb/mail program included with SunOS.

Many programs erroneously allow *any* line starting with 'From ' to mark
the start of a message (not even checking if the preceding line was empty
either).
--
Sincerely,                                berg@messua.informatik.rwth-aachen.de
           Stephen R. van den Berg.       berg@physik.tu-muenchen.de

"My name is Psmith, the P is not pronounced."

mouse@thunder.mcrcim.mcgill.edu (der Mouse) (07/01/91)

In article <4426@rwthinf.UUCP>, berg@physik.tu-muenchen.de (Stephen R. van den Berg) writes:

> The most common mailbox format (sendmail, smail or compatible
> environment)

Sendmail does not know the mailbox format.  You can use sendmail
perfectly well with a local mailer that uses some other format; just
redefine whatever mailer is used by the rule(s) in S0 that do(es) local
delivery.  (Usually this mailer is called "local".)

> is defined as follows:

> Every occurrence of the following "Regular Expression" marks the
> beginning of a new mail message:
> \n\nFrom +[^\t\n ]+ +[^\n\t]

> Any mailbox file should start with a line conforming too:
> From +[^\t\n ]+ +[^\n\t]

> No, I did not find this in the manual, I just figured this out by
> trial and error from the /usr/ucb/mail program included with SunOS.

In that case, you are hardly justified in saying that's how it's
*defined*.  At best that may be what Sun chose to implement.

> Many programs erroneously allow *any* line starting with 'From ' to
> mark the start of a message (not even checking if the preceding line
> was empty either).

This is not necessarily erroneous; absent a real spec, that's as valid
a way to mark the start of a mail message as any other.  There are
probably UAs and local delivery agents in the world that *do* use that
(ie, something matching "^From ") as the marker for the beginning of a
message.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu