diff options
author | Joshua Judson Rosen | 2017-03-19 15:28:00 -0400 |
---|---|---|
committer | Joshua Judson Rosen | 2017-03-28 22:07:50 -0400 |
commit | 73e697ac8fbe37096be960b87b684d20d4bad0eb (patch) | |
tree | da4ace15e12fa940ba9e907211f711ba90507ebc /src | |
parent | Drop unnecessary spinlock (loading, ploading) (diff) | |
download | gnurobots-73e697ac8fbe37096be960b87b684d20d4bad0eb.tar.gz |
ui-cmdwin: redirect all stdio into the embedded terminal
Users should no longer need to run from an xterm to see
to see things like final energy/score/odometry stats,
map-file path, copyright, load-messages, etc.
Note that this also means we no longer need to redirect readline,
since we're just redirecting *everything*.
Diffstat (limited to 'src')
-rw-r--r-- | src/ui-cmdwin.c | 11 | ||||
-rw-r--r-- | src/ui-window.c | 3 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/ui-cmdwin.c b/src/ui-cmdwin.c index c96388e..ce2c9ee 100644 --- a/src/ui-cmdwin.c +++ b/src/ui-cmdwin.c @@ -43,7 +43,6 @@ GtkWidget *ui_cmdwin_new(void) static void ui_cmdwin_init(UICmdWin *cmdwin) { int master_pty, slave_pty; - FILE *in, *out; cmdwin->priv = UI_CMDWIN_GET_PRIVATE(cmdwin); @@ -54,12 +53,12 @@ static void ui_cmdwin_init(UICmdWin *cmdwin) gtk_widget_set_size_request(GTK_WIDGET(cmdwin), -1, 200); g_assert(openpty(&master_pty, &slave_pty, NULL, NULL, NULL) >= 0); - vte_terminal_set_pty(VTE_TERMINAL(cmdwin->priv->vte), master_pty); - in = fdopen(slave_pty, "r"); - out = fdopen(slave_pty, "w"); - rl_instream = in; - rl_outstream = out; + dup2(slave_pty, 0); + dup2(slave_pty, 1); + dup2(slave_pty, 2); + + vte_terminal_set_pty(VTE_TERMINAL(cmdwin->priv->vte), master_pty); gtk_widget_show(cmdwin->priv->vte); } diff --git a/src/ui-window.c b/src/ui-window.c index e923c24..8034138 100644 --- a/src/ui-window.c +++ b/src/ui-window.c @@ -57,7 +57,10 @@ static void ui_window_init(UIWindow *window) gtk_window_set_title(GTK_WINDOW(window), "GNU Robots"); gtk_window_set_resizable(GTK_WINDOW(window), FALSE); + /* stdio is redirected in here...: */ window->priv->cmdwin = ui_cmdwin_new(); + /* ^so that's needed before guile can start... */ + window->priv->arena = ui_arena_new(); } |