interactive: Add producer to struct i9e_client_info.
authorAndre Noll <maan@systemlinux.org>
Sun, 8 Apr 2012 22:43:07 +0000 (00:43 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 18 Nov 2012 19:28:28 +0000 (20:28 +0100)
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
interactive.h

index cd5fa8a..6831643 100644 (file)
@@ -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;
 }
 
index 93ee56c..0af2ef4 100644 (file)
@@ -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);