DOT (filter)

From Mailutils
Jump to navigationJump to search

DOT is a Mailutils filter useful for POP3 and SMTP I/O. In encode mode, it "byte-stuffs" the input by outputting an additional '.' in front of any '.' appearing at the beginning of a line. Upon closing the filter in this mode, it outputs additional ".\n".

When decoding, the reverse is performed: additional dots are removed from beginning of lines. A single dot on a line by itself (i.e. the sequence "\n.\n") marks the end of the stream and causes the filter to return EOF.

Mailutils also provides a hairy version of this filter, called CRLFDOT, which combines its functionality with that of the CRLF filter, i.e. performs the CRLF/LF translation in addition to byte-stuffing.

The following object, declared in mailutils/filter.h describes the DOT filter:

extern mu_filter_record_t mu_dot_filter;

This filter does not take arguments.

The example below shows how to create a DOT filter instance in decode mode for reading:

  int rc;          /* Return code */
  mu_stream_t flt; /* Filter stream */
  mu_stream_t input; /* Input stream */
 
  initialize_input_stream (&input);
  rc = mu_filter_create (&flt, input, "dot", MU_FILTER_DECODE, MU_STREAM_READ);

See also