termio.4
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 4 代码 · 共 729 行 · 第 1/2 页
4
729 行
the corresponding uppercase letter.This function is often used in conjunction with IUCLCS..PPIf ONLCR is set, the NL character is transmitted as the CR-NLcharacter pair.If OCRNL is set, the CR character is transmitted as the NLcharacter.If ONOCR is set, no CRcharacter is transmitted when at column 0 (first position).If ONLRET is set, the NLcharacter is assumed to do the carriage-return function;the column pointer is set to 0 and the delays specifiedfor CR are used. Otherwise, the NL character is assumedto do just the line-feed function;the column pointer remains unchanged.The column pointer is also set to 0, if the CRcharacter is actually transmitted..PPThe delay bits specify how longtransmission stops to allow for mechanical or other movementwhen certain characters are sent to the terminal.In all cases, a value of 0 indicates no delay.If OFILL is set,fill characters is transmittedfor delay instead of a timed delay.This is useful for high baud rate terminalsthat need only a minimal delay.If OFDEL is set, the fill character is DEL,otherwise it is NUL..PPIf a form-feed or vertical-tab delay is specified,it lasts for about two seconds..PPA newline delay lasts about 0.10 seconds.If ONLRET is set, the carriage-return delays areused instead of the newline delays.If OFILL is set, two fill characters is transmitted..PPA carriage-return delay type 1 is dependent on the current columnposition. The type 2 delay is about 0.10 seconds;the type 3 delay is about 0.15 seconds.If OFILL is set,delay type 1 transmits two fill characters;type 2 transmits four fill characters..PPA horizontal-tab delay type 1 is dependent on the currentcolumn position.The type 2 delay is about 0.10 seconds.Type 3 specifies that tabs are to be expanded into spaces.If OFILL is set, two fill characters is transmitted for any delay..PPA backspace delay lasts about 0.05 seconds.If SM OFILL is set, one fill character will be transmitted..PPThe actual delays depend on line speed and system load..PPThe initial output control value is all bits clear..PPThe.I c_cflagfield describes the hardware control of the terminal:.PP.ta 13n.nfCBAUD Baud rate:B0 Hang upB50 50 baudB75 75 baudB110 110 baudB134 134.5 baudB150 150 baudB200 200 baudB300 300 baudB600 600 baudB1200 1200 baudB1800 1800 baudB2400 2400 baudB4800 4800 baudB9600 9600 baudB19200 19200 baudB38400 38400 baudEXTA External A (Same as B19200)EXTB External B (Same as B38400).spCSIZE Character size:CS5 5 bitsCS6 6 bitsCS7 7 bitsCS8 8 bitsCSTOPB Send two stop bits, otherwise one.CREAD Enable receiver.PARENB Parity enable.PARODD Odd parity, otherwise even.HUPCL Hang up on last close.CLOCAL Local line, otherwise dial-up..fi.PPThe CBAUD bits specify the baud rate.The zero baud rate, B0, is used to hang up the connection.If B0 is specified, the data-terminal-ready signal will notbe asserted.Normally, this will disconnect the line.For any particular hardware, impossible speed changesare ignored..PPThe CSIZEbits specify the character size in bitsfor both transmission and reception.This size does not include the parity bit, if any.If CSTOPB is set, two stop bits are used;otherwise, only one stop bit is used.For example, at 110 baud, two stops bits are required..PPIf PARENB is set, parity generation and detection is enabledand a parity bit is added to each character.If parity is enabled,the PARODD flag specifies odd parity, if set.Otherwise, even parity is used..PPIf CREAD is set, the receiver is enabled.Otherwise, no characters will be received..PPIf HUPCL is set, the line will be disconnectedwhen the last process with the line open closes it or terminates.That is, the data-terminal-ready signal will not be asserted..PPIf CLOCAL is set, the line is assumed to be a local, direct connectionwith no modem control.Otherwise, modem control is assumed..PPThe initial hardware control value after open isB300, CS8, CREAD, HUPCL..PPThe.I c_lflagfield of the argument structureis used by the line discipline to control terminal functions.The basic line discipline (0) provides the following:.PP.ta 13n.nfISIG Enable signals.ICANON Canonical input (erase and kill processing).XCASE Canonical upper/lower presentation.ECHO Enable echo.ECHOE Echo erase character as BS-SP-BS.ECHOK Echo NL after kill character.ECHONL Echo NL.NOFLSH Disable flush after interrupt or quit..DT.fi.PPIf ISIG is set,each input character is checked against the specialcontrol characters INTR, SWTCH, and QUIT.If an input character matches one of these control characters,the function associated with that character is performed.If ISIG is not set,no checking is done.Thus, these special input functionsare possible only if ISIG is set.These functions can be disabled individually by changingthe value of the control character toan unlikely or impossible value (for example, 0)..PPIf ICANON is set,canonical processing is enabled.This enables the erase and kill edit functions,and the assembly of input characters into lines delimited by NL,EOF, and EOL.If ICANON is not set,read requests are satisfied directlyfrom the input queue.A read is not satisfied until at least MINcharacters have been received, orthe timeout value, TIME, has expired between characters.This allows fast bursts of input to be readefficiently, while still allowing singlecharacter input.The MIN and TIME values are stored in the position for the EOF and EOLcharacters, respectively.The time value represents tenths of seconds..PPIf XCASE is set and if ICANON is set,an upper-case letter is accepted on input by precedingit with a backslash (\\), and is output preceded by a backslash (\\).In this mode, the following escape sequences are generatedon output and accepted on input:.br.PP.nffor \` | ~ { }use \e\|\' \e\|! \e\|^ \e\|( \e\|).fi.PPFor example,.B Ais input as.BR \ea ,.B \enas.BR \e\en ,and.B \eNas.BR \e\e\en ..PPIf ECHO is set, characters are echoed as received..PPWhen ICANON is set, the following echo functions are possible.If ECHO and ECHOE are set, the erase character is echoed as ASCIIBS SP BS, which clears the last character from a CRT screen.If ECHOE is set and ECHO is not set,the erase character is echoed as ASCII SP BS.If ECHOK is set, the NL character is echoed after thekill character to emphasize that the lineis deleted.Note that an escape character precedingthe erase or kill character removes any special function.If ECHONL is set, the NLcharacter is echoed, even if ECHO is not set.This is useful for terminalsset to local echo (so-called half duplex).Unless escaped, the EOF character is not echoed.Because EOT is the default EOF character,terminals that respond to EOT are prevented from hanging up..PPIf NOFLSH is set, the normal flush of the input and output queuesassociated with the quit, switch, and interrupt characterswill not be done..PPThe initial line-discipline control value isall bits clear..PPThe.I c_linefield of the argument structureis used to specify the line discipline.Support is provided for the basic termio line discipline only.For this reason, the value of this field is irrelevant andshould be set to zero (0) by convention..PPThe primary.MS ioctl 2system calls have the form:.PP.B ioctl (fildes, command, arg).br.B struct termio *arg;.PPThe commands using this form are:.TP 13TCGETAGet the parameters associated with the terminaland store in the.I termiostructure referenced by.IR arg ..TPTCSETASet the parameters associated with the terminalfrom the structure referenced by.IR arg .The change is immediate..TPTCSETAWWait for the output to drain beforesetting the new parameters.This form should be used when changing parametersthat will affect output..TPTCSETAFWait for the output to drain,then flush the input queue andset the new parameters..PPAdditional.MS ioctl 2calls have the form:.PP.B ioctl (fildes, command, arg).br.B int arg;.PPThe commands using this form are:.TP 13TCSBRKWait for the output to drain.If.I argis 0,send a break (zero bits for 0.25 seconds)..TPTCXONCStart/stop control.If.I argis 0, suspend output;if 1, restart suspended output..TPTCFLSHIf.I argis 0, flush the input queue;if 1, flush the output queue;if 2, flush both the input and output queues..PPMIN/TIME Interaction.PPMIN represents the minimum number of characters that should be received when the read is satisfied (that is, the characters are returned to theuser).TIME is a timer of 0.10 second granularity used to time-out bursty andshort-term data transmissions. The four possible values forMIN and TIME and their interactions follow:1. MIN > 0, TIME > 0.In this case, TIMEserves as an intercharacter timer activated after the first character isreceived and reset upon receipt of each character.MIN and TIME interact as follows:.PPAs soon as one character is received the intercharacter timer is started..PPIf MINcharacters are received before the intercharacter timer expires, theread is satisfied..PPIf the timer expires before MINcharacters are received, the characters received to that point arereturned to the user..PPA.MS read 2operation will sleep until the MIN and TIME mechanism are activated by the receipt of the first character; thus,at least one character must be returned..PP2.MIN > 0, TIME = 0.In this case, because TIME = 0, the timer plays no role and onlyMIN is significant. A.MS read 2operation is not satisfied until MIN characters are received..PP3.MIN = 0, TIME > 0.In this case, because MIN = 0, TIMEno longer serves as an intercharacter timer, but now serves as a readtimer that is activated as soon as the .MS read 2operation is processed. A.MS read 2 operation is satisfied as soon as a single character is received or the timer expires, in which case, the .MS read 2operation would not return any characters..PP4.MIN = 0, TIME = 0.In this case, return is immediate. If characters are present,they are returned to the user.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?