Difference between revisions of "7bit"
From Mailutils
Jump to navigationJump to searchm |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
In ''encode'' mode, the ''bin7'' filter converts its input into 7-bit ASCII, by clearing the 8th bit on each processed byte. | In ''encode'' mode, the ''bin7'' filter converts its input into 7-bit ASCII, by clearing the 8th bit on each processed byte. | ||
− | In ''decode'' mode, it operates exactly as the [[ | + | In ''decode'' mode, it operates exactly as the [[8bit]] filter, i.e. copies its input to the output verbatim. |
This filter is described in <tt>mailutils/filter.h</tt>: | This filter is described in <tt>mailutils/filter.h</tt>: | ||
− | < | + | <syntaxhighlight lang="C"> |
extern mu_filter_record_t mu_bit7_filter; | extern mu_filter_record_t mu_bit7_filter; | ||
− | </ | + | </syntaxhighlight> |
To create this filter, use the [[mu_filter_stream_create]] function: | To create this filter, use the [[mu_filter_stream_create]] function: | ||
− | < | + | <syntaxhighlight lang="C"> |
int rc; /* Return code */ | int rc; /* Return code */ | ||
mu_stream_t flt; /* Filter stream */ | mu_stream_t flt; /* Filter stream */ | ||
mu_stream_t input; /* Input stream */ | mu_stream_t input; /* Input stream */ | ||
− | initialize_input_stream (& | + | initialize_input_stream (&input); |
− | rc = | + | rc = mu_filter_create (&flt, input, "bin7", MU_FILTER_DECODE, MU_STREAM_READ); |
− | </ | + | </syntaxhighlight> |
[[Category:Filters]] | [[Category:Filters]] | ||
+ | [[Category:C API]] |
Latest revision as of 13:19, 16 October 2023
Bin7 is a Mailutils filter. It operates in both encode and decode modes.
In encode mode, the bin7 filter converts its input into 7-bit ASCII, by clearing the 8th bit on each processed byte.
In decode mode, it operates exactly as the 8bit filter, i.e. copies its input to the output verbatim.
This filter is described in mailutils/filter.h:
extern mu_filter_record_t mu_bit7_filter;
To create this filter, use the mu_filter_stream_create function:
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, "bin7", MU_FILTER_DECODE, MU_STREAM_READ);