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

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

?? common.c

?? 這是一個同樣來自貝爾實驗室的和UNIX有著淵源的操作系統, 其簡潔的設計和實現易于我們學習和理解
?? C
字號:
#include <u.h>#include <libc.h>#include <bio.h>#include <regexp.h>#include "spam.h"enum {	Quanta	= 8192,	Minbody = 6000,	HdrMax	= 15,};typedef struct keyword Keyword;typedef struct word Word;struct word{	char	*string;	int	n;};struct	keyword{	char	*string;	int	value;};Word	htmlcmds[] ={	"html",		4,	"!doctype html", 13,	0,};Word	hrefs[] ={	"a href=",	7,	"a title=",	8,	"a target=",	9,	"base href=",	10,	"img src=",	8,	"img border=",	11,	"form action=", 12,	"!--",		3,	0,};/* *	RFC822 header keywords to look for for fractured header. *	all lengths must be less than HdrMax defined above. */Word	hdrwords[] ={	"cc:",			3,	"bcc:", 		4,	"to:",			3,	0,			0,};Keyword	keywords[] ={	"header",	HoldHeader,	"line",		SaveLine,	"hold",		Hold,	"dump",		Dump,	"loff",		Lineoff,	0,		Nactions,};Patterns patterns[] = {[Dump]		{ "DUMP:", 0, 0 },[HoldHeader]	{ "HEADER:", 0, 0 },[Hold]		{ "HOLD:", 0, 0 },[SaveLine]	{ "LINE:", 0, 0 },[Lineoff]	{ "LINEOFF:", 0, 0 },[Nactions]	{ 0, 0, 0 },};static char*	endofhdr(char*, char*);static	int	escape(char**);static	int	extract(char*);static	int	findkey(char*);static	int	hash(int);static	int	isword(Word*, char*, int);static	void	parsealt(Biobuf*, char*, Spat**);/* *	The canonicalizer: convert input to canonical representation */char*readmsg(Biobuf *bp, int *hsize, int *bufsize){	char *p, *buf;	int n, offset, eoh, bsize, delta;	buf = 0;	offset = 0;	if(bufsize)		*bufsize = 0;	if(hsize)		*hsize = 0;	for(;;) {		buf = Realloc(buf, offset+Quanta+1);		n = Bread(bp, buf+offset, Quanta);		if(n < 0){			free(buf);			return 0;		}		p = buf+offset;			/* start of this chunk */		offset += n;			/* end of this chunk */		buf[offset] = 0;		if(n == 0){			if(offset == 0)				return 0;			break;		}		if(hsize == 0)			/* don't process header */			break;		if(p != buf && p[-1] == '\n')	/* check for EOH across buffer split */			p--;		p = endofhdr(p, buf+offset);		if(p)			break;		if(offset >= Maxread)		/* gargantuan header - just punt*/		{			if(hsize)				*hsize = offset;			if(bufsize)				*bufsize = offset;			return buf;		}	}	eoh = p-buf;				/* End of header */	bsize = offset - eoh;			/* amount of body already read */		/* Read at least Minbody bytes of the body */	if (bsize < Minbody){		delta = Minbody-bsize;		buf = Realloc(buf, offset+delta+1);		n = Bread(bp, buf+offset, delta);		if(n > 0) {			offset += n;			buf[offset] = 0;		}	}	if(hsize)		*hsize = eoh;	if(bufsize)		*bufsize = offset;	return buf;}static	intisword(Word *wp, char *text, int len){	for(;wp->string; wp++)		if(len >= wp->n && strncmp(text, wp->string, wp->n) == 0)			return 1;	return 0;}static char*endofhdr(char *raw, char *end){	int i;	char *p, *q;	char buf[HdrMax];	/* 	 * can't use strchr to search for newlines because	 * there may be embedded NULL's.	 */	for(p = raw; p < end; p++){		if(*p != '\n' || p[1] != '\n')			continue;		p++;		for(i = 0, q = p+1; i < sizeof(buf) && *q; q++){			buf[i++] = tolower(*q);			if(*q == ':' || *q == '\n')				break;		}		if(!isword(hdrwords, buf, i))			return p+1;	}	return 0;}static	inthtmlmatch(Word *wp, char *text, char *end, int *n){	char *cp;	int i, c, lastc;	char buf[MaxHtml];	/*	 * extract a string up to '>'	 */	i = lastc = 0;	cp = text;	while (cp < end && i < sizeof(buf)-1){		c = *cp++;		if(c == '=')			c = escape(&cp);		switch(c){		case 0:		case '\r':			continue;		case '>':			goto out;		case '\n':		case ' ':		case '\t':			if(lastc == ' ')				continue;			c = ' ';			break;		default:			c = tolower(c);			break;		}		buf[i++] = lastc = c;	}out:	buf[i] = 0;	if(n)		*n = cp-text;	return isword(wp, buf, i);}static intescape(char **msg){	int c;	char *p;	p = *msg;	c = *p;	if(c == '\n'){		p++;		c = *p++;	} else	if(c == '2'){		c = tolower(p[1]);		if(c == 'e'){			p += 2;			c = '.';		}else		if(c == 'f'){			p += 2;			c = '/';		}else		if(c == '0'){			p += 2;			c = ' ';		}		else c = '=';	} else {		if(c == '3' && tolower(p[1]) == 'd')			p += 2;		c = '=';	}	*msg = p;	return c;}static inthtmlchk(char **msg, char *end){	int n;	char *p;	static int ishtml;	p = *msg;	if(ishtml == 0){		ishtml = htmlmatch(htmlcmds, p, end, &n);			/* If not an HTML keyword, check if it's		 * an HTML comment (<!comment>).  if so,		 * skip over it; otherwise copy it in.		 */		if(ishtml == 0 && *p != '!')	/* not comment */			return '<';		/* copy it */	} else if(htmlmatch(hrefs, p, end, &n))	/* if special HTML string  */		return '<';			/* copy it */		/*	 * this is an uninteresting HTML command; skip over it.	 */	p += n;	*msg = p+1;	return *p;}/* * decode a base 64 encode body */voidconv64(char *msg, char *end, char *buf, int bufsize){	int len, i;	char *cp;	len = end - msg;	i = (len*3)/4+1;	// room for max chars + null	cp = Malloc(i);	len = dec64((uchar*)cp, i, msg, len);	convert(cp, cp+len, buf, bufsize, 1);	free(cp);}intconvert(char *msg, char *end, char *buf, int bufsize, int isbody){	char *p;	int c, lastc, base64;	lastc = 0;	base64 = 0;	while(msg < end && bufsize > 0){		c = *msg++;		/*		 * In the body only, try to strip most HTML and		 * replace certain MIME escape sequences with the character		 */		if(isbody) {			do{				p = msg;				if(c == '<')					c = htmlchk(&msg, end);				if(c == '=')					c = escape(&msg);			} while(p != msg && p < end);		}		switch(c){		case 0:		case '\r':			continue;		case '\t':		case ' ':		case '\n':			if(lastc == ' ')				continue;			c = ' ';			break;		case 'C':	/* check for MIME base 64 encoding in header */		case 'c':			if(isbody == 0)			if(msg < end-32 && *msg == 'o' && msg[1] == 'n')			if(cistrncmp(msg+2, "tent-transfer-encoding: base64", 30) == 0)				base64 = 1;			c = 'c';			break;		default:			c = tolower(c);			break;		}		*buf++ = c;		lastc = c;		bufsize--;	}	*buf = 0;	return base64;}/* *	The pattern parser: build data structures from the pattern file */static inthash(int c){	return c & 127;}static	intfindkey(char *val){	Keyword *kp;	for(kp = keywords; kp->string; kp++)		if(strcmp(val, kp->string) == 0)				break;	return kp->value;}#define	whitespace(c)	((c) == ' ' || (c) == '\t')voidparsepats(Biobuf *bp){	Pattern *p, *new;	char *cp, *qp;	int type, action, n, h;	Spat *spat;	for(;;){		cp = Brdline(bp, '\n');		if(cp == 0)			break;		cp[Blinelen(bp)-1] = 0;		while(*cp == ' ' || *cp == '\t')			cp++;		if(*cp == '#' || *cp == 0)			continue;		type = regexp;		if(*cp == '*'){			type = string;			cp++;		}		qp = strchr(cp, ':');		if(qp == 0)			continue;		*qp = 0;		if(debug)			fprint(2, "action = %s\n", cp);		action = findkey(cp);		if(action >= Nactions)			continue;		cp = qp+1;		n = extract(cp);		if(n <= 0 || *cp == 0)			continue;		qp = strstr(cp, "~~");		if(qp){			*qp = 0;			n = strlen(cp);		}		if(debug)			fprint(2, " Pattern: `%s'\n", cp);			/* Hook regexps into a chain */		if(type == regexp) {			new = Malloc(sizeof(Pattern));			new->action = action;			new->pat = regcomp(cp);			if(new->pat == 0){				free(new);				continue;			}			new->type = regexp;			new->alt = 0;			new->next = 0;			if(qp)				parsealt(bp, qp+2, &new->alt);			new->next = patterns[action].regexps;			patterns[action].regexps = new;			continue;		}			/* not a Regexp - hook strings into Pattern hash chain */		spat = Malloc(sizeof(*spat));		spat->next = 0;		spat->alt = 0;		spat->len = n;		spat->string = Malloc(n+1);		spat->c1 = cp[1];		strcpy(spat->string, cp);		if(qp)			parsealt(bp, qp+2, &spat->alt);		p = patterns[action].strings;		if(p == 0) {			p = Malloc(sizeof(Pattern));			memset(p, 0, sizeof(*p));			p->action = action;			p->type = string;			patterns[action].strings = p;		}		h = hash(*spat->string);		spat->next = p->spat[h];		p->spat[h] = spat;	}}static voidparsealt(Biobuf *bp, char *cp, Spat** head){	char *p;	Spat *alt;	while(cp){		if(*cp == 0){		/*escaped newline*/			do{				cp = Brdline(bp, '\n');				if(cp == 0)					return;				cp[Blinelen(bp)-1] = 0;			} while(extract(cp) <= 0 || *cp == 0);		}		p = cp;		cp = strstr(p, "~~");		if(cp){			*cp = 0;			cp += 2;		}		if(strlen(p)){			alt = Malloc(sizeof(*alt));			alt->string = strdup(p);			alt->next = *head;			*head = alt;		}	}}static intextract(char *cp){	int c;	char *p, *q, *r;	p = q = r = cp;	while(whitespace(*p))		p++;	while(c = *p++){		if (c == '#')			break;		if(c == '"'){			while(*p && *p != '"'){				if(*p == '\\' && p[1] == '"')					p++;				if('A' <= *p && *p <= 'Z')					*q++ = *p++ + ('a'-'A');				else					*q++ = *p++;			}			if(*p)				p++;			r = q;		/* never back up over a quoted string */		} else {			if('A' <= c && c <= 'Z')				c += ('a'-'A');			*q++ = c;		}	}	while(q > r && whitespace(q[-1]))		q--;	*q = 0;	return q-cp;}/* *	The matching engine: compare canonical input to pattern structures */static Spat*isalt(char *message, Spat *alt){	while(alt) {		if(*cmd)		if(message != cmd && strstr(cmd, alt->string))			break;		if(message != header+1 && strstr(header+1, alt->string))			break;		if(strstr(message, alt->string))			break;		alt = alt->next;	}	return alt;}intmatchpat(Pattern *p, char *message, Resub *m){	Spat *spat;	char *s;	int c, c1;	if(p->type == string){		c1 = *message;		for(s=message; c=c1; s++){			c1 = s[1];			for(spat=p->spat[hash(c)]; spat; spat=spat->next){				if(c1 == spat->c1)				if(memcmp(s, spat->string, spat->len) == 0)				if(!isalt(message, spat->alt)){					m->sp = s;					m->ep = s + spat->len;					return 1;				}			}		}		return 0;	}	m->sp = m->ep = 0;	if(regexec(p->pat, message, m, 1) == 0)		return 0;	if(isalt(message, p->alt))		return 0;	return 1;}voidxprint(int fd, char *type, Resub *m){	char *p, *q;	int i;	if(m->sp == 0 || m->ep == 0)		return;		/* back up approx 30 characters to whitespace */	for(p = m->sp, i = 0; *p && i < 30; i++, p--)			;	while(*p && *p != ' ')		p--;	p++;		/* grab about 30 more chars beyond the end of the match */	for(q = m->ep, i = 0; *q && i < 30; i++, q++)			;	while(*q && *q != ' ')		q++;	fprint(fd, "%s %.*s~%.*s~%.*s\n", type, (int)(m->sp-p), p, (int)(m->ep-m->sp), m->sp, (int)(q-m->ep), m->ep);}enum {	INVAL=	255};static uchar t64d[256] = {/*00 */	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,/*10*/	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,/*20*/	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,	INVAL, INVAL, INVAL,    62, INVAL, INVAL, INVAL,    63,/*30*/	   52,	  53,	 54,	55,    56,    57,    58,    59,	   60,	  61, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,/*40*/	INVAL,    0,      1,     2,     3,     4,     5,     6,	    7,    8,      9,    10,    11,    12,    13,    14,/*50*/	   15,   16,     17,    18,    19,    20,    21,    22,	   23,   24,     25, INVAL, INVAL, INVAL, INVAL, INVAL,/*60*/	INVAL,   26,     27,    28,    29,    30,    31,    32,	   33,   34,     35,    36,    37,    38,    39,    40,/*70*/	   41,   42,     43,    44,    45,    46,    47,    48,	   49,   50,     51, INVAL, INVAL, INVAL, INVAL, INVAL,/*80*/	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,/*90*/	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,/*A0*/	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,/*B0*/	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,/*C0*/	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,/*D0*/	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,/*E0*/	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,/*F0*/	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,	INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL, INVAL,};

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲激情成人在线| 精品国产区一区| 亚洲欧美欧美一区二区三区| 成人国产精品免费观看视频| 亚洲欧美在线aaa| 91天堂素人约啪| 经典一区二区三区| 精品电影一区二区三区| 丁香天五香天堂综合| 国产精品电影院| 欧美日韩国产一级二级| 久久99国内精品| 国产精品天天摸av网| 在线欧美日韩精品| 久久爱www久久做| 国产精品美女久久久久久| 欧美性大战久久| 极品少妇xxxx偷拍精品少妇| 国产精品高潮呻吟| 欧美日韩国产一二三| 国产精品中文字幕一区二区三区| 亚洲欧洲国产日韩| 欧美一区二区三区思思人| 成人一道本在线| 亚洲国产一区二区三区青草影视| 欧美xxxxx牲另类人与| av中文字幕在线不卡| 日本欧美韩国一区三区| 国产精品激情偷乱一区二区∴| 欧美日韩极品在线观看一区| 国产精品亚洲人在线观看| 一区二区三区在线观看网站| 欧美v国产在线一区二区三区| 成人精品一区二区三区四区| 亚洲第一av色| 中文字幕免费一区| 欧美一区二区三级| av亚洲精华国产精华| 青草av.久久免费一区| 中文字幕一区二区三区不卡| 日韩免费福利电影在线观看| av欧美精品.com| 色av成人天堂桃色av| 国模套图日韩精品一区二区| 亚洲gay无套男同| 最好看的中文字幕久久| 精品三级在线观看| 欧美日本精品一区二区三区| 99精品热视频| 国产成人免费视频网站 | 粉嫩绯色av一区二区在线观看 | 久久久亚洲国产美女国产盗摄| 在线观看精品一区| 成人看片黄a免费看在线| 激情都市一区二区| 日韩不卡在线观看日韩不卡视频| 亚洲免费毛片网站| 国产精品久久精品日日| 2019国产精品| 欧美大片日本大片免费观看| 7878成人国产在线观看| 欧洲一区在线电影| 色婷婷av一区二区三区大白胸| 成人在线一区二区三区| 国产在线麻豆精品观看| 九一九一国产精品| 精品一区二区三区视频在线观看 | 粉嫩一区二区三区性色av| 精品一区二区日韩| 久久99精品国产麻豆婷婷洗澡| 日本aⅴ免费视频一区二区三区| 一区二区三区精品| 亚洲国产综合人成综合网站| 亚洲欧美日韩久久精品| 国产欧美日韩三级| 无码av免费一区二区三区试看| 亚洲精品福利视频网站| 亚洲精品ww久久久久久p站| 亚洲美女免费视频| 亚洲精品欧美专区| 亚洲国产欧美另类丝袜| 亚洲超丰满肉感bbw| 亚洲电影欧美电影有声小说| 香蕉久久一区二区不卡无毒影院| 性感美女久久精品| 捆绑紧缚一区二区三区视频| 老汉av免费一区二区三区| 精品在线视频一区| 成人免费高清在线| 91视频一区二区三区| 欧美性三三影院| 日韩一区二区三| 26uuu亚洲| 国产精品久久久久影院| 亚洲在线观看免费| 日本免费新一区视频| 国产一区二区电影| 99久久99久久综合| 欧美三级在线播放| 精品成人私密视频| 国产精品青草综合久久久久99| 亚洲丝袜自拍清纯另类| 性感美女久久精品| 国产乱码精品一品二品| 91麻豆免费看片| 日韩一二三四区| 日本一区二区成人| 亚洲bdsm女犯bdsm网站| 国内一区二区在线| 色综合久久天天| 精品嫩草影院久久| 自拍偷自拍亚洲精品播放| 亚洲第一福利一区| 国产高清在线精品| 欧美午夜不卡在线观看免费| 亚洲精品高清在线| 九九精品视频在线看| 色美美综合视频| 精品久久久久久久久久久久久久久| 国产精品麻豆网站| 日韩福利视频网| 成人av资源在线观看| 欧美三区在线观看| 国产精品色呦呦| 免费一级欧美片在线观看| 99精品久久99久久久久| 日韩欧美国产午夜精品| 亚洲欧美偷拍另类a∨色屁股| 久久精品国产亚洲a| 91久久精品网| 国产亚洲欧美一区在线观看| 三级亚洲高清视频| 91色在线porny| 久久麻豆一区二区| 蜜臀精品久久久久久蜜臀| 色婷婷av一区| 国产精品日日摸夜夜摸av| 久久精品国产一区二区| 欧美三级中文字幕在线观看| 国产精品美女久久久久aⅴ| 九九国产精品视频| 欧美肥妇free| 亚洲国产一区在线观看| 91社区在线播放| 国产精品久线观看视频| 国产裸体歌舞团一区二区| 日韩一区二区精品在线观看| 亚洲韩国一区二区三区| 色综合天天性综合| 中文字幕免费不卡在线| 国产伦理精品不卡| 日韩亚洲国产中文字幕欧美| 午夜精品影院在线观看| 欧美日韩在线直播| 亚洲一级二级在线| 色婷婷综合中文久久一本| 亚洲欧美在线视频观看| 成人高清视频免费观看| 中文字幕久久午夜不卡| 国产成人一级电影| 国产日产亚洲精品系列| 国产精品一区不卡| 久久久精品中文字幕麻豆发布| 国内精品国产成人国产三级粉色| 日韩视频一区二区三区 | 1区2区3区精品视频| 成人激情av网| 亚洲欧美日韩国产一区二区三区| 成+人+亚洲+综合天堂| 亚洲视频在线一区观看| 色综合久久久网| 亚洲综合成人在线| 欧美日韩精品三区| 免费精品99久久国产综合精品| 欧美一激情一区二区三区| 日本aⅴ亚洲精品中文乱码| 欧美α欧美αv大片| 国产在线一区观看| 国产精品免费久久久久| 91同城在线观看| 亚洲成人资源在线| 日韩欧美的一区| 国产精品1024久久| 亚洲欧洲一区二区在线播放| 在线精品视频一区二区| 视频一区二区三区中文字幕| 日韩欧美一区中文| 国产suv精品一区二区三区| 国产精品成人在线观看| 91黄色在线观看| 日韩av高清在线观看| 亚洲一区在线视频观看| 欧美一级欧美三级| 国产成人免费视频一区| 一区二区三区色| 日韩一区二区麻豆国产| 成人激情av网| 日韩精品久久久久久| 欧美激情综合五月色丁香小说| 色琪琪一区二区三区亚洲区|