File:  [Research Unix] / researchv10dc / man / man4 / ttyld.4
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:34 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Dan Cross

.TH TTYLD 4
.CT 2 comm_term
.SH NAME
tty_ld \- terminal processing line discipline
.SH SYNOPSIS
.B #include <sys/ttyio.h>
.SH DESCRIPTION
.I Tty_ld
is usually inserted
into a stream
connected to a terminal device.
It gathers input into lines,
handles special characters like erase, kill, and interrupt,
inserts output delays,
and the like.
It does not deal with hardware parameters
such as speed and parity;
see
.IR tty (4)
for such matters.
.PP
Certain special characters have particular meaning on input.
These characters are not passed to a program
except in raw mode, where they lose their special character.
It is possible to change these characters from the default.
.PP
The
.I erase
character
(backspace by default)
erases the last-typed character.
It will not erase beyond the beginning of a line or
an end-of-file character.
.PP
The
.I kill
character
(default
.BR @ )
erases the entire preceding part of the line, but not beyond
an end-of-file character.
.PP
The
.I end-of-file
character
(default
.RB control- d )
causes any characters
waiting to be read
to be passed immediately
to the program,
without waiting for newline.
The
end-of-file character itself is discarded.
Thus if the end-of-file character
occurs at the beginning of a line,
there are no characters waiting,
and zero characters will be passed back;
this is
the standard end-of-file indication.
.PP
The
.I escape
character
.RB ( \e )
escapes a following erase, kill, or end-of-file character
and allows it to be treated as ordinary data.
.PP
The
.I interrupt
character
(default
DEL)
is not passed to a program but sends
signal
.L SIGINT
to any processes in the process group of the stream;
see
.IR signal (2)
and
.IR stream (4).
.PP
The
.I quit
character
(default
FS,
.RB control- \e )
sends signal
.BR SIGQUIT .
.PP
The
.I stop
character
(default DC3,
.RB control- s )
delays printing on the terminal
until something is typed in.
.PP
The
.I start
character
(default DC1,
.RB control- q )
restarts printing after 
a stop character without generating
any input to a program.
.PP
Two
.IR ioctl (2)
calls affect these characters:
.TF TIOCGETC
.TP
.B TIOCGETC
The argument points to a
.B tchars
structure to be filled in with current settings.
.TP
.B TIOCSETC
The argument points to a
.B tchars
structure from which the characters are set.
.PD
.PP
The
.B tchars
structure, as defined in
.LR <sys/ttyio.h> ,
is
.PP
.EX
.ta \w'struct 'u +\w'tchars 'u +\w't_startc; 'u
struct tchars {
	char	t_intrc;	/* interrupt */
	char	t_quitc;	/* quit */
	char	t_startc;	/* start output */
	char	t_stopc;	/* stop output */
	char	t_eofc;	/* end-of-file */
	char	t_brkc;	/* input delimiter (like nl) */
};
.EE
.PP
A character value of 0377
eliminates the effect of that character.
The
.L t_brkc
character, by default 0377,
acts like a new-line in that it terminates a line,
is echoed, and is passed to the program.
The stop and start characters may be the same,
to produce a toggle effect.
It is counterproductive to make
other special characters (including erase and kill)
identical.
.PP
Two
.I ioctl
calls affect other terminal processing parameters:
.TF TIOCGETP
.TP
.B TIOCGETP
The argument points to a
.B sgttyb
structure to be filled in with the current settings.
.TP
.B TIOCSETP
The argument points to a 
.B sgttyb
structure from which the parameters are set.
.PD
.PP
The
.B sgttyb
structure, as
defined in
.LR <sys/ttyio.h> ,
is
.EX
.ta \w'struct 'u +\w'sgttyb 'u +\w'sg_ispeed 'u
struct	sgttyb	{
	char	sg_ispeed;	/* unused */
	char	sg_ospeed;	/* unused */
	char	sg_erase;	/* erase character */
	char	sg_kill;	/* kill character */
	short	sg_flags;	/* mode flags */
};
.EE
.PP
The flag bits are
.PP
.ta \w'\f5ALLDELAY\fP 'u +\w'\f50100000\fP 'u
.nf
\f5ALLDELAY	0177400\fP	Delay algorithm selection
\f5VTDELAY	0040000\fP	Form-feed and vertical-tab delays:
\f5FF0	0\fP
\f5FF1	0040000\fP
\f5CRDELAY	0030000\fP	Carriage-return delays:
\f5CR0	0\fP
\f5CR1	0010000\fP
\f5CR2	0020000\fP
\f5CR3	0030000\fP
\f5TBDELAY	0006000\fP	Tab delays:
\f5TAB0	0\fP
\f5TAB1	0002000\fP
\f5TAB2	0004000\fP
\f5XTABS	0006000\fP
\f5NLDELAY	0001400\fP	New-line delays:
\f5NL0	0\fP
\f5NL1	0000400\fP
\f5NL2	0001000\fP
\f5NL3	0001400\fP
\f5RAW	0000040\fP	Raw mode: wake up on all characters
\f5CRMOD	0000020\fP	Map CR into LF; echo LF or CR as CR-LF
\f5ECHO	0000010\fP	Echo (full duplex)
\f5LCASE	0000004\fP	Map upper case to lower on input
\f5CBREAK	0000002\fP	Return each character as soon as typed
\f5TANDEM	0000001\fP	Automatic flow control
.DT
.fi
.PP
The delay bits specify how long
transmission stops to allow for mechanical or other movement
when certain characters are sent to the terminal.
In all cases a value of 0 indicates no delay.
.PP
If a form-feed/vertical tab delay is specified,
it lasts for about 2 seconds.
.PP
Carriage-return delay type 1 lasts about .08 seconds;
type 2 about .16 seconds;
type 3 about .32 seconds.
.PP
New-line delay type 1 is supposed to be for the Teletype model 37;
type 2 is about .10 seconds.
.PP
Tab delay type 1 is supposed to be for the Teletype model 37.
Type 3, called 
.LR XTABS ,
is not a delay at all but causes tabs to be replaced
by the appropriate number of spaces on output.
.PP
In
.B RAW
mode,
every character is passed immediately
to the program without waiting until a full line has been typed.
No erase or kill processing is done;
the end-of-file, interrupt, and quit characters
are not treated specially.
There are no delays and no echoing, and no replacement of
one character for another.
.PP
.L CRMOD
causes input carriage returns to be turned into
new-lines;
input of either CR or LF causes CR-LF both to
be echoed
(for terminals without a new-line function).
.PP
.L CBREAK
is a sort of half-cooked mode.
Programs read each character as soon as typed, instead
of waiting for a full line,
but quit and interrupt work, and output delays
.LR CRMOD ,
.LR XTABS ,
and
.LR ECHO
work normally.
On the other hand there is no erase or kill,
and no special treatment of
.L \e
or end-of-file.
.PP
.L TANDEM
mode causes the system to transmit
the stop character whenever the input
queue is in danger of overflowing,
and the start character
when the input queue has drained sufficiently.
It is useful for flow control when the `terminal'
is actually another machine that obeys the conventions.
.SH SEE ALSO
.IR getty (8), 
.IR stty (1), 
.IR signal (2), 
.IR ioctl (2), 
.IR stream (4),
.IR tty (4)
.SH BUGS
The
escape character
cannot be changed.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.