Unix Terminals
An Introduction |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
xterm
)/dev
or /dev/pts
tty
in each to get its namels
(you should know
what will happen)ls > other
where other is the name of the other terminal
(e.g., /dev/pts/1
)man man
(so that the
output requires more than one "screen"
and you need to provide input to move between "screens")read()
only returns when a line-feed character is
encounteredint tcsetattr(int fd, int options, const struct termios *attr);
fd
|
The open file descriptor for the terminal |
options
|
TCSANOW to make changes now; TCSADRAIN to wait until after all output is transmitted; TCSAFLUSH to both wait and discard input not received |
attr
|
The attributes to set |
Return | 0 on success; -1 on error |
termios
Structurec_iflag
ICRNL
|
Map CR to LF (i.e., newline) on input |
IGNCR
|
Ignore CR on input |
c_lflag
ECHO
|
Echo input characters |
ICANON
|
Canonical model input |
IEXTEN
|
Enable extended processing of input characters |
ISIG
|
Enable signal generating characters |
read()
Return in Noncanonical Mode?VMIN
is 0, VTIME
is 0VMIN
is > 0, VTIME
is 0VMIN
is 0, VTIME
is > 0VMIN
is > 0, VTIME
is > 0