diff --git a/src/main/c/util/pipe.c b/src/main/c/util/pipe.c index 71f107d..9842b07 100644 --- a/src/main/c/util/pipe.c +++ b/src/main/c/util/pipe.c @@ -17,6 +17,7 @@ typedef struct hbu_pipe_s { hbu_fstreamin_t input; void *output; hbu_pipe_writer_cb_t writer; + int output_masked; hbu_buffer_t buffer; @@ -116,7 +117,9 @@ static void _hbu_pipe_assert_not_eoi(hbu_pipe_t pipe, hb_eod_char_t c) { } static void _hbu_pipe_write_to_output(hbu_pipe_t pipe, hb_char_t c) { - (*pipe->writer)(pipe->output, c); + if (!pipe->output_masked) { + (*pipe->writer)(pipe->output, c); + } } /* @@ -130,6 +133,7 @@ hbu_pipe_t hbu_pipe_create(hbu_fstreamin_t input, void *output, hbu_pipe_writer_ pipe->input = input; pipe->output = output; pipe->writer = writer; + pipe->output_masked = 0; pipe->buffer = hbu_buffer_create(); @@ -146,6 +150,10 @@ void hbu_pipe_destroy(hbu_pipe_t pipe) { free(pipe); } +void hbu_pipe_toggle_output_mask(hbu_pipe_t pipe, int output_masked) { + pipe->output_masked = output_masked; +} + /* * * BUILDER FUNCTIONS