We can now configure the terminal's answerback string when it receives ^E.
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 9 Apr 2001 12:43:46 +0000 (12:43 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 9 Apr 2001 12:43:46 +0000 (12:43 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@1031 cda61777-01e9-0310-a592-d414129be87e

putty.h
settings.c
terminal.c
windlg.c

diff --git a/putty.h b/putty.h
index 755704c..5e881e1 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -227,6 +227,7 @@ typedef struct {
     char logfilename[FILENAME_MAX];
     int logtype;
     int hide_mouseptr;
+    char answerback[256];
     /* Colour options */
     int try_palette;
     int bold_colour;
index ff23ad0..3eec545 100644 (file)
@@ -97,6 +97,7 @@ void save_settings (char *section, int do_host, Config *cfg) {
     write_setting_i (sesskey, "ComposeKey", cfg->compose_key);
     write_setting_i (sesskey, "LocalEcho", cfg->localecho);
     write_setting_i (sesskey, "LocalEdit", cfg->localedit);
+    write_setting_s (sesskey, "Answerback", cfg->answerback);
     write_setting_i (sesskey, "AlwaysOnTop", cfg->alwaysontop);
     write_setting_i (sesskey, "HideMousePtr", cfg->hide_mouseptr);
     write_setting_i (sesskey, "CurType", cfg->cursor_type);
@@ -247,6 +248,7 @@ void load_settings (char *section, int do_host, Config *cfg) {
     gppi (sesskey, "ComposeKey", 0, &cfg->compose_key);
     gppi (sesskey, "LocalEcho", LD_BACKEND, &cfg->localecho);
     gppi (sesskey, "LocalEdit", LD_BACKEND, &cfg->localedit);
+    gpps (sesskey, "Answerback", "PuTTY", cfg->answerback, sizeof(cfg->answerback));
     gppi (sesskey, "AlwaysOnTop", 0, &cfg->alwaysontop);
     gppi (sesskey, "HideMousePtr", 0, &cfg->hide_mouseptr);
     gppi (sesskey, "CurType", 0, &cfg->cursor_type);
index f205c31..f064a93 100644 (file)
@@ -803,8 +803,30 @@ static int beep_overload = 0;
                 *
                 * An xterm returns "xterm" (5 characters)
                 */
-               compatibility(OTHER);
-               ldisc_send ("PuTTY", 5);
+               compatibility(ANSIMIN);
+               {
+                   char abuf[256], *s, *d;
+                   int state=0;
+                   for(s=cfg.answerback, d=abuf; *s; s++) {
+                        if (state)
+                        {
+                            if (*s >= 'a' && *s <= 'z')
+                                *d++ = (*s - ('a'-1));
+                            else if ((*s >='@' && *s<='_') ||
+                                     *s == '?' || (*s&0x80))
+                                *d++ = ('@'^*s);
+                            else if (*s == '~')
+                                *d++ = '^';
+                            state = 0;
+                        }
+                        else if (*s == '^') {
+                            state = 1;
+                        }
+                        else
+                            *d++ = xlat_kbd2tty((unsigned char)*s);
+                   }
+                   ldisc_send (abuf, d-abuf);
+               }
                break;
              case '\007':
                beep_count++; 
index 0120a3b..c57dee9 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -271,6 +271,8 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
     IDC_BEEP,
     IDC_BCE,
     IDC_BLINKTEXT,
+    IDC_ANSWERBACK,
+    IDC_ANSWEREDIT,
     IDC_ECHOSTATIC,
     IDC_ECHOBACKEND,
     IDC_ECHOYES,
@@ -530,6 +532,7 @@ static void init_dlg_ctrls(HWND hwnd) {
     CheckRadioButton (hwnd, IDC_EDITBACKEND, IDC_EDITNO,
                      cfg.localedit == LD_BACKEND ? IDC_EDITBACKEND:
                       cfg.localedit == LD_YES ? IDC_EDITYES : IDC_EDITNO);
+    SetDlgItemText (hwnd, IDC_ANSWEREDIT, cfg.answerback);
     CheckDlgButton (hwnd, IDC_ALWAYSONTOP, cfg.alwaysontop);
     CheckDlgButton (hwnd, IDC_SCROLLKEY, cfg.scroll_on_key);
     CheckDlgButton (hwnd, IDC_SCROLLDISP, cfg.scroll_on_disp);
@@ -747,7 +750,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
     }
 
     if (panel == terminalpanelstart) {
-        /* The Terminal panel. Accelerators used: [acgo] wdlben ht */
+        /* The Terminal panel. Accelerators used: [acgo] wdlben hts */
         struct ctlpos cp;
         ctlposinit(&cp, hwnd, 80, 3, 13);
         bartitle(&cp, "Options controlling the terminal emulation",
@@ -760,6 +763,9 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
         checkbox(&cp, "&Beep enabled", IDC_BEEP);
         checkbox(&cp, "Use background colour to &erase screen", IDC_BCE);
         checkbox(&cp, "Enable bli&nking text", IDC_BLINKTEXT);
+        multiedit(&cp,
+                  "An&swerback to ^E:", IDC_ANSWERBACK,
+                  IDC_ANSWEREDIT, 100, NULL);
         endbox(&cp);
 
         beginbox(&cp, "Line discipline options",
@@ -1492,6 +1498,11 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
                if (LOWORD(wParam)==IDC_EDITNO) cfg.localedit=LD_NO;
             }
            break;
+         case IDC_ANSWEREDIT:
+           if (HIWORD(wParam) == EN_CHANGE)
+               GetDlgItemText (hwnd, IDC_ANSWEREDIT, cfg.answerback,
+                               sizeof(cfg.answerback)-1);
+           break;
           case IDC_ALWAYSONTOP:
            if (HIWORD(wParam) == BN_CLICKED ||
                HIWORD(wParam) == BN_DOUBLECLICKED)