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

📄 tty.c

📁 这是linux下运行的mysql软件包,可用于linux 下安装 php + mysql + apach 的网络配置
💻 C
📖 第 1 页 / 共 3 页
字号:
	{"time", C_SH(C_TIME), MD_CHAR},#endif /* VTIME */	{NULL, 0, -1},};#define	tty_getty(el, td)	tcgetattr((el)->el_infd, (td))#define	tty_setty(el, td)	tcsetattr((el)->el_infd, TCSADRAIN, (td))#define	tty__gettabs(td)	((((td)->c_oflag & TAB3) == TAB3) ? 0 : 1)#define	tty__geteightbit(td)	(((td)->c_cflag & CSIZE) == CS8)#define	tty__cooked_mode(td)	((td)->c_lflag & ICANON)private int	tty__getcharindex(int);private void	tty__getchar(struct termios *, unsigned char *);private void	tty__setchar(struct termios *, unsigned char *);private speed_t	tty__getspeed(struct termios *);private int	tty_setup(EditLine *);#define	t_qu	t_ts/* tty_setup(): *	Get the tty parameters and initialize the editing state */private inttty_setup(EditLine *el){	int rst = 1;	if (el->el_flags & EDIT_DISABLED)		return (0);	if (tty_getty(el, &el->el_tty.t_ed) == -1) {#ifdef DEBUG_TTY		(void) fprintf(el->el_errfile,		    "tty_setup: tty_getty: %s\n", strerror(errno));#endif /* DEBUG_TTY */		return (-1);	}	el->el_tty.t_ts = el->el_tty.t_ex = el->el_tty.t_ed;	el->el_tty.t_speed = tty__getspeed(&el->el_tty.t_ex);	el->el_tty.t_tabs = tty__gettabs(&el->el_tty.t_ex);	el->el_tty.t_eight = tty__geteightbit(&el->el_tty.t_ex);	el->el_tty.t_ex.c_iflag &= ~el->el_tty.t_t[EX_IO][MD_INP].t_clrmask;	el->el_tty.t_ex.c_iflag |= el->el_tty.t_t[EX_IO][MD_INP].t_setmask;	el->el_tty.t_ex.c_oflag &= ~el->el_tty.t_t[EX_IO][MD_OUT].t_clrmask;	el->el_tty.t_ex.c_oflag |= el->el_tty.t_t[EX_IO][MD_OUT].t_setmask;	el->el_tty.t_ex.c_cflag &= ~el->el_tty.t_t[EX_IO][MD_CTL].t_clrmask;	el->el_tty.t_ex.c_cflag |= el->el_tty.t_t[EX_IO][MD_CTL].t_setmask;	el->el_tty.t_ex.c_lflag &= ~el->el_tty.t_t[EX_IO][MD_LIN].t_clrmask;	el->el_tty.t_ex.c_lflag |= el->el_tty.t_t[EX_IO][MD_LIN].t_setmask;	/*         * Reset the tty chars to reasonable defaults         * If they are disabled, then enable them.         */	if (rst) {		if (tty__cooked_mode(&el->el_tty.t_ts)) {			tty__getchar(&el->el_tty.t_ts, el->el_tty.t_c[TS_IO]);			/*	                 * Don't affect CMIN and CTIME for the editor mode	                 */			for (rst = 0; rst < C_NCC - 2; rst++)				if (el->el_tty.t_c[TS_IO][rst] !=				      el->el_tty.t_vdisable				    && el->el_tty.t_c[ED_IO][rst] !=				      el->el_tty.t_vdisable)					el->el_tty.t_c[ED_IO][rst] =					    el->el_tty.t_c[TS_IO][rst];			for (rst = 0; rst < C_NCC; rst++)				if (el->el_tty.t_c[TS_IO][rst] !=				    el->el_tty.t_vdisable)					el->el_tty.t_c[EX_IO][rst] =					    el->el_tty.t_c[TS_IO][rst];		}		tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[EX_IO]);		if (tty_setty(el, &el->el_tty.t_ex) == -1) {#ifdef DEBUG_TTY			(void) fprintf(el->el_errfile,			    "tty_setup: tty_setty: %s\n",			    strerror(errno));#endif /* DEBUG_TTY */			return (-1);		}	} else		tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[EX_IO]);	el->el_tty.t_ed.c_iflag &= ~el->el_tty.t_t[ED_IO][MD_INP].t_clrmask;	el->el_tty.t_ed.c_iflag |= el->el_tty.t_t[ED_IO][MD_INP].t_setmask;	el->el_tty.t_ed.c_oflag &= ~el->el_tty.t_t[ED_IO][MD_OUT].t_clrmask;	el->el_tty.t_ed.c_oflag |= el->el_tty.t_t[ED_IO][MD_OUT].t_setmask;	el->el_tty.t_ed.c_cflag &= ~el->el_tty.t_t[ED_IO][MD_CTL].t_clrmask;	el->el_tty.t_ed.c_cflag |= el->el_tty.t_t[ED_IO][MD_CTL].t_setmask;	el->el_tty.t_ed.c_lflag &= ~el->el_tty.t_t[ED_IO][MD_LIN].t_clrmask;	el->el_tty.t_ed.c_lflag |= el->el_tty.t_t[ED_IO][MD_LIN].t_setmask;	tty__setchar(&el->el_tty.t_ed, el->el_tty.t_c[ED_IO]);	tty_bind_char(el, 1);	return (0);}protected inttty_init(EditLine *el){	el->el_tty.t_mode = EX_IO;	el->el_tty.t_vdisable = _POSIX_VDISABLE;	(void) memcpy(el->el_tty.t_t, ttyperm, sizeof(ttyperm_t));	(void) memcpy(el->el_tty.t_c, ttychar, sizeof(ttychar_t));	return (tty_setup(el));}/* tty_end(): *	Restore the tty to its original settings */protected void/*ARGSUSED*/tty_end(EditLine *el __attribute__((__unused__))){	/* XXX: Maybe reset to an initial state? */}/* tty__getspeed(): *	Get the tty speed */private speed_ttty__getspeed(struct termios *td){	speed_t spd;	if ((spd = cfgetispeed(td)) == 0)		spd = cfgetospeed(td);	return (spd);}/* tty__getspeed(): *	Return the index of the asked char in the c_cc array */private inttty__getcharindex(int i){	switch (i) {#ifdef VINTR	case C_INTR:		return VINTR;#endif /* VINTR */#ifdef VQUIT	case C_QUIT:		return VQUIT;#endif /* VQUIT */#ifdef VERASE	case C_ERASE:		return VERASE;#endif /* VERASE */#ifdef VKILL	case C_KILL:		return VKILL;#endif /* VKILL */#ifdef VEOF	case C_EOF:		return VEOF;#endif /* VEOF */#ifdef VEOL	case C_EOL:		return VEOL;#endif /* VEOL */#ifdef VEOL2	case C_EOL2:		return VEOL2;#endif /* VEOL2 */#ifdef VSWTCH	case C_SWTCH:		return VSWTCH;#endif /* VSWTCH */#ifdef VDSWTCH	case C_DSWTCH:		return VDSWTCH;#endif /* VDSWTCH */#ifdef VERASE2	case C_ERASE2:		return VERASE2;#endif /* VERASE2 */#ifdef VSTART	case C_START:		return VSTART;#endif /* VSTART */#ifdef VSTOP	case C_STOP:		return VSTOP;#endif /* VSTOP */#ifdef VWERASE	case C_WERASE:		return VWERASE;#endif /* VWERASE */#ifdef VSUSP	case C_SUSP:		return VSUSP;#endif /* VSUSP */#ifdef VDSUSP	case C_DSUSP:		return VDSUSP;#endif /* VDSUSP */#ifdef VREPRINT	case C_REPRINT:		return VREPRINT;#endif /* VREPRINT */#ifdef VDISCARD	case C_DISCARD:		return VDISCARD;#endif /* VDISCARD */#ifdef VLNEXT	case C_LNEXT:		return VLNEXT;#endif /* VLNEXT */#ifdef VSTATUS	case C_STATUS:		return VSTATUS;#endif /* VSTATUS */#ifdef VPAGE	case C_PAGE:		return VPAGE;#endif /* VPAGE */#ifdef VPGOFF	case C_PGOFF:		return VPGOFF;#endif /* VPGOFF */#ifdef VKILL2	case C_KILL2:		return VKILL2;#endif /* KILL2 */#ifdef VMIN	case C_MIN:		return VMIN;#endif /* VMIN */#ifdef VTIME	case C_TIME:		return VTIME;#endif /* VTIME */	default:		return -1;	}}/* tty__getchar(): *	Get the tty characters */private voidtty__getchar(struct termios *td, unsigned char *s){#ifdef VINTR	s[C_INTR] = td->c_cc[VINTR];#endif /* VINTR */#ifdef VQUIT	s[C_QUIT] = td->c_cc[VQUIT];#endif /* VQUIT */#ifdef VERASE	s[C_ERASE] = td->c_cc[VERASE];#endif /* VERASE */#ifdef VKILL	s[C_KILL] = td->c_cc[VKILL];#endif /* VKILL */#ifdef VEOF	s[C_EOF] = td->c_cc[VEOF];#endif /* VEOF */#ifdef VEOL	s[C_EOL] = td->c_cc[VEOL];#endif /* VEOL */#ifdef VEOL2	s[C_EOL2] = td->c_cc[VEOL2];#endif /* VEOL2 */#ifdef VSWTCH	s[C_SWTCH] = td->c_cc[VSWTCH];#endif /* VSWTCH */#ifdef VDSWTCH	s[C_DSWTCH] = td->c_cc[VDSWTCH];#endif /* VDSWTCH */#ifdef VERASE2	s[C_ERASE2] = td->c_cc[VERASE2];#endif /* VERASE2 */#ifdef VSTART	s[C_START] = td->c_cc[VSTART];#endif /* VSTART */#ifdef VSTOP	s[C_STOP] = td->c_cc[VSTOP];#endif /* VSTOP */#ifdef VWERASE	s[C_WERASE] = td->c_cc[VWERASE];#endif /* VWERASE */#ifdef VSUSP	s[C_SUSP] = td->c_cc[VSUSP];#endif /* VSUSP */#ifdef VDSUSP	s[C_DSUSP] = td->c_cc[VDSUSP];#endif /* VDSUSP */#ifdef VREPRINT	s[C_REPRINT] = td->c_cc[VREPRINT];#endif /* VREPRINT */#ifdef VDISCARD	s[C_DISCARD] = td->c_cc[VDISCARD];#endif /* VDISCARD */#ifdef VLNEXT	s[C_LNEXT] = td->c_cc[VLNEXT];#endif /* VLNEXT */#ifdef VSTATUS	s[C_STATUS] = td->c_cc[VSTATUS];#endif /* VSTATUS */#ifdef VPAGE	s[C_PAGE] = td->c_cc[VPAGE];#endif /* VPAGE */#ifdef VPGOFF	s[C_PGOFF] = td->c_cc[VPGOFF];#endif /* VPGOFF */#ifdef VKILL2	s[C_KILL2] = td->c_cc[VKILL2];#endif /* KILL2 */#ifdef VMIN	s[C_MIN] = td->c_cc[VMIN];#endif /* VMIN */#ifdef VTIME	s[C_TIME] = td->c_cc[VTIME];#endif /* VTIME */}				/* tty__getchar *//* tty__setchar(): *	Set the tty characters */private voidtty__setchar(struct termios *td, unsigned char *s){#ifdef VINTR	td->c_cc[VINTR] = s[C_INTR];#endif /* VINTR */#ifdef VQUIT	td->c_cc[VQUIT] = s[C_QUIT];#endif /* VQUIT */#ifdef VERASE	td->c_cc[VERASE] = s[C_ERASE];#endif /* VERASE */#ifdef VKILL	td->c_cc[VKILL] = s[C_KILL];#endif /* VKILL */#ifdef VEOF	td->c_cc[VEOF] = s[C_EOF];#endif /* VEOF */#ifdef VEOL	td->c_cc[VEOL] = s[C_EOL];#endif /* VEOL */#ifdef VEOL2	td->c_cc[VEOL2] = s[C_EOL2];#endif /* VEOL2 */#ifdef VSWTCH	td->c_cc[VSWTCH] = s[C_SWTCH];#endif /* VSWTCH */#ifdef VDSWTCH	td->c_cc[VDSWTCH] = s[C_DSWTCH];#endif /* VDSWTCH */#ifdef VERASE2	td->c_cc[VERASE2] = s[C_ERASE2];#endif /* VERASE2 */#ifdef VSTART	td->c_cc[VSTART] = s[C_START];#endif /* VSTART */#ifdef VSTOP	td->c_cc[VSTOP] = s[C_STOP];#endif /* VSTOP */#ifdef VWERASE	td->c_cc[VWERASE] = s[C_WERASE];#endif /* VWERASE */#ifdef VSUSP	td->c_cc[VSUSP] = s[C_SUSP];#endif /* VSUSP */#ifdef VDSUSP	td->c_cc[VDSUSP] = s[C_DSUSP];#endif /* VDSUSP */#ifdef VREPRINT	td->c_cc[VREPRINT] = s[C_REPRINT];#endif /* VREPRINT */#ifdef VDISCARD	td->c_cc[VDISCARD] = s[C_DISCARD];#endif /* VDISCARD */#ifdef VLNEXT	td->c_cc[VLNEXT] = s[C_LNEXT];#endif /* VLNEXT */#ifdef VSTATUS	td->c_cc[VSTATUS] = s[C_STATUS];#endif /* VSTATUS */#ifdef VPAGE	td->c_cc[VPAGE] = s[C_PAGE];#endif /* VPAGE */#ifdef VPGOFF	td->c_cc[VPGOFF] = s[C_PGOFF];#endif /* VPGOFF */#ifdef VKILL2	td->c_cc[VKILL2] = s[C_KILL2];#endif /* VKILL2 */#ifdef VMIN	td->c_cc[VMIN] = s[C_MIN];#endif /* VMIN */#ifdef VTIME	td->c_cc[VTIME] = s[C_TIME];#endif /* VTIME */}				/* tty__setchar *//* tty_bind_char(): *	Rebind the editline functions */protected voidtty_bind_char(EditLine *el, int force){	unsigned char *t_n = el->el_tty.t_c[ED_IO];	unsigned char *t_o = el->el_tty.t_ed.c_cc;	unsigned char new[2], old[2];	const ttymap_t *tp;	el_action_t *map, *alt;	const el_action_t *dmap, *dalt;

⌨️ 快捷键说明

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