[9] | 1 | .TH TERMIOS 3
|
---|
| 2 | .SH NAME
|
---|
| 3 | termios, tcgetattr, tcsetattr, cfgetispeed, cfgetospeed, cfsetispeed, cfsetospeed, tcsendbreak, tcdrain, tcflush, tcflow \- change terminal attributes
|
---|
| 4 | .SH SYNOPSIS
|
---|
| 5 | .ft B
|
---|
| 6 | .nf
|
---|
| 7 | #include <termios.h>
|
---|
| 8 |
|
---|
| 9 | int tcgetattr(int \fIfd\fP, struct termios *\fItp\fP)
|
---|
| 10 | int tcsetattr(int \fIfd\fP, int \fIaction\fP, const struct termios *\fItp\fP)
|
---|
| 11 |
|
---|
| 12 | speed_t cfgetispeed(const struct termios *\fItp\fP)
|
---|
| 13 | speed_t cfgetospeed(const struct termios *\fItp\fP)
|
---|
| 14 | int cfsetispeed(struct termios *\fItp\fP, speed_t \fIspeed\fP)
|
---|
| 15 | int cfsetospeed(struct termios *\fItp\fP, speed_t \fIspeed\fP)
|
---|
| 16 |
|
---|
| 17 | int tcsendbreak(int \fIfd\fP, int \fIduration\fP)
|
---|
| 18 | int tcdrain(int \fIfd\fP)
|
---|
| 19 | int tcflush(int \fIfd\fP, int \fIqueue_selector\fP)
|
---|
| 20 | int tcflow(int \fIfd\fP, int \fIaction\fP)
|
---|
| 21 | .fi
|
---|
| 22 | .ft P
|
---|
| 23 | .SH DESCRIPTION
|
---|
| 24 | .de SP
|
---|
| 25 | .if t .sp 0.4
|
---|
| 26 | .if n .sp
|
---|
| 27 | ..
|
---|
| 28 | These are the user functions that modify the tty attributes mentioned in
|
---|
| 29 | .BR tty (4).
|
---|
| 30 | In the following,
|
---|
| 31 | .I fd
|
---|
| 32 | refers to an open terminal device file,
|
---|
| 33 | .I tp
|
---|
| 34 | is the address of a
|
---|
| 35 | .BR "struct termios" ,
|
---|
| 36 | and
|
---|
| 37 | .I speed
|
---|
| 38 | and values of type
|
---|
| 39 | .B speed_t
|
---|
| 40 | are equal to one of the
|
---|
| 41 | .BR B0 ,
|
---|
| 42 | .BR B50 ,
|
---|
| 43 | etc. baud rate symbols. All functions, symbols, and types are declared in
|
---|
| 44 | .BR <termios.h> .
|
---|
| 45 | .PP
|
---|
| 46 | The effects of the tty functions are:
|
---|
| 47 | .TP
|
---|
| 48 | .B tcgetattr(\fIfd\fP, \fItp\fP)
|
---|
| 49 | Get the current settings of the tty attributes.
|
---|
| 50 | .TP
|
---|
| 51 | .B tcsetattr(\fIfd\fP, TCSANOW, \fItp\fP)
|
---|
| 52 | Set the terminal attributes. The change occurs immediately.
|
---|
| 53 | .TP
|
---|
| 54 | .B tcsetattr(\fIfd\fP, TCSADRAIN, \fItp\fP)
|
---|
| 55 | Set the terminal attributes. The change occurs once all the output waiting
|
---|
| 56 | in the output queues has been transmitted. This should be used when options
|
---|
| 57 | affecting output are changed.
|
---|
| 58 | .TP
|
---|
| 59 | .B tcsetattr(\fIfd\fP, TCSAFLUSH, \fItp\fP)
|
---|
| 60 | Set the terminal attributes. But first wait until all the output waiting
|
---|
| 61 | in the output queues has been transmitted. All input waiting in the input
|
---|
| 62 | queues is then discarded and the change is made. This should be used when
|
---|
| 63 | switching from canonical to non-canonical mode or vice-versa. (Oddly
|
---|
| 64 | enough, this is seldom what you want, because it discards typeahead. An
|
---|
| 65 | editing shell does the Right Thing if it uses
|
---|
| 66 | .B TCSANOW
|
---|
| 67 | instead. \s-2POSIX\s+2 may not guarantee good results, but in practice most
|
---|
| 68 | systems make the canonical input available in raw mode.)
|
---|
| 69 | .TP
|
---|
| 70 | .B cfgetispeed(\fItp\fP)
|
---|
| 71 | Return the input baud rate encoded in the termios structure.
|
---|
| 72 | .TP
|
---|
| 73 | .B cfgetospeed(\fItp\fP)
|
---|
| 74 | Return the output baud rate encoded in the termios structure.
|
---|
| 75 | .TP
|
---|
| 76 | .B cfsetispeed(\fItp\fP, \fIspeed\fP)
|
---|
| 77 | Encode the new input baud rate into the termios structure.
|
---|
| 78 | .TP
|
---|
| 79 | .B cfsetospeed(\fItp\fP, \fIspeed\fP)
|
---|
| 80 | Encode the new output baud rate into the termios structure.
|
---|
| 81 | .TP
|
---|
| 82 | .B tcsendbreak(\fIfd\fP, \fIduration\fP)
|
---|
| 83 | Emit a break condition on a serial line for a time indicated by
|
---|
| 84 | .IR duration .
|
---|
| 85 | (Always 0.4 seconds under MINIX 3,
|
---|
| 86 | .I duration
|
---|
| 87 | is ignored.)
|
---|
| 88 | .TP
|
---|
| 89 | .B tcdrain(\fIfd\fP)
|
---|
| 90 | Wait until all output waiting in the output queues has been transmitted.
|
---|
| 91 | .TP
|
---|
| 92 | .B tcflush(\fIfd\fP, TCIFLUSH)
|
---|
| 93 | Flush the input queue. (I.e. discard it.)
|
---|
| 94 | .TP
|
---|
| 95 | .B tcflush(\fIfd\fP, TCOFLUSH)
|
---|
| 96 | Flush the output queue.
|
---|
| 97 | .TP
|
---|
| 98 | .B tcflush(\fIfd\fP, TCIOFLUSH)
|
---|
| 99 | Flush the input and output queues.
|
---|
| 100 | .TP
|
---|
| 101 | .B tcflow(\fIfd\fP, TCOOFF)
|
---|
| 102 | Suspend output. (Like the effect of
|
---|
| 103 | .BR STOP .)
|
---|
| 104 | .TP
|
---|
| 105 | .B tcflow(\fIfd\fP, TCOON)
|
---|
| 106 | Restart output. (Like the effect of
|
---|
| 107 | .BR START .)
|
---|
| 108 | .TP
|
---|
| 109 | .B tcflow(\fIfd\fP, TCIOFF)
|
---|
| 110 | Transmit a
|
---|
| 111 | .B STOP
|
---|
| 112 | character intended to make the remote device stop transmitting data.
|
---|
| 113 | .TP
|
---|
| 114 | .B tcflow(\fIfd\fP, TCION)
|
---|
| 115 | Transmit a
|
---|
| 116 | .B START
|
---|
| 117 | character to restart the remote device.
|
---|
| 118 | .SH "SEE ALSO"
|
---|
| 119 | .BR stty (1),
|
---|
| 120 | .BR tty (4).
|
---|
| 121 | .SH DIAGNOSTICS
|
---|
| 122 | All functions return 0 unless otherwise specified, and \-1 on error with
|
---|
| 123 | .B errno
|
---|
| 124 | set to indicate the type of error. The most notable errors are
|
---|
| 125 | .B ENOTTY
|
---|
| 126 | if
|
---|
| 127 | .I fd
|
---|
| 128 | does not refer to a terminal device, and
|
---|
| 129 | .B EINTR
|
---|
| 130 | if one of the functions waiting for output to drain is interrupted.
|
---|
| 131 | .SH NOTES
|
---|
| 132 | It may be interesting to know that the functions operating on the tty are
|
---|
| 133 | directly translated into the following MINIX 3
|
---|
| 134 | .B ioctl
|
---|
| 135 | requests:
|
---|
| 136 | .BR TCGETS ,
|
---|
| 137 | .BR TCSETS
|
---|
| 138 | (now),
|
---|
| 139 | .BR TCSETSW
|
---|
| 140 | (drain),
|
---|
| 141 | .BR TCSETSF ,
|
---|
| 142 | (flush),
|
---|
| 143 | .BR TCSBRK ,
|
---|
| 144 | .BR TCDRAIN ,
|
---|
| 145 | .BR TCFLSH ,
|
---|
| 146 | and
|
---|
| 147 | .BR TCFLOW .
|
---|
| 148 | You should only use this knowledge when trying to understand the tty driver
|
---|
| 149 | code, of course.
|
---|
| 150 | .SH BUGS
|
---|
| 151 | .SH AUTHOR
|
---|
| 152 | Kees J. Bot (kjb@cs.vu.nl)
|
---|
| 153 |
|
---|
| 154 | .\"
|
---|
| 155 | .\" $PchId: termios.3,v 1.2 1996/04/11 06:41:24 philip Exp $
|
---|