The functions we have already covered (
so on) are used by most applications to do I/O to a terminal. This chapter concentrates on
the control functions defined in the header file
. The vast majority of
ations do not use terminal control functions. We begin by looking at the hardware and
the use of
to modify a terminal's parameters. There is an example showing
how to turn off the echoing of input on the terminal screen, a fairly typical use of
terminal control functions. Then we go through a detailed description of input processing
and look at all the parameters a program can alter. We look at some examples of using a
terminal port for computer-to-computer communications. Finally, we descri
be POSIX job
control. These are functions used by the shell to control which processes get signals and
which ones have access to the terminal.
attempted to specify a portable mechanism that application
writers could use to get and set the modes of an asynchronous terminal. The intention of that
committee was to provide an interface that was neither implementation-speci
hardware-dependent. The terminal interface specification underwent more debate and revision
than any other part of the POSIX standard.
The resulting interface, though it meets all of the original goals, is different from any existing
system. The most dramatic change is the replacement of the
function with a
collection of terminal-specific functions. The change was made for several
mechanism is difficult to specify adequately due to its use of a third
argument that varies in both size and type according to the second argument.
The exact semantics of
are different on different systems.
None of the existing implementations was adequate in an international environment.
While the functions for terminal control may be new to you, experienced UNIX programmers
will see many familiar things.
A classic terminal is a keyboard and a display (or printer) that is connected to the computer
using an asynchronous communications port. From the perspective of the operating system, the