[GRASS5] Re: IRIX Binaries

Glynn Clements glynn.clements at virgin.net
Thu Aug 22 16:06:33 EDT 2002


Paul Kelly wrote:

> > thanks for the reply. You are correct, if i start grass from xterm it
> > works.
> > But i don't remember this problem from the distribution i created
> > myself. I am not able to start grass with the bash shell, grass uses ksh
> 
> I believe I have found the problem; it is in src/libes/vask (VASKLIB). CVS
> shows in May 2001 changes were made to the way it uses the curses library.
> I got the older versions of the files from before then and compiled and it
> works all right; I can press <Esc> and <Return> in winterm. Probably
> somebody should put in a workaround for IRIX then but I don't understand
> it enough at the minute.

I made the changes to which you are referring.

The old version tried to process extended keys (those which generate
escape sequences, e.g. cursor keys) manually, by recognising
hard-coded sequences (e.g. ESC-[-A for up).

I changed it to call the curses keypad() function, which causes curses
to process the escape sequences for extended keys internally, and
return special codes (e.g. KEY_UP for up).

The curs_getch(3) manpage (from ncurses) says:

       If  keypad  is  TRUE,  and  a function key is pressed, the
       token for that function key is returned instead of the raw
       characters.    Possible   function  keys  are  defined  in
       <curses.h> as macros with  values  outside  the  range  of
       8-bit  characters  whose  names  begin  with KEY_. Thus, a
       variable intended to hold the return value of  a  function
       key must be of short size or larger.

       When a character that could be the beginning of a function
       key is received (which,  on  modern  terminals,  means  an
       escape  character), curses sets a timer.  If the remainder
       of the sequence does not come  in  within  the  designated
       time,  the  character  is  passed  through; otherwise, the
       function key value is returned.   For  this  reason,  many
       terminals  experience  a  delay  between  the  time a user
       presses the escape key and the escape is returned  to  the
       program.

If this works with xterm, that suggests that it isn't a problem with
the curses library itself.

The keypad() function sends the sequence associated with the "smkx"
terminfo entry to the terminal to enable the extended keys (on xterm,
this selects "application mode"; note the ticks on the Ctrl+Button2
menu). It's possible that the terminfo entry for winterm has the wrong
sequence.

It wouldn't be that hard to (conditionally) disable the call to
keypad(); that would allow ESC to be received, but extended keys won't
work.

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




More information about the grass-dev mailing list