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

tcsendbreak 中文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 18:14:26

tcflow中文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
點贊
收藏

51CTO技術棧公眾號

亚洲精品成人| 欧美色网在线| 波多野洁衣一区| 欧美在线性爱视频| www..com.cn蕾丝视频在线观看免费版 | 欧美在线三级| 精品国产一区二区三区久久影院 | 一区视频在线| 久久亚洲精华国产精华液 | av高清不卡| 国产精品久久久一本精品 | 中文成人综合网| 亚洲r级在线观看| 青青操免费在线视频| 日韩精品中文字幕第1页| 日韩女优av电影| 黄色av免费在线播放| 怡红院在线播放| 久久色在线视频| 北条麻妃高清一区| 国产免费www| 黄色欧美日韩| 久久视频在线免费观看| 女~淫辱の触手3d动漫| 老司机福利在线视频| 亚洲国产精品一区制服丝袜| 亚洲色图综合久久| 岳毛多又紧做起爽| 成人高清免费在线| 国产欧美精品一区二区色综合朱莉| 亚洲一区二区三区四区在线播放 | 欧美特黄一级| 一本久久综合亚洲鲁鲁| av黄色一级片| 日韩精品一区二区三区免费视频| 欧美优质美女网站| 国产乱子夫妻xx黑人xyx真爽| 午夜小视频福利在线观看| 国产偷国产偷精品高清尤物| 国产亚洲福利社区| www.久久综合| 精品亚洲欧美一区| 国产精品视频久| 亚洲天堂男人av| 亚洲美女视频在线免费观看| 欧美大片欧美激情性色a∨久久| 不卡中文字幕在线观看| 日韩电影网站| 欧美日韩亚洲高清| 免费不卡av在线| 天堂成人av| 亚洲另类春色国产| 懂色av一区二区三区四区五区| 成人在线免费观看| 国产亚洲视频系列| 欧美一区亚洲二区| 国产在线色视频| 久久精品无码一区二区三区| 国产精品成人国产乱一区| 天天操天天摸天天干| 影音先锋一区| 午夜精品一区二区三区在线播放| 国产亚洲色婷婷久久99精品| 韩日成人av| 久久久久久久久爱| 日韩高清免费av| 一本久道久久综合狠狠爱| 久久久久久久电影一区| 国产午夜免费视频| 悠悠资源网久久精品| 久久理论片午夜琪琪电影网| 久久精品国产亚洲AV无码男同| 亚洲经典在线看| 91av成人在线| 色老头一区二区| 日本一不卡视频| 久久精品亚洲国产| 黄色一级片中国| 在线日韩网站| 亚洲系列中文字幕| 老司机福利在线观看| 91久久高清国语自产拍| 欧美另类99xxxxx| 在线免费观看毛片| 亚洲影音先锋| 精品国偷自产在线视频| 人人澡人人澡人人看| 欧美 日韩 国产一区二区在线视频 | 日本中文字幕不卡免费| 日本熟妇一区二区三区| 极品美女销魂一区二区三区| 超碰97人人人人人蜜桃| 亚洲欧美日韩动漫| 国产精品区一区二区三| 免费观看亚洲视频| 亚洲欧美小说色综合小说一区| 欧美性受极品xxxx喷水| 中文字幕第66页| 欧美在线关看| 日韩中文字幕视频| 国产精品成人国产乱| 久久久蜜桃一区二区人| 91在线免费视频| 日本中文字幕电影在线观看| 激情欧美日韩一区二区| 成人91视频| 电影av在线| 亚洲成va人在线观看| 国产视频一区二区视频| 亚洲一区二区三区在线免费| 一本一本久久a久久精品牛牛影视 一本色道久久综合亚洲精品小说 一本色道久久综合狠狠躁篇怎么玩 | 91在线播放网址| 91一区二区三区| 你懂的免费在线观看视频网站| 亚洲欧美一区二区视频| 怡红院av亚洲一区二区三区h| 亚洲一区二区小说| 精品一区二区亚洲| 九九视频免费在线观看| 免费精品视频最新在线| 国产精品中出一区二区三区| 亚洲xxxxxx| 欧美视频在线观看免费网址| 国产成人强伦免费视频网站| 久草成人在线| 久久男人资源视频| 国产日韩在线观看一区| 国产欧美日韩在线看| 一二三四视频社区在线| 精品国产欧美| 日韩中文字幕在线| 无码人妻精品一区二| zzijzzij亚洲日本少妇熟睡| 欧美xxxx吸乳| 福利一区二区三区视频在线观看| 日韩激情第一页| 国产在线视频在线观看| 国产一区二区三区四区五区美女 | 精品中文一区| 欧美精品videossex性护士| 一级黄色片在线| 国产精品色在线观看| 国产福利视频在线播放| 日本久久成人网| 2020久久国产精品| 日本毛片在线观看| 亚洲成av人片在线观看无码| 丰满人妻一区二区三区53视频| 91欧美在线| 国产精品极品美女粉嫩高清在线| 欧美孕妇性xxxⅹ精品hd| 亚洲成人av在线电影| 在线中文字日产幕| 欧美视频导航| 国产欧美欧洲| 极品av在线| 国产丝袜视频一区| 久草视频一区二区| 国产日本欧洲亚洲| 天堂网在线免费观看| 91亚洲精品在看在线观看高清| 亚洲深夜福利在线| 最好看的日本字幕mv视频大全| 精品在线视频一区| 亚洲一区二区三区乱码| av在线免费网站| 欧美一级片免费看| 久久艹精品视频| 波多野结衣在线一区| 成人综合视频在线| 国产一区二区电影在线观看| 国产精品亚发布| www.久久ai| 亚洲国产成人一区| 国产无遮挡呻吟娇喘视频| 久久久亚洲高清| 亚洲男人天堂色| 99成人在线视频| av一区二区三区四区电影| 国产高清自产拍av在线| 亚洲人成免费电影| 国产精品国产精品国产专区| 一区二区三区在线免费播放| 99久久激情视频| 青青草成人影院| 91在线视频免费| 久久电影网站| 亚洲午夜久久久久久久| 国产三级午夜理伦三级| 午夜视频在线观看一区| 日韩中文字幕有码| 国产成人精品一区二区三区四区 | 日韩极品一区| 国产精品美乳在线观看| av免费网站在线观看| 亚洲精品一区二区精华| 一级特黄免费视频| 亚洲乱码日产精品bd | 久久久久久亚洲综合| 中文字幕精品一区二区三区在线| 国产精品www994| 亚洲国产精品一区二区第一页| 亚洲一区二区三区免费| 国产成人精品视频| 国产三线在线| 在线精品91av| 天堂在线中文网| 欧美女孩性生活视频| 国产五月天婷婷| 国产精品福利电影一区二区三区四区| 国产51自产区| 精品一区二区日韩| 99久久久无码国产精品6| 欧美激情性爽国产精品17p| 牛人盗摄一区二区三区视频| 日韩三级网址| 国产剧情久久久久久| 看黄在线观看| 欧美国产欧美亚洲国产日韩mv天天看完整| 极品美乳网红视频免费在线观看| 精品国产一二三| 一级特黄aaaaaa大片| 色噜噜狠狠成人网p站| av av在线| 欧美日韩精品| 亚洲一区二区三区免费观看| 综合综合综合综合综合网| 成人精品水蜜桃| 9999在线精品视频| 国产精品吹潮在线观看| 日韩深夜视频| 久久久噜噜噜久噜久久| www.久久久久.com| 日韩在线观看av| www.亚洲资源| 亚洲人成电影网站色| 色在线免费视频| 亚洲成在人线av| 成人黄色免费视频| 欧美一区二区三区喷汁尤物| 中文字幕在线播放不卡| 在线精品视频免费观看| 一级黄色av片| 一本色道久久综合亚洲精品按摩| 亚洲综合一二三| 亚洲国产精品久久人人爱蜜臀| 欧美色图一区二区| 91美女福利视频| 少妇户外露出[11p]| 成人免费高清在线观看| 国产乱国产乱老熟300部视频| 国产精品一区二区三区四区| 免费欧美一级片| 国产精品亚洲人在线观看| www.51色.com| 国产一区二区三区观看| 欧美一级免费在线| 国产剧情一区二区| 91精品国产高清91久久久久久 | 稀缺小u女呦精品呦| 国产成人在线色| 在线xxxxx| 99re热这里只有精品视频| 国产网站无遮挡| 日本午夜精品视频在线观看| 久章草在线视频| 天堂成人国产精品一区| 激情视频免费网站| 国产一区二区影院| 亚洲一级Av无码毛片久久精品| 成人av在线资源网站| 日韩网站在线播放| 欧美国产禁国产网站cc| 天天操夜夜操av| 亚洲在线视频网站| 天天操夜夜操视频| 欧美日韩一区视频| 日本特黄特色aaa大片免费| 黄色成人av在线| 中文字幕在线天堂| 91精品国产欧美一区二区成人| 性一交一乱一乱一视频| 日韩av影片在线观看| 黄色片在线免费看| 久久国内精品一国内精品| 懂色av一区| 国产精品9999| 无人区乱码一区二区三区| 精品麻豆av| 亚洲精品影片| 亚洲v在线观看| 亚洲av人无码激艳猛片服务器| 黑人巨大精品| 在线亚洲观看| 日韩欧美中文字幕一区| 国产在线拍揄自揄拍无码| 国产精品综合在线| 国产欧美自拍| av毛片精品| 国产成人精品aa毛片| 精品福利在线导航| 亚洲最大成人网色| 青青草成人免费视频| 国产在线视频你懂得| 在线综合亚洲| 日韩有码在线观看| 日韩在线一卡二卡| 国产精品美女久久久久久久| 久久亚洲精品大全| 精品视频一区三区九区| 欧美一区二不卡视频| 色视频www在线播放国产成人| 欧洲一区二区三区| 国产欧美日韩精品专区| 欧美日韩在线中文字幕| 日韩中文字幕在线| 中文在线最新版地址| 亚洲自拍小视频| 激情综合网五月| 少妇高潮喷水在线观看| 国内不卡的二区三区中文字幕| 日本高清www| 亚洲专区一二三| 97超碰人人草| 亚洲欧美激情精品一区二区| 免费网站在线观看人| 成人网址在线观看| 日本欧美视频| 337p粉嫩大胆噜噜噜鲁| 丁香六月久久综合狠狠色| 国产男女猛烈无遮挡在线喷水| 色www精品视频在线观看| 人妻偷人精品一区二区三区| 欧美成人全部免费| 日韩国产一二三区| 日韩精彩视频| 免费国产自线拍一欧美视频| 99re久久精品国产| 亚洲第一在线综合网站| 亚洲国产精品久久人人爱潘金莲| 久久精品色欧美aⅴ一区二区| 成人国产精选| 色综合电影网| 日本午夜精品视频在线观看| 亚洲av无码一区二区三区人| 欧美性感美女h网站在线观看免费| 日本黄色一区二区三区| 国模精品一区二区三区色天香| 亚洲va欧美va人人爽成人影院| 亚洲啊啊啊啊啊| 国产精品乡下勾搭老头1| 日本青青草视频| 欧美一区二区私人影院日本| www国产在线观看| 91中文字精品一区二区| 国产综合久久| 岛国精品资源网站| 一本大道久久a久久精二百| 撸视在线观看免费视频| 国产精品99久久99久久久二8| sdde在线播放一区二区| www.超碰97.com| 亚洲精品一二三区| 风流少妇一区二区三区91| 97精品一区二区视频在线观看| 看全色黄大色大片免费久久久| 成人免费aaa| 国产亚洲女人久久久久毛片| 凹凸精品一区二区三区| 色悠悠久久久久| 免费观看亚洲天堂| 国产九色porny| www国产精品av| 真实的国产乱xxxx在线91| 日韩中文字幕视频在线| aiss精品大尺度系列| 妞干网在线观看视频| 久久久久久久久久久99999| 中文字幕在线观看视频一区| 欧美猛交免费看| 天堂成人娱乐在线视频免费播放网站 | 免费观看日批视频| 日韩中文字幕久久| av日韩精品| 国产激情在线观看视频| 成人免费一区二区三区视频| 成人小说亚洲一区二区三区| 欧美在线视频观看| 我不卡影院28| 色噜噜在线观看| 欧美男男青年gay1069videost | 天堂中文在线资源| 国产91在线视频| 亚洲国产精品久久久久蝴蝶传媒| 香蕉在线观看视频| 欧美性生活大片视频| 任你弄在线视频免费观看| 奇米影视首页 狠狠色丁香婷婷久久综合 | 99久久精品国产麻豆演员表| 国产亚洲欧美日韩高清|