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

📄 config.c

📁 VT100终端程序
💻 C
📖 第 1 页 / 共 3 页
字号:
  	case 'E':  		get_bbp(P_BAUDRATE, P_BITS, P_PARITY, 0);  		if (portfd >= 0) port_init();  		wlocate(w, 29, 4);		wprintf(w, "%s %s%s1  \n", P_BAUDRATE, P_BITS, P_PARITY);		if (st != NIL_WIN) mode_status();		markch(P_BAUDRATE);		markch(P_BITS);		markch(P_PARITY);		break;	case 'F':		strcpy(P_HASRTS, yesno(P_HASRTS[0] == 'N'));		wlocate(w, 29, 5);		wprintf(w, "%s ", P_HASRTS);  		if (portfd >= 0) port_init();		markch(P_HASRTS);		break;	case 'G':		strcpy(P_HASXON, yesno(P_HASXON[0] == 'N'));		wlocate(w, 29, 6);		wprintf(w, "%s ", P_HASXON);  		if (portfd >= 0) port_init();		markch(P_HASXON);		break;  	default:  		break;      }  }}static void domodem(){  WIN *w;  char *str;  int c, x, y, ypos, maxl;  w = wopen(2, 2, 77, 21, BDOUBLE, stdattr, mfcolor, mbcolor, 0, 0, 1);  dirflush = 0;  wtitle(w, TMID, "Modem and dialing parameter setup");  wprintf(w, "\n");  wprintf(w, " A - Init string ......... %.48s\n", P_MINIT);  wprintf(w, " B - Reset string ........ %.48s\n", P_MRESET);  wprintf(w, " C - Dialing prefix #1.... %.48s\n", P_MDIALPRE);  wprintf(w, " D - Dialing suffix #1.... %.48s\n", P_MDIALSUF);  wprintf(w, " E - Dialing prefix #2.... %.48s\n", P_MDIALPRE2);  wprintf(w, " F - Dialing suffix #2.... %.48s\n", P_MDIALSUF2);  wprintf(w, " G - Dialing prefix #3.... %.48s\n", P_MDIALPRE3);  wprintf(w, " H - Dialing suffix #3.... %.48s\n", P_MDIALSUF3);  wprintf(w, " I - Connect string ...... %.48s\n", P_MCONNECT);  wprintf(w, " J - No connect strings .. %-20.20s  %.20s\n", P_MNOCON1, P_MNOCON2);  wlocate(w, 27, 11);  wprintf(w, "%-20.20s  %.20s\n", P_MNOCON3, P_MNOCON4);  wprintf(w, " K - Hang-up string ...... %.48s\n", P_MHANGUP);  wprintf(w, " L - Dial cancel string .. %.48s\n", P_MDIALCAN);  wprintf(w, "\n");  wprintf(w, " M - Dial time ........... %.3s\n", P_MDIALTIME);  wprintf(w, " N - Delay before redial . %.3s\n", P_MRDELAY);  wprintf(w, " O - Number of tries ..... %.3s\n", P_MRETRIES);  wlocate(w, 34, 15);  wprintf(w, " P - Auto baud detect .... %s\n", P_MAUTOBAUD);  wlocate(w, 34, 16);  wprintf(w, " Q - Drop DTR to hangup .. %s\n", P_MDROPDTR);  wlocate(w, 34, 17);  wprintf(w, " R - Modem has DCD line .. %s\n", P_HASDCD);  wlocate(w, 1, 19);  wprintf(w, " Change which setting? ");  x = w->curx; y = w->cury;  wprintf(w, "      (Return or Esc to exit)");  wredraw(w, 1);  while(1) {  	wlocate(w, x, y);  	wflush();  	c = rwxgetch();  	ypos = 1;	maxl = 64;  	switch(c) {  		case 'M':  		case 'N':  		case 'O':  			ypos++;			maxl = 4;  		case 'K':  		case 'L':  			ypos -= 2;  			c += 3;  		case 'A':  		case 'B':  		case 'C':  		case 'D':  		case 'E':		case 'F':		case 'G':		case 'H':		case 'I':  			/* Calculate adress of string tomodify */  			str = P_MINIT + (c - 'A') * sizeof(struct pars);  			pgets(w, 27, ypos + (c - 'A'), str, maxl, maxl);  			break;  		case 'J':  			/* Walk through all four */  			pgets(w, 27, 10, P_MNOCON1, 20, 64);  			pgets(w, 49, 10, P_MNOCON2, 20, 64);  			pgets(w, 27, 11, P_MNOCON3, 20, 64);  			pgets(w, 49, 11, P_MNOCON4, 20, 64);  			break;  		case 'P':  			psets(P_MAUTOBAUD, yesno(P_MAUTOBAUD[0] == 'N'));  			wlocate(w, 61, 15);  			wputs(w, P_MAUTOBAUD);  			break;  		case 'Q':  			psets(P_MDROPDTR, yesno(P_MDROPDTR[0] == 'N'));  			wlocate(w, 61, 16);  			wputs(w, P_MDROPDTR);  			break;  		case 'R':  			psets(P_HASDCD, yesno(P_HASDCD[0] == 'N'));  			wlocate(w, 61, 17);  			wputs(w, P_HASDCD);  			break;  		case '\n':  			dirflush = 1;  			wclose(w, 1);  			return;  		default:  			break;	  	}  }}/* * Screen and keyboard menu. */static void doscrkeyb(){  WIN *w, *w1;  int c;  int once = 0;  int clr = 1;  int tmp_c;    /* fmg - need it to color keep in sanity checks */  char buf[16];  int miny = 4,   maxy = 17;  int old_stat = P_STATLINE[0];#if _HAVE_MACROS  FILE	*fp;  miny = 3;  maxy = 19;#endif  w = wopen(15, miny, 69, maxy, BDOUBLE, stdattr, mfcolor, mbcolor, 0, 0, 1);  wtitle(w, TMID, "Screen and keyboard");  wprintf(w, "\n A - Command key is         : %s\n", P_ESCAPE);  wprintf(w, " B - Backspace key sends    : %s\n", P_BACKSPACE);  wprintf(w, " C - Status line is         : %s\n", P_STATLINE);  wprintf(w, " D - Alarm sound            : %s\n", P_SOUND);  /* fmg - colors support */  wprintf(w, " E - Foreground Color (menu): %s\n", J_col[mfcolor]);  wprintf(w, " F - Background Color (menu): %s\n", J_col[mbcolor]);  wprintf(w, " G - Foreground Color (term): %s\n", J_col[tfcolor]);  wprintf(w, " H - Background Color (term): %s\n", J_col[tbcolor]);  wprintf(w, " I - Foreground Color (stat): %s\n", J_col[sfcolor]);  wprintf(w, " J - Background Color (stat): %s\n", J_col[sbcolor]);    /* MARK updated 02/17/95 - Configurable history buffer size */  wprintf(w, " K - History Buffer Size    : %s\n", P_HISTSIZE);#if _HAVE_MACROS  /* fmg - macros support */  wprintf(w, " L - Macros file            : %s\n", P_MACROS);  wprintf(w, " M - Edit Macros\n");  wprintf(w, " N - Macros enabled         : %s\n", P_MACENAB);#endif  wredraw(w, 1);  while(1) {  	if (clr) {  		wlocate(w, 2, maxy - miny);		wputs(w, "Change which setting?  (Esc to exit) ");		wclreol(w);		clr = 0;	} else  		wlocate(w, 39, maxy - miny);  	if (once) {	/* fmg - allow to force looping */  		c = once;  		once = 0;	} else c = rwxgetch();#if 0 /* This might save us someday */	if (!usecolor && (c >= 'E' && c <= 'J')) {		werror("You can't change colors in black and white mode");		continue;	}#endif  	switch(c) {  		case '\n':                 /* fmg - sanity checks... "we found the enemy and he is us" :-) */                 if (mfcolor == mbcolor)   /* oops... */                 {                    tmp_c=mfcolor;      /* save color (same for both, right?) */                    mfcolor=WHITE;      /* make sure they can see error :-) */                    mbcolor=BLACK;                    werror("Menu foreground == background color, change!");                    mfcolor=tmp_c;      /* restore colors */                    mbcolor=tmp_c;                    break;                 }                 if (tfcolor == tbcolor)   /* oops... */                 {                    tmp_c=mfcolor;      /* save color (same for both, right?) */                    mfcolor=WHITE;      /* make sure they can see error :-) */                    mbcolor=BLACK;                    werror("Terminal foreground == background color, change!");                    mfcolor=tmp_c;      /* restore colors */                    mbcolor=tmp_c;                    break;                 }                 /* fmg - I'll let them change sfcolor=sbcolor because it's just                          another way of turning "off" the status line... */			/* MARK updated 02/17/95, Warn user to restart */			/* minicom if they changed history buffer size */			if (atoi(P_HISTSIZE) != num_hist_lines) {				w1 = wopen(14, 9, 70, 15, BSINGLE, stdattr, mfcolor, mbcolor, 0, 0, 1);				wtitle(w1, TMID, "History Buffer Size");				wputs(w1, "\n\  You have changed the history buffer size.\n\  You will need to save the configuration file and\n\  restart minicom for the change to take effect.\n\n\  Hit a key to Continue... ");				wredraw(w1, 1);				c = wxgetch();				wclose(w1, 1);			}  			wclose(w, 1);			/* If status line enabled/disabled resize screen. */			if (P_STATLINE[0] != old_stat)				init_emul(terminal, 0);  			return;  		case 'A':  			w1 = wopen(11, 8, 73, 17, BSINGLE, stdattr, mfcolor, mbcolor, 0, 0, 1);			wtitle(w1, TMID, "Program new command key");			wputs(w1, "\n Press the new command key. If you want to use\n");			wputs(w1, " the META or ALT key enter:\n\n");			wputs(w1, "  o SPACE if your meta key sets the 8th bit high\n");			wputs(w1, "  o ESC   if your meta key sends the ESCAPE prefix (standard)\n");			wputs(w1, "\n\n Press new command key: ");			wredraw(w1, 1);			c = wxgetch();			wclose(w1, 1);  			if (c  == ' ')  				strcpy(buf, "Meta-8th bit ");  			else if (c == 27)				strcpy(buf, "Escape (Meta)");			else  				sprintf(buf, "^%c          ", (c & 0x1f) + 'A' - 1);  			psets(P_ESCAPE, buf);  			wlocate(w, 30, 1);  			wputs(w, buf);  			clr = 1;  			alt_override = 0;			switch(P_ESCAPE[0]) {				case '^':					c = P_ESCAPE[1] & 31;					break;				case 'E':					c = 27;					break;				default:					c = 128;					break;			}			keyboard(KSETESC, c);  			if (st) show_status();  			break;  		case 'B':  			if (P_BACKSPACE[0] == 'D')  				psets(P_BACKSPACE, "BS");  			else  				psets(P_BACKSPACE, "DEL");  			wlocate(w, 30, 2);  			wprintf(w, "%s ", P_BACKSPACE);			keyboard(KSETBS, P_BACKSPACE[0] == 'B' ? 8 : 127);  			break;  		case 'C':  			if (P_STATLINE[0] == 'e') {  				psets(P_STATLINE, "disabled");  				tempst = 1;  			} else {  				psets(P_STATLINE, "enabled");  				/* See if it fits on screen */  				if (LINES > 24) tempst = 0;  			}  			wlocate(w, 30, 3);  			wprintf(w, "%s ", P_STATLINE);  			break;		case 'D':			psets(P_SOUND, yesno(P_SOUND[0] == 'N'));			wlocate(w, 30, 4);			wprintf(w, "%s", P_SOUND);			break;                case 'E': /* fmg - letters cycle colors */                        if (mfcolor == WHITE)                                mfcolor = BLACK;                        else                                mfcolor++;                        psets(P_MFG, J_col[mfcolor]);                        wlocate(w, 30, 5);                        wprintf(w, "%s   ", J_col[mfcolor]);                        break;                case 'F': /* fmg - letters cycle colors */                        if (mbcolor == WHITE)                                mbcolor = BLACK;                        else                                mbcolor++;                        psets(P_MBG, J_col[mbcolor]);                        wlocate(w, 30, 6);                        wprintf(w, "%s   ", J_col[mbcolor]);                        break;                case 'G': /* fmg - letters cycle colors */                        if (tfcolor == WHITE)                                tfcolor = BLACK;                        else                                tfcolor++;                        psets(P_TFG, J_col[tfcolor]);                        wlocate(w, 30, 7);                        wprintf(w, "%s   ", J_col[tfcolor]);			if (us) vt_pinit(us, tfcolor, tbcolor);                        break;                case 'H': /* fmg - letters cycle colors */                        if (tbcolor == WHITE)                                tbcolor = BLACK;                        else                                tbcolor++;                        psets(P_TBG, J_col[tbcolor]);                        wlocate(w, 30, 8);                        wprintf(w, "%s   ", J_col[tbcolor]);			if (us) vt_pinit(us, tfcolor, tbcolor);                        break;                case 'I': /* fmg - letters cycle colors & redraw stat line */                        if (sfcolor == WHITE)                                sfcolor = BLACK;                        else                                sfcolor++;                        /* fmg - this causes redraw of status line (if any)                                 in current color */                        if (st)                        {                                wclose(st,0);                                st = wopen(0, LINES - 1, COLS - 1, LINES - 1, BNONE,                                         XA_NORMAL, sfcolor, sbcolor, 1, 0, 1);                                show_status();                        }                        psets(P_SFG, J_col[sfcolor]);                        wlocate(w, 30, 9);                        wprintf(w, "%s   ", J_col[sfcolor]);                        break;                case 'J': /* fmg - letters cycle colors & redraw stat line */                        if (sbcolor == WHITE)                                sbcolor = BLACK;                        else                                sbcolor++;                        /* fmg - this causes redraw of status line (if any)                                 in current color */                        if (st)                        {                                wclose(st,0);                                st = wopen(0, LINES - 1, COLS - 1, LINES - 1, BNONE,                                         XA_NORMAL, sfcolor, sbcolor, 1, 0, 0);                                show_status();                        }                        psets(P_SBG, J_col[sbcolor]);                        wlocate(w, 30, 10);                        wprintf(w, "%s   ", J_col[sbcolor]);                        break;		case 'K': /* MARK updated 02/17/95 - Config history size */#if HISTORY                        pgets(w, 30, 11, P_HISTSIZE, 5, 5);                                                /* In case gibberish or a value was out of bounds, */                        /* limit history buffer size between 0 to 5000 lines */                        /* 5000 line history at 80 columns consumes about */                        /* 800 kilobytes including chars and attrs bytes! */                        if (atoi(P_HISTSIZE) <= 0)                         	strcpy(P_HISTSIZE,"0");                        else if (atoi(P_HISTSIZE) >= 5000)                        	strcpy(P_HISTSIZE,"5000");	                                                wlocate(w, 30, 11);                        wprintf(w, "%s     ", P_HISTSIZE);#else			werror("This system does not support history");#endif			break;#if _HAVE_MACROS                case 'L': /* fmg - get local macros storage file */                        pgets(w, 30, 12, P_MACROS, 64, 64);			/* Try to open the file to read it in. */			fp = sfopen(pfix_home(P_MACROS), "r+");			if (fp == NULL) {			    if (errno == EPERM) {				/* Permission denied, hacker! */				werror("ERROR: you do not have permission to create a file there!");				once = 'J'; /* fmg - re-enter it! */				continue;			    }			    if (errno != ENOENT) {				/* File does exist, but cannot be opened. */				werror("ERROR: cannot open macro file %s",					pfix_home(P_MACROS));			    }			    continue;			}			/* Read macros from the file. */			werror("Reading macros");			readmacs(fp, 0);			fclose(fp);                        break;                case 'M': /* fmg - Bring up macro editing window */                        domacros();                        break;		case 'N':			psets(P_MACENAB, yesno(P_MACENAB[0] == 'N'));			wlocate(w, 30, 14);			wprintf(w, "%s", P_MACENAB);			break;#endif  	}  }}/* * This is the 'T' menu - terminal parameters. Does NOT set the new * terminal type, but returns it to the calling functions that has * to call init_emul itself. */int dotermmenu(){  WIN *w;  int c;

⌨️ 快捷键说明

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