Go to the first, previous, next, last section, table of contents.

Screen Size

A terminal description has two capabilities, `co' and `li', that describe the screen size in columns and lines. But there is more to the question of screen size than this.

On some operating systems the "screen" is really a window and the effective width can vary. On some of these systems, tgetnum uses the actual width of the window to decide what value to return for the `co' capability, overriding what is actually written in the terminal description. On other systems, it is up to the application program to check the actual window width using a system call. For example, on BSD 4.3 systems, the system call ioctl with code TIOCGWINSZ will tell you the current screen size.

On all window systems, termcap is powerless to advise the application program if the user resizes the window. Application programs must deal with this possibility in a system-dependent fashion. On some systems the C shell handles part of the problem by detecting changes in window size and setting the TERMCAP environment variable appropriately. This takes care of application programs that are started subsequently. It does not help application programs already running.

On some systems, including BSD 4.3, all programs using a terminal get a signal named SIGWINCH whenever the screen size changes. Programs that use termcap should handle this signal by using ioctl TIOCGWINSZ to learn the new screen size.

Numeric value, the width of the screen in character positions. Even hardcopy terminals normally have a `co' capability.
Numeric value, the height of the screen in lines.

Go to the first, previous, next, last section, table of contents.