.TH tcsetattr() "" "" "termios Macro (termios.h)"
.PC "Set terminal attributes"
.B "#include <termios.h>"
\fBint tcsetattr(\fIfd\^\fB, \fIoptional_actions\^\fB, \fItermios_p\^\fB)\fR
\fBint \fIfd\^\fB, \fIoptional_actions\^\fB;\fR
\fBstruct termios *\fItermios_p\^\fB;\fR
.PP
The
.B termios
macro
.B tcsetattr()
sets the attributes of the terminal device described by file descriptor
.I fd
to those stored in the
.B termios
structure to which
.I termios_p
points.
.PP
.I option_actions
defines the manner in which the attributes are set, as follows:
.IP \fBTCSANOW\fR
The attributes are set immediately.
.IP \fBTCSADRAIN\fR
The attributes are set after all data that has been sent to
.I fd
has been written.
Use this when changing parameters that affect output.
.IP \fBTCSAFLUSH\fR
The change occurs after all output send to
.I fd
has been written:
all input received but not read is discarded.
.PP
These constants are defined in header file
.BR <termios.h> .
.PP
If all goes well,
.B tcsetattr()
returns zero.
If something goes wrong, it returns \-1 and sets
.B errno to an appropriate value, as follows:
.IP \fBEBADF\fR
.I fd
is not a valid file descriptor.
.IP \fBEINVAL\fR
.I optional_actions
is not a proper value, or an attempt was made to change an attribute in the
.B termios
structure to an unsupported value.
.IP \fBENOTTY\fR
.I fd
does not describe a terminal.
.SH "See Also"
.Xr "termios" termios
.br
\*(PX Standard, \(sc7.2.1
