Hello,
Similarly to the problem with d.measure, I get the following output in the
tcltk version of d.colors:
e[17de[19;7He[17X
e[17de[19;7H- Unknown Command
Seems that there is also a terminal command that doesn't work in tcltk.
Moritz
Hello,
Similarly to the problem with d.measure, I get the following output in the
tcltk version of d.colors:
e[17de[19;7He[17X
e[17de[19;7H- Unknown Command
Seems that there is also a terminal command that doesn't work in tcltk.
Moritz
Moritz Lennert wrote:
Similarly to the problem with d.measure, I get the following output in the
tcltk version of d.colors:e[17de[19;7He[17X
e[17de[19;7H- Unknown CommandSeems that there is also a terminal command that doesn't work in tcltk.
The specific problem there is that d.colors tries to read from stdin:
cur_char = getchar() & 0177 ;
[d.colors/interact.c, line 62.]
But stdin is closed (stdin is actually the pipe through which G_gui()
feeds the Tcl code to wish), so getchar() returns -1, so cur_char gets
set to 127 (0177, 0x7f). This isn't a valid "command" (i.e. key) for
d.colors, so it ends up in the default case of the switch statement:
default:
sprintf(buffer," %c - Unknown Command",cur_char) ;
Write_message(2, buffer) ;
break ;
}
Of course, the general problem is that d.colors is an interactive
program which requires a terminal (if it wasn't for the stdin issue,
you would still end up with curses dumping garbage into the text box),
but G_gui, d.m, tcltkgrass etc don't have any way of knowing that.
We could fix d.m and tcltkgrass by having separate "execute" and
"execute_term" commands (and changing the menu entries to use the
latter where necessary). The latter would record the fact that the
program requires a terminal so that, when you press the Run button, it
would would be started via xterm.
However, this won't work for the G_gui() case, as there isn't any way
for G_gui() to discover that the program requires a terminal. The only
thing which will fix that case is for the programs themselves to
indicate that they require a terminal before they call G_parser().
That would also eliminate the need for a separate execute_term
command.
--
Glynn Clements <glynn.clements@virgin.net>