Add a way to associate custom data with a madtty term.
[apps/madtty.git] / madtty / madtty.c
index 1718b83..c35959a 100644 (file)
@@ -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;
+}