terminfo programming

Working with terminfo routines

Some programs need to use lower level routines (that is, primitives) than those offered by the curses routines. For such programs, the terminfo routines are offered. They do not manage your terminal screen, but rather give you access to strings and capabilities which you can use yourself to manipulate the terminal.

There are three circumstances when it is proper to use terminfo routines. The first is when you need only some screen management capabilities, for example, making text stand out on a screen. The second is when writing a filter. A typical filter does one transformation on an input stream without clearing the screen or addressing the cursor. If this transformation is terminal dependent and clearing the screen is inappropriate, use of the terminfo routines is worthwhile. The third is when you are writing a special purpose tool that sends a special purpose string to the terminal, such as programming a function key, setting tab stops, sending output to a printer port, or dealing with the status line. Otherwise, you are discouraged from using these routines: the higher level curses routines make your program more portable to other UNIX systems and to a wider class of terminals.

NOTE: You are discouraged from using terminfo routines except for the purposes noted, because curses routines take care of all the glitches present in physical terminals. When you use the terminfo routines, you must deal with the glitches yourself. Also, these routines may change and be incompatible with previous releases.

Next topic: What every terminfo program needs
Previous topic: A shell script using terminfo routines

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004