Interfacing with "mr" engine.

There are three main functions of the engine:

1. spit out header lines in various formats, for use in selecting
	messages. Headers can be sorted by date, sender, subject,
	or number of hits.
2. search within messages for strings (and print out number of
	hits found in each message)
3. print the text of a selected message.

There is no facility for modifying the mail file or sending mail.

- Prompt is ": " by default. If your program needs a return after
	the prompt character, send the command ":" to start,
	which toggles the newline.
- Unknown command prints "?\n" followed by a prompt.

Command structure is somewhat rigid because it is expected that
mr will be communicating with a program, not a user.

After printing a message, the string "----- END DNE -----\n"
is printed. Programs should watch for this rather than the prompt
to recognize the end of message, because a message could contain ":\n".
(This string is EOM_STRING defined in mr.h)

Some commands (as of this writing):

?		print list of all commands.
h               show headers with sequence numbers
hb              show briefest headers (seq & hdr summary)
hh              show headers with number of hits
hv              list headers with verbose (all) info
hH		list only # hits
hD		list only date (numeric)
H string        custom header order
/string 	search all messages for 'string'*
s               sort by sequence number*
ss              sort by subject*
sd              sort by date*
sh              sort by hits*
sa              sort by addr of sender*
p msg           prints msg by number
P msg           prints msg with all headers
n		print number of messages
x               exit

[ * no output from this command ]


CHOOSING MAIL FILES
-------------------

The "l filename" command loads a single file and removes all others.
The "a filename" command adds a new file to the buffer. No checking
is made for duplication. "f" lists first the number of loaded mail files
followed by one line containing each mail file name.


SEARCHING
---------

searching sets the 'hits' counter for each item to the number
of times the given string exists in the document. / is case sensitive
and matches substrings. additional search commands will be available
to do case-insensitive substring matches and "full word" matches.
No more flexible searching (regexp) is planned.

SORTING
-------

There is an internal order of items. It is initially the
order of the messages in the mailbox, and can change by sorting.
Headers are always printed in internal order. A "sequence" number
is associated with each message which refers to its *original*
order. So the first message in the mail file is always "0",
even after sorting, but it will not necessarily be displayed
first in a header list.

You can sort by sequence number (original order), subject
(alphabetical, case insensitive, with original message before "Re:"),
receipt date (oldest first), or number of hits (most to least).

No reversing of those sorts is available.

Your frontend is welcome to sort them in any other way you want
of course (see next section on receiving headers).

HEADER PRINTING
---------------

There are not commands to print all possible combinations of
header items. I have picked what I think will be useful. Here
are examples.

("h" summary)
3   p00784@psilink.com   Tue Sep 21 21:20:23  Re: cron troubles

("hb" brief -- no sequence numbers)
p00784@psilink.com   Tue Sep 21 21:20:23  Re: cron troubles

("hh" hits)
3   0   p00784@psilink.com   Tue Sep 21 21:20:23  Re: cron troubles

("hH" hits only - in message order)
0

("hD" date only -- in message order)
748646423

("hv" verbose - seq, date, hits, hdr)
3   748646423 0   p00784@psilink.com   Tue Sep 21 21:20:23  Re: cron troubles

hb, hH, and hD are meant to save the work of parsing. After
a search you can do an hH to quickly list just the new hits
counters, for example.

Of course, if you want, you can always do 'hv' and parse the output.

I have also included limited "custom header" formatting using the H
command followed by a string. The string should contain one letter for
each item you want, in order: sequence number, hits, address of sender,
bytes in article, date, Subject, filename, Date (numeric format).

You can specify up to 8 values and repetition is allowed.

"L" can be used to select a single mail file to be included in the
output of subsequent header commands. "L" with no argument turns this
feature off.

PRINTING A MESSAGE
------------------

the p and P commands, followed by a sequence number, output
that message (including all headers for 'P'; a selected set
for 'p'.

A string representing the maximum number of characters to be output
(including newlines) will be the first line returned, so that
you can allocate whatever space is necessary. When printing
with selected headers, the actual number of characters returned
will be somewhat less.

The sequence number of the last message displayed is remembered
and a 'p' or 'P' with no number prints the previously displayed
message again (or message 0 if none have been displayed).

EXAMPLE
-------

I originally intended for this to have a Tk front end. My work
on this is in the 'client' directory.
