亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tty.c

?? UNIX v6 源代碼
?? C
字號:
#/* *//* * general TTY subroutines */#include "../param.h"#include "../systm.h"#include "../user.h"#include "../tty.h"#include "../proc.h"#include "../inode.h"#include "../file.h"#include "../reg.h"#include "../conf.h"/* * Input mapping table-- if an entry is non-zero, when the * corresponding character is typed preceded by "\" the escape * sequence is replaced by the table value.  Mostly used for * upper-case only terminals. */char	maptab[]{	000,000,000,000,004,000,000,000,	000,000,000,000,000,000,000,000,	000,000,000,000,000,000,000,000,	000,000,000,000,000,000,000,000,	000,'|',000,'#',000,000,000,'`',	'{','}',000,000,000,000,000,000,	000,000,000,000,000,000,000,000,	000,000,000,000,000,000,000,000,	'@',000,000,000,000,000,000,000,	000,000,000,000,000,000,000,000,	000,000,000,000,000,000,000,000,	000,000,000,000,000,000,'~',000,	000,'A','B','C','D','E','F','G',	'H','I','J','K','L','M','N','O',	'P','Q','R','S','T','U','V','W',	'X','Y','Z',000,000,000,000,000,};/* * The actual structure of a clist block manipulated by * getc and putc (mch.s) */struct cblock {	struct cblock *c_next;	char info[6];};/* The character lists-- space for 6*NCLIST characters */struct cblock cfree[NCLIST];/* List head for unused character blocks. */struct cblock *cfreelist;/* * structure of device registers for KL, DL, and DC * interfaces-- more particularly, those for which the * SSTART bit is off and can be treated by general routines * (that is, not DH). */struct {	int ttrcsr;	int ttrbuf;	int tttcsr;	int tttbuf;};/* * The routine implementing the gtty system call. * Just call lower level routine and pass back values. */gtty(){	int v[3];	register *up, *vp;	vp = v;	sgtty(vp);	if (u.u_error)		return;	up = u.u_arg[0];	suword(up, *vp++);	suword(++up, *vp++);	suword(++up, *vp++);}/* * The routine implementing the stty system call. * Read in values and call lower level. */stty(){	register int *up;	up = u.u_arg[0];	u.u_arg[0] = fuword(up);	u.u_arg[1] = fuword(++up);	u.u_arg[2] = fuword(++up);	sgtty(0);}/* * Stuff common to stty and gtty. * Check legality and switch out to individual * device routine. * v  is 0 for stty; the parameters are taken from u.u_arg[]. * c  is non-zero for gtty and is the place in which the device * routines place their information. */sgtty(v)int *v;{	register struct file *fp;	register struct inode *ip;	if ((fp = getf(u.u_ar0[R0])) == NULL)		return;	ip = fp->f_inode;	if ((ip->i_mode&IFMT) != IFCHR) {		u.u_error = ENOTTY;		return;	}	(*cdevsw[ip->i_addr[0].d_major].d_sgtty)(ip->i_addr[0], v);}/* * Wait for output to drain, then flush input waiting. */wflushtty(atp)struct tty *atp;{	register struct tty *tp;	tp = atp;	spl5();	while (tp->t_outq.c_cc) {		tp->t_state =| ASLEEP;		sleep(&tp->t_outq, TTOPRI);	}	flushtty(tp);	spl0();}/* * Initialize clist by freeing all character blocks, then count * number of character devices. (Once-only routine) */cinit(){	register int ccp;	register struct cblock *cp;	register struct cdevsw *cdp;	ccp = cfree;	for (cp=(ccp+07)&~07; cp <= &cfree[NCLIST-1]; cp++) {		cp->c_next = cfreelist;		cfreelist = cp;	}	ccp = 0;	for(cdp = cdevsw; cdp->d_open; cdp++)		ccp++;	nchrdev = ccp;}/* * flush all TTY queues */flushtty(atp)struct tty *atp;{	register struct tty *tp;	register int sps;	tp = atp;	while (getc(&tp->t_canq) >= 0);	while (getc(&tp->t_outq) >= 0);	wakeup(&tp->t_rawq);	wakeup(&tp->t_outq);	sps = PS->integ;	spl5();	while (getc(&tp->t_rawq) >= 0);	tp->t_delct = 0;	PS->integ = sps;}/* * transfer raw input list to canonical list, * doing erase-kill processing and handling escapes. * It waits until a full line has been typed in cooked mode, * or until any character has been typed in raw mode. */canon(atp)struct tty *atp;{	register char *bp;	char *bp1;	register struct tty *tp;	register int c;	tp = atp;	spl5();	while (tp->t_delct==0) {		if ((tp->t_state&CARR_ON)==0)			return(0);		sleep(&tp->t_rawq, TTIPRI);	}	spl0();loop:	bp = &canonb[2];	while ((c=getc(&tp->t_rawq)) >= 0) {		if (c==0377) {			tp->t_delct--;			break;		}		if ((tp->t_flags&RAW)==0) {			if (bp[-1]!='\\') {				if (c==tp->t_erase) {					if (bp > &canonb[2])						bp--;					continue;				}				if (c==tp->t_kill)					goto loop;				if (c==CEOT)					continue;			} else			if (maptab[c] && (maptab[c]==c || (tp->t_flags&LCASE))) {				if (bp[-2] != '\\')					c = maptab[c];				bp--;			}		}		*bp++ = c;		if (bp>=canonb+CANBSIZ)			break;	}	bp1 = bp;	bp = &canonb[2];	c = &tp->t_canq;	while (bp<bp1)		putc(*bp++, c);	return(1);}/* * Place a character on raw TTY input queue, putting in delimiters * and waking up top half as needed. * Also echo if required. * The arguments are the character and the appropriate * tty structure. */ttyinput(ac, atp)struct tty *atp;{	register int t_flags, c;	register struct tty *tp;	tp = atp;	c = ac;	t_flags = tp->t_flags;	if ((c =& 0177) == '\r' && t_flags&CRMOD)		c = '\n';	if ((t_flags&RAW)==0 && (c==CQUIT || c==CINTR)) {		signal(tp, c==CINTR? SIGINT:SIGQIT);		flushtty(tp);		return;	}	if (tp->t_rawq.c_cc>=TTYHOG) {		flushtty(tp);		return;	}	if (t_flags&LCASE && c>='A' && c<='Z')		c =+ 'a'-'A';	putc(c, &tp->t_rawq);	if (t_flags&RAW || c=='\n' || c==004) {		wakeup(&tp->t_rawq);		if (putc(0377, &tp->t_rawq)==0)			tp->t_delct++;	}	if (t_flags&ECHO) {		ttyoutput(c, tp);		ttstart(tp);	}}/* * put character on TTY output queue, adding delays, * expanding tabs, and handling the CR/NL bit. * It is called both from the top half for output, and from * interrupt level for echoing. * The arguments are the character and the tty structure. */ttyoutput(ac, tp)struct tty *tp;{	register int c;	register struct tty *rtp;	register char *colp;	int ctype;	rtp = tp;	c = ac&0177;	/*	 * Ignore EOT in normal mode to avoid hanging up	 * certain terminals.	 */	if (c==004 && (rtp->t_flags&RAW)==0)		return;	/*	 * Turn tabs to spaces as required	 */	if (c=='\t' && rtp->t_flags&XTABS) {		do			ttyoutput(' ', rtp);		while (rtp->t_col&07);		return;	}	/*	 * for upper-case-only terminals,	 * generate escapes.	 */	if (rtp->t_flags&LCASE) {		colp = "({)}!|^~'`";		while(*colp++)			if(c == *colp++) {				ttyoutput('\\', rtp);				c = colp[-2];				break;			}		if ('a'<=c && c<='z')			c =+ 'A' - 'a';	}	/*	 * turn <nl> to <cr><lf> if desired.	 */	if (c=='\n' && rtp->t_flags&CRMOD)		ttyoutput('\r', rtp);	if (putc(c, &rtp->t_outq))		return;	/*	 * Calculate delays.	 * The numbers here represent clock ticks	 * and are not necessarily optimal for all terminals.	 * The delays are indicated by characters above 0200,	 * thus (unfortunately) restricting the transmission	 * path to 7 bits.	 */	colp = &rtp->t_col;	ctype = partab[c];	c = 0;	switch (ctype&077) {	/* ordinary */	case 0:		(*colp)++;	/* non-printing */	case 1:		break;	/* backspace */	case 2:		if (*colp)			(*colp)--;		break;	/* newline */	case 3:		ctype = (rtp->t_flags >> 8) & 03;		if(ctype == 1) { /* tty 37 */			if (*colp)				c = max((*colp>>4) + 3, 6);		} else		if(ctype == 2) { /* vt05 */			c = 6;		}		*colp = 0;		break;	/* tab */	case 4:		ctype = (rtp->t_flags >> 10) & 03;		if(ctype == 1) { /* tty 37 */			c = 1 - (*colp | ~07);			if(c < 5)				c = 0;		}		*colp =| 07;		(*colp)++;		break;	/* vertical motion */	case 5:		if(rtp->t_flags & VTDELAY) /* tty 37 */			c = 0177;		break;	/* carriage return */	case 6:		ctype = (rtp->t_flags >> 12) & 03;		if(ctype == 1) { /* tn 300 */			c = 5;		} else		if(ctype == 2) { /* ti 700 */			c = 10;		}		*colp = 0;	}	if(c)		putc(c|0200, &rtp->t_outq);}/* * Restart typewriter output following a delay * timeout. * The name of the routine is passed to the timeout * subroutine and it is called during a clock interrupt. */ttrstrt(atp){	register struct tty *tp;	tp = atp;	tp->t_state =& ~TIMEOUT;	ttstart(tp);}/* * Start output on the typewriter. It is used from the top half * after some characters have been put on the output queue, * from the interrupt routine to transmit the next * character, and after a timeout has finished. * If the SSTART bit is off for the tty the work is done here, * using the protocol of the single-line interfaces (KL, DL, DC); * otherwise the address word of the tty structure is * taken to be the name of the device-dependent startup routine. */ttstart(atp)struct tty *atp;{	register int *addr, c;	register struct tty *tp;	struct { int (*func)(); };	tp = atp;	addr = tp->t_addr;	if (tp->t_state&SSTART) {		(*addr.func)(tp);		return;	}	if ((addr->tttcsr&DONE)==0 || tp->t_state&TIMEOUT)		return;	if ((c=getc(&tp->t_outq)) >= 0) {		if (c<=0177)			addr->tttbuf = c | (partab[c]&0200);		else {			timeout(ttrstrt, tp, c&0177);			tp->t_state =| TIMEOUT;		}	}}/* * Called from device's read routine after it has * calculated the tty-structure given as argument. * The pc is backed up for the duration of this call. * In case of a caught interrupt, an RTI will re-execute. */ttread(atp)struct tty *atp;{	register struct tty *tp;	tp = atp;	if ((tp->t_state&CARR_ON)==0)		return;	if (tp->t_canq.c_cc || canon(tp))		while (tp->t_canq.c_cc && passc(getc(&tp->t_canq))>=0);}/* * Called from the device's write routine after it has * calculated the tty-structure given as argument. */ttwrite(atp)struct tty *atp;{	register struct tty *tp;	register int c;	tp = atp;	if ((tp->t_state&CARR_ON)==0)		return;	while ((c=cpass())>=0) {		spl5();		while (tp->t_outq.c_cc > TTHIWAT) {			ttstart(tp);			tp->t_state =| ASLEEP;			sleep(&tp->t_outq, TTOPRI);		}		spl0();		ttyoutput(c, tp);	}	ttstart(tp);}/* * Common code for gtty and stty functions on typewriters. * If v is non-zero then gtty is being done and information is * passed back therein; * if it is zero stty is being done and the input information is in the * u_arg array. */ttystty(atp, av)int *atp, *av;{	register  *tp, *v;	tp = atp;	if(v = av) {		*v++ = tp->t_speeds;		v->lobyte = tp->t_erase;		v->hibyte = tp->t_kill;		v[1] = tp->t_flags;		return(1);	}	wflushtty(tp);	v = u.u_arg;	tp->t_speeds = *v++;	tp->t_erase = v->lobyte;	tp->t_kill = v->hibyte;	tp->t_flags = v[1];	return(0);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
激情综合网最新| 91影院在线观看| 欧美日韩国产不卡| 午夜欧美视频在线观看| 日本精品免费观看高清观看| 亚洲欧美另类久久久精品 | 日韩欧美一级二级三级| 免费人成在线不卡| 国产日韩精品一区二区三区| 国产一区不卡视频| 亚洲乱码国产乱码精品精可以看| 91视频免费观看| 蜜臀av亚洲一区中文字幕| 中文字幕中文乱码欧美一区二区| 色哟哟国产精品免费观看| 免费高清不卡av| 中文字幕在线一区免费| 91精品国产一区二区| 成人激情免费电影网址| 蜜臀av一区二区在线免费观看| 久久精品亚洲乱码伦伦中文| 一本一本大道香蕉久在线精品| 日韩在线卡一卡二| 亚洲精品欧美激情| 日本一区二区三区免费乱视频| 在线播放一区二区三区| av亚洲精华国产精华精华| 久久精品二区亚洲w码| 亚洲一区二区三区四区五区黄| 久久精品夜色噜噜亚洲a∨| 91精品国产一区二区人妖| 99久久99精品久久久久久 | 国产精品一区免费视频| 日韩电影在线看| 日韩综合小视频| 日韩不卡一二三区| 久久精品99久久久| 麻豆视频观看网址久久| 精品一区二区三区影院在线午夜| 日韩电影免费在线观看网站| 日日夜夜免费精品视频| 日韩av电影免费观看高清完整版在线观看 | 99精品视频在线观看免费| 国产精品久久久久7777按摩| 国产日韩三级在线| 亚洲美女电影在线| 偷拍一区二区三区| 韩国欧美一区二区| 91欧美一区二区| 欧美va天堂va视频va在线| 精品国产成人在线影院| 国产精品国产三级国产aⅴ中文| 国产精品久久久久久久岛一牛影视| 亚洲日穴在线视频| 久久国产精品99精品国产| 国产福利91精品一区二区三区| 成人黄色综合网站| 欧美高清dvd| 亚洲精品国久久99热| 九九精品视频在线看| caoporn国产一区二区| 91麻豆精品国产91久久久久久 | 亚洲激情在线激情| 日韩成人伦理电影在线观看| 成人免费三级在线| 久久嫩草精品久久久久| 日韩不卡在线观看日韩不卡视频| 成人午夜电影久久影院| 日韩欧美三级在线| 日韩综合在线视频| 欧美日韩激情一区| 亚洲成人久久影院| 欧美亚洲日本国产| 亚洲大片在线观看| 色8久久精品久久久久久蜜| 国产欧美一区二区在线观看| 日韩av电影免费观看高清完整版在线观看| 成人午夜免费av| 国产精品三级电影| 成人精品视频一区| 国产精品二三区| 欧美最猛性xxxxx直播| 一区二区三区国产| 制服丝袜av成人在线看| 麻豆免费看一区二区三区| 欧美成人aa大片| 国产99久久久国产精品免费看 | 欧美日韩一本到| 丝袜美腿高跟呻吟高潮一区| 欧美一区二区视频在线观看2020| 亚洲国产视频在线| 久久久亚洲精品石原莉奈| 国产黄色成人av| 一区二区三区**美女毛片| 欧美视频在线不卡| 国产原创一区二区| 亚洲国产成人av网| 国产精品免费免费| 精品视频一区 二区 三区| 国模少妇一区二区三区| 亚洲美女电影在线| 这里只有精品电影| 岛国精品在线观看| 韩国三级在线一区| 日韩一区欧美二区| 亚洲精品美国一| 亚洲欧美色一区| 国产亚洲精品超碰| 久久免费视频色| 日韩免费在线观看| 6080亚洲精品一区二区| 91久久精品一区二区二区| 国产精品99久久久久久似苏梦涵| 亚洲1区2区3区视频| 一区二区三区在线播| 国产精品久久久久久久久果冻传媒| 久久色中文字幕| 久久精品人人做人人综合| 精品奇米国产一区二区三区| 欧美一区二区视频观看视频| 欧美精品欧美精品系列| 欧美综合在线视频| 欧美精品久久久久久久多人混战| 欧美精品v国产精品v日韩精品| 欧美日韩在线直播| 91麻豆精品国产综合久久久久久| 欧美日韩大陆一区二区| 欧美一区二区三区免费| 欧美va日韩va| 亚洲精品日产精品乱码不卡| 亚洲一区二区在线免费看| 性感美女久久精品| 狠狠色综合色综合网络| 成人一道本在线| 在线观看网站黄不卡| 久久综合丝袜日本网| 中文字幕一区二区三区在线不卡| 亚洲另类色综合网站| 天天综合网 天天综合色| 国产精品一区不卡| 欧美日韩国产高清一区二区三区| 欧美电影免费观看完整版| 中文av一区二区| 国内精品嫩模私拍在线| 91啪九色porn原创视频在线观看| 欧美tickling网站挠脚心| 洋洋成人永久网站入口| 国产高清在线精品| 日韩欧美另类在线| 亚洲第一激情av| 欧美色网一区二区| 日韩久久一区二区| 成人av中文字幕| 久久久精品免费网站| 琪琪久久久久日韩精品| 欧美性极品少妇| 亚洲午夜久久久| 91福利在线导航| 亚洲综合色在线| 欧洲另类一二三四区| 亚洲综合一区二区三区| av高清不卡在线| 亚洲男同性视频| 欧美三电影在线| 亚洲第一久久影院| 精品少妇一区二区三区在线播放| 午夜日韩在线观看| 久久久久久影视| 97久久超碰国产精品电影| 亚洲色图欧美在线| 欧美伊人久久久久久午夜久久久久| 亚洲精品国产a久久久久久 | 欧美日韩1234| 美女视频黄免费的久久| 国产午夜精品理论片a级大结局| av不卡免费电影| 亚洲福利视频一区| 国产性色一区二区| 欧美日韩三级一区二区| 国产成人午夜视频| 婷婷一区二区三区| 日本一区二区三区在线观看| 欧美性大战xxxxx久久久| 狠狠色伊人亚洲综合成人| 一级精品视频在线观看宜春院| 8x福利精品第一导航| av激情成人网| 国产福利一区二区三区视频| 一区二区三区欧美久久| 日本一区二区三区高清不卡| 欧美日韩美女一区二区| 成人高清av在线| 久久精品国产精品亚洲综合| 亚洲曰韩产成在线| 国产精品美女久久久久久2018| 美国欧美日韩国产在线播放| 欧美日韩综合不卡| 亚洲成人www| 亚洲人精品一区| 国产精品理论片在线观看|