tcgetattr(3P) tcgetattr(3P)NAME tcgetattr, tcsetattr - get and set the terminal state SYNOPSIS #include <termios.h> int tcgetattr(fildes, termios-p) int fildes; struct termio *termio-p; int tcsetattr(fildes, optional-actions, termio-p) int fildes, optional-actions; struct termio *termio-p; DESCRIPTION tcgetattr retrieves the parameters associated with the dev- ice indicated by fildes and stores them in the termios structure indicated by termios-p. tcsetattr sets the parameters associated with the terminal using the information in the termios structure pointed to by termios-p. The action taken is dependent on the value of optional-actions. If optional-actions is TCSANOW, the change occurs immediately. If optional-actions is TCSA- DRAIN, the change occurs after all output written to fildes has been transmitted. TCSADRAIN should be used when chang- ing parameters that affect output. If optional-actions is TCSAFLUSH, 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. tcgettattr is allowed from a background process; however, the terminal attributes may be changed later by a foreground process. RETURN VALUE On successful completion, a value of 0 is returned. Other- wise, -1 is returned and errno is set to indicate the error. ERRORS If any of the following conditions occur, tcgetattr and tcsetattr return -1 and set errno to the corresponding value: [EBADF] The file descriptor fildes is not valid. [EINVAL] The device does not support the function called, or if the function called was tcsetattr, optional-actions is an invalid value. April, 1990 1
tcgetattr(3P) tcgetattr(3P)[ENOTTY] The file associated with fildes is not a ter- minal. SEE ALSO cfgetospeed(3P), termios(7P). 2 April, 1990