BSD 3 development
[unix-history] / usr / man / man2 / stty.2
.TH STTY 2 11/15/79
.SH NAME
stty, gtty \- set and retrieve terminal modes
.SH SYNOPSIS
.B #include <sgtty.h>
.PP
.B stty(fildes, arg)
.br
.B struct sgttyb *arg;
.PP
.B gtty(fildes, arg)
.br
.B struct sgttyb *arg;
.SH DESCRIPTION
.I Gtty
stores in the structure pointed to by
.I arg
status information about the terminal
whose file descriptor is in r0 (in the first argument).
.PP
.I Stty
delays until the terminal is quiescent,
then sets its status to agree with the structure
pointed to by
.IR arg .
.PP
The input and output speeds are set from the first two bytes
Both system calls use the structure
defined in <sgtty.h>:
.PP
.nf
struct sgttyb {
char sg_ispeed;
char sg_ospeed;
char sg_erase;
char sg_kill;
short sg_flags;
};
.fi
.PP
The
.I sg_ispeed
and
.I sg_ospeed
fields describe the input and output speeds of the
device according to the following table,
which corresponds to the DH-11 interface.
If DC-11, DL-11 or KL-11 interfaces are used,
impossible speed changes are ignored.
Symbolic values in the table are as defined in
.IR <sgtty.h> .
.PP
.nf
.ta \w'B9600 'u +5n
B0 0 (hang up dataphone)
B50 1 50 baud
B75 2 75 baud
B110 3 110 baud
B134 4 134.5 baud
B150 5 150 baud
B200 6 200 baud
B300 7 300 baud
B600 8 600 baud
B1200 9 1200 baud
B1800 10 1800 baud
B2400 11 2400 baud
B4800 12 4800 baud
B9600 13 9600 baud
EXTA 14 External A
EXTB 15 External B
.fi
.DT
.PP
In the current configuration,
only 110, 150, 300 and 1200 baud are really supported on dial-up lines.
Code conversion and line control required for
IBM 2741's (134.5 baud)
must be implemented by the user's
program.
The half-duplex line discipline
required for the 202 dataset (1200 baud)
is not supplied; full-duplex 212 datasets work fine.
.PP
The
.I sg_erase
and
.I sg_kill
fields of the argument structure
specify the erase and kill characters respectively.
(Defaults are # and @.)
.PP
The
.I sg_flags
field of the argument structure
contains several bits which determine the
system's treatment of the terminal:
.PP
.ta \w'ALLDELAY 'u +\w'0100000 'u
.nf
ALLDELAY 0177400 Delay algorithm selection
BSDELAY 0100000 Select backspace delays:
BS0 0
BS1 0100000
VTDELAY 0040000 Select form-feed and vertical-tab delays:
FF0 0
FF1 0040000
CRDELAY 0030000 Select carriage-return delays:
CR0 0
CR1 0010000
CR2 0020000
CR3 0030000
TBDELAY 0006000 Select tab delays:
TAB0 0
TAB1 0002000
TAB2 0004000
TAB3 0006000
NLDELAY 0001400 Select new-line delays:
NL0 0
NL1 0000400
NL2 0001000
NL3 0001400
EVENP 0000200 Even parity allowed on input (e. g. for M37s)
ODDP 0000100 Odd parity allowed on input
RAW 0000040 Raw mode: wake up on all characters
CRMOD 0000020 Map CR into LF; echo LF or CR as CR-LF
ECHO 0000010 Echo (full duplex)
LCASE 0000004 Map upper case to lower on input (e. g. M33)
CBREAK 0000002 Return each character as soon as it is tped
HUPCL 0000001 Hang up (remove `data terminal ready') on last close
.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
Backspace delays are currently ignored but will
be used for Terminet 300's.
.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
and is suitable for the Terminet 300.
Delay type 2 lasts about .16 seconds and is suitable
for the VT05 and the TI 700.
Delay type 3 is suitable for the Concept 100.
.PP
New-line delay type 1 is dependent on the current column
and is tuned for Teletype model 37's.
Type 2 is useful for the VT05 and is about .10 seconds.
Type 3 is unimplemented and is 0.
.PP
Tab delay type 1 is dependent on the amount of movement
and is tuned to the Teletype model
37.
Other types are unimplemented and are 0.
.PP
Characters with the wrong parity, as determined by bits 200 and
100, are ignored.
.PP
In 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 character (EOT), the interrupt character
(DEL) and the quit character (FS) are not treated specially.
.PP
Mode 020 causes input carriage returns to be turned into
new-lines;
input of either CR or LF causes LF-CR both to
be echoed
(used for GE TermiNet 300's and other terminals without the newline function).
.PP
The hangup mode 01
causes the line to be disconnected
when the last process with the line open closes it or terminates.
It is useful when a port is to be used for some special
purpose;
for example, if it is associated
with an ACU used to place outgoing calls.
.PP
This system call is also used with certain special
files other than terminals,
but since none of them are part of the standard system
the specifications will not be given.
.SH "SEE ALSO"
stty(1), tty(4), ioctl(2)
.SH DIAGNOSTICS
Zero is returned if the call was successful;
\-1 if the file descriptor does not refer to a terminal.
.SH "ASSEMBLER (PDP-11)"
(stty = 31.)
.br
(file descriptor in r0)
.br
.B sys stty; arg
.PP
(gtty = 32.)
.br
(file descriptor in r0)
.B sys gtty; arg