Scroll to navigation

TICKIT_TERM_SET_OUTPUT_FUNC(3) Library Functions Manual TICKIT_TERM_SET_OUTPUT_FUNC(3)

NAME

tickit_term_set_output_func - manage terminal output via a callback function

SYNOPSIS

#include <tickit.h>

typedef void TickitTermOutputFunc(TickitTerm *tt, const char *bytes,
    size_t len, void *user);

void tickit_term_set_output_func(TickitTerm *tt,
    TickitTermOutputFunc *fn, void *user);

Link with -ltickit.

DESCRIPTION

tickit_term_set_output_func() associates an output function with the terminal instance. If set, this function will be used to send bytes to the user's terminal even if an output file descriptor is also set. When the function is invoked, it will be passed the terminal instance, a byte buffer and size, and the user data pointer it was installed with.

When an output function is replaced by another or the terminal is destroyed, an existing function is invoked one final time to inform it. In this case, the len argument will be 0 and bytes will be NULL.

After both an input and output method have been defined, it is recommended to call tickit_term_await_started(3) to wait for the terminal to be set up.

RETURN VALUE

tickit_term_set_output_func() returns no value.

SEE ALSO

tickit_term_new(3), tickit_term_set_output_fd(3), tickit_term_await_started(3), tickit_term_print(3), tickit_term(7), tickit(7)