Difference between revisions of "DOT (filter)"

From Mailutils
Jump to navigationJump to search
m
 
Line 7: Line 7:
 
The following object, declared in <tt>mailutils/filter.h</tt> describes the ''DOT'' filter:
 
The following object, declared in <tt>mailutils/filter.h</tt> describes the ''DOT'' filter:
  
<source lang="C">
+
<syntaxhighlight lang="C">
 
extern mu_filter_record_t mu_dot_filter;
 
extern mu_filter_record_t mu_dot_filter;
</source>
+
</syntaxhighlight>
  
 
This filter does not take arguments.
 
This filter does not take arguments.
Line 15: Line 15:
 
The example below shows how to create a ''DOT'' filter instance in decode mode for reading:
 
The example below shows how to create a ''DOT'' filter instance in decode mode for reading:
  
<source lang="C">
+
<syntaxhighlight lang="C">
 
   int rc;          /* Return code */
 
   int rc;          /* Return code */
 
   mu_stream_t flt; /* Filter stream */
 
   mu_stream_t flt; /* Filter stream */
Line 22: Line 22:
 
   initialize_input_stream (&input);
 
   initialize_input_stream (&input);
 
   rc = mu_filter_create (&flt, input, "dot", MU_FILTER_DECODE, MU_STREAM_READ);
 
   rc = mu_filter_create (&flt, input, "dot", MU_FILTER_DECODE, MU_STREAM_READ);
</source>
+
</syntaxhighlight>
  
 
== See also ==
 
== See also ==

Latest revision as of 13:22, 16 October 2023

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