termio.4

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 4 代码 · 共 729 行 · 第 1/2 页

4
729
字号
.TH termio 4.SH Nametermio \- System V terminal interface.SH Description.PPThis section specificly describes the System V terminalinterface.A general description of the available terminal interfacesis provided in.MS tty 4 ..PPWhen a terminal file is opened,it normally causesthe process to wait until a connection is established.In practice, users' programs seldom open thesefiles; they are opened by.PN gettyand become a user'sstandard input, output, and error files.The very first terminal file openedby the process group leader of a terminalfile not already associated with a process groupbecomes the.I control terminalfor that process group.The control terminal plays a specialrole in handling quit and interrupt signals, as discussedlater.The control terminal is inherited by a child process during a.MS fork 2 .A process can break this association by changing itsprocess group using.MS setpgrp 2 ..PPA terminal associated with one of these files ordinarilyoperates in full-duplex mode.Characters can be typed at any time,even while output is occurring.  They are only lost when thesystem's character input buffers become completelyfull, which is rare,or when the user has accumulated the maximum allowed number ofinput characters that have not yet been read by some program.Currently, this limit is (MAX_INPUT) characters,as defined in.PN <limits.h> .When the input limit is reached, all thesaved characters are thrown away without notice..PPNormally, terminal input is processed in units of lines.A line is delimited by a newline (ASCII LF)character, an end-of-file (ASCII EOT) character,or an end-of-line character.This means that a program attemptingto read is suspended until an entire line has beentyped.No matter how many characters are requestedin the read call, at most one line will be returned.It is not, however, necessary to read a whole line atonce; any number of characters can berequested in a read, even one, without losing information..PPSome characters have special meaning when input.For example, during input.I eraseand.I kill,processing is normally done.  The erase character erases the last character typed, except that it willnot erase beyond the beginning of a line.  Typically the erase character is the number sign (#).The kill character kills (deletes) the entire input line, and optionallyoutputs a newline character.The default kill character is the at sign (@).  Both characters operate on akey-stroke basis, independently of any backspacing or tabbing.Both the erase and kill characterscan be entered literally by preceding them withthe escape character.RB ( \e ).In this case the escape character is not read.The erase and kill characters can be changed..PPCertain characters have special functions on input.These functions and their default character valuesare summarized as follows:.TP "\w'START\ \ \ 'u".PN INTR(Rubout or ASCII DEL)generates an.I interruptsignal that is sent to all processeswith the associated control terminal.Normally, each such process is forced to terminate,but arrangements can be made either toignore the signal or to receive atrap to an agreed-upon location;see.MS signal 3 ..TP.PN QUIT(CTRL/| or ASCII FS)generates a.I quitsignal.Its treatment is identical to the interrupt signalexcept that, unless a receiving process hasmade other arrangements, it is not only terminatedbut a core image file(called.BR core )is created in the current working directory..TP.PN ERASEThe number sign (#) erases the preceding character.It will not erase beyond the start of a line,as delimited by an NL, EOF, or EOL character..TP.PN KILLThe at sign (@) deletes the entire line,as delimited by an NL, EOF, or EOL character..TP.PN EOF(CTRL/D or ASCII EOT) canbe used to generate an end-of-filefrom a terminal.When received, all the characterswaiting to be read are immediately passed tothe program, without waiting for a newline,and the EOF is discarded.Thus, if there are no characters waiting, whichis to say the EOFoccurred at the beginning of a line,zero characters are passed back,which is the standard end-of-file indication..TP.PN NL(ASCII LF) is the normal line delimiter.It can not be changed or escaped..TP.PN EOL(ASCII NUL) is an additional line delimiter, like NL.It is not normally used..TP.PN STOP(CTRL/S or ASCII DC3)can be used to temporarily suspend output.It is useful with CRTterminals to prevent output fromdisappearing before it can be read.While output is suspended, STOPcharacters are ignored and not read..TP.PN START(CTRL/Q or ASCII DC1)is used to resume output that has been suspended by a STOPcharacter.While output is not suspended, STARTcharacters are ignored and not read.The START/STOP characterscan not be changed or escaped..TP.PN MINUsed to control terminal I/O when the ICANON flag is not set in the c_lflag.Input processing behaves as described in the .B "MIN/TIME Interaction"section that follows..TP.PN TIMEUsed to control terminal I/O when the ICANON flag is not set in the c_lflag.Input processing behaves as described in the .B "MIN/TIME Interaction"section that follows..PPThe character values for INTR, QUIT, ERASE, KILL, EOF, MIN, TIME, andEOL can be changed to suit individual tastes.  The ERASE, KILL, and EOFcharacters can be escaped by a preceding backslash (\\) character, inwhich case no special function is performed..PPWhen one or morecharacters are written, they are transmittedto the terminal as soon as previously-written charactershave finished typing.Input characters are echoed by putting them in the output queueas they arrive.If a process produces characters more rapidly than they can be typed,it is suspended when its output queue exceeds some limit.When the queue has drained down to some threshold,the program is resumed..PPWhen the carrier signal from the data-set drops, a.I hang-upsignal, SIGHUP, is sent to all processesthat have this terminalas the control terminal.Unless other arrangements have been made,this signal causes the processes to terminate.If the hang-up signal is ignored, any subsequent readreturns with an end-of-file indication.Thus, programs that read a terminal and test forend-of-file can terminate appropriately whenhung up on..PPSeveral.MS ioctl 2system calls apply to terminal files.The primary calls use the following structure,defined in .PN <termio.h> :.PP.ta .6i 1.3i 1.8i 2.6i.nfstruct	termio {	unsigned	short	c_iflag;	/\(** input modes \(**/	unsigned	short	c_oflag;	/\(** output modes \(**/	unsigned	short	c_cflag;	/\(** control modes \(**/	unsigned	short	c_lflag;	/\(** local modes \(**/	char		c_line;		/\(** line discipline \(**/	unsigned	char	c_cc[\s-1NCC\s+1];	/\(** control chars \(**/};.fi.PPThe special control characters are defined by the array.IR c_cc .The initial valuesfor each function are as follows:.ta 13n.nfVINTR	DELVQUIT	FSVERASE	#VKILL	@VEOF	EOTVEOL	NULVMIN	6VTIME	1.fi.PPThe.I c_iflagfield describes the basic terminal input control:.PP.ta 13n.nfIGNBRK	Ignore break condition.BRKINT	Signal interrupt on break.IGNPAR	Ignore characters with parity errors.PARMRK	Mark parity errors.INPCK	Enable input parity check.ISTRIP	Strip character.INLCR	Map NL to CR on input.IGNCR	Ignore CR.ICRNL	Map CR to NL on input.IUCLC	Map uppercase to lowercase on input.IXON	Enable start/stop output control.IXANY	Enable any character to restart output.IXOFF	Enable start/stop input control..fi.PPIf IGNBRK is set, the break condition(a character framing error, with data all zeros)is ignored, that is, not put on the input queueand therefore not read by any process.Otherwise, if BRKINT is set,the break condition generates an interrupt signaland flushes both the input and output queues.If IGNPAR is set,characters with other framing and parity errors are ignored..PPIf PARMRK is set, a character witha framing or parity error that is not ignoredis read as the three-character sequence:0377, 0, X,where X is the data of the character received in error.To avoid ambiguity in this case,if ISTRIP is not set,a valid character of 0377 is read as 0377, 0377.If PARMRK is not set,a framing or parity error that is not ignoredis read as the character NUL (0)..PPIf INPCK is set,input parity checking is enabled.If INPCK is not set,input parity checking is disabled.This allows output parity generation, withoutinput parity errors..PPIf ISTRIP is set,valid input characters are first stripped to seven bits.Otherwise, all eight bits are processed..PPIf INLCR is set, a received NL character is translated into a CR character.If IGNCR is set, a received CR character is ignored (not read).Otherwise, if ICRNL is set, a received CR character is translated into aNL character..PPIf IUCLC is set,a received uppercase letter is translatedinto the corresponding lowercase letter..PPIf IXON is set, start/stop output control is enabled.  A received STOPcharacter suspends output and a received STARTcharacter restarts output.All start/stop characters are ignored and not read.If IXANY is set, any input character restarts outputthat has been suspended..PPIf IXOFF is set, the system transmits START/STOPcharacters when the input queue isnearly empty/full..PPThe initial input control value isall-bits-clear..PPThe.I c_oflagfield specifies the system treatment of output:.PP.ta 13n.nfOPOST	Postprocess output.OLCUC	Map lower case to upper on output.ONLCR	Map NL to CR-NL on output.OCRNL	Map CR to NL on output.ONOCR	No CR output at column 0.ONLRET	NL performs CR function.OFILL	Use fill characters for delay.OFDEL	Fill is DEL or else NUL..spNLDLY	Select newline delays:NL0	Newline delay type 0. NL1	Newline delay type 1..spCRDLY	Select carriage-return delays:CR0	Carriage-return delay type 0. CR1	Carriage-return delay type 1.CR2	Carriage-return delay type 2.CR3	Carriage-return delay type 3..spTABDLY	Select horizontal-tab delays:TAB0	Horizontal-tab delay type 0.TAB1	Horizontal-tab delay type 1.TAB2	Horizontal-tab delay type 2.TAB3	Expand tabs to spaces..spBSDLY	Select backspace delays:BS0	Backspace delay type 0.BS1	Backspace delay type 1..spVTDLY	Select vertical-tab delays:VT0	Vertical-tab delay type 0.VT1	Vertical-tab delay type 1..spFFDLY	Select form-feed delays:FF0	Form-feed delay type 0.FF1	Form-feed delay type 1..DT.fi.PPIf OPOST is set,output characters are post-processedas indicated by the remaining flags,otherwise characters are transmitted without change..PPIf OLCUC is set,a lowercase letter is transmitted as

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?