CRLF (filter)

From Mailutils
Revision as of 10:22, 9 July 2020 by Gray (talk | contribs)
Jump to navigationJump to search

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