Before starting to output commands to a terminal using termcap, an application program should do two things:
PC
and ospeed
for
padding (see section Performing Padding with tputs
) and UP
and BC
for
cursor motion (see section tgoto
).
To turn off output processing in Berkeley Unix you would use ioctl
with code TIOCLSET
to set the bit named LLITOUT
, and clear
the bits ANYDELAY
using TIOCSETN
. In POSIX or System V, you
must clear the bit named OPOST
. Refer to the system documentation
for details.
If you do not set the terminal flags properly, some older terminals will not work. This is because their commands may contain the characters that normally signify newline, carriage return and horizontal tab--characters which the kernel thinks it ought to modify before output.
When you change the kernel's terminal flags, you must arrange to restore
them to their normal state when your program exits. This implies that the
program must catch fatal signals such as SIGQUIT
and SIGINT
and restore the old terminal flags before actually terminating.
Modern terminals' commands do not use these special characters, so if you do not care about problems with old terminals, you can leave the kernel's terminal flags unaltered.
Go to the first, previous, next, last section, table of contents.