Of course, that cleanup I did earlier in which I rationalised all
[u/mdw/putty] / settings.c
index 2c37dce..2dadfa0 100644 (file)
@@ -156,7 +156,9 @@ void save_open_settings(void *sesskey, int do_host, Config *cfg)
        }
     write_setting_s(sesskey, "Protocol", p);
     write_setting_i(sesskey, "PortNumber", cfg->port);
-    write_setting_i(sesskey, "CloseOnExit", cfg->close_on_exit);
+    /* The CloseOnExit numbers are arranged in a different order from
+     * the standard FORCE_ON / FORCE_OFF / AUTO. */
+    write_setting_i(sesskey, "CloseOnExit", (cfg->close_on_exit+2)%3);
     write_setting_i(sesskey, "WarnOnClose", !!cfg->warn_on_close);
     write_setting_i(sesskey, "PingInterval", cfg->ping_interval / 60); /* minutes */
     write_setting_i(sesskey, "PingIntervalSecs", cfg->ping_interval % 60);     /* seconds */
@@ -166,7 +168,7 @@ void save_open_settings(void *sesskey, int do_host, Config *cfg)
 
     /* proxy settings */
     write_setting_s(sesskey, "ProxyExcludeList", cfg->proxy_exclude_list);
-    write_setting_i(sesskey, "ProxyDNS", cfg->proxy_dns);
+    write_setting_i(sesskey, "ProxyDNS", (cfg->proxy_dns+2)%3);
     write_setting_i(sesskey, "ProxyLocalhost", cfg->even_proxy_localhost);
     write_setting_i(sesskey, "ProxyType", cfg->proxy_type);
     write_setting_s(sesskey, "ProxyHost", cfg->proxy_host);
@@ -321,13 +323,13 @@ void save_open_settings(void *sesskey, int do_host, Config *cfg)
        *p = '\0';
        write_setting_s(sesskey, "PortForwardings", buf);
     }
-    write_setting_i(sesskey, "BugIgnore1", cfg->sshbug_ignore1);
-    write_setting_i(sesskey, "BugPlainPW1", cfg->sshbug_plainpw1);
-    write_setting_i(sesskey, "BugRSA1", cfg->sshbug_rsa1);
-    write_setting_i(sesskey, "BugHMAC2", cfg->sshbug_hmac2);
-    write_setting_i(sesskey, "BugDeriveKey2", cfg->sshbug_derivekey2);
-    write_setting_i(sesskey, "BugRSAPad2", cfg->sshbug_rsapad2);
-    write_setting_i(sesskey, "BugDHGEx2", cfg->sshbug_dhgex2);
+    write_setting_i(sesskey, "BugIgnore1", 2-cfg->sshbug_ignore1);
+    write_setting_i(sesskey, "BugPlainPW1", 2-cfg->sshbug_plainpw1);
+    write_setting_i(sesskey, "BugRSA1", 2-cfg->sshbug_rsa1);
+    write_setting_i(sesskey, "BugHMAC2", 2-cfg->sshbug_hmac2);
+    write_setting_i(sesskey, "BugDeriveKey2", 2-cfg->sshbug_derivekey2);
+    write_setting_i(sesskey, "BugRSAPad2", 2-cfg->sshbug_rsapad2);
+    write_setting_i(sesskey, "BugDHGEx2", 2-cfg->sshbug_dhgex2);
     write_setting_i(sesskey, "StampUtmp", cfg->stamp_utmp);
     write_setting_i(sesskey, "LoginShell", cfg->login_shell);
     write_setting_i(sesskey, "ScrollbarOnLeft", cfg->scrollbar_on_left);
@@ -373,17 +375,9 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg)
            break;
        }
 
-    /*
-     * CloseOnExit defaults to closing only on a clean exit - but
-     * unfortunately not on Unix (pterm). On Unix, the exit code of
-     * a shell is the last exit code of one of its child processes,
-     * even if it's an interactive shell - so some pterms will
-     * close and some will not for no particularly good reason. The
-     * mode is still useful for specialist purposes (running a
-     * single command in its own pterm), but I don't think it's a
-     * sane default, unfortunately.
-     */
-    gppi(sesskey, "CloseOnExit", COE_NORMAL, &cfg->close_on_exit);
+    /* The CloseOnExit numbers are arranged in a different order from
+     * the standard FORCE_ON / FORCE_OFF / AUTO. */
+    gppi(sesskey, "CloseOnExit", 1, &i); cfg->close_on_exit = (i+1)%3;
     gppi(sesskey, "WarnOnClose", 1, &cfg->warn_on_close);
     {
        /* This is two values for backward compatibility with 0.50/0.51 */
@@ -401,9 +395,9 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg)
     /* proxy settings */
     gpps(sesskey, "ProxyExcludeList", "", cfg->proxy_exclude_list,
         sizeof(cfg->proxy_exclude_list));
-    gppi(sesskey, "ProxyDNS", PROXYDNS_AUTO, &i); cfg->proxy_dns = i;
+    gppi(sesskey, "ProxyDNS", 1, &i); cfg->proxy_dns = (i+1)%3;
     gppi(sesskey, "ProxyLocalhost", 0, &cfg->even_proxy_localhost);
-    gppi(sesskey, "ProxyType", PROXY_NONE, &i); cfg->proxy_type = i;
+    gppi(sesskey, "ProxyType", PROXY_NONE, &cfg->proxy_type);
     gpps(sesskey, "ProxyHost", "proxy", cfg->proxy_host,
         sizeof(cfg->proxy_host));
     gppi(sesskey, "ProxyPort", 80, &cfg->proxy_port);
@@ -474,8 +468,8 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg)
     gppi(sesskey, "CtrlAltKeys", 1, &cfg->ctrlaltkeys);
     gppi(sesskey, "TelnetKey", 0, &cfg->telnet_keyboard);
     gppi(sesskey, "TelnetRet", 1, &cfg->telnet_newline);
-    gppi(sesskey, "LocalEcho", LD_BACKEND, &cfg->localecho);
-    gppi(sesskey, "LocalEdit", LD_BACKEND, &cfg->localedit);
+    gppi(sesskey, "LocalEcho", AUTO, &cfg->localecho);
+    gppi(sesskey, "LocalEdit", AUTO, &cfg->localedit);
     gpps(sesskey, "Answerback", "PuTTY", cfg->answerback,
         sizeof(cfg->answerback));
     gppi(sesskey, "AlwaysOnTop", 0, &cfg->alwaysontop);
@@ -486,8 +480,8 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg)
     gppi(sesskey, "CurType", 0, &cfg->cursor_type);
     gppi(sesskey, "BlinkCur", 0, &cfg->blink_cur);
     /* pedantic compiler tells me I can't use &cfg->beep as an int * :-) */
-    gppi(sesskey, "Beep", 1, &i); cfg->beep = i;
-    gppi(sesskey, "BeepInd", 0, &i); cfg->beep_ind = i;
+    gppi(sesskey, "Beep", 1, &cfg->beep);
+    gppi(sesskey, "BeepInd", 0, &cfg->beep_ind);
     gpps(sesskey, "BellWaveFile", "", cfg->bell_wavefile,
         sizeof(cfg->bell_wavefile));
     gppi(sesskey, "BellOverload", 1, &cfg->bellovl);
@@ -583,7 +577,7 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg)
     gppi(sesskey, "ScrollBarFullScreen", 0, &cfg->scrollbar_in_fullscreen);
     gppi(sesskey, "ScrollOnKey", 0, &cfg->scroll_on_key);
     gppi(sesskey, "ScrollOnDisp", 1, &cfg->scroll_on_disp);
-    gppi(sesskey, "LockSize", 0, &i); cfg->resize_action = i;
+    gppi(sesskey, "LockSize", 0, &cfg->resize_action);
     gppi(sesskey, "BCE", 1, &cfg->bce);
     gppi(sesskey, "BlinkText", 0, &cfg->blinktext);
     gppi(sesskey, "X11Forward", 0, &cfg->x11_forward);
@@ -613,21 +607,21 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg)
        }
        *q = '\0';
     }
-    gppi(sesskey, "BugIgnore1", BUG_AUTO, &i); cfg->sshbug_ignore1 = i;
-    gppi(sesskey, "BugPlainPW1", BUG_AUTO, &i); cfg->sshbug_plainpw1 = i;
-    gppi(sesskey, "BugRSA1", BUG_AUTO, &i); cfg->sshbug_rsa1 = i;
+    gppi(sesskey, "BugIgnore1", 0, &i); cfg->sshbug_ignore1 = 2-i;
+    gppi(sesskey, "BugPlainPW1", 0, &i); cfg->sshbug_plainpw1 = 2-i;
+    gppi(sesskey, "BugRSA1", 0, &i); cfg->sshbug_rsa1 = 2-i;
     {
        int i;
-       gppi(sesskey, "BugHMAC2", BUG_AUTO, &i); cfg->sshbug_hmac2 = i;
-       if (cfg->sshbug_hmac2 == BUG_AUTO) {
+       gppi(sesskey, "BugHMAC2", 0, &i); cfg->sshbug_hmac2 = 2-i;
+       if (cfg->sshbug_hmac2 == AUTO) {
            gppi(sesskey, "BuggyMAC", 0, &i);
            if (i == 1)
-               cfg->sshbug_hmac2 = BUG_ON;
+               cfg->sshbug_hmac2 = FORCE_ON;
        }
     }
-    gppi(sesskey, "BugDeriveKey2", BUG_AUTO, &i); cfg->sshbug_derivekey2 = i;
-    gppi(sesskey, "BugRSAPad2", BUG_AUTO, &i); cfg->sshbug_rsapad2 = i;
-    gppi(sesskey, "BugDHGEx2", BUG_AUTO, &i); cfg->sshbug_dhgex2 = i;
+    gppi(sesskey, "BugDeriveKey2", 0, &i); cfg->sshbug_derivekey2 = 2-i;
+    gppi(sesskey, "BugRSAPad2", 0, &i); cfg->sshbug_rsapad2 = 2-i;
+    gppi(sesskey, "BugDHGEx2", 0, &i); cfg->sshbug_dhgex2 = 2-i;
     gppi(sesskey, "StampUtmp", 1, &cfg->stamp_utmp);
     gppi(sesskey, "LoginShell", 1, &cfg->login_shell);
     gppi(sesskey, "ScrollbarOnLeft", 0, &cfg->scrollbar_on_left);