Path: utzoo!attcan!uunet!mitel!sce!cognos!dgbt!phil From: phil@dgbt.uucp (Phil Blanchfield DGBT/DIP) Newsgroups: comp.unix.ultrix Subject: Bug in ULTRIX terminfo/curses? Keywords: ULTRIX curses terminfo bug Message-ID: <1363@dgbt.uucp> Date: 1 Mar 90 02:18:52 GMT Organization: CRC, Ottawa CANADA Lines: 79 Fellow ULTRIX folk: I was trying to get a PD package to work with VT100 arrows (function keys) and I think I discovered a bug in the ULTRIX terminfo/curses stuff. The included program demonstrates the bug. Both the ULTRIX an SUNOS man pages for getch() say: " If keypad is TRUE, and a function key is pressed, the token " for that function key is returned instead of the raw charac- ters. This is also spoken of in "Guide to Curses Screen-Handling". The included program shows that getch() returns token's only if you don't "fopen()" a file!!! Actually, the call to fopen here is never even reached. It works fine on SUNOS both ways. I am running ULTRIX V3.1 on a VAX-750. Has anyone else seen this bug? Does this happen on a RISC? Is there a work around? /* * Test program for terminfo under ULTRIX 3.1 * * This program demonstrates a bug that I found in the ULTRIX * terminfo/curses library. With "keypad TRUE", when a function key * is hit, getch() should return a function key code (int > 401) * instead of the multi-character string which is actually sent * by the terminal. * * To compile on ULTRIX: * * cc prog.c -o prog -lcursesX * * To compile on SUNOS: * * /usr/5bin/cc prog.c -o prog -lcurses * * Notes: * The only way out is with a control-C and the you will * have to type: reset without any echo. */ #include #ifdef sun #include #else /* assume ULTRIX */ #include #endif main() { int chr; char string[30]; FILE *fopen(); initscr(); keypad(stdscr,TRUE); crmode(); noecho(); for(;;) { chr = getch(); sprintf(string,"%d = %o\n",chr,chr); addstr(string); refresh(); } fopen("vtst.c","r"); /* comment out this line and it works!! */ } -- Phil Blanchfield phil@dgbt.crc.dnd.ca | The Communications Research Centre UUCP: ...utzoo!lsuc!nrcaer!dgbt!phil | 3701 Carling Avenue, Ottawa CANADA