mboxrd-read
mboxrd-parse
mboxrd-parse/  port
6.2.901.900

mboxrd-read

 (require mboxrd-read) package: mboxrd-read
This package parses mboxrd files, also known as "normal UNIX mbox files", into lazy lists of messages.

procedure

(mboxrd-parse path)  (stream/c (list/c bytes? bytes?))

  path : path?
given a path to an mbox file, return a stream of the messages in the file. Each file is represented as a list containing a byte-string representing the header and the promise of a byte-string representing the body. These byte-strings can be appended to obtain the original message except that every \n in the original is replaced by \r\n to match the RFC 2822 format.

procedure

(mboxrd-parse/port port)  (stream/c (list/c bytes? bytes?))

  port : input-port?
given an input port, return a lazy list of the messages in the port.

NB: this procedure assumes that it’s the only one reading the port. Bad stuff will happen if its not; it doesn’t leave the "From " of the next message on the stream.

EFFECT: reads from stream, closes it when peek-char returns #<eof>

Additionally, you can use the utilities (e.g. extract-field) in "net/head.ss" to process the header.

Let me know of any bugs.

John Clements