Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cfspeed(3C)

tccontrol(3C)

termio(7)

tcattribute(3C)

NAME

tcgetattr(), tcsetattr() − control tty device

SYNOPSIS

#include <termios.h>

int tcgetattr(int fildes, struct termios *termios_p);

int tcsetattr(

int fildes,
int optional_actions,
const struct termios *termios_p

);

DESCRIPTION

tcgetattr() gets the parameters associated with fildes and stores them in the termios structure referenced by termios_p. If the terminal device does not support split baud rates, the input baud rate stored in the termios structure is zero.  This function is allowed from a background process (see termio(7)). However, the terminal attributes can be subsequently changed by a foreground process.

tcsetattr() sets the parameters associated with fildes (unless support is required from underlying hardware that is not available) from the termios structure referenced by termios_p as follows:

• If optional_actions is TCSANOW, the change is immediate. 

• If optional_actions is TCSADRAIN, the change occurs after all output written to fildes is transmitted. 

• If optional_actions is TCSAFLUSH, the change occurs after all output written to fildes is transmitted, and all input that has been received but not read is discarded. 

RETURN VALUE

Upon successful completion, a value of zero is returned.  Otherwise, a value of −1 is returned and errno is set to indicate the error. 

ERRORS

tcgetattr() and tcsetattr() fail if any of the following conditions are encountered:

[EBADF] fildes is not a valid file descriptor. 

[EINVAL] The optional_actions argument is not a proper value. 

[ENOTTY] The file associated with fildes is not a terminal. 

WARNINGS

A request to set a hardware parameter to a value that is not supported by the hardware being used is ignored.  Any remaining parameter values in the request that are supported or that do not affect hardware are set as requested.  For any hardware that does not support separate input and output baud rates, the requested output baud rate is used to set the actual hardware baud rate.  tcgetattr() always returns the actual values set in hardware. 

SEE ALSO

cfspeed(3C), tccontrol(3C), termio(7). 

STANDARDS CONFORMANCE

tcgetattr(): AES, XPG3, XPG4, FIPS 151-2, POSIX.1

tcsetattr(): AES, XPG3, XPG4, FIPS 151-2, POSIX.1

Hewlett-Packard Company  —  HP-UX Release 9.0: August 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026