Difference between revisions of "DOT (filter)"
m |
|||
(One intermediate revision by the same user not shown) | |||
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: | ||
− | < | + | <syntaxhighlight lang="C"> |
extern mu_filter_record_t mu_dot_filter; | extern mu_filter_record_t mu_dot_filter; | ||
− | </ | + | </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: | ||
− | < | + | <syntaxhighlight lang="C"> |
int rc; /* Return code */ | int rc; /* Return code */ | ||
mu_stream_t flt; /* Filter stream */ | mu_stream_t flt; /* Filter stream */ | ||
mu_stream_t input; /* Input stream */ | mu_stream_t input; /* Input stream */ | ||
− | initialize_input_stream (& | + | initialize_input_stream (&input); |
− | rc = | + | rc = mu_filter_create (&flt, input, "dot", MU_FILTER_DECODE, MU_STREAM_READ); |
− | </ | + | </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);