|
|
The UNIX system does a considerable amount of processing on input before an application ever sees a character. For example, it does the following:
Because an ETI program maintains total control over the screen, low-level ETI turns off echoing on the UNIX system and does echoing itself. At times, you may not want the UNIX system to process other characters in the standard way in an interactive screen management program. Some ETI routines, noecho and cbreak, for example, have been designed so that you can change the standard character processing. Using these routines in an application controls how input is interpreted. ``Input option settings for ETI programs'' shows some of the major routines for controlling input.
Every low-level ETI program accepting input should set some input options. This is because when the program starts running, the terminal on which it runs may be in cbreak, raw, nocbreak, or noraw mode. Although the low-level ETI program starts up in echo mode, none of the other modes are guaranteed.
The combination of noecho and cbreak is most common in interactive screen management programs. Suppose, for instance, that you do not want the characters sent to your application program to be echoed wherever the cursor currently happens to be; instead, you want them echoed at the bottom of the screen. The ETI routine noecho is designed for this purpose. However, when noecho turns off echoing, normal erase and kill processing is still on. Using the routine cbreak causes these characters to be uninterpreted.
Input option settings for ETI programs
Input options | Characters interpreted | Characters uninterpreted |
---|---|---|
Normal ``out of ETI state'' |
interrupt, quit
stripping RETURN to <NL> echoing erase, kill EOF | |
Normal ETI ``start up state'' | echoing (simulated) | All else undefined |
cbreak() and echo() |
interrupt, quit
stripping echoing |
erase, kill
EOF |
cbreak() and noecho() |
interrupt, quit
stripping |
erase, kill
EOF |
nocbreak() and noecho() |
break, quit
stripping erase, kill EOF | echoing |
nocbreak() and echo() | See caution below. | |
nl() | RETURN to <NL> | |
nonl() | RETURN to <NL> | |
raw()
(instead of cbreak()) |
break, quit
stripping |
In addition to the routines noted in ``Input option settings for ETI programs'', you can use the ETI routines noraw, halfdelay, and nodelay to control input. See the curses(3ocurses) manual pages for discussions of these routines.
The next few pages describe noecho, cbreak,
and the related routines echo and nocbreak in more detail.