From 6cb789ba07d3830f1d7fbff9daa059eb1c99c166 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 9 Apr 2012 00:43:07 +0200 Subject: [PATCH 1/1] interactive: Add producer to struct i9e_client_info. This enables users of the i9e API to open the i9e subsystem with a producer already attached to the stdout buffer tree node of the i9e subsystem. --- interactive.c | 6 +++++- interactive.h | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/interactive.c b/interactive.c index cd5fa8a8..68316438 100644 --- a/interactive.c +++ b/interactive.c @@ -421,7 +421,11 @@ int i9e_open(struct i9e_client_info *ici, struct sched *s) if (ici->history_file) read_history(ici->history_file); update_winsize(); - rl_callback_handler_install(i9ep->ici->prompt, i9e_line_handler); + if (ici->producer) { + rl_callback_handler_install("", i9e_line_handler); + i9e_attach_to_stdout(ici->producer); + } else + rl_callback_handler_install(i9ep->ici->prompt, i9e_line_handler); return 1; } diff --git a/interactive.h b/interactive.h index 93ee56c7..0af2ef40 100644 --- a/interactive.h +++ b/interactive.h @@ -71,6 +71,11 @@ struct i9e_client_info { * completer if the cursor is not on the first word. */ struct i9e_completer *completers; + /** + * If non-NULL, this node is attached immediately to the stdout btr + * node of the i9e subsystem. + */ + struct btr_node *producer; }; int i9e_open(struct i9e_client_info *ici, struct sched *s); -- 2.39.2