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

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

?? ldisc.c

?? 遠程登陸工具軟件源碼 用于遠程登陸unix
?? C
字號:
/*
 * ldisc.c: PuTTY line discipline. Sits between the input coming
 * from keypresses in the window, and the output channel leading to
 * the back end. Implements echo and/or local line editing,
 * depending on what's currently configured.
 */

#include <stdio.h>
#include <ctype.h>

#include "putty.h"
#include "terminal.h"
#include "ldisc.h"

#define ECHOING (ldisc->cfg->localecho == FORCE_ON || \
                 (ldisc->cfg->localecho == AUTO && \
                      (ldisc->back->ldisc(ldisc->backhandle, LD_ECHO) || \
			   term_ldisc(ldisc->term, LD_ECHO))))
#define EDITING (ldisc->cfg->localedit == FORCE_ON || \
                 (ldisc->cfg->localedit == AUTO && \
                      (ldisc->back->ldisc(ldisc->backhandle, LD_EDIT) || \
			   term_ldisc(ldisc->term, LD_EDIT))))

static void c_write(Ldisc ldisc, char *buf, int len)
{
    from_backend(ldisc->frontend, 0, buf, len);
}

static int plen(Ldisc ldisc, unsigned char c)
{
    if ((c >= 32 && c <= 126) || (c >= 160 && !in_utf(ldisc->term)))
	return 1;
    else if (c < 128)
	return 2;		       /* ^x for some x */
    else
	return 4;		       /* <XY> for hex XY */
}

static void pwrite(Ldisc ldisc, unsigned char c)
{
    if ((c >= 32 && c <= 126) || (c >= 160 && !in_utf(ldisc->term))) {
	c_write(ldisc, (char *)&c, 1);
    } else if (c < 128) {
	char cc[2];
	cc[1] = (c == 127 ? '?' : c + 0x40);
	cc[0] = '^';
	c_write(ldisc, cc, 2);
    } else {
	char cc[5];
	sprintf(cc, "<%02X>", c);
	c_write(ldisc, cc, 4);
    }
}

static void bsb(Ldisc ldisc, int n)
{
    while (n--)
	c_write(ldisc, "\010 \010", 3);
}

#define CTRL(x) (x^'@')
#define KCTRL(x) ((x^'@') | 0x100)

void *ldisc_create(Config *mycfg, Terminal *term,
		   Backend *back, void *backhandle,
		   void *frontend)
{
    Ldisc ldisc = snew(struct ldisc_tag);

    ldisc->buf = NULL;
    ldisc->buflen = 0;
    ldisc->bufsiz = 0;
    ldisc->quotenext = 0;

    ldisc->cfg = mycfg;
    ldisc->back = back;
    ldisc->backhandle = backhandle;
    ldisc->term = term;
    ldisc->frontend = frontend;

    /* Link ourselves into the backend and the terminal */
    if (term)
	term->ldisc = ldisc;
    if (back)
	back->provide_ldisc(backhandle, ldisc);

    return ldisc;
}

void ldisc_free(void *handle)
{
    Ldisc ldisc = (Ldisc) handle;

    if (ldisc->term)
	ldisc->term->ldisc = NULL;
    if (ldisc->back)
	ldisc->back->provide_ldisc(ldisc->backhandle, NULL);
    if (ldisc->buf)
	sfree(ldisc->buf);
    sfree(ldisc);
}

void ldisc_send(void *handle, char *buf, int len, int interactive)
{
    Ldisc ldisc = (Ldisc) handle;
    int keyflag = 0;
    /*
     * Called with len=0 when the options change. We must inform
     * the front end in case it needs to know.
     */
    if (len == 0) {
	ldisc_update(ldisc->frontend, ECHOING, EDITING);
	return;
    }
    /*
     * Notify the front end that something was pressed, in case
     * it's depending on finding out (e.g. keypress termination for
     * Close On Exit). 
     */
    frontend_keypress(ldisc->frontend);

    /*
     * Less than zero means null terminated special string.
     */
    if (len < 0) {
	len = strlen(buf);
	keyflag = KCTRL('@');
    }
    /*
     * Either perform local editing, or just send characters.
     */
    if (EDITING) {
	while (len--) {
	    int c;
	    c = *buf++ + keyflag;
	    if (!interactive && c == '\r')
		c += KCTRL('@');
	    switch (ldisc->quotenext ? ' ' : c) {
		/*
		 * ^h/^?: delete one char and output one BSB
		 * ^w: delete, and output BSBs, to return to last
		 * space/nonspace boundary
		 * ^u: delete, and output BSBs, to return to BOL
		 * ^c: Do a ^u then send a telnet IP
		 * ^z: Do a ^u then send a telnet SUSP
		 * ^\: Do a ^u then send a telnet ABORT
		 * ^r: echo "^R\n" and redraw line
		 * ^v: quote next char
		 * ^d: if at BOL, end of file and close connection,
		 * else send line and reset to BOL
		 * ^m: send line-plus-\r\n and reset to BOL
		 */
	      case KCTRL('H'):
	      case KCTRL('?'):	       /* backspace/delete */
		if (ldisc->buflen > 0) {
		    if (ECHOING)
			bsb(ldisc, plen(ldisc, ldisc->buf[ldisc->buflen - 1]));
		    ldisc->buflen--;
		}
		break;
	      case CTRL('W'):	       /* delete word */
		while (ldisc->buflen > 0) {
		    if (ECHOING)
			bsb(ldisc, plen(ldisc, ldisc->buf[ldisc->buflen - 1]));
		    ldisc->buflen--;
		    if (ldisc->buflen > 0 &&
			isspace((unsigned char)ldisc->buf[ldisc->buflen-1]) &&
			!isspace((unsigned char)ldisc->buf[ldisc->buflen]))
			break;
		}
		break;
	      case CTRL('U'):	       /* delete line */
	      case CTRL('C'):	       /* Send IP */
	      case CTRL('\\'):	       /* Quit */
	      case CTRL('Z'):	       /* Suspend */
		while (ldisc->buflen > 0) {
		    if (ECHOING)
			bsb(ldisc, plen(ldisc, ldisc->buf[ldisc->buflen - 1]));
		    ldisc->buflen--;
		}
		ldisc->back->special(ldisc->backhandle, TS_EL);
                /*
                 * We don't send IP, SUSP or ABORT if the user has
                 * configured telnet specials off! This breaks
                 * talkers otherwise.
                 */
                if (!ldisc->cfg->telnet_keyboard)
                    goto default_case;
		if (c == CTRL('C'))
		    ldisc->back->special(ldisc->backhandle, TS_IP);
		if (c == CTRL('Z'))
		    ldisc->back->special(ldisc->backhandle, TS_SUSP);
		if (c == CTRL('\\'))
		    ldisc->back->special(ldisc->backhandle, TS_ABORT);
		break;
	      case CTRL('R'):	       /* redraw line */
		if (ECHOING) {
		    int i;
		    c_write(ldisc, "^R\r\n", 4);
		    for (i = 0; i < ldisc->buflen; i++)
			pwrite(ldisc, ldisc->buf[i]);
		}
		break;
	      case CTRL('V'):	       /* quote next char */
		ldisc->quotenext = TRUE;
		break;
	      case CTRL('D'):	       /* logout or send */
		if (ldisc->buflen == 0) {
		    ldisc->back->special(ldisc->backhandle, TS_EOF);
		} else {
		    ldisc->back->send(ldisc->backhandle, ldisc->buf, ldisc->buflen);
		    ldisc->buflen = 0;
		}
		break;
		/*
		 * This particularly hideous bit of code from RDB
		 * allows ordinary ^M^J to do the same thing as
		 * magic-^M when in Raw protocol. The line `case
		 * KCTRL('M'):' is _inside_ the if block. Thus:
		 * 
		 *  - receiving regular ^M goes straight to the
		 *    default clause and inserts as a literal ^M.
		 *  - receiving regular ^J _not_ directly after a
		 *    literal ^M (or not in Raw protocol) fails the
		 *    if condition, leaps to the bottom of the if,
		 *    and falls through into the default clause
		 *    again.
		 *  - receiving regular ^J just after a literal ^M
		 *    in Raw protocol passes the if condition,
		 *    deletes the literal ^M, and falls through
		 *    into the magic-^M code
		 *  - receiving a magic-^M empties the line buffer,
		 *    signals end-of-line in one of the various
		 *    entertaining ways, and _doesn't_ fall out of
		 *    the bottom of the if and through to the
		 *    default clause because of the break.
		 */
	      case CTRL('J'):
		if (ldisc->cfg->protocol == PROT_RAW &&
		    ldisc->buflen > 0 && ldisc->buf[ldisc->buflen - 1] == '\r') {
		    if (ECHOING)
			bsb(ldisc, plen(ldisc, ldisc->buf[ldisc->buflen - 1]));
		    ldisc->buflen--;
		    /* FALLTHROUGH */
	      case KCTRL('M'):	       /* send with newline */
		    if (ldisc->buflen > 0)
			ldisc->back->send(ldisc->backhandle, ldisc->buf, ldisc->buflen);
		    if (ldisc->cfg->protocol == PROT_RAW)
			ldisc->back->send(ldisc->backhandle, "\r\n", 2);
		    else if (ldisc->cfg->protocol == PROT_TELNET && ldisc->cfg->telnet_newline)
			ldisc->back->special(ldisc->backhandle, TS_EOL);
		    else
			ldisc->back->send(ldisc->backhandle, "\r", 1);
		    if (ECHOING)
			c_write(ldisc, "\r\n", 2);
		    ldisc->buflen = 0;
		    break;
		}
		/* FALLTHROUGH */
	      default:		       /* get to this label from ^V handler */
                default_case:
		if (ldisc->buflen >= ldisc->bufsiz) {
		    ldisc->bufsiz = ldisc->buflen + 256;
		    ldisc->buf = sresize(ldisc->buf, ldisc->bufsiz, char);
		}
		ldisc->buf[ldisc->buflen++] = c;
		if (ECHOING)
		    pwrite(ldisc, (unsigned char) c);
		ldisc->quotenext = FALSE;
		break;
	    }
	}
    } else {
	if (ldisc->buflen != 0) {
	    ldisc->back->send(ldisc->backhandle, ldisc->buf, ldisc->buflen);
	    while (ldisc->buflen > 0) {
		bsb(ldisc, plen(ldisc, ldisc->buf[ldisc->buflen - 1]));
		ldisc->buflen--;
	    }
	}
	if (len > 0) {
	    if (ECHOING)
		c_write(ldisc, buf, len);
	    if (keyflag && ldisc->cfg->protocol == PROT_TELNET && len == 1) {
		switch (buf[0]) {
		  case CTRL('M'):
		    if (ldisc->cfg->protocol == PROT_TELNET && ldisc->cfg->telnet_newline)
			ldisc->back->special(ldisc->backhandle, TS_EOL);
		    else
			ldisc->back->send(ldisc->backhandle, "\r", 1);
		    break;
		  case CTRL('?'):
		  case CTRL('H'):
		    if (ldisc->cfg->telnet_keyboard) {
			ldisc->back->special(ldisc->backhandle, TS_EC);
			break;
		    }
		  case CTRL('C'):
		    if (ldisc->cfg->telnet_keyboard) {
			ldisc->back->special(ldisc->backhandle, TS_IP);
			break;
		    }
		  case CTRL('Z'):
		    if (ldisc->cfg->telnet_keyboard) {
			ldisc->back->special(ldisc->backhandle, TS_SUSP);
			break;
		    }

		  default:
		    ldisc->back->send(ldisc->backhandle, buf, len);
		    break;
		}
	    } else
		ldisc->back->send(ldisc->backhandle, buf, len);
	}
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
自拍偷拍欧美激情| 一本色道久久综合狠狠躁的推荐| 狠狠色狠狠色合久久伊人| 99国产精品99久久久久久| 欧美一级在线视频| 亚洲欧洲成人自拍| 国产一区不卡视频| 在线成人av网站| 亚洲视频综合在线| 韩国成人福利片在线播放| 在线观看视频一区二区| 国产欧美一区二区精品久导航 | 日韩一二三区不卡| 亚洲欧美色图小说| 国产精品888| 日韩精品一区二区三区swag | 亚洲一区二区三区四区不卡| 国产美女娇喘av呻吟久久| 在线不卡中文字幕播放| 一区二区在线免费| 色综合色狠狠综合色| 中文字幕的久久| 国产成人免费在线视频| 精品嫩草影院久久| 久久国产综合精品| 欧美sm极限捆绑bd| 热久久国产精品| 欧美一级片免费看| 男女性色大片免费观看一区二区| 91成人在线观看喷潮| 成人欧美一区二区三区小说| 国产成人在线观看免费网站| 精品国产乱码久久久久久影片| 麻豆国产精品777777在线| 制服丝袜亚洲色图| 秋霞午夜鲁丝一区二区老狼| 在线播放欧美女士性生活| 日韩av一区二区在线影视| 日韩午夜电影在线观看| 久久精品国产网站| 精品成人一区二区三区| 国产在线看一区| 久久先锋影音av鲁色资源网| 韩国成人精品a∨在线观看| 精品福利在线导航| 顶级嫩模精品视频在线看| 国产精品久久久久影院老司| 91麻豆高清视频| 亚洲一二三四久久| 3d动漫精品啪啪一区二区竹菊| 日韩电影免费一区| 久久亚洲捆绑美女| 99久久er热在这里只有精品66| 一区二区三区四区国产精品| 欧美精品一卡二卡| 国产精品主播直播| 亚洲精品中文在线影院| 欧美久久久影院| 激情综合色综合久久| 中文字幕一区二区三区不卡| 欧美日韩不卡在线| 国产揄拍国内精品对白| 亚洲美女视频在线| 日韩片之四级片| 成人动漫av在线| 亚洲v精品v日韩v欧美v专区| 久久色成人在线| 色综合久久久久综合体桃花网| 首页欧美精品中文字幕| 久久综合色综合88| 欧美亚洲一区二区在线观看| 久久91精品国产91久久小草| 亚洲欧洲av色图| 日韩亚洲电影在线| 在线欧美一区二区| 国产成人激情av| 免费成人在线观看| 一区二区三区在线免费播放| 2024国产精品视频| 欧美日韩免费观看一区二区三区| 国产很黄免费观看久久| 亚洲国产精品一区二区www在线| 精品国产一区二区三区四区四| 色婷婷综合久久久久中文 | 艳妇臀荡乳欲伦亚洲一区| 久久综合丝袜日本网| 欧美另类videos死尸| 97se亚洲国产综合自在线| 久久国产成人午夜av影院| 午夜免费久久看| 1000部国产精品成人观看| 精品久久久久久久久久久院品网 | 中文字幕五月欧美| 欧美成人三级电影在线| 欧美三电影在线| 99精品在线观看视频| 国产成人在线看| 麻豆91精品视频| 亚洲国产成人91porn| 亚洲嫩草精品久久| 国产精品欧美综合在线| 精品久久久久久久久久久久久久久 | 国产日本欧洲亚洲| 日韩三级视频中文字幕| 欧美日韩国产另类一区| 在线观看www91| 91丨porny丨首页| 成人av电影在线| 成人av影视在线观看| 岛国一区二区三区| 亚洲激情综合网| 色94色欧美sute亚洲线路二 | 亚洲手机成人高清视频| 日本一区二区三区在线观看| 久久人人爽爽爽人久久久| 精品久久国产老人久久综合| 日韩欧美国产三级| 日韩三级免费观看| 欧美电视剧在线看免费| 精品国产制服丝袜高跟| 精品第一国产综合精品aⅴ| 日韩精品中文字幕一区二区三区| 这里只有精品99re| 日韩欧美国产精品| 欧美精品一区二区三区蜜桃视频| 日韩一区二区三区av| 欧美成人精品福利| 国产日韩影视精品| 中文字幕一区二区三区在线观看 | 国产成人免费视频网站高清观看视频 | 欧美视频中文字幕| 精品视频999| 91麻豆精品国产| 久久女同互慰一区二区三区| 国产三级三级三级精品8ⅰ区| 国产日本亚洲高清| 亚洲免费成人av| 三级精品在线观看| 国产精品一区久久久久| 不卡av电影在线播放| 欧洲一区二区三区免费视频| 欧美精品自拍偷拍动漫精品| 日韩欧美电影一区| 欧美国产97人人爽人人喊| 亚洲综合av网| 狠狠色丁香婷婷综合久久片| 成人免费毛片片v| 欧美在线观看一区| 久久夜色精品国产欧美乱极品| 一色桃子久久精品亚洲| 午夜欧美电影在线观看| 国产高清在线精品| 欧美天堂亚洲电影院在线播放| 日韩欧美中文字幕公布| 国产日产欧美精品一区二区三区| 亚洲夂夂婷婷色拍ww47| 国产一区二区在线视频| 色婷婷精品久久二区二区蜜臂av | 国产一区二区三区不卡在线观看| 99精品欧美一区二区三区小说| 欧美日韩亚洲国产综合| 久久久噜噜噜久噜久久综合| 亚洲国产裸拍裸体视频在线观看乱了 | 97久久超碰国产精品电影| 欧美一级黄色录像| 亚洲欧美另类图片小说| 黄色日韩网站视频| 欧美在线看片a免费观看| 日韩欧美一区二区在线视频| 亚洲人成网站影音先锋播放| 国产一区二区三区四区五区美女 | 欧美一区二区视频免费观看| 国产精品婷婷午夜在线观看| 日韩高清不卡一区| 色哟哟一区二区在线观看 | 国产999精品久久| 日韩三区在线观看| 亚洲成人精品在线观看| 99久久久久久99| 国产偷国产偷亚洲高清人白洁| 日韩av一区二区三区四区| 日本精品免费观看高清观看| 久久久久久久久久久久久夜| 五月婷婷综合在线| 欧美亚洲免费在线一区| 中文字幕一区二区三区在线观看 | 亚洲一区二区三区小说| 99精品欧美一区二区三区综合在线| 精品久久久久久亚洲综合网| 亚洲成人激情社区| 欧美日韩免费一区二区三区视频| 亚洲欧美日韩国产一区二区三区| 国产白丝网站精品污在线入口| 2024国产精品| 精品系列免费在线观看| 日韩欧美国产小视频| 日韩专区欧美专区| 欧美精品乱码久久久久久| 性久久久久久久| 欧美精品免费视频|