Linelen

From Mailutils
Jump to navigationJump to search

The linelen filter limits the length of the output lines to a certain number of octets. It operates in encode mode only and requires a single parameter: the desired output length in octets. This filter makes no attempt to analyze the lexical structure of the input: the newline caracters are inserted when the length of the output line reaches a predefined maximum. Any "\n" characters present in the input are taken into account when computing the input line length.

The following code creates an instance of read-only linelen stream which breaks the input stream (mu_stream_t input, which is supposed to have been initialized previously) to lines of no more than 76 characters.

  int rc;          /* Return code */
  mu_stream_t flt; /* Filter stream */
  char *argv[] = { "linelen", "76", NULL };

  rc = mu_filter_chain_create (&flt, input, MU_FILTER_ENCODE, MU_STREAM_READ, 2, argv);

The object describing this filter is declared in mailutils/filter.h as follows:

extern mu_filter_record_t mu_linelen_filter;

See also