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

📄 config.c

📁 minicom的源码,linux下常用的串口程序.
💻 C
📖 第 1 页 / 共 4 页
字号:
  }  wlocate(w, 1, 13);  wprintf(w, "%s %c", zmodem_download, P_PAUTO[0]);  wlocate(w, 1, 14);  wprintf(w, "%s %s", use_filename_selection, _(P_FSELW));  wlocate(w, 1, 15);  wprintf(w, "%s %s", prompt_downdir, _(P_ASKDNDIR));  wlocate(w, 3, 17);  wputs(w, question);  wredraw(w, 1);  do {    wlocate(w, mbslen (question) + 4, 17);    c = rwxgetch();    if (c >= 'A' && c <= 'L')      inputproto(w, c - 'A');    if (c == ' ') {      wlocate(w, 3, 17);      wputs(w, _("Delete which protocol? "));      wclreol(w);      c = rwxgetch();      if (c >= 'A' && c <= 'L') {        P_PNAME(c - 'A')[0] = '\0';        mpars[PROTO_BASE + (c - 'A')].flags |= CHANGED;        wlocate(w, 3, c - 'A' + 1);        wclreol(w);        wputs(w, "   -");      }      wlocate(w, 3, 17);      wputs(w, question);      c = ' ';    }    else if (c == 'M') {      wlocate(w, mbslen (zmodem_download) + 2, 13);      wprintf(w, " \b");      c = rwxgetch();      if (c >= 'A' && c <= 'L') {        P_PAUTO[0] = c;        markch(P_PAUTO);        wprintf(w, "%c", c);      } else if (c == '\n' || c == ' ') {        P_PAUTO[0] = ' ';        markch(P_PAUTO);      } else {        wprintf(w, "%c", P_PAUTO[0]);      }      c = 0;    }    else if (c == 'N') {      strcpy(P_FSELW, yesno(P_FSELW[0] == 'N'));      if (P_FSELW[0] == 'N') {        strcpy(P_ASKDNDIR, "No ");        wlocate(w, mbslen (prompt_downdir) + 2, 15);        wprintf(w, "%s ", _(P_ASKDNDIR));        markch(P_ASKDNDIR);      }      wlocate(w, mbslen (use_filename_selection) + 2, 14);      wprintf(w, "%s ", _(P_FSELW));      markch(P_FSELW);    }    else if (c == 'O') {      strcpy(P_ASKDNDIR, yesno(P_ASKDNDIR[0] == 'N'));      if (P_ASKDNDIR[0] == 'Y') {        strcpy(P_FSELW, "Yes");        wlocate(w, mbslen (use_filename_selection) + 2, 14);        wprintf(w, "%s ", _(P_FSELW));        markch(P_FSELW);      }      wlocate(w, mbslen (prompt_downdir) + 2, 15);      wprintf(w, "%s ", _(P_ASKDNDIR));      markch(P_ASKDNDIR);    }  } while (c != '\n');  wclose(w, 1);}static void doserial(void){  WIN *w;  char *serial_device         = _(" A -    Serial Device      :");  char *lockfile_location     = _(" B - Lockfile Location     :");  char *callin_program        = _(" C -   Callin Program      :");  char *callout_program       = _(" D -  Callout Program      :");  char *bps_par_bits          = _(" E -    Bps/Par/Bits       :");  char *hardware_flow_control = _(" F - Hardware Flow Control :");  char *software_flow_control = _(" G - Software Flow Control :");  char *question              = _("Change which setting?");  w = wopen(5, 4, 75, 12, BDOUBLE, stdattr, mfcolor, mbcolor, 0, 0, 1);  wprintf(w, "%s %.41s\n", serial_device, P_PORT);  wprintf(w, "%s %.41s\n", lockfile_location, P_LOCK);  wprintf(w, "%s %.41s\n", callin_program, P_CALLIN);  wprintf(w, "%s %.41s\n", callout_program, P_CALLOUT);  wprintf(w, "%s %s %s%s%s\n",          bps_par_bits, P_BAUDRATE, P_BITS, P_PARITY, P_STOPB);  wprintf(w, "%s %s\n", hardware_flow_control, _(P_HASRTS));  wprintf(w, "%s %s\n", software_flow_control, _(P_HASXON));  wlocate(w, 4, 8);  wputs(w, question);  wredraw(w, 1);  while(1) {    wlocate(w, mbslen (question) + 5, 8);    switch (rwxgetch()) {      case '\n':        wclose(w, 1);        return;      case 'A':        pgets(w, mbslen (serial_device) + 1, 0, P_PORT, 64, 64);        break;      case 'B':        pgets(w, mbslen (lockfile_location) + 1, 1, P_LOCK, 64, 64);        break;      case 'C':        pgets(w, mbslen (callin_program) + 1, 2, P_CALLIN, 64, 64);        break;      case 'D':        pgets(w, mbslen (callout_program) + 1, 3, P_CALLOUT, 64, 64);        break;      case 'E':        get_bbp(P_BAUDRATE, P_BITS, P_PARITY, P_STOPB, 0);        if (portfd >= 0)          port_init();        wlocate(w, mbslen (bps_par_bits) + 1, 4);        wprintf(w, "%s %s%s%s  \n",                P_BAUDRATE, P_BITS, P_PARITY, P_STOPB);        if (st)          mode_status();        markch(P_BAUDRATE);        markch(P_BITS);        markch(P_PARITY);        markch(P_STOPB);        break;      case 'F':        strcpy(P_HASRTS, yesno(P_HASRTS[0] == 'N'));        wlocate(w, mbslen (hardware_flow_control) + 1, 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, mbslen (software_flow_control) + 1, 6);        wprintf(w, "%s ", _(P_HASXON));        if (portfd >= 0)          port_init();        markch(P_HASXON);        break;      default:        break;    }  }}char * sspd(char *sptyp){  if (sptyp[0] == 'd')    return (_("DTE speed "));  else    return (_("line speed"));}static void domodem(void){  WIN *w;  char *str;  int c, x, y, ypos, maxl, string_size;  char *init_string         = _(" A - Init string .........");  char *reset_string        = _(" B - Reset string ........");  char *dialing_prefix_1    = _(" C - Dialing prefix #1....");  char *dialing_suffix_1    = _(" D - Dialing suffix #1....");  char *dialing_prefix_2    = _(" E - Dialing prefix #2....");  char *dialing_suffix_2    = _(" F - Dialing suffix #2....");  char *dialing_prefix_3    = _(" G - Dialing prefix #3....");  char *dialing_suffix_3    = _(" H - Dialing suffix #3....");  char *connect_string      = _(" I - Connect string ......");  char *no_connect_strings  = _(" J - No connect strings ..");  char *hangup_string       = _(" K - Hang-up string ......");  char *dial_cancel_string  = _(" L - Dial cancel string ..");  char *dial_time           = _(" M - Dial time ...........");  char *delay_before_redial = _(" N - Delay before redial .");  char *number_of_tries     = _(" O - Number of tries .....");  char *dtr_drop_time       = _(" P - DTR drop time (0=no).");  char *auto_bps_detect     = _(" Q - Auto bps detect .....");  char *modem_has_dcd_line  = _(" R - Modem has DCD line ..");  char *shown_speed         = _(" S - Status line shows ...");  char *multi_node          = _(" T - Multi-line untag ....");  char *question            = _("Change which setting?");  w = wopen(2, 2, 77, 22, BDOUBLE, stdattr, mfcolor, mbcolor, 0, 0, 1);  dirflush = 0;  wtitle(w, TMID, _("Modem and dialing parameter setup"));  wprintf(w, "\n");  wprintf(w, "%s %.48s\n", init_string, P_MINIT);  wprintf(w, "%s %.48s\n", reset_string, P_MRESET);  wprintf(w, "%s %.48s\n", dialing_prefix_1, P_MDIALPRE);  wprintf(w, "%s %.48s\n", dialing_suffix_1, P_MDIALSUF);  wprintf(w, "%s %.48s\n", dialing_prefix_2, P_MDIALPRE2);  wprintf(w, "%s %.48s\n", dialing_suffix_2, P_MDIALSUF2);  wprintf(w, "%s %.48s\n", dialing_prefix_3, P_MDIALPRE3);  wprintf(w, "%s %.48s\n", dialing_suffix_3, P_MDIALSUF3);  wprintf(w, "%s %.48s\n", connect_string, P_MCONNECT);  wprintf(w, "%s %-20.20s  %.20s\n", no_connect_strings, P_MNOCON1, P_MNOCON2);  wlocate(w, mbslen (no_connect_strings) + 1, 11);  wprintf(w, "%-20.20s  %.20s\n", P_MNOCON3, P_MNOCON4);  wprintf(w, "%s %.48s\n", hangup_string, P_MHANGUP);  wprintf(w, "%s %.48s\n", dial_cancel_string, P_MDIALCAN);  wprintf(w, "\n");  wprintf(w, "%s %.3s\n", dial_time, P_MDIALTIME);  wprintf(w, "%s %.3s\n", delay_before_redial, P_MRDELAY);  wprintf(w, "%s %.3s\n", number_of_tries, P_MRETRIES);  wprintf(w, "%s %.3s\n", dtr_drop_time, P_MDROPDTR);  wlocate(w, 34, 15);  wprintf(w, "%s %s\n", auto_bps_detect, _(P_MAUTOBAUD));  wlocate(w, 34, 16);  wprintf(w, "%s %s\n", modem_has_dcd_line, _(P_HASDCD));  wlocate(w, 34, 17);  wprintf(w, "%s %s\n", shown_speed, sspd(P_SHOWSPD));  wlocate(w, 34, 18); /* Option for multi-node untag */  wprintf(w, "%s %s\n", multi_node, _(P_MULTILINE));	/* er 18-Apr-99 */  wlocate(w, 1, 20);  wprintf(w, "%s ", question);  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;    string_size = 0;    switch(c) {      case 'M':        if (string_size == 0)          string_size = mbslen(dial_time);      case 'N':        if (string_size == 0)          string_size = mbslen(delay_before_redial);      case 'O':        if (string_size == 0)          string_size = mbslen(number_of_tries);      case 'P':        if (string_size == 0)          string_size = mbslen(dtr_drop_time);        ypos++;        maxl = 4;      case 'K':        if (string_size == 0)          string_size = mbslen(hangup_string);      case 'L':        if (string_size == 0)          string_size = mbslen(dial_cancel_string);        ypos -= 2;        c += 3;      case 'A':        if (string_size == 0)          string_size = mbslen(init_string);      case 'B':        if (string_size == 0)          string_size = mbslen(reset_string);      case 'C':        if (string_size == 0)          string_size = mbslen(dialing_prefix_1);      case 'D':        if (string_size == 0)          string_size = mbslen(dialing_suffix_1);      case 'E':        if (string_size == 0)          string_size = mbslen(dialing_prefix_2);      case 'F':        if (string_size == 0)          string_size = mbslen(dialing_suffix_2);      case 'G':        if (string_size == 0)          string_size = mbslen(dialing_prefix_3);      case 'H':        if (string_size == 0)          string_size = mbslen(dialing_suffix_3);      case 'I':        if (string_size == 0)          string_size = mbslen(connect_string);        /* Calculate adress of string tomodify */        str = P_MINIT + (c - 'A') * sizeof(struct pars);        pgets(w, string_size + 1, ypos + (c - 'A'), str, maxl, maxl);        break;      case 'J':        string_size = mbslen (no_connect_strings);        /* Walk through all four */        pgets(w, string_size + 1, 10, P_MNOCON1, 20, 64);        pgets(w, string_size + 1 + 22, 10, P_MNOCON2, 20, 64);        pgets(w, string_size + 1 , 11, P_MNOCON3, 20, 64);        pgets(w, string_size + 1 + 22, 11, P_MNOCON4, 20, 64);        break;      case 'Q':        psets(P_MAUTOBAUD, yesno(P_MAUTOBAUD[0] == 'N'));        wlocate(w, 35 + mbslen (auto_bps_detect), 15);        wputs(w, _(P_MAUTOBAUD));        break;      case 'R':        psets(P_HASDCD, yesno(P_HASDCD[0] == 'N'));        wlocate(w, 35 + mbslen (modem_has_dcd_line), 16);        wputs(w, _(P_HASDCD));        break;      case 'S':        psets(P_SHOWSPD, P_SHOWSPD[0] == 'd' ? "l": "d");        wlocate(w, 35 + mbslen (shown_speed), 17);        wputs(w, sspd(P_SHOWSPD));        mode_status();        break;      case 'T': /* Update for multi-node */        psets(P_MULTILINE, yesno(P_MULTILINE[0] == 'N' ));        wlocate(w, 35 + mbslen(multi_node), 18);        wputs(w, _(P_MULTILINE));        break;        /* er 18-Apr-99 */      case '\n':        dirflush = 1;        wclose(w, 1);        return;      default:        break;    }  }}/* * Screen and keyboard menu. */static void doscrkeyb(void){  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 = 3, maxy = 20;  int old_stat = P_STATLINE[0];  FILE *fp;  char *command_key           = _(" A - Command key is         :");  char *backspace_key         = _(" B - Backspace key sends    :");  char *status_line           = _(" C - Status line is         :");  char *alarm_sound           = _(" D - Alarm sound            :");  char *foreground_color_menu = _(" E - Foreground Color (menu):");  char *background_color_menu = _(" F - Background Color (menu):");  char *foreground_color_term = _(" G - Foreground Color (term):");  char *background_color_term = _(" H - Background Color (term):");  char *foreground_color_stat = _(" I - Foreground Color (stat):");  char *background_color_stat = _(" J - Background Color (stat):");  char *history_buffer_size   = _(" K - History Buffer Size    :");  char *macros_file           = _(" L - Macros file            :");  char *macros_enabled        = _(" N - Macros enabled         :");  char *character_conversion  = _(" O - Character conversion   :");  char *add_linefeed          = _(" P - Add linefeed           :");  char *local_echo            = _(" Q - Local echo             :");  char *question              = _("Change which setting?  (Esc to exit)");  w = wopen(15, miny, 69, maxy, BDOUBLE, stdattr, mfcolor, mbcolor, 0, 0, 1);  wtitle(w, TMID, _("Screen and keyboard"));  wprintf(w, "\n%s %s\n", command_key, P_ESCAPE);  wprintf(w, "%s %s\n", backspace_key, P_BACKSPACE);  wprintf(w, "%s %s\n", status_line, _(P_STATLINE));  wprintf(w, "%s %s\n", alarm_sound, _(P_SOUND));  /* fmg - colors support */  wprintf(w, "%s %s\n", foreground_color_menu, _(J_col[mfcolor]));  wprintf(w, "%s %s\n", background_color_menu, _(J_col[mbcolor]));  wprintf(w, "%s %s\n", foreground_color_term, _(J_col[tfcolor]));  wprintf(w, "%s %s\n", background_color_term, _(J_col[tbcolor]));  wprintf(w, "%s %s\n", foreground_color_stat, _(J_col[sfcolor]));  wprintf(w, "%s %s\n", background_color_stat, _(J_col[sbcolor]));  /* MARK updated 02/17/95 - Configurable history buffer size */  wprintf(w, "%s %s\n", history_buffer_size, P_HISTSIZE);  /* fmg - macros support */  wprintf(w, "%s %s\n", macros_file, P_MACROS);  wprintf(w, _(" M - Edit Macros\n"));  wprintf(w, "%s %s\n", macros_enabled, _(P_MACENAB));  wprintf(w, "%s %s\n", character_conversion, P_CONVF);  wprintf(w, "%s %s\n", add_linefeed, P_ADDLINEFEED);  wprintf(w, "%s %s\n", local_echo, P_LOCALECHO);  wredraw(w, 1);  while (1) {    if (clr) {      wlocate(w, 2, maxy - miny);      wprintf(w, "%s ", question);      wclreol(w);      clr = 0;    } else      wlocate(w, mbslen (question) + 3, 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);

⌨️ 快捷键说明

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