Difference between revisions of "CRLF (filter)"

From Mailutils
Jump to navigationJump to search
m
Line 19: Line 19:
  
 
   initialize_input_stream (&stream);
 
   initialize_input_stream (&stream);
   rc = mu_filter_stream_create (&flt, input, "CRLF", MU_FILTER_DECODE, MU_STREAM_READ);
+
   rc = mu_filter_create (&flt, input, "CRLF", MU_FILTER_DECODE, MU_STREAM_READ);
 
</source>
 
</source>
  

Revision as of 10:22, 9 July 2020

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