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

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

?? textbox.c

?? 嵌入式LINUX中瑞士軍刀BusyBox源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* *  textbox.c -- implements the text box * *  ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) *  MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) * *  This program is free software; you can redistribute it and/or *  modify it under the terms of the GNU General Public License *  as published by the Free Software Foundation; either version 2 *  of the License, or (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */#include "dialog.h"static void back_lines (int n);static void print_page (WINDOW * win, int height, int width);static void print_line (WINDOW * win, int row, int width);static char *get_line (void);static void print_position (WINDOW * win, int height, int width);static int hscroll, fd, file_size, bytes_read;static int begin_reached = 1, end_reached, page_length;static char *buf, *page;/* * Display text from a file in a dialog box. */intdialog_textbox (const char *title, const char *file, int height, int width){    int i, x, y, cur_x, cur_y, fpos, key = 0;    int passed_end;    char search_term[MAX_LEN + 1];    WINDOW *dialog, *text;    search_term[0] = '\0';	/* no search term entered yet */    /* Open input file for reading */    if ((fd = open (file, O_RDONLY)) == -1) {	endwin ();	fprintf (stderr,		 "\nCan't open input file in dialog_textbox().\n");	exit (-1);    }    /* Get file size. Actually, 'file_size' is the real file size - 1,       since it's only the last byte offset from the beginning */    if ((file_size = lseek (fd, 0, SEEK_END)) == -1) {	endwin ();	fprintf (stderr, "\nError getting file size in dialog_textbox().\n");	exit (-1);    }    /* Restore file pointer to beginning of file after getting file size */    if (lseek (fd, 0, SEEK_SET) == -1) {	endwin ();	fprintf (stderr, "\nError moving file pointer in dialog_textbox().\n");	exit (-1);    }    /* Allocate space for read buffer */    if ((buf = malloc (BUF_SIZE + 1)) == NULL) {	endwin ();	fprintf (stderr, "\nCan't allocate memory in dialog_textbox().\n");	exit (-1);    }    if ((bytes_read = read (fd, buf, BUF_SIZE)) == -1) {	endwin ();	fprintf (stderr, "\nError reading file in dialog_textbox().\n");	exit (-1);    }    buf[bytes_read] = '\0';	/* mark end of valid data */    page = buf;			/* page is pointer to start of page to be displayed */    /* center dialog box on screen */    x = (COLS - width) / 2;    y = (LINES - height) / 2;    draw_shadow (stdscr, y, x, height, width);    dialog = newwin (height, width, y, x);    keypad (dialog, TRUE);    /* Create window for text region, used for scrolling text */    text = subwin (dialog, height - 4, width - 2, y + 1, x + 1);    wattrset (text, dialog_attr);    wbkgdset (text, dialog_attr & A_COLOR);    keypad (text, TRUE);    /* register the new window, along with its borders */    draw_box (dialog, 0, 0, height, width, dialog_attr, border_attr);    wattrset (dialog, border_attr);    mvwaddch (dialog, height-3, 0, ACS_LTEE);    for (i = 0; i < width - 2; i++)	waddch (dialog, ACS_HLINE);    wattrset (dialog, dialog_attr);    wbkgdset (dialog, dialog_attr & A_COLOR);    waddch (dialog, ACS_RTEE);    if (title != NULL && strlen(title) >= width-2 ) {	/* truncate long title -- mec */	char * title2 = malloc(width-2+1);	memcpy( title2, title, width-2 );	title2[width-2] = '\0';	title = title2;    }    if (title != NULL) {	wattrset (dialog, title_attr);	mvwaddch (dialog, 0, (width - strlen(title))/2 - 1, ' ');	waddstr (dialog, (char *)title);	waddch (dialog, ' ');    }    print_button (dialog, " Exit ", height - 2, width / 2 - 4, TRUE);    wnoutrefresh (dialog);    getyx (dialog, cur_y, cur_x);	/* Save cursor position */    /* Print first page of text */    attr_clear (text, height - 4, width - 2, dialog_attr);    print_page (text, height - 4, width - 2);    print_position (dialog, height, width);    wmove (dialog, cur_y, cur_x);	/* Restore cursor position */    wrefresh (dialog);    while ((key != ESC) && (key != '\n')) {	key = wgetch (dialog);	switch (key) {	case 'E':		/* Exit */	case 'e':	case 'X':	case 'x':	    delwin (dialog);	    free (buf);	    close (fd);	    return 0;	case 'g':		/* First page */	case KEY_HOME:	    if (!begin_reached) {		begin_reached = 1;		/* First page not in buffer? */		if ((fpos = lseek (fd, 0, SEEK_CUR)) == -1) {		    endwin ();		    fprintf (stderr,		      "\nError moving file pointer in dialog_textbox().\n");		    exit (-1);		}		if (fpos > bytes_read) {	/* Yes, we have to read it in */		    if (lseek (fd, 0, SEEK_SET) == -1) {			endwin ();			fprintf (stderr, "\nError moving file pointer in "				 "dialog_textbox().\n");			exit (-1);		    }		    if ((bytes_read = read (fd, buf, BUF_SIZE)) == -1) {			endwin ();			fprintf (stderr,			     "\nError reading file in dialog_textbox().\n");			exit (-1);		    }		    buf[bytes_read] = '\0';		}		page = buf;		print_page (text, height - 4, width - 2);		print_position (dialog, height, width);		wmove (dialog, cur_y, cur_x);	/* Restore cursor position */		wrefresh (dialog);	    }	    break;	case 'G':		/* Last page */	case KEY_END:	    end_reached = 1;	    /* Last page not in buffer? */	    if ((fpos = lseek (fd, 0, SEEK_CUR)) == -1) {		endwin ();		fprintf (stderr,		      "\nError moving file pointer in dialog_textbox().\n");		exit (-1);	    }	    if (fpos < file_size) {	/* Yes, we have to read it in */		if (lseek (fd, -BUF_SIZE, SEEK_END) == -1) {		    endwin ();		    fprintf (stderr,		      "\nError moving file pointer in dialog_textbox().\n");		    exit (-1);		}		if ((bytes_read = read (fd, buf, BUF_SIZE)) == -1) {		    endwin ();		    fprintf (stderr,			     "\nError reading file in dialog_textbox().\n");		    exit (-1);		}		buf[bytes_read] = '\0';	    }	    page = buf + bytes_read;	    back_lines (height - 4);	    print_page (text, height - 4, width - 2);	    print_position (dialog, height, width);	    wmove (dialog, cur_y, cur_x);	/* Restore cursor position */	    wrefresh (dialog);	    break;	case 'K':		/* Previous line */	case 'k':	case KEY_UP:	    if (!begin_reached) {		back_lines (page_length + 1);		/* We don't call print_page() here but use scrolling to ensure		   faster screen update. However, 'end_reached' and		   'page_length' should still be updated, and 'page' should		   point to start of next page. This is done by calling		   get_line() in the following 'for' loop. */		scrollok (text, TRUE);		wscrl (text, -1);	/* Scroll text region down one line */		scrollok (text, FALSE);		page_length = 0;		passed_end = 0;		for (i = 0; i < height - 4; i++) {		    if (!i) {			/* print first line of page */			print_line (text, 0, width - 2);			wnoutrefresh (text);		    } else			/* Called to update 'end_reached' and 'page' */			get_line ();		    if (!passed_end)			page_length++;		    if (end_reached && !passed_end)			passed_end = 1;		}		print_position (dialog, height, width);		wmove (dialog, cur_y, cur_x);	/* Restore cursor position */		wrefresh (dialog);	    }	    break;	case 'B':		/* Previous page */	case 'b':	case KEY_PPAGE:	    if (begin_reached)		break;	    back_lines (page_length + height - 4);	    print_page (text, height - 4, width - 2);	    print_position (dialog, height, width);	    wmove (dialog, cur_y, cur_x);	    wrefresh (dialog);	    break;	case 'J':		/* Next line */	case 'j':	case KEY_DOWN:	    if (!end_reached) {		begin_reached = 0;		scrollok (text, TRUE);		scroll (text);	/* Scroll text region up one line */		scrollok (text, FALSE);		print_line (text, height - 5, width - 2);		wnoutrefresh (text);		print_position (dialog, height, width);		wmove (dialog, cur_y, cur_x);	/* Restore cursor position */		wrefresh (dialog);	    }	    break;	case KEY_NPAGE:		/* Next page */	case ' ':	    if (end_reached)		break;	    begin_reached = 0;	    print_page (text, height - 4, width - 2);	    print_position (dialog, height, width);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品人人做人人爽97| 亚洲免费观看高清完整| 国产精品福利影院| 日韩av不卡在线观看| 99re66热这里只有精品3直播| 欧美剧在线免费观看网站| 国产婷婷色一区二区三区 | 日本一区二区三区视频视频| 亚洲成a人片在线观看中文| 成人免费视频免费观看| 欧美不卡一区二区三区四区| 亚洲一区二区综合| 成人av第一页| 国产三级欧美三级日产三级99| 午夜精品久久久久久不卡8050| 91在线你懂得| 中文字幕的久久| 国产成人免费视频一区| 精品精品欲导航| 婷婷国产在线综合| 欧美中文字幕一区| 亚洲欧美激情视频在线观看一区二区三区| 国产一区999| 精品1区2区在线观看| 麻豆精品视频在线观看免费| 91麻豆精品久久久久蜜臀| 亚洲国产成人porn| 91丨九色丨国产丨porny| 国产日韩精品一区| 国产**成人网毛片九色| 久久午夜电影网| 国产自产2019最新不卡| 精品奇米国产一区二区三区| 视频在线在亚洲| 7777精品伊人久久久大香线蕉经典版下载| 亚洲宅男天堂在线观看无病毒| 色综合久久综合网欧美综合网| 国产精品你懂的在线| 在线观看精品一区| 亚洲精品国产精华液| 91福利国产成人精品照片| 亚洲综合一区二区三区| 欧美日韩一区视频| 天堂午夜影视日韩欧美一区二区| 欧美日韩一级二级| 美女视频黄频大全不卡视频在线播放 | 91在线高清观看| 亚洲免费伊人电影| 欧美影院一区二区| 免费观看91视频大全| 精品福利一二区| 国产精品亚洲成人| 欧美激情综合五月色丁香小说| 成人精品免费看| 一区二区三区四区在线播放| 欧美日韩卡一卡二| 麻豆精品蜜桃视频网站| 国产亚洲综合色| 欧美午夜片在线观看| 久久成人免费电影| 亚洲天堂网中文字| 日韩视频一区二区三区在线播放| 极品少妇xxxx精品少妇| 国产日本欧美一区二区| 色婷婷亚洲婷婷| 国产在线视频一区二区| 国产精品超碰97尤物18| 欧美日韩亚洲综合在线 | av资源网一区| 国产一区二区不卡在线| 中文字幕一区在线观看视频| 欧美精品在线一区二区| 国产精品亚洲а∨天堂免在线| 一区二区三区免费看视频| 精品乱人伦一区二区三区| 成人v精品蜜桃久久一区| 三级一区在线视频先锋 | 欧美v亚洲v综合ⅴ国产v| 成人av资源下载| 日本女人一区二区三区| 亚洲特黄一级片| 精品粉嫩超白一线天av| 欧美主播一区二区三区| 国产成人在线视频播放| 日韩av中文字幕一区二区| 综合精品久久久| 久久久电影一区二区三区| 欧美一区二区在线观看| 91在线国产福利| 国产一区在线观看麻豆| 三级精品在线观看| 亚洲影视在线观看| 中文字幕在线播放不卡一区| 亚洲精品一区二区三区福利| 欧美日本精品一区二区三区| 97精品久久久午夜一区二区三区 | 日韩久久精品一区| 欧美午夜精品电影| 91香蕉视频污在线| 国产·精品毛片| 国模娜娜一区二区三区| 日本在线不卡视频| 午夜激情久久久| 亚洲韩国精品一区| 一色桃子久久精品亚洲| 国产色产综合色产在线视频| 国产精品久久精品日日| 精品成人免费观看| 欧美sm极限捆绑bd| 欧美一级片免费看| 欧美一级欧美三级| 欧美丰满美乳xxx高潮www| 在线精品亚洲一区二区不卡| 日本乱码高清不卡字幕| 91免费看片在线观看| 99久久久无码国产精品| 91麻豆123| 欧洲一区二区三区在线| 欧美性大战久久久| 欧美乱妇15p| 日韩视频一区在线观看| 精品国产免费一区二区三区四区| 欧美一区二区视频在线观看2020| 欧美精品xxxxbbbb| 欧美一级在线视频| 久久―日本道色综合久久| 国产亚洲精品免费| 综合久久国产九一剧情麻豆| 一区2区3区在线看| 亚洲成人动漫在线观看| 免费看精品久久片| 国产麻豆精品95视频| 成人视屏免费看| 91丨九色丨国产丨porny| 欧美日韩午夜精品| 精品国产1区2区3区| 国产精品欧美一级免费| 亚洲精品欧美激情| 日本不卡123| 国产成人精品影视| 欧美体内she精视频| 欧美sm极限捆绑bd| 亚洲欧美日韩国产另类专区| 性做久久久久久免费观看 | 亚洲aⅴ怡春院| 激情综合网激情| 99久久99久久精品免费看蜜桃| 91成人免费网站| 精品少妇一区二区三区免费观看 | 成人一级视频在线观看| 色诱亚洲精品久久久久久| 欧美一区二区三区色| 国产欧美精品国产国产专区| 亚洲激情在线播放| 美女高潮久久久| 色偷偷一区二区三区| 日韩欧美高清在线| 亚洲女人小视频在线观看| 久久激情五月激情| 色欧美乱欧美15图片| 精品国产一二三| 亚洲电影欧美电影有声小说| 国产福利一区在线| 欧美性猛交xxxx黑人交| 国产色婷婷亚洲99精品小说| 亚洲gay无套男同| 成人午夜激情视频| 欧美一二三在线| 亚洲精品日韩一| 成人性色生活片免费看爆迷你毛片| 精品视频1区2区| 综合亚洲深深色噜噜狠狠网站| 裸体在线国模精品偷拍| 色哦色哦哦色天天综合| 国产精品你懂的在线欣赏| 精品一区二区三区影院在线午夜 | 91热门视频在线观看| 欧美成人性战久久| 亚洲mv在线观看| 日本韩国一区二区三区视频| 欧美国产日产图区| 国内精品久久久久影院薰衣草 | 欧美电视剧免费观看| 亚洲国产人成综合网站| www.亚洲色图.com| 欧美国产精品久久| 国产伦精品一区二区三区在线观看| 欧美午夜视频网站| 一区二区三区资源| 91视频.com| 日韩一区在线免费观看| 成人app网站| 国产欧美日韩视频一区二区| 国产精品亚洲成人| 国产女同性恋一区二区| 国产在线麻豆精品观看| 欧美mv日韩mv亚洲| 国内精品视频666| 国产日韩欧美高清| 9i看片成人免费高清|