From: Marc Andre Tanner Date: Mon, 14 Jan 2008 21:53:33 +0000 (+0100) Subject: Add a way to associate custom data with a madtty term. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=0b11e26f67ee0114f87c692c0d8f9e66ddf8b9ef;p=apps%2Fmadtty.git Add a way to associate custom data with a madtty term. Signed-off-by: Marc Andre Tanner --- diff --git a/madtty/madtty.c b/madtty/madtty.c index 1718b83..c35959a 100644 --- a/madtty/madtty.c +++ b/madtty/madtty.c @@ -107,6 +107,7 @@ struct madtty_t { char ebuf[BUFSIZ]; int rlen, elen; madtty_handler_t handler; + void *data; }; typedef struct t_row_t { @@ -1095,3 +1096,13 @@ void madtty_set_handler(madtty_t *t, madtty_handler_t handler) { t->handler = handler; } + +void madtty_set_data(madtty_t *t, void *data) +{ + t->data = data; +} + +void *madtty_get_data(madtty_t *t) +{ + return t->data; +} diff --git a/madtty/madtty.h b/madtty/madtty.h index 0a1e451..2859bfe 100644 --- a/madtty/madtty.h +++ b/madtty/madtty.h @@ -55,6 +55,8 @@ typedef int (*madtty_handler_t)(madtty_t *, char *es); void madtty_init_colors(void); void madtty_init_vt100_graphics(void); void madtty_set_handler(madtty_t *, madtty_handler_t); +void madtty_set_data(madtty_t *, void *); +void *madtty_get_data(madtty_t *); int madtty_color_pair(int fg, int bg); madtty_t *madtty_create(int rows, int cols);