Difference between revisions of "From (filter)"

From Mailutils
Jump to navigationJump to search
m
Line 1: Line 1:
 
The <tt>from</tt> [[filter]] performs a traditional UNIX processing of lines starting with a <tt>From</tt> followed by a space character.
 
The <tt>from</tt> [[filter]] performs a traditional UNIX processing of lines starting with a <tt>From</tt> followed by a space character.
  
 +
; [[MU_FILTER_ENCODE|Encode]] mode
 +
: In encode mode, each "<tt>From </tt>" at the beginning of a line is replaced by "<tt>>From </tt>"
 
; [[MU_FILTER_DECODE|Decode]] mode
 
; [[MU_FILTER_DECODE|Decode]] mode
: In decode mode, each "<tt>From </tt>" at the beginning of a line is replaced by "<tt>>From </tt>"
+
: In decode mode, the reverse operation is performed: initial ''greater-then'' sign (<tt>></tt>) is removed from any line starting with "<tt>>From </tt>".
; [[MU_FILTER_ENCODE|Encode]] mode
 
: In encode mode, the reverse operation is performed: initial ''greater-then'' sign (<tt>></tt>) is removed from any line starting with "<tt>>From </tt>".
 
  
 
The following code creates an instance of read-only <tt>from</tt> stream which adds the ''greater-than'' character to each  "<tt>>From </tt>" at the beginning of a line (the <tt>mu_stream_t input</tt> is supposed to have been initialized previously):
 
The following code creates an instance of read-only <tt>from</tt> stream which adds the ''greater-than'' character to each  "<tt>>From </tt>" at the beginning of a line (the <tt>mu_stream_t input</tt> is supposed to have been initialized previously):

Revision as of 12:06, 1 November 2011

The from filter performs a traditional UNIX processing of lines starting with a From followed by a space character.

Encode mode
In encode mode, each "From " at the beginning of a line is replaced by ">From "
Decode mode
In decode mode, the reverse operation is performed: initial greater-then sign (>) is removed from any line starting with ">From ".

The following code creates an instance of read-only from stream which adds the greater-than character to each ">From " at the beginning of a line (the mu_stream_t input is supposed to have been initialized previously):

  int rc;          /* Return code */
  mu_stream_t flt; /* Filter stream */

  rc = mu_filter_stream_create (&flt, input, "from", MU_FILTER_ENCODE, MU_STREAM_READ);

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

extern mu_filter_record_t mu_from_filter;