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

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

?? view.c

?? 這是新華龍(www.xhl.xom.xn)開發的
?? C
字號:
/* Random access file viewer. PC specific */

#include <stdio.h>
#include <conio.h>
#include "global.h"
#include "session.h"
#include "tty.h"
#include "commands.h"
#include "socket.h"

#include <dos.h>

static long lineseek(FILE *fp,long offset,int nlines,int width);
static int ctlproc(int c);

int
doview(argc,argv,p)
int argc;
char *argv[];
void *p;
{
	FILE *fp;

	if((fp = fopen(argv[1],READ_TEXT)) == NULL){
		printf("Can't read %s\n",argv[1]);
		return 1;
	}
	newproc("view",512,view,0,(void *)fp,strdup(Cmdline),0);
	return 0;	
}
/* Random-access file display program. Used both to read local
 * files with the "view" command, and by the FTP client to view
 * directory listings, temporary copies of read files, etc.
 *
 */
void
view(s,p1,p2)
int s;		/* If non-zero, poll interval for a changing file */
void *p1;	/* Open file pointer to read from */
void *p2;	/* If non-null, name to give to session. We free it */
{
	struct session *sp;
	FILE *fp;
	char *name;
	int c;
	long offset = 0;
	int row,col;
	int cols;
	int rows;
	int32 polldelay = 0;
	struct text_info text_info;

	gettextinfo(&text_info);
	cols = text_info.screenwidth;
	rows = text_info.screenheight-1;	/* Allow for status line */

	fp = (FILE *)p1;
	if(p2 != NULL)
		name = (char *)p2;
	else
		name = fpname(fp);

	if((sp = newsession(name,VIEW,1)) == NULL)
		return;

	if(p2 != NULL)
		free(name);

	if(s != 0)
		polldelay = s;
	sp->ctlproc = ctlproc;
	/* Put tty into raw mode so single-char responses will work */
	sp->ttystate.echo = sp->ttystate.edit = 0;
	for(;;){
		fseek(fp,offset,SEEK_SET);
		putchar(FF);	/* Clear screen */
		/* Display a screen's worth of data, keeping track of
		 * cursor location so we know when the screen is full
		 */
		col = row = 0;
		while((c = getc(fp)),c != EOF){
			switch(c){
			case '\n':
				row++;
				col = 0;
				break;
			case '\t':
				if(col < cols - 8)
					col = (col + 8) & ~7;
				break;
			default:
				col++;
				break;
			}
			if(col >= cols){
				/* Virtual newline caused by wraparound */
				col = 0;
				row++;
			}
			if(row >= rows)
				break;	/* Screen now full */
			putchar(c);
		}
#ifdef	notdef
		if(feof(fp) && offset != 0){
			/* Hit end of file. Back up proper number of
			 * lines and try again.
			 */
			offset = lineseek(fp,offset,row-rows,cols);
			continue;
		}
#endif
		fflush(stdout);
		/* If we hit the end of the file and the file may be
		 * growing, then set an alarm to time out the getchar()
		 */
		do {
			if(feof(fp) && polldelay != 0){
				kalarm(polldelay);
			}
			c = getchar();	/* Wait for user keystroke */
			kalarm(0L);	/* Cancel alarm */
			if(c != -1 || errno != EALARM)
				break;	/* User hit key */
			/* Alarm timeout; see if more data arrived by
			 * clearing the EOF flag, trying to read
			 * another byte, and then testing EOF again
			 */
			clearerr(fp);
			(void)getc(fp);
			c = ' ';	/* Simulate a no-op keypress */
		} while(feof(fp));
		switch(c){
		case 'h':	/* Home */
		case 'H':
		case '<':	/* For emacs users */
			offset = 0;
			break;
		case 'e':	/* End */
		case '>':	/* For emacs users */
			fseek(fp,0L,SEEK_END);
			offset = lineseek(fp,ftell(fp),-rows,cols);
			break;
		case CTLD:	/* Down one half screen (for VI users) */
			if(!feof(fp))
				offset = lineseek(fp,offset,rows/2,cols);
			break;
		case CTLU:	/* Up one half screen (for VI users) */
			offset = lineseek(fp,offset,-rows/2,cols);
			break;
		case 'd':	/* down line */
		case CTLN:	/* For emacs users */
		case 'j':	/* For vi users */
			if(!feof(fp))
				offset = lineseek(fp,offset,1,cols);
			break;
		case 'D':	/* Down page */
		case CTLV:	/* For emacs users */
			if(!feof(fp))
				offset = lineseek(fp,offset,rows,cols);
			break;
		case 'u':	/* up line */
		case CTLP:	/* for emacs users */
		case 'k':	/* for vi users */
			offset = lineseek(fp,offset,-1,cols);
			break;
		case 'U':	/* Up page */
		case 'v':	/* for emacs users */
			offset = lineseek(fp,offset,-rows,cols);
			break;
		case CTLC:
		case 'q':
		case 'Q':
		case ESC:
			goto done;
		default:
			break;	/* Redisplay screen */
		}
	}
done:	fclose(fp);
	freesession(sp);
}
/* Given a starting offset into an open file stream, scan forwards
 * or backwards the specified number of lines and return a pointer to the
 * new offset.
 */
static long
lineseek(fp,start,nlines,width)
FILE *fp;	/* Open file stream */
long start;	/* Offset to start searching backwards from */
int nlines;	/* Number of lines to move forward (+) or back (-) */
int width;	/* Screen width (max line size) */
{
	long offset;
	long *pointers;
	int col = 0;
	int c;
	int newlines = 0;

	if(nlines == 0)
		return start;	/* Nothing to do */

	if(nlines > 0){		/* Look forward requested # of lines */
		fseek(fp,start,SEEK_SET);
		col = 0;
		while((c = getc(fp)),c != EOF){
			switch(c){
			case '\n':
				newlines++;
				col = 0;
				break;
			case '\t':
				if(col < width - 8)
					col = (col + 8) & ~7;
				break;
			default:
				col++;
				break;
			}
			if(col >= width){
				/* Virtual newline caused by wraparound */
				col = 0;
				newlines++;
			}
			if(newlines >= nlines)
				break;	/* Found requested count */
		}
		return ftell(fp);	/* Could be EOF */
	}
	/* Backwards scan (the hardest)
	 * Start back up at most (width + 2) chars/line from the start.
	 * This handles full lines followed by expanded newline
	 * sequences
	 */
	nlines = -nlines;
	offset = (width + 2)*(nlines + 1);
	if(offset > start)
		offset = 0;	/* Go to the start of the file */
	else
		offset = start - offset;
	fseek(fp,offset,SEEK_SET);

	/* Keep a circular list of the last 'nlines' worth of offsets to
	 * each line, starting with the first
	 */
	pointers = (int32 *)calloc(sizeof(long),nlines);
	pointers[newlines++ % nlines] = offset;

	/* Now count newlines up but not including the original
	 * starting point
	 */
	col = 0;
	for(;;){
		c = getc(fp);
		switch(c){
		case EOF:
			goto done;
		case '\n':
			col = 0;
			offset = ftell(fp);
			if(offset >= start)
				goto done;
			pointers[newlines++ % nlines] = offset;
			break;
		case '\t':
			if(col < width - 8)
				col = (col + 8) & ~7;
			break;
		default:
			col++;
			break;
		}
		if(col >= width){
			/* Virtual newline caused by wraparound */
			col = 0;
			offset = ftell(fp);
			if(offset >= start)
				goto done;
			pointers[newlines++ % nlines] = offset;
		}
	}
	done:;
	if(newlines >= nlines){
		/* Select offset pointer nlines back */
		offset = pointers[newlines % nlines];
	} else {
		/* The specified number of newlines wasn't seen, so
		 * go to the start of the file
		 */
		offset = 0;
	}
	free(pointers);
	return offset;
}

/* Handle special keystrokes */
static int
ctlproc(c)
int c;
{
	switch(c){
	case 256 + 71:	/* HOME */
		putc('h',Current->input);
		break;
	case 256 + 72:	/* Cursor up */
		putc('u',Current->input);
		break;
	case 256 + 73:	/* Page up */
		putc('U',Current->input);
		break;
	case 256 + 79:	/* End */
		putc('e',Current->input);
		break;
	case 256 + 80:	/* Cursor down */
		putc('d',Current->input);
		break;
	case 256 + 81:	/* Page down */
		putc('D',Current->input);
		break;
	default:
		return c;
	}
	fflush(Current->input);
	return 0;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区精品在线| 成人av综合在线| 国产一区二区剧情av在线| 国产高清精品久久久久| 欧美性视频一区二区三区| 欧美一区二区私人影院日本| 中文字幕中文在线不卡住| 免费看黄色91| av高清不卡在线| 精品三级av在线| 亚洲一区视频在线| 成人动漫一区二区在线| 精品毛片乱码1区2区3区| 亚洲一区视频在线观看视频| 成人一区二区在线观看| 日韩欧美国产一区二区三区| 亚洲精品免费视频| 大胆欧美人体老妇| 精品久久久久久久人人人人传媒| 国产一区二区在线观看视频| 欧美日韩色一区| 中文字幕亚洲不卡| 国产不卡视频在线播放| 日韩午夜在线观看| 日韩av电影免费观看高清完整版| 91久久精品国产91性色tv| 国产精品久久久久影院| 国产麻豆视频精品| 欧美sm极限捆绑bd| 久久精品99国产精品日本| 欧美日韩视频一区二区| 亚洲电影一区二区| 91国偷自产一区二区三区观看 | 成人av动漫在线| 久久中文字幕电影| 国内欧美视频一区二区| 欧美大片在线观看一区二区| 美女视频黄 久久| 日韩一区二区视频在线观看| 蜜臀精品久久久久久蜜臀| 欧美精品一级二级三级| 日韩精品亚洲一区二区三区免费| 欧美亚洲国产一区二区三区va| 亚洲乱码国产乱码精品精98午夜 | 国产中文一区二区三区| 自拍偷自拍亚洲精品播放| 成人99免费视频| ㊣最新国产の精品bt伙计久久| 成人激情黄色小说| 亚洲另类春色国产| 在线亚洲精品福利网址导航| 亚洲自拍另类综合| 91精品国产免费| 狠狠色狠狠色综合系列| 亚洲国产精品国自产拍av| 成人性生交大片免费看在线播放 | 久久成人免费网站| 精品国产三级a在线观看| 国产精品888| 亚洲欧洲日韩av| 欧美色视频在线观看| 免费观看在线综合色| 久久久久久久精| 成人黄色免费短视频| 亚洲精品乱码久久久久久| 欧美一区二区三区视频在线观看| 国产一区二区女| 亚洲精品国产精华液| 欧美精品xxxxbbbb| 国产精品自拍一区| 夜夜嗨av一区二区三区中文字幕 | 欧美色精品在线视频| 老司机一区二区| 日本vs亚洲vs韩国一区三区| 日韩欧美一区二区三区在线| 成人一区二区三区视频在线观看| 亚洲电影欧美电影有声小说| 欧美成人性福生活免费看| 成人性色生活片| 石原莉奈一区二区三区在线观看| 久久精品夜夜夜夜久久| 欧美日韩高清一区| 成人性色生活片| 美洲天堂一区二卡三卡四卡视频| 欧美国产欧美综合| 欧美一区二区黄色| 91丨九色丨黑人外教| 精品一区二区三区免费视频| 亚洲精品美腿丝袜| 久久精品亚洲精品国产欧美 | 国产黄人亚洲片| 亚洲综合色视频| 久久久亚洲精品一区二区三区| 欧美日韩午夜在线| 成人avav影音| 极品少妇一区二区| 无码av中文一区二区三区桃花岛| 国产精品乱码一区二区三区软件 | 日本少妇一区二区| 自拍偷拍欧美精品| 国产午夜精品一区二区三区视频 | 久久午夜免费电影| 欧美人xxxx| 91激情在线视频| 成人免费av资源| 黄色精品一二区| 免费亚洲电影在线| 无码av中文一区二区三区桃花岛| 亚洲免费在线电影| 中文字幕中文在线不卡住| 国产亚洲va综合人人澡精品 | 久久综合色8888| 欧美一区二区三级| 在线不卡的av| 欧美日韩专区在线| 在线一区二区视频| 91同城在线观看| 91论坛在线播放| 91丨porny丨蝌蚪视频| 不卡视频一二三| 成人h精品动漫一区二区三区| 国产成人在线视频网址| 国产夫妻精品视频| 国产成人免费av在线| 国产一区二区免费在线| 成人综合在线观看| 97成人超碰视| 91激情五月电影| 在线不卡一区二区| 欧美电影免费观看完整版| 精品国产人成亚洲区| 国产色婷婷亚洲99精品小说| 国产精品久久久久久妇女6080 | 国产成人综合在线| 成人午夜av电影| 日本久久精品电影| 欧美在线视频不卡| 日韩三级精品电影久久久| 精品国产一区a| 欧美国产日韩一二三区| 尤物视频一区二区| 亚洲国产日日夜夜| 青青草国产成人av片免费| 国产在线精品视频| av成人老司机| 欧美日韩国产中文| 欧美大片在线观看| 亚洲图片欧美激情| 丝袜亚洲精品中文字幕一区| 精品亚洲成a人| 99久久精品情趣| 91精品国模一区二区三区| 久久久青草青青国产亚洲免观| 亚洲欧美在线另类| 国产在线国偷精品免费看| 91网站最新地址| 欧美精品123区| 久久九九久久九九| 亚洲一区二区在线免费看| 理论电影国产精品| 91老司机福利 在线| 日韩美女视频一区二区在线观看| 日本一区二区三区在线观看| 亚洲国产精品人人做人人爽| 国产专区综合网| 欧美三级资源在线| 国产欧美久久久精品影院| 丝袜国产日韩另类美女| 成人app软件下载大全免费| 欧美一级片在线| 亚洲欧美激情视频在线观看一区二区三区 | 中文字幕一区二区不卡| 日本欧美在线观看| 92精品国产成人观看免费| 日韩欧美一区二区视频| 亚洲免费av在线| 国内精品自线一区二区三区视频| 在线观看亚洲专区| 国产色91在线| 久久黄色级2电影| 欧美日韩综合在线免费观看| 国产欧美日韩一区二区三区在线观看 | 中文字幕第一区| 另类专区欧美蜜桃臀第一页| 欧美日韩亚洲国产综合| 亚洲欧美视频在线观看| 国产成人免费视频网站| 精品国精品国产| 全国精品久久少妇| 欧洲一区二区三区在线| 亚洲情趣在线观看| 粉嫩av亚洲一区二区图片| 欧美tickling网站挠脚心| 日韩av高清在线观看| 色综合色狠狠综合色| 国产精品免费视频观看| 国产99久久久国产精品免费看| 亚洲精品在线三区| 另类小说视频一区二区| 欧美电影免费观看完整版|