⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 common.c

📁 Asterisk-1.4.4最新内核源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
 **//* ed_tty_sigint(): *	Tty interrupt character *	[^C] */protected el_action_t/*ARGSUSED*/ed_tty_sigint(EditLine *el, int c){	return (CC_NORM);}/* ed_tty_dsusp(): *	Tty delayed suspend character *	[^Y] */protected el_action_t/*ARGSUSED*/ed_tty_dsusp(EditLine *el, int c){	return (CC_NORM);}/* ed_tty_flush_output(): *	Tty flush output characters *	[^O] */protected el_action_t/*ARGSUSED*/ed_tty_flush_output(EditLine *el, int c){	return (CC_NORM);}/* ed_tty_sigquit(): *	Tty quit character *	[^\] */protected el_action_t/*ARGSUSED*/ed_tty_sigquit(EditLine *el, int c){	return (CC_NORM);}/* ed_tty_sigtstp(): *	Tty suspend character *	[^Z] */protected el_action_t/*ARGSUSED*/ed_tty_sigtstp(EditLine *el, int c){	return (CC_NORM);}/* ed_tty_stop_output(): *	Tty disallow output characters *	[^S] */protected el_action_t/*ARGSUSED*/ed_tty_stop_output(EditLine *el, int c){	return (CC_NORM);}/* ed_tty_start_output(): *	Tty allow output characters *	[^Q] */protected el_action_t/*ARGSUSED*/ed_tty_start_output(EditLine *el, int c){	return (CC_NORM);}/* ed_newline(): *	Execute command *	[^J] */protected el_action_t/*ARGSUSED*/ed_newline(EditLine *el, int c){	re_goto_bottom(el);	*el->el_line.lastchar++ = '\n';	*el->el_line.lastchar = '\0';	if (el->el_map.type == MAP_VI)		el->el_chared.c_vcmd.ins = el->el_line.buffer;	return (CC_NEWLINE);}/* ed_delete_prev_char(): *	Delete the character to the left of the cursor *	[^?] */protected el_action_t/*ARGSUSED*/ed_delete_prev_char(EditLine *el, int c){	if (el->el_line.cursor <= el->el_line.buffer)		return (CC_ERROR);	c_delbefore(el, el->el_state.argument);	el->el_line.cursor -= el->el_state.argument;	if (el->el_line.cursor < el->el_line.buffer)		el->el_line.cursor = el->el_line.buffer;	return (CC_REFRESH);}/* ed_clear_screen(): *	Clear screen leaving current line at the top *	[^L] */protected el_action_t/*ARGSUSED*/ed_clear_screen(EditLine *el, int c){	term_clear_screen(el);	/* clear the whole real screen */	re_clear_display(el);	/* reset everything */	return (CC_REFRESH);}/* ed_redisplay(): *	Redisplay everything *	^R */protected el_action_t/*ARGSUSED*/ed_redisplay(EditLine *el, int c){	return (CC_REDISPLAY);}/* ed_start_over(): *	Erase current line and start from scratch *	[^G] */protected el_action_t/*ARGSUSED*/ed_start_over(EditLine *el, int c){	ch_reset(el);	return (CC_REFRESH);}/* ed_sequence_lead_in(): *	First character in a bound sequence *	Placeholder for external keys */protected el_action_t/*ARGSUSED*/ed_sequence_lead_in(EditLine *el, int c){	return (CC_NORM);}/* ed_prev_history(): *	Move to the previous history line *	[^P] [k] */protected el_action_t/*ARGSUSED*/ed_prev_history(EditLine *el, int c){	char beep = 0;	el->el_chared.c_undo.action = NOP;	*el->el_line.lastchar = '\0';		/* just in case */	if (el->el_history.eventno == 0) {	/* save the current buffer						 * away */		(void) strncpy(el->el_history.buf, el->el_line.buffer,		    EL_BUFSIZ - 1);		el->el_history.last = el->el_history.buf +		    (el->el_line.lastchar - el->el_line.buffer);	}	el->el_history.eventno += el->el_state.argument;	if (hist_get(el) == CC_ERROR) {		beep = 1;		/* el->el_history.eventno was fixed by first call */		(void) hist_get(el);	}	re_refresh(el);	if (beep)		return (CC_ERROR);	else		return (CC_NORM);	/* was CC_UP_HIST */}/* ed_next_history(): *	Move to the next history line *	[^N] [j] */protected el_action_t/*ARGSUSED*/ed_next_history(EditLine *el, int c){	el->el_chared.c_undo.action = NOP;	*el->el_line.lastchar = '\0';	/* just in case */	el->el_history.eventno -= el->el_state.argument;	if (el->el_history.eventno < 0) {		el->el_history.eventno = 0;		return (CC_ERROR);/* make it beep */	}	return (hist_get(el));}/* ed_search_prev_history(): *	Search previous in history for a line matching the current *	next search history [M-P] [K] */protected el_action_t/*ARGSUSED*/ed_search_prev_history(EditLine *el, int c){	const char *hp;	int h;	bool_t found = 0;	el->el_chared.c_vcmd.action = NOP;	el->el_chared.c_undo.action = NOP;	*el->el_line.lastchar = '\0';	/* just in case */	if (el->el_history.eventno < 0) {#ifdef DEBUG_EDIT		(void) fprintf(el->el_errfile,		    "e_prev_search_hist(): eventno < 0;\n");#endif		el->el_history.eventno = 0;		return (CC_ERROR);	}	if (el->el_history.eventno == 0) {		(void) strncpy(el->el_history.buf, el->el_line.buffer,		    EL_BUFSIZ - 1);		el->el_history.last = el->el_history.buf +		    (el->el_line.lastchar - el->el_line.buffer);	}	if (el->el_history.ref == NULL)		return (CC_ERROR);	hp = HIST_FIRST(el);	if (hp == NULL)		return (CC_ERROR);	c_setpat(el);		/* Set search pattern !! */	for (h = 1; h <= el->el_history.eventno; h++)		hp = HIST_NEXT(el);	while (hp != NULL) {#ifdef SDEBUG		(void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);#endif		if ((strncmp(hp, el->el_line.buffer, (size_t)			    (el->el_line.lastchar - el->el_line.buffer)) ||			hp[el->el_line.lastchar - el->el_line.buffer]) &&		    c_hmatch(el, hp)) {			found++;			break;		}		h++;		hp = HIST_NEXT(el);	}	if (!found) {#ifdef SDEBUG		(void) fprintf(el->el_errfile, "not found\n");#endif		return (CC_ERROR);	}	el->el_history.eventno = h;	return (hist_get(el));}/* ed_search_next_history(): *	Search next in history for a line matching the current *	[M-N] [J] */protected el_action_t/*ARGSUSED*/ed_search_next_history(EditLine *el, int c){	const char *hp;	int h;	bool_t found = 0;	el->el_chared.c_vcmd.action = NOP;	el->el_chared.c_undo.action = NOP;	*el->el_line.lastchar = '\0';	/* just in case */	if (el->el_history.eventno == 0)		return (CC_ERROR);	if (el->el_history.ref == NULL)		return (CC_ERROR);	hp = HIST_FIRST(el);	if (hp == NULL)		return (CC_ERROR);	c_setpat(el);		/* Set search pattern !! */	for (h = 1; h < el->el_history.eventno && hp; h++) {#ifdef SDEBUG		(void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);#endif		if ((strncmp(hp, el->el_line.buffer, (size_t)			    (el->el_line.lastchar - el->el_line.buffer)) ||			hp[el->el_line.lastchar - el->el_line.buffer]) &&		    c_hmatch(el, hp))			found = h;		hp = HIST_NEXT(el);	}	if (!found) {		/* is it the current history number? */		if (!c_hmatch(el, el->el_history.buf)) {#ifdef SDEBUG			(void) fprintf(el->el_errfile, "not found\n");#endif			return (CC_ERROR);		}	}	el->el_history.eventno = found;	return (hist_get(el));}/* ed_prev_line(): *	Move up one line *	Could be [k] [^p] */protected el_action_t/*ARGSUSED*/ed_prev_line(EditLine *el, int c){	char *ptr;	int nchars = c_hpos(el);	/*         * Move to the line requested         */	if (*(ptr = el->el_line.cursor) == '\n')		ptr--;	for (; ptr >= el->el_line.buffer; ptr--)		if (*ptr == '\n' && --el->el_state.argument <= 0)			break;	if (el->el_state.argument > 0)		return (CC_ERROR);	/*         * Move to the beginning of the line         */	for (ptr--; ptr >= el->el_line.buffer && *ptr != '\n'; ptr--)		continue;	/*         * Move to the character requested         */	for (ptr++;	    nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n';	    ptr++)		continue;	el->el_line.cursor = ptr;	return (CC_CURSOR);}/* ed_next_line(): *	Move down one line *	Could be [j] [^n] */protected el_action_t/*ARGSUSED*/ed_next_line(EditLine *el, int c){	char *ptr;	int nchars = c_hpos(el);	/*         * Move to the line requested         */	for (ptr = el->el_line.cursor; ptr < el->el_line.lastchar; ptr++)		if (*ptr == '\n' && --el->el_state.argument <= 0)			break;	if (el->el_state.argument > 0)		return (CC_ERROR);	/*         * Move to the character requested         */	for (ptr++;	    nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n';	    ptr++)		continue;	el->el_line.cursor = ptr;	return (CC_CURSOR);}/* ed_command(): *	Editline extended command *	[M-X] [:] */protected el_action_t/*ARGSUSED*/ed_command(EditLine *el, int c){	char tmpbuf[EL_BUFSIZ];	int tmplen;	el->el_line.buffer[0] = '\0';	el->el_line.lastchar = el->el_line.buffer;	el->el_line.cursor = el->el_line.buffer;	c_insert(el, 3);	/* prompt + ": " */	*el->el_line.cursor++ = '\n';	*el->el_line.cursor++ = ':';	*el->el_line.cursor++ = ' ';	re_refresh(el);	tmplen = c_gets(el, tmpbuf);	tmpbuf[tmplen] = '\0';	el->el_line.buffer[0] = '\0';	el->el_line.lastchar = el->el_line.buffer;	el->el_line.cursor = el->el_line.buffer;	if (parse_line(el, tmpbuf) == -1)		return (CC_ERROR);	else		return (CC_REFRESH);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -