tcgetattr(3P) INTERACTIVE UNIX System (POSIX) tcgetattr(3P)
NAME
tcgetattr, tcsetattr - get and set terminal state
SYNOPSIS
#include <termios.h>
int tcgetattr (fildes, termios_p)
int fildes;
struct termios *termios_p;
int tcsetattr (fildes, optional_actions, termios_p)
int fildes, optional_actions;
struct termios *termios_p;
DESCRIPTION
The tcgetattr() function gets the parameters associated with
the object referred to by fildes and store them in the ter-
mios structure referenced by termios_p. This function is
allowed from a background process; however, the terminal
attributes may be subsequently changed by a foreground pro-
cess.
The tcsetattr() function sets the parameters associated with
the terminal (unless support is required from the underlying
hardware that is not available) from the termios structure
referenced by termios_p as follows:
(1)
If optional_actions is TCSANOW, the change occurs
immediately.
(2)
If optional_actions is TCSADRAIN, the change occurs after
all output written to fildes has been transmitted. This
function should be used when changing parameters that
affect output.
(3)
If optional_actions is TCSAFLUSH, the change occurs after
all output written to the object referred to by fildes
has been transmitted, and all input that has been
received but not read shall be discarded before the
change is made.
The symbolic constants for the values of optional_actions
are defined in <termios.h>.
DIAGNOSTICS
Upon successful completion, a value of zero is returned.
Otherwise, a value of -1 is returned, and errno is set to
indicate the error.
Rev. 1.1 Page 1