_TTYIO - change terminal processing.


#include <ttyio.h>
#include <stdio.h>
ret = _ttyio(term,action);


FILE *term;
is associated with a terminal. This can be a DAC or a TS8 terminal; it cannot be a TSS or TP8 terminal.
int action;
is a symbol telling how you want to change the terminal handling. Possible symbols are defined in <ttyio.h>. They are:
sets (turns on) "raw" mode. Raw mode is described below.
resets (turns off) raw mode.
sets (turns on) VIP function code mode. VIP function code mode is described below.
resets (turns off) VIP function code mode.
int ret;
is -1 if "_ttyio" believes it has failed to set the mode you requested. Otherwise "ret" is 0. Note that "_ttyio" cannot always tell whether or not it was successful; therefore -1 is a definite failure, but 0 is not a sure success.


"_ttyio" changes the way the library handles I/O on a terminal.

Raw Mode:

Setting raw mode on an input terminal tells the library not to convert carriage returns ('\r') into new-lines ('\n'). In addition, the ASCII FS (CTRL-\) will not be recognized as end of file.

For VIP terminals transmitting multiple lines, raw mode also prevents stripping of carriage returns in the embedded carriage return/line feed sequences. It also prevents the library from echoing the missing carriage return on the last line of VIP input.

Setting raw mode on an output terminal stops the library from converting new-lines ('\n') into carriage return/linefeeds ('\r\n'), and also prevents normal pending linefeed processing.

The only time you'll need raw mode for a terminal is in special applications for VIP terminals. If you set raw mode on an input terminal, it is usually desirable to set raw mode on the corresponding output terminal, and vice versa.

VIP Function Code Mode:

VIP function code mode is used when you want to intercept input from special keys on some varieties of synchronous VIP terminals (e.g. Questars). This mode can only be used with input terminals; it cannot be used with output terminals.

When you press a function key on an appropriate synchronous terminal, it transmits one or two characters, but these are not usually directed along the normal input stream. Such keys are "invisible" to the program when you are working in normal mode.

If you use "_ttyio" to turn on VIP function code mode, the library's input routines will deliver such codes to your program in the normal input stream. The character(s) transmitted by the special key will be preceded by the ESC character. For example, if the key sends the character X, the input stream will contain the two characters ESC X. If the key sends the two characters X and Y, the input stream will contain ESC X ESC Y.

See Also:

expl nsc lib _viphdr

Copyright © 1996, Thinkage Ltd.