CRLF (filter)

From Mailutils

(Difference between revisions)
Jump to: navigation, search
m
Line 1: Line 1:
''CRLF'' is a Mailutils [[filter]] which converts line separators from LF (ASCII 10) to CRLF (ASCII 13 10) and vice-versa.
''CRLF'' is a Mailutils [[filter]] which converts line separators from LF (ASCII 10) to CRLF (ASCII 13 10) and vice-versa.
-
In [[MU_FILTER_DECODE|decode]] mode, the ''CRLF'' filter replaces each LF character with the CRLF sequence, unless LF is already preceded by a CR.
+
In [[MU_FILTER_DECODE|decode]] mode, translates each CRLF sequence to LF. Takes no arguments.
-
In [[MU_FILTER_ENCODE|encode]] mode, this filter removes CR from each CRLF sequence.
+
In [[MU_FILTER_ENCODE|encode]] mode, replaces each LF character with the CRLF sequence. If created with the <tt>-n</tt> option, the filter produces a "normalized" output, by preserving input CRLF untouched (by default they are translated to CR CR LF).
The following object, declared in the header <tt>mailutils/filter.h</tt>, describes this filter:
The following object, declared in the header <tt>mailutils/filter.h</tt>, describes this filter:
Line 11: Line 11:
</source>  
</source>  
-
This filter does not take any arguments.  The example below shows how to create a <tt>CRLF</tt> filter instance in decode mode for reading:
+
The example below shows how to create a <tt>CRLF</tt> filter instance in decode mode for reading:
<source lang="C">
<source lang="C">

Revision as of 16:43, 16 December 2017

CRLF is a Mailutils filter which converts line separators from LF (ASCII 10) to CRLF (ASCII 13 10) and vice-versa.

In decode mode, translates each CRLF sequence to LF. Takes no arguments.

In encode mode, replaces each LF character with the CRLF sequence. If created with the -n option, the filter produces a "normalized" output, by preserving input CRLF untouched (by default they are translated to CR CR LF).

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

extern mu_filter_record_t mu_crlf_filter;

The example below shows how to create a CRLF 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 (&stream);
  rc = mu_filter_stream_create (&flt, input, "CRLF", MU_FILTER_DECODE, MU_STREAM_READ);

This filter is also available under the name RFC822, which is deprecated.

See also

Personal tools