精品欧美一区二区三区在线观看 _久久久久国色av免费观看性色_国产精品久久在线观看_亚洲第一综合网站_91精品又粗又猛又爽_小泽玛利亚一区二区免费_91亚洲精品国偷拍自产在线观看 _久久精品视频在线播放_美女精品久久久_欧美日韩国产成人在线

tcflow 中文man頁面

系統
termios 函數族提供了一個常規的終端接口,用于控制非同步通信端口。

NAME

termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow, cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed - 獲取和設置終端屬性,行控制,獲取和設置波特率  

SYNOPSIS 總覽

#include <termios.h>
#include <unistd.h>
fd, struct termios *termios_p);

int tcgetattr(int

int tcsetattr(int fd, int optional_actions, struct termios *termios_p);

int tcsendbreak(int fd, int duration);

int tcdrain(int fd);

int tcflush(int fd, int queue_selector);

int tcflow(int fd, int action);

int cfmakeraw(struct termios *termios_p);

speed_t cfgetispeed(struct termios *termios_p);

speed_t cfgetospeed(struct termios *termios_p);

int cfsetispeed(struct termios *termios_p, speed_t speed);

int cfsetospeed(struct termios *termios_p, speed_t speed);  

DESCRIPTION 描述

termios 函數族提供了一個常規的終端接口,用于控制非同步通信端口。

這里描述的大部分屬性有一個 termios_p 類型的參數,它是指向一個 termios 結構的指針。這個結構包含了至少下列成員:

tcflag_t c_iflag;      /* 輸入模式 */
tcflag_t c_oflag;      /* 輸出模式 */
tcflag_t c_cflag;      /* 控制模式 */
tcflag_t c_lflag;      /* 本地模式 */
cc_t c_cc[NCCS];       /* 控制字符 */

c_iflag 標志常量:

IGNBRK
忽略輸入中的 BREAK 狀態。
BRKINT
如果設置了 IGNBRK,將忽略 BREAK。如果沒有設置,但是設置了 BRKINT,那么 BREAK 將使得輸入和輸出隊列被刷新,如果終端是一個前臺進程組的控制終端,這個進程組中所有進程將收到 SIGINT 信號。如果既未設置 IGNBRK 也未設置 BRKINT,BREAK 將視為與 NUL 字符同義,除非設置了 PARMRK,這種情況下它被視為序列 \377 \0 \0。
IGNPAR
忽略楨錯誤和奇偶校驗錯。
PARMRK
如果沒有設置 IGNPAR,在有奇偶校驗錯或楨錯誤的字符前插入 \377 \0。如果既沒有設置 IGNPAR 也沒有設置 PARMRK,將有奇偶校驗錯或楨錯誤的字符視為 \0。
INPCK
啟用輸入奇偶檢測。
ISTRIP
去掉第八位。
INLCR
將輸入中的 NL 翻譯為 CR。
IGNCR
忽略輸入中的回車。
ICRNL
將輸入中的回車翻譯為新行 (除非設置了 IGNCR)。
IUCLC
(不屬于 POSIX) 將輸入中的大寫字母映射為小寫字母。
IXON
啟用輸出的 XON/XOFF 流控制。
IXANY
(不屬于 POSIX.1;XSI) 允許任何字符來重新開始輸出。(?)
IXOFF
啟用輸入的 XON/XOFF 流控制。
IMAXBEL
(不屬于 POSIX) 當輸入隊列滿時響零。Linux 沒有實現這一位,總是將它視為已設置。

POSIX.1 中定義的 c_oflag 標志常量:

OPOST
啟用具體實現自行定義的輸出處理。

其余 c_oflag 標志常量定義在 POSIX 1003.1-2001 中,除非另外說明。

OLCUC
(不屬于 POSIX) 將輸出中的小寫字母映射為大寫字母。
ONLCR
(XSI) 將輸出中的新行符映射為回車-換行。
OCRNL
將輸出中的回車映射為新行符
ONOCR
不在第 0 列輸出回車。
ONLRET
不輸出回車。
OFILL
發送填充字符作為延時,而不是使用定時來延時。
OFDEL
(不屬于 POSIX) 填充字符是 ASCII DEL (0177)。如果不設置,填充字符則是 ASCII NUL。
NLDLY
新行延時掩碼。取值為 NL0NL1
CRDLY
回車延時掩碼。取值為 CR0, CR1, CR2, 或 CR3
TABDLY
水平跳格延時掩碼。取值為 TAB0, TAB1, TAB2, TAB3 (或 XTABS)。取值為 TAB3,即 XTABS,將擴展跳格為空格 (每個跳格符填充 8 個空格)。(?)
BSDLY
回退延時掩碼。取值為 BS0BS1。(從來沒有被實現過)
VTDLY
豎直跳格延時掩碼。取值為 VT0VT1。
FFDLY
進表延時掩碼。取值為 FF0FF1。

c_cflag 標志常量:

CBAUD
(不屬于 POSIX) 波特率掩碼 (4+1 位)。
CBAUDEX
(不屬于 POSIX) 擴展的波特率掩碼 (1 位),包含在 CBAUD 中。

(POSIX 規定波特率存儲在 termios 結構中,并未精確指定它的位置,而是提供了函數 cfgetispeed()cfsetispeed() 來存取它。一些系統使用 c_cflag 中 CBAUD 選擇的位,其他系統使用單獨的變量,例如 sg_ispeedsg_ospeed 。)

CSIZE
字符長度掩碼。取值為 CS5, CS6, CS7, 或 CS8
CSTOPB
設置兩個停止位,而不是一個。
CREAD
打開接受者。
PARENB
允許輸出產生奇偶信息以及輸入的奇偶校驗。
PARODD
輸入和輸出是奇校驗。
HUPCL
在最后一個進程關閉設備后,降低 modem 控制線 (掛斷)。(?)
CLOCAL
忽略 modem 控制線。
LOBLK
(不屬于 POSIX) 從非當前 shell 層阻塞輸出(用于 shl )。(?)
CIBAUD
(不屬于 POSIX) 輸入速度的掩碼。CIBAUD 各位的值與 CBAUD 各位相同,左移了 IBSHIFT 位。
CRTSCTS
(不屬于 POSIX) 啟用 RTS/CTS (硬件) 流控制。

c_lflag 標志常量:

ISIG
當接受到字符 INTR, QUIT, SUSP, 或 DSUSP 時,產生相應的信號。
ICANON
啟用標準模式 (canonical mode)。允許使用特殊字符 EOF, EOL, EOL2, ERASE, KILL, LNEXT, REPRINT, STATUS, 和 WERASE,以及按行的緩沖。
XCASE
(不屬于 POSIX; Linux 下不被支持) 如果同時設置了 ICANON,終端只有大寫。輸入被轉換為小寫,除了以 \ 前綴的字符。輸出時,大寫字符被前綴 \,小寫字符被轉換成大寫。
ECHO
回顯輸入字符。
ECHOE
如果同時設置了 ICANON,字符 ERASE 擦除前一個輸入字符,WERASE 擦除前一個詞。
ECHOK
如果同時設置了 ICANON,字符 KILL 刪除當前行。
ECHONL
如果同時設置了 ICANON,回顯字符 NL,即使沒有設置 ECHO。
ECHOCTL
(不屬于 POSIX) 如果同時設置了 ECHO,除了 TAB, NL, START, 和 STOP 之外的 ASCII 控制信號被回顯為 ^X, 這里 X 是比控制信號大 0x40 的 ASCII 碼。例如,字符 0x08 (BS) 被回顯為 ^H。
ECHOPRT
(不屬于 POSIX) 如果同時設置了 ICANONIECHO,字符在刪除的同時被打印。
ECHOKE
(不屬于 POSIX) 如果同時設置了 ICANON,回顯 KILL 時將刪除一行中的每個字符,如同指定了 ECHOEECHOPRT 一樣。
DEFECHO
(不屬于 POSIX) 只在一個進程讀的時候回顯。
FLUSHO
(不屬于 POSIX; Linux 下不被支持) 輸出被刷新。這個標志可以通過鍵入字符 DISCARD 來開關。
NOFLSH
禁止在產生 SIGINT, SIGQUIT 和 SIGSUSP 信號時刷新輸入和輸出隊列。
TOSTOP
向試圖寫控制終端的后臺進程組發送 SIGTTOU 信號。
PENDIN
(不屬于 POSIX; Linux 下不被支持) 在讀入下一個字符時,輸入隊列中所有字符被重新輸出。(bash 用它來處理 typeahead)
IEXTEN
啟用實現自定義的輸入處理。這個標志必須與 ICANON 同時使用,才能解釋特殊字符 EOL2,LNEXT,REPRINT 和 WERASE,IUCLC 標志才有效。

c_cc 數組定義了特殊的控制字符。符號下標 (初始值) 和意義為:

VINTR
(003, ETX, Ctrl-C, or also 0177, DEL, rubout) 中斷字符。發出 SIGINT 信號。當設置 ISIG 時可被識別,不再作為輸入傳遞。
VQUIT
(034, FS, Ctrl-\) 退出字符。發出 SIGQUIT 信號。當設置 ISIG 時可被識別,不再作為輸入傳遞。
VERASE
(0177, DEL, rubout, or 010, BS, Ctrl-H, or also #) 刪除字符。刪除上一個還沒有刪掉的字符,但不刪除上一個 EOF 或行首。當設置 ICANON 時可被識別,不再作為輸入傳遞。
VKILL
(025, NAK, Ctrl-U, or Ctrl-X, or also @) 終止字符。刪除自上一個 EOF 或行首以來的輸入。當設置 ICANON 時可被識別,不再作為輸入傳遞。
VEOF
(004, EOT, Ctrl-D) 文件尾字符。更精確地說,這個字符使得 tty 緩沖中的內容被送到等待輸入的用戶程序中,而不必等到 EOL。如果它是一行的第一個字符,那么用戶程序的 read() 將返回 0,指示讀到了 EOF。當設置 ICANON 時可被識別,不再作為輸入傳遞。
VMIN
非 canonical 模式讀的最小字符數。
VEOL
(0, NUL) 附加的行尾字符。當設置 ICANON 時可被識別。
VTIME
非 canonical 模式讀時的延時,以十分之一秒為單位。
VEOL2
(not in POSIX; 0, NUL) 另一個行尾字符。當設置 ICANON 時可被識別。
VSWTCH
(not in POSIX; not supported under Linux; 0, NUL) 開關字符。(只為 shl 所用。)
VSTART
(021, DC1, Ctrl-Q) 開始字符。重新開始被 Stop 字符中止的輸出。當設置 IXON 時可被識別,不再作為輸入傳遞。
VSTOP
(023, DC3, Ctrl-S) 停止字符。停止輸出,直到鍵入 Start 字符。當設置 IXON 時可被識別,不再作為輸入傳遞。
VSUSP
(032, SUB, Ctrl-Z) 掛起字符。發送 SIGTSTP 信號。當設置 ISIG 時可被識別,不再作為輸入傳遞。
VDSUSP
(not in POSIX; not supported under Linux; 031, EM, Ctrl-Y) 延時掛起信號。當用戶程序讀到這個字符時,發送 SIGTSTP 信號。當設置 IEXTEN 和 ISIG,并且系統支持作業管理時可被識別,不再作為輸入傳遞。
VLNEXT
(not in POSIX; 026, SYN, Ctrl-V) 字面上的下一個。引用下一個輸入字符,取消它的任何特殊含義。當設置 IEXTEN 時可被識別,不再作為輸入傳遞。
VWERASE
(not in POSIX; 027, ETB, Ctrl-W) 刪除詞。當設置 ICANON 和 IEXTEN 時可被識別,不再作為輸入傳遞。
VREPRINT
(not in POSIX; 022, DC2, Ctrl-R) 重新輸出未讀的字符。當設置 ICANON 和 IEXTEN 時可被識別,不再作為輸入傳遞。
VDISCARD
(not in POSIX; not supported under Linux; 017, SI, Ctrl-O) 開關:開始/結束丟棄未完成的輸出。當設置 IEXTEN 時可被識別,不再作為輸入傳遞。
VSTATUS
(not in POSIX; not supported under Linux; status request: 024, DC4, Ctrl-T).

這些符號下標值是互不相同的,除了 VTIME,VMIN 的值可能分別與 VEOL,VEOF 相同。 (在 non-canonical 模式下,特殊字符的含義更改為延時含義。MIN 表示應當被讀入的最小字符數。TIME 是以十分之一秒為單位的計時器。如果同時設置了它們,read 將等待直到至少讀入一個字符,一旦讀入 MIN 個字符或者從上次讀入字符開始經過了 TIME 時間就立即返回。如果只設置了 MIN,read 在讀入 MIN 個字符之前不會返回。如果只設置了 TIME,read 將在至少讀入一個字符,或者計時器超時的時候立即返回。如果都沒有設置,read 將立即返回,只給出當前準備好的字符。) (?)

tcgetattr() 得到與 fd 指向的對象相關的參數,將它們保存于 termios_p 引用的 termios 結構中。函數可以從后臺進程中調用;但是,終端屬性可能被后來的前臺進程所改變。

tcsetattr() 設置與終端相關的參數 (除非需要底層支持卻無法滿足),使用 termios_p 引用的 termios 結構。optional_actions 指定了什么時候改變會起作用:

TCSANOW
改變立即發生
TCSADRAIN
改變在所有寫入 fd 的輸出都被傳輸后生效。這個函數應當用于修改影響輸出的參數時使用。
TCSAFLUSH
改變在所有寫入 fd 引用的對象的輸出都被傳輸后生效,所有已接受但未讀入的輸入都在改變發生前丟棄。

tcsendbreak() 傳送連續的 0 值比特流,持續一段時間,如果終端使用異步串行數據傳輸的話。如果 duration 是 0,它至少傳輸 0.25 秒,不會超過 0.5 秒。如果 duration 非零,它發送的時間長度由實現定義。

如果終端并非使用異步串行數據傳輸,tcsendbreak() 什么都不做。

tcdrain() 等待直到所有寫入 fd 引用的對象的輸出都被傳輸。

tcflush() 丟棄要寫入 引用的對象,但是尚未傳輸的數據,或者收到但是尚未讀取的數據,取決于 queue_selector 的值:

TCIFLUSH
刷新收到的數據但是不讀
TCOFLUSH
刷新寫入的數據但是不傳送
TCIOFLUSH
同時刷新收到的數據但是不讀,并且刷新寫入的數據但是不傳送

tcflow() 掛起 fd 引用的對象上的數據傳輸或接收,取決于 action 的值:

TCOOFF
掛起輸出
TCOON
重新開始被掛起的輸出
TCIOFF
發送一個 STOP 字符,停止終端設備向系統傳送數據
TCION
發送一個 START 字符,使終端設備向系統傳輸數據

打開一個終端設備時的默認設置是輸入和輸出都沒有掛起。

波特率函數被用來獲取和設置 termios 結構中,輸入和輸出波特率的值。新值不會馬上生效,直到成功調用了 tcsetattr() 函數。

設置速度為 B0 使得 modem "掛機"。與 B38400 相應的實際比特率可以用 setserial(8) 調整。

輸入和輸出波特率被保存于 termios 結構中。

cfmakeraw 設置終端屬性如下:

            termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
                            |INLCR|IGNCR|ICRNL|IXON);
            termios_p->c_oflag &= ~OPOST;
            termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
            termios_p->c_cflag &= ~(CSIZE|PARENB);
            termios_p->c_cflag |= CS8;

cfgetospeed() 返回 termios_p 指向的 termios 結構中存儲的輸出波特率

cfsetospeed() 設置 termios_p 指向的 termios 結構中存儲的輸出波特率為 speed。取值必須是以下常量之一:

        B0
        B50
        B75
        B110
        B134
        B150
        B200
        B300
        B600
        B1200
        B1800
        B2400
        B4800
        B9600
        B19200
        B38400
        B57600
        B115200
        B230400

零值 B0 用來中斷連接。如果指定了 B0,不應當再假定存在連接。通常,這樣將斷開連接。CBAUDEX 是一個掩碼,指示高于 POSIX.1 定義的速度的那一些 (57600 及以上)。因此,B57600 & CBAUDEX 為非零。

cfgetispeed() 返回 termios 結構中存儲的輸入波特率。

cfsetispeed() 設置 termios 結構中存儲的輸入波特率為 speed。如果輸入波特率被設為0,實際輸入波特率將等于輸出波特率。  

RETURN VALUE 返回值

cfgetispeed() 返回 termios 結構中存儲的輸入波特率。

cfgetospeed() 返回 termios 結構中存儲的輸出波特率。

其他函數返回:

0
成功
-1
失敗,并且為 errno 置值來指示錯誤。

注意 tcsetattr() 返回成功,如果任何所要求的修改可以實現的話。因此,當進行多重修改時,應當在這個函數之后再次調用 tcgetattr() 來檢測是否所有修改都成功實現。

NOTES 注意

Unix V7 以及很多后來的系統有一個波特率的列表,在十四個值 B0, ..., B9600 之后可以看到兩個常數 EXTA, EXTB ("External A" and "External B")。很多系統將這個列表擴展為更高的波特率。

tcsendbreak 中非零的 duration 有不同的效果。SunOS 指定中斷 duration*N 秒,其中 N 至少為 0.25,不高于 0.5 。Linux, AIX, DU, Tru64 發送 duration 微秒的 break 。FreeBSD, NetBSD, HP-UX 以及 MacOS 忽略 duration 的值。在 Solaris 和 Unixware 中, tcsendbreak 搭配非零的 duration 效果類似于 tcdrain。  

SEE ALSO 參見

stty(1), setserial(8)

#p#

NAME

termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow, cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed - get and set terminal attributes, line control, get and set baud rate  

SYNOPSIS

#include <termios.h>
#include <unistd.h>
fd, struct termios *termios_p);

int tcgetattr(int

int tcsetattr(int fd, int optional_actions, struct termios *termios_p);

int tcsendbreak(int fd, int duration);

int tcdrain(int fd);

int tcflush(int fd, int queue_selector);

int tcflow(int fd, int action);

int cfmakeraw(struct termios *termios_p);

speed_t cfgetispeed(struct termios *termios_p);

speed_t cfgetospeed(struct termios *termios_p);

int cfsetispeed(struct termios *termios_p, speed_t speed);

int cfsetospeed(struct termios *termios_p, speed_t speed);  

DESCRIPTION

The termios functions describe a general terminal interface that is provided to control asynchronous communications ports.

Many of the functions described here have a termios_p argument that is a pointer to a termios structure. This structure contains at least the following members:

tcflag_t c_iflag;      /* input modes */
tcflag_t c_oflag;      /* output modes */
tcflag_t c_cflag;      /* control modes */
tcflag_t c_lflag;      /* local modes */
cc_t c_cc[NCCS];       /* control chars */

c_iflag flag constants:

IGNBRK
Ignore BREAK condition on input.
BRKINT
If IGNBRK is set, a BREAK is ignored. If it is not set but BRKINT is set, then a BREAK causes the input and output queues to be flushed, and if the terminal is the controlling terminal of a foreground process group, it will cause a SIGINT to be sent to this foreground process group. When neither IGNBRK nor BRKINT are set, a BREAK reads as a NUL character, except when PARMRK is set, in which case it reads as the sequence \377 \0 \0.
IGNPAR
Ignore framing errors and parity errors.
PARMRK
If IGNPAR is not set, prefix a character with a parity error or framing error with \377 \0. If neither IGNPAR nor PARMRK is set, read a character with a parity error or framing error as \0.
INPCK
Enable input parity checking.
ISTRIP
Strip off eighth bit.
INLCR
Translate NL to CR on input.
IGNCR
Ignore carriage return on input.
ICRNL
Translate carriage return to newline on input (unless IGNCR is set).
IUCLC
(not in POSIX) Map uppercase characters to lowercase on input.
IXON
Enable XON/XOFF flow control on output.
IXANY
(not in POSIX.1; XSI) Enable any character to restart output.
IXOFF
Enable XON/XOFF flow control on input.
IMAXBEL
(not in POSIX) Ring bell when input queue is full. Linux does not implement this bit, and acts as if it is always set.

c_oflag flag constants defined in POSIX.1:

OPOST
Enable implementation-defined output processing.

The remaining c_oflag flag constants are defined in POSIX 1003.1-2001, unless marked otherwise.

OLCUC
(not in POSIX) Map lowercase characters to uppercase on output.
ONLCR
(XSI) Map NL to CR-NL on output.
OCRNL
Map CR to NL on output.
ONOCR
Don't output CR at column 0.
ONLRET
Don't output CR.
OFILL
Send fill characters for a delay, rather than using a timed delay.
OFDEL
(not in POSIX) Fill character is ASCII DEL (0177). If unset, fill character is ASCII NUL.
NLDLY
Newline delay mask. Values are NL0 and NL1.
CRDLY
Carriage return delay mask. Values are CR0, CR1, CR2, or CR3.
TABDLY
Horizontal tab delay mask. Values are TAB0, TAB1, TAB2, TAB3 (or XTABS). A value of TAB3, that is, XTABS, expands tabs to spaces (with tab stops every eight columns).
BSDLY
Backspace delay mask. Values are BS0 or BS1. (Has never been implemented.)
VTDLY
Vertical tab delay mask. Values are VT0 or VT1.
FFDLY
Form feed delay mask. Values are FF0 or FF1.

c_cflag flag constants:

CBAUD
(not in POSIX) Baud speed mask (4+1 bits).
CBAUDEX
(not in POSIX) Extra baud speed mask (1 bit), included in CBAUD.

(POSIX says that the baud speed is stored in the termios structure without specifying where precisely, and provides cfgetispeed() and cfsetispeed() for getting at it. Some systems use bits selected by CBAUD in c_cflag, other systems use separate fields, e.g. sg_ispeed and sg_ospeed.)

CSIZE
Character size mask. Values are CS5, CS6, CS7, or CS8.
CSTOPB
Set two stop bits, rather than one.
CREAD
Enable receiver.
PARENB
Enable parity generation on output and parity checking for input.
PARODD
Parity for input and output is odd.
HUPCL
Lower modem control lines after last process closes the device (hang up).
CLOCAL
Ignore modem control lines.
LOBLK
(not in POSIX) Block output from a noncurrent shell layer. (For use by shl.)
CIBAUD
(not in POSIX) Mask for input speeds. The values for the CIBAUD bits are the same as the values for the CBAUD bits, shifted left IBSHIFT bits.
CRTSCTS
(not in POSIX) Enable RTS/CTS (hardware) flow control.

c_lflag flag constants:

ISIG
When any of the characters INTR, QUIT, SUSP, or DSUSP are received, generate the corresponding signal.
ICANON
Enable canonical mode. This enables the special characters EOF, EOL, EOL2, ERASE, KILL, LNEXT, REPRINT, STATUS, and WERASE, and buffers by lines.
XCASE
(not in POSIX; not supported under Linux) If ICANON is also set, terminal is uppercase only. Input is converted to lowercase, except for characters preceded by \. On output, uppercase characters are preceded by \ and lowercase characters are converted to uppercase.
ECHO
Echo input characters.
ECHOE
If ICANON is also set, the ERASE character erases the preceding input character, and WERASE erases the preceding word.
ECHOK
If ICANON is also set, the KILL character erases the current line.
ECHONL
If ICANON is also set, echo the NL character even if ECHO is not set.
ECHOCTL
(not in POSIX) If ECHO is also set, ASCII control signals other than TAB, NL, START, and STOP are echoed as ^X, where X is the character with ASCII code 0x40 greater than the control signal. For example, character 0x08 (BS) is echoed as ^H.
ECHOPRT
(not in POSIX) If ICANON and IECHO are also set, characters are printed as they are being erased.
ECHOKE
(not in POSIX) If ICANON is also set, KILL is echoed by erasing each character on the line, as specified by ECHOE and ECHOPRT.
DEFECHO
(not in POSIX) Echo only when a process is reading.
FLUSHO
(not in POSIX; not supported under Linux) Output is being flushed. This flag is toggled by typing the DISCARD character.
NOFLSH
Disable flushing the input and output queues when generating the SIGINT, SIGQUIT and SIGSUSP signals.
TOSTOP
Send the SIGTTOU signal to the process group of a background process which tries to write to its controlling terminal.
PENDIN
(not in POSIX; not supported under Linux) All characters in the input queue are reprinted when the next character is read. (bash handles typeahead this way.)
IEXTEN
Enable implementation-defined input processing. This flag, as well as ICANON must be enabled for the special characters EOL2, LNEXT, REPRINT, WERASE to be interpreted, and for the IUCLC flag to be effective.

The c_cc array defines the special control characters. The symbolic indices (initial values) and meaning are:

VINTR
(003, ETX, Ctrl-C, or also 0177, DEL, rubout) Interrupt character. Send a SIGINT signal. Recognized when ISIG is set, and then not passed as input.
VQUIT
(034, FS, Ctrl-\) Quit character. Send SIGQUIT signal. Recognized when ISIG is set, and then not passed as input.
VERASE
(0177, DEL, rubout, or 010, BS, Ctrl-H, or also #) Erase character. This erases the previous not-yet-erased character, but does not erase past EOF or beginning-of-line. Recognized when ICANON is set, and then not passed as input.
VKILL
(025, NAK, Ctrl-U, or Ctrl-X, or also @) Kill character. This erases the input since the last EOF or beginning-of-line. Recognized when ICANON is set, and then not passed as input.
VEOF
(004, EOT, Ctrl-D) End-of-file character. More precisely: this character causes the pending tty buffer to be sent to the waiting user program without waiting for end-of-line. If it is the first character of the line, the read() in the user program returns 0, which signifies end-of-file. Recognized when ICANON is set, and then not passed as input.
VMIN
Minimum number of characters for non-canonical read.
VEOL
(0, NUL) Additional end-of-line character. Recognized when ICANON is set.
VTIME
Timeout in deciseconds for non-canonical read.
VEOL2
(not in POSIX; 0, NUL) Yet another end-of-line character. Recognized when ICANON is set.
VSWTCH
(not in POSIX; not supported under Linux; 0, NUL) Switch character. (Used by shl only.)
VSTART
(021, DC1, Ctrl-Q) Start character. Restarts output stopped by the Stop character. Recognized when IXON is set, and then not passed as input.
VSTOP
(023, DC3, Ctrl-S) Stop character. Stop output until Start character typed. Recognized when IXON is set, and then not passed as input.
VSUSP
(032, SUB, Ctrl-Z) Suspend character. Send SIGTSTP signal. Recognized when ISIG is set, and then not passed as input.
VDSUSP
(not in POSIX; not supported under Linux; 031, EM, Ctrl-Y) Delayed suspend character: send SIGTSTP signal when the character is read by the user program. Recognized when IEXTEN and ISIG are set, and the system supports job control, and then not passed as input.
VLNEXT
(not in POSIX; 026, SYN, Ctrl-V) Literal next. Quotes the next input character, depriving it of a possible special meaning. Recognized when IEXTEN is set, and then not passed as input.
VWERASE
(not in POSIX; 027, ETB, Ctrl-W) Word erase. Recognized when ICANON and IEXTEN are set, and then not passed as input.
VREPRINT
(not in POSIX; 022, DC2, Ctrl-R) Reprint unread characters. Recognized when ICANON and IEXTEN are set, and then not passed as input.
VDISCARD
(not in POSIX; not supported under Linux; 017, SI, Ctrl-O) Toggle: start/stop discarding pending output. Recognized when IEXTEN is set, and then not passed as input.
VSTATUS
(not in POSIX; not supported under Linux; status request: 024, DC4, Ctrl-T).

These symbolic subscript values are all different, except that VTIME, VMIN may have the same value as VEOL, VEOF, respectively. (In non-canonical mode the special character meaning is replaced by the timeout meaning. MIN represents the minimum number of characters that should be received to satisfy the read. TIME is a decisecond-valued timer. When both are set, a read will wait until at least one character has been received, and then return as soon as either MIN characters have been received or time TIME has passed since the last character was received. If only MIN is set, the read will not return before MIN characters have been received. If only TIME is set, the read will return as soon as either at least one character has been received, or the timer times out. If neither is set, the read will return immediately, only giving the currently already available characters.)

tcgetattr() gets the parameters associated with the object referred by fd and stores them in the termios structure referenced by termios_p. This function may be invoked from a background process; however, the terminal attributes may be subsequently changed by a foreground process.

tcsetattr() sets the parameters associated with the terminal (unless support is required from the underlying hardware that is not available) from the termios structure referred to by termios_p. optional_actions specifies when the changes take effect:

TCSANOW
the change occurs immediately.
TCSADRAIN
the change occurs after all output written to fd has been transmitted. This function should be used when changing parameters that affect output.
TCSAFLUSH
the change occurs after all output written to the object referred by fd has been transmitted, and all input that has been received but not read will be discarded before the change is made.

tcsendbreak() transmits a continuous stream of zero-valued bits for a specific duration, if the terminal is using asynchronous serial data transmission. If duration is zero, it transmits zero-valued bits for at least 0.25 seconds, and not more that 0.5 seconds. If duration is not zero, it sends zero-valued bits for some implementation-defined length of time.

If the terminal is not using asynchronous serial data transmission, tcsendbreak() returns without taking any action.

tcdrain() waits until all output written to the object referred to by fd has been transmitted.

tcflush() discards data written to the object referred to by fd but not transmitted, or data received but not read, depending on the value of queue_selector:

TCIFLUSH
flushes data received but not read.
TCOFLUSH
flushes data written but not transmitted.
TCIOFLUSH
flushes both data received but not read, and data written but not transmitted.

tcflow() suspends transmission or reception of data on the object referred to by fd, depending on the value of action:

TCOOFF
suspends output.
TCOON
restarts suspended output.
TCIOFF
transmits a STOP character, which stops the terminal device from transmitting data to the system.
TCION
transmits a START character, which starts the terminal device transmitting data to the system.

The default on open of a terminal file is that neither its input nor its output is suspended.

The baud rate functions are provided for getting and setting the values of the input and output baud rates in the termios structure. The new values do not take effect until tcsetattr() is successfully called.

Setting the speed to B0 instructs the modem to "hang up". The actual bit rate corresponding to B38400 may be altered with setserial(8).   

The input and output baud rates are stored in the termios structure.

cfmakeraw sets the terminal attributes as follows:

            termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
                            |INLCR|IGNCR|ICRNL|IXON);
            termios_p->c_oflag &= ~OPOST;
            termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
            termios_p->c_cflag &= ~(CSIZE|PARENB);
            termios_p->c_cflag |= CS8;

cfgetospeed() returns the output baud rate stored in the termios structure pointed to by termios_p.

cfsetospeed() sets the output baud rate stored in the termios structure pointed to by termios_p to speed, which must be one of these constants:

        B0
        B50
        B75
        B110
        B134
        B150
        B200
        B300
        B600
        B1200
        B1800
        B2400
        B4800
        B9600
        B19200
        B38400
        B57600
        B115200
        B230400

The zero baud rate, B0, is used to terminate the connection. If B0 is specified, the modem control lines shall no longer be asserted. Normally, this will disconnect the line. CBAUDEX is a mask for the speeds beyond those defined in POSIX.1 (57600 and above). Thus, B57600 & CBAUDEX is nonzero.

cfgetispeed() returns the input baud rate stored in the termios structure.

cfsetispeed() sets the input baud rate stored in the termios structure to speed. If the input baud rate is set to zero, the input baud rate will be equal to the output baud rate.  

RETURN VALUE

cfgetispeed() returns the input baud rate stored in the termios structure.

cfgetospeed() returns the output baud rate stored in the termios structure.

All other functions return:

0
on success.
-1
on failure and set errno to indicate the error.

Note that tcsetattr() returns success if any of the requested changes could be successfully carried out. Therefore, when making multiple changes it may be necessary to follow this call with a further call to tcgetattr() to check that all changes have been performed successfully.

NOTES

Unix V7 and several later systems have a list of baud rates where after the fourteen values B0, ..., B9600 one finds the two constants EXTA, EXTB ("External A" and "External B"). Many systems extend the list with much higher baud rates.

The effect of a nonzero duration with tcsendbreak varies. SunOS specifies a break of duration*N seconds, where N is at least 0.25, and not more than 0.5. Linux, AIX, DU, Tru64 send a break of duration milliseconds. FreeBSD and NetBSD and HP-UX and MacOS ignore the value of duration. Under Solaris and Unixware, tcsendbreak with nonzero duration behaves like tcdrain.  

SEE ALSO

stty(1), setserial(8)

責任編輯:韓亞珊 來源: CMPP.net
相關推薦

2011-08-24 16:48:36

man中文man

2011-08-15 10:21:09

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-16 10:21:13

setconsole中文man

2011-08-24 17:06:42

NOTIFY中文man

2011-08-16 09:32:01

quotaoff中文man

2011-08-23 18:05:21

ABORT中文man

2011-08-25 16:55:26

gets中文man

2011-08-12 11:07:19

git中文man

2011-08-25 17:30:26

setbuf中文man

2011-08-15 13:14:44

rmdir中文man

2011-08-24 17:00:04

netdevice中文man

2011-11-01 13:46:50

中文mantac

2011-08-15 09:55:01

ls中文man

2011-08-24 16:20:09

load中文man

2011-08-25 15:47:06

fopen中文man

2011-08-25 16:25:30

fputs中文man

2011-08-25 10:49:28

rpc中文man

2011-08-25 11:44:36

wtmp中文man
點贊
收藏

51CTO技術棧公眾號

国产亚洲精品久久久久久无几年桃| 人妻熟女一二三区夜夜爱| 99久久精品国产一区二区成人| 午夜久久影院| 精品国产一区二区三区av性色| 好吊妞无缓冲视频观看| www黄在线观看| 国产超碰在线一区| 国产suv精品一区二区三区88区| 国产三级黄色片| 9l亚洲国产成人精品一区二三| 欧美午夜丰满在线18影院| 伊人久久大香线蕉精品| 婷婷av一区二区三区| 蜜桃视频在线观看一区二区| 69av在线视频| 久久高清内射无套| 欧美调教网站| 日韩三级电影网址| 一本久道中文无码字幕av| 在线看女人毛片| 日本一区二区三区视频视频| 国产女人水真多18毛片18精品 | 国产精品三级久久久久久电影| 男女性高潮免费网站| 亚洲最好看的视频| 精品久久人人做人人爱| 一级黄色特级片| 中文在线免费视频| 一区二区三区在线免费| 亚洲欧洲另类精品久久综合| 美女毛片在线看| 99久久精品国产观看| 亚洲www在线| 一级爱爱免费视频| 水蜜桃久久夜色精品一区的特点| 国模私拍视频一区| 国产精品丝袜一区二区| 成人三级视频| 一区二区三区视频免费在线观看| 三级视频网站在线观看| 91麻豆精品激情在线观看最新 | 国产精品久久精品| 9i看片成人免费看片| 亚洲三级网站| 欧美精品videofree1080p| www.色小姐com| 午夜亚洲福利| 欧美美最猛性xxxxxx| 秋霞欧美一区二区三区视频免费 | 粉嫩aⅴ一区二区三区四区五区| 国产日韩av高清| 最近中文在线观看| 人妖欧美一区二区| 国产精品久久久久久av福利软件| 一级黄色大片视频| 免费一级欧美片在线播放| 91精品国产成人www| 日韩欧美激情视频| 亚洲一区二区三区高清不卡| 2025国产精品视频| 中文字幕国产在线观看| 日韩精品一级中文字幕精品视频免费观看 | 玖玖爱在线观看| 中文字幕精品影院| 国产亚洲精品成人av久久ww| 一级黄色录像毛片| 久久中文视频| 欧美精品在线免费观看| 国产在线观看免费av| 亚洲福利精品| 日本精品久久电影| 九九热最新视频| 久草这里只有精品视频| 亚洲一区二区三区sesese| 精品人妻av一区二区三区| 成人午夜视频网站| 久久综合福利| 在线观看av黄网站永久| 亚洲同性gay激情无套| 日韩精品久久一区二区| 擼擼色在线看观看免费| 色视频一区二区| 久久黄色片网站| 伊人久久影院| 亚洲欧美日韩在线一区| 女同久久另类69精品国产| 综合五月婷婷| 日韩av理论片| 国产精品无码免费播放| av动漫一区二区| 手机看片福利永久国产日韩| av免费在线观| 欧美色视频日本版| 亚洲精品永久视频| 久久成人福利| 日韩在线观看免费av| 国产精久久久久久| 日韩在线a电影| 国产高清在线一区二区| 国产在线网站| 一区二区三区欧美| 99视频在线免费| 色妞ww精品视频7777| 精品一区二区三区三区| 国产一区二区精彩视频| 免费视频一区| 国产aⅴ精品一区二区三区黄| 激情视频在线观看免费| 伊人开心综合网| 欧美一级黄色影院| 2023国产精华国产精品| 中文字幕无线精品亚洲乱码一区| 国产污片在线观看| 狠狠v欧美v日韩v亚洲ⅴ| 狠狠色伊人亚洲综合网站色 | 午夜精品www| 97超碰人人模人人人爽人人爱| www.激情成人| 日本在线视频www色| 欧美一级大黄| 亚洲国产小视频在线观看| 老司机成人免费视频| 久久伊人亚洲| 精品国产综合| 2019中文字幕在线电影免费 | 国产精品久久久久久麻豆一区软件 | 国产一区二区0| 亚州欧美一区三区三区在线| 两个人看的在线视频www| 欧美大片一区二区三区| 国产探花在线视频| 麻豆国产精品一区二区三区| 欧美一区免费视频| 精品极品在线| 亚洲成人久久久久| 国产中文字幕免费| 国产成人av影院| 在线观看免费黄色片| 色8久久久久| 在线精品视频视频中文字幕| 四虎成人在线观看| 91丨porny丨最新| 人人妻人人澡人人爽欧美一区双| 国产一区精品二区| 欧美成人在线网站| 国产熟女一区二区三区四区| 亚洲色图欧美激情| 国产美女视频免费看| 色综合天天爱| 91精品久久久久久综合乱菊| 日本美女在线中文版| 欧美日韩国产区一| 黑人狂躁日本娇小| 久久99久久精品| 400部精品国偷自产在线观看| 玖玖精品在线| 久久亚洲精品国产亚洲老地址| 国产精品久久久久久久免费| 综合精品久久久| 免费人成视频在线播放| 欧美日韩视频| 国产一区免费观看| 不卡福利视频| 最近2019中文字幕mv免费看| 国产精品永久久久久久久久久| 亚洲人精品一区| 最好看的中文字幕| 亚洲裸体俱乐部裸体舞表演av| 精品乱色一区二区中文字幕| 女海盗2成人h版中文字幕| 亚洲女人被黑人巨大进入al| 中文字幕第三页| √…a在线天堂一区| 亚洲精品鲁一鲁一区二区三区| 在线精品一区| 色综合视频二区偷拍在线| 深夜日韩欧美| 韩国精品久久久999| 牛牛澡牛牛爽一区二区| 欧美日韩在线观看一区二区| 欧美交换国产一区内射| kk眼镜猥琐国模调教系列一区二区| 92看片淫黄大片一级| 日本大胆欧美| 高清日韩一区| 美女色狠狠久久| 欧美激情区在线播放| 色吊丝在线永久观看最新版本| 欧美三级电影在线观看| 欧美精品成人久久| 91蝌蚪国产九色| 狠狠干狠狠操视频| 亚洲深夜影院| 在线观看视频黄色| 久久aimee| 91精品视频在线看| 高潮一区二区| 九九热精品视频国产| 黄色在线视频观看网站| 欧美成人猛片aaaaaaa| 久久久久久久久久成人| 一片黄亚洲嫩模| 国产精品无码无卡无需播放器| 成人免费视频网站在线观看| 91香蕉视频导航| 亚洲人人精品| 特级黄色录像片| 国产一区二区三区电影在线观看 | 亚洲国产精品日韩专区av有中文| 九九久久99| 国产精品视频一区视频二区| 欧日韩在线观看| 福利写真视频网站在线| 日韩视频免费观看| 欧洲视频在线免费观看| 欧美日韩国产精选| 伊人手机在线视频| 亚洲成人tv网| 青青草免费av| 国产精品久久久久影院老司| 日本aaa视频| av资源站一区| 潘金莲一级淫片aaaaaaa| 老司机一区二区| 少妇性l交大片| 亚洲在线成人| 精品国偷自产一区二区三区| 一区二区三区国产精华| 亚洲人成网站在线播放2019| 沈樵精品国产成av片| 久久久久国产精品视频| 国产乱人伦丫前精品视频| 99在线影院| 91视频成人| 国产日韩欧美视频在线| 天然素人一区二区视频| 青草青草久热精品视频在线网站| h片精品在线观看| 欧美大片第1页| 色婷婷视频在线观看| 欧美成人合集magnet| 精品国产丝袜高跟鞋| 日韩中文字幕不卡视频| 在线观看免费高清完整| 在线亚洲午夜片av大片| 成黄免费在线| 这里只有视频精品| 中国日本在线视频中文字幕| 最近2019中文免费高清视频观看www99| av播放在线观看| 日韩在线视频国产| 欧美激情二区| 久久成人精品一区二区三区| av免费在线网站| 欧美精品videofree1080p| 丰乳肥臀在线| 亚州成人av在线| 忘忧草在线日韩www影院| 奇米成人av国产一区二区三区| 丝袜诱惑一区二区| 日本精品一区二区三区在线播放视频 | 欧美精品日本| 成年人网站免费视频| 免费看亚洲片| 国产亚洲视频一区| 国产乱子伦一区二区三区国色天香| 黄色片子免费看| 北条麻妃一区二区三区| 国精产品一区一区三区免费视频| 久久久精品蜜桃| 夫妻性生活毛片| 亚洲午夜精品久久久久久久久| 午夜精品三级久久久有码| 91久久精品网| 国产欧美久久久精品免费| 精品99久久久久久| 黄色电影免费在线看| 久久精品国产久精国产一老狼| av小次郎在线| 1769国内精品视频在线播放| 日韩一区二区三区免费视频| 96国产粉嫩美女| 超碰一区二区三区| 日韩激情视频| 欧美日韩国产精品一区二区亚洲| 久色视频在线播放| 秋霞午夜鲁丝一区二区老狼| 精品无码av一区二区三区不卡| 91视频观看视频| 欧美一区免费观看| 日韩欧美国产激情| 97超碰国产在线| 亚洲欧美日韩久久久久久 | 亚洲91精品在线| 日韩漫画puputoon| 国产超碰91| 日韩精品1区| 男女激情无遮挡| 久久精品国产一区二区三| 国产人成视频在线观看| 国产精品久久久久久久久免费相片| 久久久精品99| 欧美日韩高清在线播放| 日韩一级免费毛片| 久久久精品一区二区| 美女福利一区二区三区| 成人xxxxx色| 色一区二区三区四区| 丰满少妇被猛烈进入高清播放| 国产一区二区不卡老阿姨| 精品一区二区三区蜜桃在线| 亚洲大片一区二区三区| 国产精品嫩草影院桃色| 亚洲欧美日韩国产中文| 后进极品白嫩翘臀在线播放| 成人妇女淫片aaaa视频| 俺要去色综合狠狠| 北条麻妃在线视频观看| 国产成人亚洲综合a∨婷婷| 91狠狠综合久久久久久| 一本大道久久a久久综合| 神马久久久久久久久久| 欧美精品日韩三级| 亚洲老司机网| 亚洲精品一区二区三区四区五区 | 亚洲第一福利一区| 99久久精品国产一区色| 色香阁99久久精品久久久| xxx欧美xxx| 欧美日韩一区在线观看视频| 精品动漫一区| youjizz.com日本| 亚洲精品视频免费看| 国产精品久久免费| 色伦专区97中文字幕| 亚洲成av在线| 日韩妆和欧美的一区二区| 午夜亚洲一区| 国精品无码人妻一区二区三区| 午夜欧美在线一二页| 人妻va精品va欧美va| 久久久久久有精品国产| 999国产精品一区| 日本福利视频网站| 成人听书哪个软件好| 久久久久久久久久99| 欧美成人aa大片| av第一福利在线导航| 国产九色精品| 亚洲一区二区免费看| 欧美做受xxxxxⅹ性视频| 色婷婷久久久久swag精品| 免费资源在线观看| 热久久这里只有精品| 精品欧美久久| 亚洲一区二区三区观看| 一区二区视频在线| 欧美一区二区黄片| 91av在线网站| 欧洲毛片在线视频免费观看| 性欧美videossex精品| 成人欧美一区二区三区小说| jizz国产视频| 久久全国免费视频| 美女精品一区最新中文字幕一区二区三区| 黄色免费视频大全| 国产欧美综合在线| 国产乱淫av片免费| 久久久久久91香蕉国产| 亚洲小说图片| 天天干天天玩天天操| 伊人夜夜躁av伊人久久| 五月婷婷在线播放| 国产精品久久久久久久久久99| 香蕉视频官网在线观看日本一区二区| 日韩精品xxx| 一本久道久久综合中文字幕| 幼a在线观看| 国内精品久久国产| 日韩av电影天堂| 久久艹精品视频| 亚洲欧美制服丝袜| 91成人在线网站| 亚洲中文字幕无码专区| 国产精品久久久一区麻豆最新章节| 亚洲av无码一区二区乱子伦| 91超碰caoporn97人人| 99国内精品久久久久久久| 岛国av免费观看| 欧美三级视频在线观看| av福利在线导航| 亚洲视频欧美在线| 成人免费福利片| 亚洲香蕉在线视频| 91精品国产91久久| 欧美精品18| 大胸美女被爆操| 日韩av一区二区在线观看| 日本国产亚洲|