STTY(2) — UNIX Programmer’s Manual
NAME
stty, gtty − set and retrieve terminal modes
SYNOPSIS
#include <sgtty.h>
stty(fildes, arg)
struct sgttyb *arg;
gtty(fildes, arg)
struct sgttyb *arg;
DESCRIPTION
Gtty stores in the structure pointed to by arg status information about the terminal whose file descriptor is in r0 (in the first argument).
Stty delays until the terminal is quiescent, then sets its status to agree with the structure pointed to by arg.
The input and output speeds are set from the first two bytes Both system calls use the structure defined in <sgtty.h>:
struct sgttyb {
charsg_ispeed;
charsg_ospeed;
charsg_erase;
charsg_kill;
intsg_flags;
};
The sg_ispeed and 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 <sgtty.h>.
B00(hang up dataphone)
B50150 baud
B75275 baud
B1103110 baud
B1344134.5 baud
B1505150 baud
B2006200 baud
B3007300 baud
B6008600 baud
B120091200 baud
B1800101800 baud
B2400112400 baud
B4800124800 baud
B9600139600 baud
EXTA14External A
EXTB15External B
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.
The sg_erase and sg_kill fields of the argument structure specify the erase and kill characters respectively. (Defaults are # and @.)
The sg_flags field of the argument structure contains several bits which determine the system’s treatment of the terminal:
ALLDELAY0177400Delay algorithm selection
BSDELAY0100000Select backspace delays:
BS00
BS10100000
VTDELAY0040000Select form-feed and vertical-tab delays:
FF00
FF10040000
CRDELAY0030000Select carriage-return delays:
CR00
CR10010000
CR20020000
CR30030000
TBDELAY0006000Select tab delays:
TAB00
TAB10002000
TAB20004000
TAB30006000
NLDELAY0001400Select new-line delays:
NL00
NL10000400
NL20001000
NL30001400
EVENP0000200Even parity allowed on input (e. g. for M37s)
ODDP0000100Odd parity allowed on input
RAW0000040Raw mode: wake up on all characters
CRMOD0000020Map CR into LF; echo LF or CR as CR-LF
ECHO0000010Echo (full duplex)
LCASE0000004Map upper case to lower on input (e. g. M33)
CBREAK0000002Return each character as soon as typed
HUPCL0000001Hang up (remove ‘data terminal ready’) on last close
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.
Backspace delays are currently ignored but will be used for Terminet 300’s.
If a form-feed/vertical tab delay is specified, it lasts for about 2 seconds.
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 unimplemented and is 0.
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.
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.
Characters with the wrong parity, as determined by bits 200 and 100, are ignored.
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.
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).
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.
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.
SEE ALSO
DIAGNOSTICS
Zero is returned if the call was successful; −1 if the file descriptor does not refer to a terminal.
ASSEMBLER (PDP-11)
(stty = 31.)
(file descriptor in r0)
sys stty; arg
(gtty = 32.)
(file descriptor in r0) sys gtty; arg
7th Edition