.TH termios "" "" "Overview"
.PC "POSIX extended terminal interface"
.PP
The name
.B termios
describes a group of routines that \*(PX defines to extend the
.B termio
interface to terminals.
.B termios
includes the following routines:
.LB
\fBcfgetispeed()\fR	Get input speed
\fBcfgetospeed()\fR	Get output speed
\fBcfsetispeed()\fR	Set input speed
\fBcfsetospeed()\fR	Set output speed
\fBtcdrain()\fR	Drain output to a device
\fBtcflow()\fR	Control flow on a terminal device
\fBtcflush()\fR	Flush data being exchanged with a terminal
\fBtcgetattr()\fR	Get terminal attributes
\fBtcsendbreak()\fR	Send a break to a terminal
\fBtcsetattr()\fR	Set terminal attributes
.PP
Each is described in its own Lexicon entry.
Under \*(CO, all are defined as macros in header file
.BR <termios.h> .
.SH Example
The following example returns the input and output speeds for the
terminal device that you now are using:
.DM
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <termios.h>
.DE
.DM
int main()
{
	struct termios term;
	int speed;
.DE
.DM
	if (tcgetattr(STDIN_FILENO, &term) < 0) {
		fprintf(stderr, "tcgetattr error");
		exit(EXIT_FAILURE);
	}
.DE
.DM
	speed = cfgetispeed(&term);
	printf("tty line input speed is ");
.DE
.DM
	if      (speed == B50)		printf("50 baud\en");
	else if (speed == B75)		printf("75 baud\en");
	else if (speed == B110)		printf("110 baud\en");
	else if (speed == B134)		printf("134 baud\en");
	else if (speed == B150)		printf("150 baud\en");
	else if (speed == B200)		printf("200 baud\en");
	else if (speed == B300)		printf("300 baud\en");
	else if (speed == B600)		printf("600 baud\en");
	else if (speed == B1200)	printf("1200 baud\en");
	else if (speed == B1800)	printf("1800 baud\en");
	else if (speed == B2400)	printf("2400 baud\en");
	else if (speed == B4800)	printf("4800 baud\en");
	else if (speed == B9600)	printf("9600 baud\en");
	else if (speed == B19200)	printf("19200 baud\en");
	else if (speed == B38400)	printf("38400 baud\en");
	else				printf("unknown speed\en");
.DE
.DM
	speed = cfgetospeed(&term);
	printf("tty line output speed is ");
.DE
.DM
	if      (speed == B50)		printf("50 baud\en");
	else if (speed == B75)		printf("75 baud\en");
	else if (speed == B110)		printf("110 baud\en");
	else if (speed == B134)		printf("134 baud\en");
	else if (speed == B150)		printf("150 baud\en");
	else if (speed == B200)		printf("200 baud\en");
	else if (speed == B300)		printf("300 baud\en");
	else if (speed == B600)		printf("600 baud\en");
	else if (speed == B1200)	printf("1200 baud\en");
	else if (speed == B1800)	printf("1800 baud\en");
	else if (speed == B2400)	printf("2400 baud\en");
	else if (speed == B4800)	printf("4800 baud\en");
	else if (speed == B9600)	printf("9600 baud\en");
	else if (speed == B19200)	printf("19200 baud\en");
	else if (speed == B38400)	printf("38400 baud\en");
	else				printf("unknown speed\en");
.DE
.DM
	exit(EXIT_SUCCESS);
}
.DE
.SH "See Also"
.Xr "cfgetispeed()," cfgetispe
.Xr "cfgetospeed()," cfgetospe
.Xr "cfsetispeed()," cfsetispe
.Xr "cfsetospeed()," cfsetospe
.Xr "Programming COHERENT," programmi
.Xr "tcdrain()," tcdrain
.Xr "tcflow()," tcflow
.Xr "tcflush()," tcflush
.Xr "tcgetattr()," tcgetattr
.Xr "tcsendbreak()," tcsendbre
.Xr "tcsetattr()," tcsetattr
.Xr "termio," termio
.Xr "termios.h" termios.h
.SH Notes
If a program that uses
.B termios
has set the
.B termio
flag
.B ISIG
(which enables signals) and receives character
.B SUSP
(normally
.BR <ctrl-Z> ),
it sends the signal
.B SIGTSTP
to the current process group.
By default,
.B termios
then discards
.BR SUSP .
Character
.BR SUSP ,
as its name implies, tells a program to suspend operation and recede into the
background.
Please note that
because \*(CO does not yet support job control,
.B SUSP
at present will do nothing.
