精品欧美一区二区三区在线观看 _久久久久国色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毛片基地| 白嫩亚洲一区二区三区| 亚洲制服丝袜一区| 欧美乱偷一区二区三区在线| 亚洲第一区av| 欧美成人嫩草网站| 亚洲国产精品电影在线观看| 北条麻妃在线视频| 国产欧美黑人| 床上的激情91.| 日本伊人精品一区二区三区介绍 | 日韩精品久久久免费观看| 夜夜爽8888| 99在线|亚洲一区二区| 亚洲天堂av在线播放| 狠狠操狠狠干视频| 波多野结衣在线播放| 高潮按摩久久久久久av免费| 亚洲成人一区二区| 日本在线播放一区| 国产男女无套免费网站| 综合天堂av久久久久久久| 欧美草草影院在线视频| 国产麻花豆剧传媒精品mv在线| 暖暖日本在线观看| av不卡一区二区三区| 国产精品日韩电影| 国产精品第9页| 外国成人免费视频| 一区二区亚洲精品国产| 亚洲精品在线网址| 日日av拍夜夜添久久免费| 亚洲精品高清在线| 日韩国产美国| 日本韩国免费观看| 精品一区二区三区的国产在线播放| 久久久久中文字幕2018| 日韩在线不卡av| 九九视频免费观看视频精品| 日韩精品在线一区| 污视频网站观看| 亚洲国产成人二区| 亚洲激情图片小说视频| 亚洲资源视频| 国产51人人成人人人人爽色哟哟| k8久久久一区二区三区| 不卡视频一区二区| 国产三级精品在线观看| 日韩精品亚洲专区| 2025国产精品视频| 国产一级在线播放| 国产精品99一区二区三| 亚洲一区第一页| 中文幕无线码中文字蜜桃| 成人影院中文字幕| 日韩精品专区在线影院重磅| 手机免费av片| 88xx成人网| 91成人网在线| 青青青国产在线视频| 国精产品一区一区三区mba下载| 亚洲欧洲成人av每日更新| 日韩一区二区三区高清| 毛片网站在线| 国产91精品露脸国语对白| 91青青草免费在线看| www久久久久久| 国产一区亚洲一区| 国产精品视频内| 日韩xxx视频| 免费成人在线影院| 国产精品入口免费视频一| 午夜精品久久久久久久蜜桃| 蜜桃久久av| 国产精品视频不卡| 91精品国自产| 国产成人精品三级| 国产精品一区二| 污视频在线免费| 92国产精品观看| 欧美日韩亚洲在线| 国产露出视频在线观看| 欧美国产激情一区二区三区蜜月| 日韩午夜视频在线观看| 嫩草在线视频| 亚洲成av人**亚洲成av**| 亚洲 自拍 另类小说综合图区| 韩国精品一区| 日本高清免费不卡视频| 亚洲免费成人在线视频| 免费精品一区| 亚洲精品xxx| 亚洲女优在线观看| 亚洲91视频| 久久久久久国产精品| 久久久久久91亚洲精品中文字幕| 亚洲国产99| 国产精品aaaa| 国产一区二区三区中文字幕| 国产suv精品一区二区三区| 精品日本一区二区三区| 天天色棕合合合合合合合| 久久一夜天堂av一区二区三区| 亚洲午夜激情| free性欧美16hd| 色欧美日韩亚洲| 在线观看av免费观看| 久草在线综合| 色婷婷**av毛片一区| 欧美日韩精品亚洲精品| 久久三级福利| 97欧洲一区二区精品免费| 欧洲亚洲精品视频| 亚洲另类在线制服丝袜| 中文字幕乱码人妻综合二区三区| 国产高清亚洲| 亚洲精品一区二区在线| 影音先锋欧美资源| 色呦呦在线观看视频| 亚洲国产另类av| 一级黄色录像在线观看| 欧美黄色网视频| 久久香蕉国产线看观看av| 91精品国产乱码久久久张津瑜| 美国欧美日韩国产在线播放| 国产一级特黄a大片99| caoporn国产精品免费视频| 亚洲一区二区中文在线| 亚洲一级免费观看| 欧美一级色片| 另类少妇人与禽zozz0性伦| 无码人妻丰满熟妇区五十路| 成人污污视频在线观看| 影音先锋在线亚洲| 成人啊v在线| 欧美精品一区二区三区四区 | 91丨九色丨国产丨porny| 亚洲免费av网| 国产一区二区主播在线| 精品视频久久久久久| 毛片aaaaa| 国产乱码精品一区二区三| 亚洲精品高清视频| 国产欧美一区二区三区精品酒店| 精品免费一区二区三区| 国产精品免费人成网站酒店 | 国产精品国产三级国产有无不卡| 国产成人精品视频免费看| 超碰成人福利| 欧美人在线观看| 99er热精品视频| 国产精品电影一区二区三区| xxxx一级片| 欧美中文一区| 欧美亚洲伦理www| 亚洲aaaaaaa| 五月综合激情网| 黄色性生活一级片| 国产欧美日韩一区二区三区在线| 成人区精品一区二区| 日本亚洲精品| 欧美久久一区二区| 艳妇荡乳欲伦69影片| 久久aⅴ国产欧美74aaa| 日韩国产精品一区二区| 精品九九久久| 久久精品视频网站| a在线观看免费| 一区二区三区在线观看网站| 亚洲 自拍 另类 欧美 丝袜| 欧美日韩精选| 官网99热精品| 人在线成免费视频| 精品无人国产偷自产在线| 日韩久久中文字幕| 久久九九国产精品| 色乱码一区二区三区在线| 97精品在线| 3d蒂法精品啪啪一区二区免费| 金瓶狂野欧美性猛交xxxx| 欧美精品一区二区久久婷婷| 强乱中文字幕av一区乱码| 国产福利不卡视频| 国产原创中文在线观看| 最新亚洲精品| 国产欧美日韩高清| 色黄网站在线观看| 亚洲精品720p| 免费黄色网址在线| 国产精品久久久久久久久免费相片| 看看黄色一级片| 欧美日韩1080p| 久久免费看av| 亚洲aⅴ网站| 国内精品久久久久久影视8| 深夜福利视频在线观看| 欧美日韩五月天| 精品无码久久久久| 国产午夜精品久久| 亚洲 自拍 另类 欧美 丝袜| 久久精品亚洲一区二区| 91制片厂免费观看| 自拍自偷一区二区三区| 成人写真视频福利网| 麻豆mv在线观看| 综合久久五月天| 欧美一级特黄aaaaaa| 欧美天堂亚洲电影院在线播放| 1024手机在线视频| 国产欧美精品一区aⅴ影院| 色欲无码人妻久久精品| 噜噜爱69成人精品| 亚洲国产欧美日韩| 国内精品国产成人国产三级粉色| 国产精品欧美亚洲777777| 黄页网站大全在线免费观看| 夜夜嗨av色一区二区不卡| 国产黄色av片| 日韩欧美在线网址| 欧美高清视频一区二区三区| 亚洲国产精品精华液2区45| 稀缺小u女呦精品呦| 久久国产人妖系列| 路边理发店露脸熟妇泻火| 红桃成人av在线播放| 成人国产精品久久久久久亚洲| 正在播放日韩精品| 欧美激情在线视频二区| 无遮挡动作视频在线观看免费入口| 精品国产第一区二区三区观看体验| 中文字字幕在线中文| 亚洲综合色噜噜狠狠| www.99re6| 91丨国产丨九色丨pron| 亚洲性图第一页| 精品一区二区三区香蕉蜜桃| 亚洲福利精品视频| 久久国产福利| 国产老熟妇精品观看| 都市激情久久| 99久热re在线精品视频| 亚洲专区**| 国产高清一区视频| 嫩草国产精品入口| 久久精品一区二区三区不卡免费视频 | 性感美女一级片| 精品国产髙清在线看国产毛片| 亚洲国产精品久久久久久6q| 精品国产乱码久久久久久1区2区| 免费看av毛片| 日韩精品在线观看网站| 久久经典视频| 在线观看中文字幕亚洲| 日本视频在线| 欧美激情视频一区| 理论片午夜视频在线观看| 人体精品一二三区| 一二区成人影院电影网| 91在线视频导航| 91麻豆精品激情在线观看最新| 国产欧美在线一区二区| 九九精品久久| 四虎免费在线观看视频| 国产精品久久| 无码aⅴ精品一区二区三区浪潮 | 秋霞电影一区二区| 午夜免费视频网站| 97久久人人超碰| 欧美一区二区三区粗大| 一区二区三区免费看视频| 日本一级片免费看| 欧美丝袜第三区| 亚洲av永久纯肉无码精品动漫| 亚洲激情在线视频| 97电影在线观看| 欧美黑人性猛交| 日本精品不卡| 91精品视频网站| 日本亚洲不卡| 艳母动漫在线免费观看| 国产精品社区| 波多野结衣国产精品| 成人av网站免费观看| 国产欧美小视频| 亚洲大片在线观看| 在线免费看av片| 日韩av在线网站| 久久99精品久久| 人人爽久久涩噜噜噜网站| 免费精品一区| 视频在线精品一区| av成人黄色| 伊人免费视频二| 国产校园另类小说区| 久久精品国产亚洲av高清色欲| 在线欧美日韩国产| 人妻少妇精品无码专区久久| zzijzzij亚洲日本成熟少妇| 松下纱荣子在线观看| 99久久99久久精品国产片| 国产一区国产二区国产三区| 成人网站免费观看入口| 九九在线精品视频| 精品无人区无码乱码毛片国产| 亚洲男女一区二区三区| 国产一区二区视频免费| 亚洲成人激情在线| 亚洲第一图区| 91免费欧美精品| 日韩电影在线视频| 黄色一级一级片| 99re这里只有精品视频首页| 欧美久久久久久久久久久久| 欧美乱妇15p| 成人资源www网在线最新版| 91精品成人久久| 在这里有精品| 蜜桃网站在线观看| 国产一区三区三区| 日韩激情小视频| 欧美日韩免费高清一区色橹橹| 欧美xxx.com| 欧美一级片一区| 日韩欧美ww| 欧美s码亚洲码精品m码| 91亚洲精品久久久蜜桃网站| 国产无码精品在线观看| 欧美成人欧美edvon| 婷婷丁香在线| 97se国产在线视频| 国产精品theporn| 精品国产一二区| 亚洲一区二区在线视频| 免费av网站观看| 97成人在线视频| 亚洲瘦老头同性70tv| 妺妺窝人体色www在线小说| 92精品国产成人观看免费| 国产又大又黄视频| 亚洲美女在线视频| 欧美日韩免费看片| 日韩欧美一区二区三区四区 | 精品久久久久久久久久久久| 日韩在线视频免费| 欧美亚洲视频一区二区| 欧美日韩播放| 国产福利影院在线观看| 国产精品灌醉下药二区| 国产熟女一区二区三区四区| 欧美成人合集magnet| 大奶在线精品| 69堂免费视频| 国产亚洲一二三区| 在线观看免费视频一区| 久久久精品久久久| theporn国产在线精品| 欧美啪啪免费视频| 久久九九久久九九| 国产美女永久免费| 久久久久久久久亚洲| 另类春色校园亚洲| 成人免费在线观看视频网站| 亚洲色图视频免费播放| 性生交大片免费看女人按摩| 久久免费国产视频| 国产成人黄色| 午夜xxxxx| 婷婷久久综合九色综合绿巨人| 国产三级在线免费观看| 成人字幕网zmw| 亚洲视频日本| 中文字幕免费在线看线人动作大片| 91精品免费观看| 激情aⅴ欧美一区二区欲海潮| 日韩欧美一区二区视频在线播放| 国产中文字幕一区| 在线观看免费国产视频| 日韩在线中文视频| 麻豆精品少妇| 日本高清一区二区视频| 欧美日韩国产一中文字不卡 | 亚洲三级在线免费观看| 午夜一区在线观看| 国产三级精品网站| 国产亚洲网站| 亚洲天堂黄色片| 亚洲色图校园春色| 亚洲一二av| 777视频在线| 欧美日韩国产麻豆| 怡红院av在线| 亚洲ai欧洲av| 91在线视频免费观看|