."\ Master source for mailsplit : /usr/src/local/man/src/mailsplit.rof
.TH mailsplit P "Manual V1.3 for Program V1.1" "Julian H. Stacey" "Julian H. Stacey, http://www.berklix.com"
.\" A4 the cludgy way.
.pl 29.6c
.UC 4
.SH NAME
mailsplit \- Split mail and news concatenations into separate files.
.SH SYNTAX
.B mailsplit
[-c cut_str] [-r] [-o] [-v] [-?] [-- or files]
.SH SUMMARY
Split mail and news archives into separate files
.SH DESCRIPTION
Designed to be used with 
.I mailname, (
see example below).
.SH OPTIONS
Parameters must precede file names.
Parameters may be in any order.
Parameters available include :-
.TP
.B \-?
.br
Print allowable syntax, then exit(0).
.TP
.B \-c cut_str
.br
Specify the string to initiate the cutting between output files,
if you do not want the default "^From ".
.br
Example: 
.ce
mailsplit -c ">From " walk.archive.1007
.TP
.B \-r
.br
Specify this if you want input file to be deleted.
Not to be used with -- option.
.TP
.B \--
.br
Take input from stdin pipe rather than files.
No files may be specified if this option is specified.
Not to be used with -r option.
.TP
.B \-o
.br
Overwrite pre-existing output files, if extant.
.TP
.B \-v
.br
Verbose mode.
.TP
.B \-?
.br
print allowable syntax, then exit(0).
.SH EXAMPLE
mkdir tmp_mail ; cd tmp_mail ; mailsplit mbox ; mailname *
.SH EXIT CODE
0 if no problems, else cumulative total of input files that could not be opened.
.SH BUGS
Fails on zero size input files.
.sp
Code needs a rewrite to extend split string from "From: " to "\\n\\nFrom: "
You get an undesired split if eg:
.in +2
.ti -2
- A mail contains the innocent text:
.br
From my experience
.br
.ti -2
- You set your inter article delimeter to
.ti +2
">From "
.br
and text such as
.ti +2
">From my experience, "
occurs in the middle of a collation, 
.ti -2
- Body of mail contains eg:
.in +2
.nf
------- Forwarded Message

From name@domain
.fi
.in -2
One could reduce the amount of false splits by both:
Checking if there was blank line before,
& also Checking if current line also contained an @,
but it would still not solve the problem, merely reduce the frequency of occurence.
.br 
There may be better treatment of this problem in tools
such as
.I
/usr/src/usr.bin/mail/head.c ishead() : Routines for processing and detecting headlines.
that handle Inbox format in /var/mail/*
.in -2
.\"
.SH HOST OP SYSTEM
This utility runs on Unix BSD 4.2 through to FreeBSD-13 2021.
.SH COPYRIGHT
Program & Document Copyright Julian H. Stacey, Munich, 10th April 1991 & 2013.
.so author.jhs
.SH SEE ALSO
mailname
.SH FILES
ms_pid_sequential
where pid is process identity number, & sequential increments from 0
upward.
So you are safe to not overlap output, running a /bin/sh for loop extracting from archives, eg:
.nf
#!/bin/sh
cd ~/mail/arc_pub.LN/list/walk
for i in /usr/backup/host/list/usr/local/majordomo.archives/walk.archive/*
	do
	mailsplit $i
	done
mailname *
mkdir x
mv *mailname_duplicate x/
cd x
mailname *
cmpd -d -v * ..
cd ..
mailname -N *
 ... sort with MH tools eg EXMH
.fi
.\ End of file
