Difference between revisions of "CRLF (filter)"

From Mailutils
Jump to navigationJump to search
m
m
 
Line 7: Line 7:
 
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:
  
<source lang="C">
+
<syntaxhighlight lang="C">
 
extern mu_filter_record_t mu_crlf_filter;
 
extern mu_filter_record_t mu_crlf_filter;
</source>  
+
</syntaxhighlight>  
  
 
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">
+
<syntaxhighlight lang="C">
 
   int rc;          /* Return code */
 
   int rc;          /* Return code */
 
   mu_stream_t flt; /* Filter stream */
 
   mu_stream_t flt; /* Filter stream */
Line 20: Line 20:
 
   initialize_input_stream (&stream);
 
   initialize_input_stream (&stream);
 
   rc = mu_filter_create (&flt, input, "CRLF", MU_FILTER_DECODE, MU_STREAM_READ);
 
   rc = mu_filter_create (&flt, input, "CRLF", MU_FILTER_DECODE, MU_STREAM_READ);
</source>
+
</syntaxhighlight>
  
 
This filter is also available under the name <tt>RFC822</tt>, which is deprecated.
 
This filter is also available under the name <tt>RFC822</tt>, which is deprecated.

Latest revision as of 13:18, 16 October 2023

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_create (&flt, input, "CRLF", MU_FILTER_DECODE, MU_STREAM_READ);

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

See also