#63 Problems with `tty-info' under GNU/Linux

closed-fixed
nobody
run-time (53)
5
2002-01-24
2002-01-17
Detlev Zundel
No

Trying to retrieve the tty-info failed for me on my
current GNU/Linux
system (Kernel 2.4.9 - glibc 2.2.4):

> (tty-info (current-input-port))

Error: exception
index-out-of-range
(call-external-value "scheme_tcgetattr" 19 0 18)

I traced the problem to `scsh/tty1.c' where the C code
uses the
constant `NCCS' whereas the scheme code uses
`num-ttychars'.
The latter is defined in scsh/linux/tty-consts.scm to
be 19.

The small test program

#include <termios.h>

void main() {
printf("%d\n", NCCS);
}

prints `32'. Looking for the definition I found these
contradicting
definitions:

$ rgrep NCCS /usr/include
/usr/include/asm/termbits.h:#define NCCS 19
/usr/include/asm/termbits.h: cc_t
c_cc[NCCS]; /* control characters */
/usr/include/sys/ttydefaults.h:cc_t
ttydefchars[NCCS] = {
/usr/include/bits/termios.h:#define NCCS 32
/usr/include/bits/termios.h: cc_t
c_cc[NCCS]; /* control characters */
/usr/include/bits/termios.h: _IOT (_IOTS (cflag_t), 4,
_IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
$

Changing `num-ttychars' in scsh/linux/tty-consts.scm to
32 solved
the problem for me.

I am not sure since when `32' is the answer or why the
definitions
contradict each other anyway.

Cheers
Detlev

Discussion

  • Logged In: YES
    user_id=17553

    32 seems to be the right value for num-ttychars.

     
    • status: open --> closed-fixed