[GRASSLIST:4023] Re: rxvt/xterm,NVIZ fonts

Glynn Clements glynn.clements at virgin.net
Sun Jul 25 20:57:58 EDT 2004


Hamish wrote:

> There are three calls to xterm in main/gui.tcl, and three more in
> gui/tcltkgrass/script/. Should these be changed to $env(TERM)?

No.

> or is that bad misuse of the $TERM enviro. variable?

Yes. Seriously bad misuse.

$TERM is the name of the termcap/terminfo entry which describes the
behaviour of the terminal; it isn't the name of the program.

It's entirely possible that $TERM doesn't match the name of any
program; e.g. my xterm sessions normally have $TERM equal to
"xterm-color", but there isn't any program with that name. And most of
my shells run in an XEmacs shell-mode buffer, where $TERM is "emacs",
but running "emacs -e <program> <args>" certainly won't work.

Also, you will need more than just the program name. tcltkgrass uses
the -title, -iconic and -e switches; there's no guarantee that other
emulators will accept those switches, or will interpret them in the
same way (rxvt understands those three, but I suspect that the MacOSX
terminal probably doesn't).

Essentially, the existing occurrences of "exec xterm ..." need to be
passed to a single procedure which the user can then override (by
whatever means).

E.g.:

proc spawn_terminal {title iconic background program args} {
	set cmd {exec -- xterm}
	if {$title != ""} {lappend cmd -title $title}
	if {$iconic} {lappend cmd -iconic}
	lappend cmd -e $program
	set cmd [concat $cmd $args]
	if {$background} {lappend cmd "&"}
	eval $cmd
}

If you read Tcl commands from a file (e.g. ~/.tcltkgrassrc; not
~/.tcltkgrass, as that gets overwritten) after the above has been
defined, the user can redefine it if they want to use something else.

More generally, we should be trying to eliminate the use of terminals. 
E.g. there's no need (AFAICT) to use an xterm for all of those d.mon
commands in menu.tcl; a Tk-based log window should suffice.

The only programs which *really* need a terminal are those which use
the Vask library or G_ask_* etc, and we should be trying our best to
either convert those to support non-interactive use or replacing them.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list