?? config.c
字號:
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, N_("Meta-8th bit ")); else if (c == 27) strcpy(buf, N_("Escape (Meta)")); else sprintf(buf, "^%c ", (c & 0x1f) + 'A' - 1); psets(P_ESCAPE, buf); wlocate(w, strlen (command_key) + 1, 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, strlen (backspace_key) + 1, 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, N_("disabled")); tempst = 1; } else { psets(P_STATLINE, N_("enabled")); /* See if it fits on screen */ if (LINES > 24) tempst = 0; } wlocate(w, strlen (status_line) + 1, 3); wprintf(w, "%s ", _(P_STATLINE)); break; case 'D': psets(P_SOUND, yesno(P_SOUND[0] == 'N')); wlocate(w, strlen (alarm_sound) + 1, 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, strlen (foreground_color_menu) + 1, 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, strlen (background_color_menu) + 1, 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, strlen (foreground_color_term) + 1, 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, strlen (background_color_term) + 1, 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, strlen (foreground_color_stat) + 1, 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, strlen (background_color_stat) + 1, 10); wprintf(w, "%s ", _(J_col[sbcolor])); break; case 'K': /* MARK updated 02/17/95 - Config history size */#if HISTORY pgets(w, strlen (history_buffer_size) + 1, 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, strlen (history_buffer_size) + 1, 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, strlen (macros_file) + 1, 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, strlen (macros_enabled) + 1, 14); wprintf(w, "%s", _(P_MACENAB)); break; case 'O': /* Character conversions - jl / 04.09.97 */ doconv(); wlocate(w, strlen (character_conversion) + 1, 15); wprintf(w, "%-16.16s", _(P_CONVF)); 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; int new_term = -1; int old_stat = P_STATLINE[0]; extern int use_status; char buf[8]; extern int vt_nl_delay; char* terminal_emulation = _(" A - Terminal emulation :"), * backspace_key_sends = _(" B - Backspace key sends :"), * status_line = _(" C - Status line is :"), * msg_nl_delay = _(" D - Newline delay (ms) :"), * question = _("Change which setting?"); w = wopen(20, 7, 59, 14, BDOUBLE, stdattr, mfcolor, mbcolor, 0, 0, 1); wtitle(w, TMID, _("Terminal settings")); wprintf(w, "\n"); wprintf(w, "%s %s\n", terminal_emulation, terminal == VT100 ? "VT102" : "ANSI"); wprintf(w, "%s %s\n", backspace_key_sends, P_BACKSPACE); wprintf(w, "%s %s\n", status_line, _(P_STATLINE)); wprintf(w, "%s %d\n", msg_nl_delay, vt_nl_delay); wlocate(w, 4, 6); wputs(w, question); wredraw(w, 1); while(1) { wlocate(w, strlen (question) + 5, 6); c = rwxgetch(); switch(c) { case '\n': wclose(w, 1); /* If status line enabled/disabled resize screen. */ if (P_STATLINE[0] != old_stat && new_term < 0) init_emul(terminal, 0); return(new_term); case 'A': if (new_term < 0) new_term = terminal; if (new_term == VT100) { new_term = ANSI; psets(P_BACKSPACE, "BS"); } else { new_term = VT100; psets(P_BACKSPACE, "DEL"); } wlocate(w, strlen (terminal_emulation) + 1, 1); wprintf(w, "%s ", new_term == VT100 ? "VT102" : "ANSI"); wlocate(w, strlen (backspace_key_sends) + 1, 2); wprintf(w, "%s ", P_BACKSPACE); keyboard(KSETBS, P_BACKSPACE[0] == 'B' ? 8 : 127); break; case 'B': if (P_BACKSPACE[0] == 'D') psets(P_BACKSPACE, "BS"); else psets(P_BACKSPACE, "DEL"); wlocate(w, strlen (backspace_key_sends) + 1, 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, N_("disabled")); tempst = 1; } else { psets(P_STATLINE, N_("enabled")); /* See if it fits on screen */ if (LINES > 24 || use_status) tempst = 0; } wlocate(w, strlen (status_line) + 1, 3); wprintf(w, "%s ", _(P_STATLINE)); break; case 'D': sprintf(buf, "%d", vt_nl_delay); wlocate(w, strlen(msg_nl_delay) +1, 4); wgets(w, buf, 4, 4); vt_nl_delay = atoi(buf); wlocate(w, strlen(msg_nl_delay) +1, 4); wprintf(w, "%-3d", vt_nl_delay); break; default: break; } }}/* * Save the configuration. */void vdodflsave(){ dodflsave();}/* * Save the configuration. */int dodflsave(){ FILE *fp; /* Root saves new configuration */ if (real_uid == 0) { if ((fp = fopen(parfile, "w")) == (FILE *)NULL) { werror(_("Cannot write to %s"), parfile); return(-1); } writepars(fp, 1); fclose(fp); werror(_("Configuration saved")); } else { /* Mortals save their own configuration */ if ((fp = sfopen(pparfile, "w")) == (FILE *)NULL) { werror(_("Cannot write to %s"), pparfile); return (-1); } writepars(fp, 0); fclose(fp); werror(_("Configuration saved")); }#if _HAVE_MACROS if (domacsave() < 0) /* fmg - something went wrong... */ return(-1);#endif return(0);}#if _HAVE_MACROS/* * Save the macros. (fmg) */int domacsave(){ FILE *fp; /* fmg - do some basic silly-mortal checks and allow for recovery */ if (!strcmp(P_MACCHG,"CHANGED")) { if (strlen(P_MACROS) == 0) { /* fmg - they might want to know... */ werror(_("ERROR: Macros have changed but no filename is set!")); return(-1); } else { if ((fp = sfopen(pfix_home(P_MACROS), "w")) == (FILE *)NULL) { werror(_("Cannot write macros file %s"), pfix_home(P_MACROS)); return(-1); } writemacs(fp, 0); fclose(fp); werror(_("Macros saved")); strcpy(P_MACCHG,"SAVED"); /* fmg - reset after save */ return(0); } } return(0);}#endif/* * Save the configuration, ask a name for it. */static void donamsave(){ char ifile[128]; char *s; if (real_uid != 0) { werror(_("You are not allowed to create a configuration")); return; } ifile[0] = 0; s = input(_("Give name to save this configuration?"), ifile); if (s != (char *)0 && *s != 0) { snprintf(parfile, sizeof(parfile), "%s/minirc.%s", LIBDIR, s); dodflsave(); }}static void (*funcs1[])() = { dopath, doproto, doserial, domodem, doscrkeyb, vdodflsave, donamsave, NIL_FUN, NIL_FUN};char some_string[32];static char *menu1[] = { N_("Filenames and paths"), N_("File transfer protocols"), N_("Serial port setup"), N_("Modem and dialing"), N_("Screen and keyboard"), some_string, N_("Save setup as.."), N_("Exit"), N_("Exit from Minicom"), MENU_END};int config(setup)int setup;{ int c; char *s; /* Find out extension of parameter file */ s = parfile + strlen(LIBDIR) + 8; snprintf(some_string, sizeof(some_string), _("Save setup as %s"), s); if (!setup) menu1[8] = MENU_END; c = wselect(13, 10, menu1, funcs1, _("configuration"), stdattr, mfcolor, mbcolor); if (c == 9) return(1); return(0);}/* fmg 1/11/94 Color names for menu */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -