C-escape

From Mailutils
Revision as of 19:10, 5 September 2015 by Gray (talk | contribs)
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The C-escape filter replaces C escape sequences with the corresponding control character and vice versa.

In encode mode, recognized control characters are replaced with their C escapes. For example, newline (ASCII 10) becomes \n, horizontal tab (ASCII 9) becomes \t, etc.

In decode mode, the reverse operation is performed, i.e. each C escape is replaced with the corresponding character. Unrecognized escape sequences are copied verbatim.

Only named escapes are supported, i.e.: \\, \a, \b, \f, \n, \r, \t, \v.

This filter does not take arguments.

The following object, declared in mailutils/filter.h describes the C-escape filter:

extern mu_filter_record_t mu_c_escape_filter;

The example below shows how to create an instance of this filter 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, "C-escape", MU_FILTER_DECODE, MU_STREAM_READ);