Oops - add a terminator to the array
[sgt/putty] / windlg.c
index 2e63f04..23aee3f 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -117,7 +117,7 @@ static void save_settings (char *section, int do_host) {
        wpps (sesskey, "HostName", cfg.host);
        wppi (sesskey, "PortNumber", cfg.port);
         p = "raw";
-        for (i = 0; backends[i].backend != NULL; i++)
+        for (i = 0; backends[i].name != NULL; i++)
             if (backends[i].protocol == cfg.protocol) {
                 p = backends[i].name;
                 break;
@@ -162,6 +162,7 @@ static void save_settings (char *section, int do_host) {
     wppi (sesskey, "AltF4", cfg.alt_f4);
     wppi (sesskey, "AltSpace", cfg.alt_space);
     wppi (sesskey, "LdiscTerm", cfg.ldisc_term);
+    wppi (sesskey, "BlinkCur", cfg.blink_cur);
     wppi (sesskey, "ScrollbackLines", cfg.savelines);
     wppi (sesskey, "DECOriginMode", cfg.dec_om);
     wppi (sesskey, "AutoWrapMode", cfg.wrap_mode);
@@ -242,7 +243,7 @@ static void load_settings (char *section, int do_host) {
 
     gpps (sesskey, "Protocol", "default", prot, 10);
     cfg.protocol = default_protocol;
-    for (i = 0; backends[i].backend != NULL; i++)
+    for (i = 0; backends[i].name != NULL; i++)
         if (!strcmp(prot, backends[i].name)) {
             cfg.protocol = backends[i].protocol;
             break;
@@ -258,7 +259,7 @@ static void load_settings (char *section, int do_host) {
       char buf[2*sizeof(cfg.environmt)], *p, *q;
        gpps (sesskey, "Environment", "", buf, sizeof(buf));
        p = buf;
-      q = cfg.environmt;
+       q = cfg.environmt;
        while (*p) {
            while (*p && *p != ',') {
                int c = *p++;
@@ -266,7 +267,7 @@ static void load_settings (char *section, int do_host) {
                    c = '\t';
                if (c == '\\')
                    c = *p++;
-               *p++ = c;
+               *q++ = c;
            }
            if (*p == ',') p++;
            *q++ = '\0';
@@ -296,6 +297,7 @@ static void load_settings (char *section, int do_host) {
     gppi (sesskey, "AltF4", 1, &cfg.alt_f4);
     gppi (sesskey, "AltSpace", 0, &cfg.alt_space);
     gppi (sesskey, "LdiscTerm", 0, &cfg.ldisc_term);
+    gppi (sesskey, "BlinkCur", 0, &cfg.blink_cur);
     gppi (sesskey, "ScrollbackLines", 200, &cfg.savelines);
     gppi (sesskey, "DECOriginMode", 0, &cfg.dec_om);
     gppi (sesskey, "AutoWrapMode", 1, &cfg.wrap_mode);
@@ -648,6 +650,7 @@ static int CALLBACK KeyboardProc (HWND hwnd, UINT msg,
        CheckDlgButton (hwnd, IDC1_ALTF4, cfg.alt_f4);
        CheckDlgButton (hwnd, IDC1_ALTSPACE, cfg.alt_space);
        CheckDlgButton (hwnd, IDC1_LDISCTERM, cfg.ldisc_term);
+       CheckDlgButton (hwnd, IDC1_BLINKCUR, cfg.blink_cur);
        break;
       case WM_COMMAND:
        if (HIWORD(wParam) == BN_CLICKED ||
@@ -693,6 +696,11 @@ static int CALLBACK KeyboardProc (HWND hwnd, UINT msg,
                    HIWORD(wParam) == BN_DOUBLECLICKED)
                    cfg.ldisc_term = IsDlgButtonChecked (hwnd, IDC1_LDISCTERM);
                break;
+             case IDC1_BLINKCUR:
+               if (HIWORD(wParam) == BN_CLICKED ||
+                   HIWORD(wParam) == BN_DOUBLECLICKED)
+                   cfg.blink_cur = IsDlgButtonChecked (hwnd, IDC1_BLINKCUR);
+               break;
            }
     }
     return GeneralPanelProc (hwnd, msg, wParam, lParam);