TCGETATTR(3P) TCGETATTR(3P)
NAME
tcgetattr, tcsetattr - get and set terminal state
SYNOPSIS
#include <termios.h>
int tcgetattr(fildes,termiosp)
int fildes;
struct termio *termiop;
int tcsetattr(fildes,optionalactions,termiop)
int fildes, optionalactions;
struct termio *termiop;
DESCRIPTION
tcgetattr retrieves the parameters associated with the
device indicated by fildes and stores them in the termios
structure indicated by termiosp.
tcsetattr sets the parameters associated with the terminal
using the information in the termios structure pointed to by
termiosp. The action taken is dependent on the value of
optionalactions. If optionalactions is TCSANOW, the
change occurs immediately. If optionalactions is
TCSADRAIN, the change occurs after all output written to
fildes has been transmitted. TCSADRAIN should be used when
changing parameters that affect output. If optionalactions
is TCSADFLUSH, the change occurs after all output written to
the object indicated by fildes has been transmitted; all
input that has been received but not read is discarded
before the change is made.
RETURN VALUE
Upon successful completion, zero will be returned.
Otherwise, -1 will be returned and errno set to indicate the
error.
ERRORS
If any of the following conditions occur, tcgetattr and
tcsetattr will return -1 and set errno to the corresponding
Page 1 May 1989
TCGETATTR(3P) TCGETATTR(3P)
value:
[EBADF] fildes is not a valid file descriptor.
[EINVAL] The device does not support the function
called, or if the function called was
tcsetattr, optionalactions is an invalid
value.
[ENOTTY] The file associated with fildes is not a
terminal.
[EFAULT] terminop is an invalid address.
SEE ALSO
cfgetospeed(3P), termios(7).
Page 2 May 1989