[comp.unix.sysv386] Cursor keys, curses, and SCO-Unix

rbraun@spdcc.COM (Rich Braun) (06/14/91)

I've started developing an application which uses Unix curses, and it
has to run with a variety of terminals on a variety of systems (SCO
Unix, NCR Tower, IBM RS/6000, etc).  I've run into a couple of "gotchas"
which are causing me to rethink my decision to use curses, perhaps forcing
me to write my own code and my orm terminfo files.

The first is that SCO appears to be shipping (with 3.2v2) an incorrect
terminfo.src file.  For the worlds-most-common-terminal, the vt100, it
defines the keypad arrow keys ('kcuu1') as the sequences <ESC>OA etc.  In
order to get the cursor keys to send the <ESC>O prefix, one first has
to transmit the DECCKM ('smkx') sequence, which is commented out with
the explanation "this will put the auxiliary keypad in dec application
mode, which is not appropriate for SCO applications".  Normally, the
terminal will send <ESC>[A etc, which is not interpreted at all by the
curses library as shipped by SCO.  Hence the vt100 definition is internally
inconsistent.

The second is that AIX curses as shipped with the IBM RS/6000 lacks color
support, and seems to transmit wildly incorrect sequences using source
code which works OK under SysV.  I defined the NLS macro but still have
scrambled screens.

Is there any magic to writing portable, lowest-common-denominator curses
code?  Should I scrap the keyboard input code and write my own escape-
sequence parser, which would be less work than writing a whole display
output driver?

My co-worker Steve says he has a very good idea why they called it "curses"
to begin with.  :-)

-rich

mike@bria.UUCP (mike.stefanik) (06/16/91)

In an article, rbraun@spdcc.COM (Rich Braun) writes:
>Is there any magic to writing portable, lowest-common-denominator curses
>code?  Should I scrap the keyboard input code and write my own escape-
>sequence parser, which would be less work than writing a whole display
>output driver?

Use only the original curses functions, which lacked the attrxxx functions
and only supported the _STANDOUT attribute.  Since color has not been
introduced to all implementations of curses, avoid it.  If you don't like
the termcap definition, copy it, modify it, and use the TERMCAP variable
to point to it.

Not useful for snazzy looking screens, but then again, you did ask for portable
lowest-common-denominator curses code, did you not?

-- 
Mike Stefanik, MGI Inc., Los Angeles -- Opinions stated are never realistic!
"To sin by silence when they should protest makes cowards out of men." -Lincoln