Robert de Bath's asynchronous-connect patch. Helps a lot in port
[u/mdw/putty] / settings.c
index 53e8959..d2ba357 100644 (file)
 struct keyval { char *s; int v; };
 
 static const struct keyval ciphernames[] = {
-    { "WARN",      CIPHER_WARN },
-    { "3des",      CIPHER_3DES },
-    { "blowfish",   CIPHER_BLOWFISH },
     { "aes",       CIPHER_AES },
+    { "blowfish",   CIPHER_BLOWFISH },
+    { "3des",      CIPHER_3DES },
+    { "WARN",      CIPHER_WARN },
     { "des",       CIPHER_DES }
 };
 
@@ -81,7 +81,7 @@ static void gprefs(void *sesskey, char *name, char *def,
     } while (n < nvals);
     /* Add any missing values (backward compatibility ect). */
     {
-       int i, j;
+       int i;
        for (i = 0; i < nvals; i++) {
            if (!(seen & 1<<mapping[i].v)) {
                array[n] = mapping[i].v;
@@ -171,7 +171,7 @@ void save_settings(char *section, int do_host, Config * cfg)
     write_setting_i(sesskey, "NoPTY", cfg->nopty);
     write_setting_i(sesskey, "Compression", cfg->compression);
     write_setting_i(sesskey, "AgentFwd", cfg->agentfwd);
-    wprefs(sesskey, "SSHCipherList", ciphernames, CIPHER_MAX,
+    wprefs(sesskey, "Cipher", ciphernames, CIPHER_MAX,
           cfg->ssh_cipherlist);
     write_setting_i(sesskey, "AuthTIS", cfg->try_tis_auth);
     write_setting_i(sesskey, "SshProt", cfg->sshprot);
@@ -233,6 +233,7 @@ void save_settings(char *section, int do_host, Config * cfg)
     }
     write_setting_i(sesskey, "RawCNP", cfg->rawcnp);
     write_setting_i(sesskey, "MouseIsXterm", cfg->mouse_is_xterm);
+    write_setting_i(sesskey, "MouseOverride", cfg->mouse_override);
     for (i = 0; i < 256; i += 32) {
        char buf[20], buf2[256];
        int j;
@@ -287,6 +288,7 @@ void load_settings(char *section, int do_host, Config * cfg)
 
     cfg->ssh_subsys = 0;              /* FIXME: load this properly */
     cfg->remote_cmd_ptr = cfg->remote_cmd;
+    cfg->remote_cmd_ptr2 = NULL;
 
     gpps(sesskey, "HostName", "", cfg->host, sizeof(cfg->host));
     gppi(sesskey, "PortNumber", default_port, &cfg->port);
@@ -342,19 +344,8 @@ void load_settings(char *section, int do_host, Config * cfg)
     gppi(sesskey, "NoPTY", 0, &cfg->nopty);
     gppi(sesskey, "Compression", 0, &cfg->compression);
     gppi(sesskey, "AgentFwd", 0, &cfg->agentfwd);
-    {
-       /* Backwards compatibility: recreate old cipher policy. */
-       char defcipherlist[80];
-       gpps(sesskey, "Cipher", "3des", defcipherlist, 80);
-       if (strcmp(defcipherlist, "3des") != 0) {
-           int l = strlen(defcipherlist);
-           strncpy(defcipherlist + l, ",3des", 80 - l);
-           defcipherlist[79] = '\0';
-       }
-       /* Use it as default if no new-style policy. */
-       gprefs(sesskey, "SSHCipherList", defcipherlist,
-              ciphernames, CIPHER_MAX, cfg->ssh_cipherlist);
-    }
+    gprefs(sesskey, "Cipher", "\0",
+          ciphernames, CIPHER_MAX, cfg->ssh_cipherlist);
     gppi(sesskey, "SshProt", 1, &cfg->sshprot);
     gppi(sesskey, "BuggyMAC", 0, &cfg->buggymac);
     gppi(sesskey, "AuthTIS", 0, &cfg->try_tis_auth);
@@ -442,6 +433,7 @@ void load_settings(char *section, int do_host, Config * cfg)
     }
     gppi(sesskey, "RawCNP", 0, &cfg->rawcnp);
     gppi(sesskey, "MouseIsXterm", 0, &cfg->mouse_is_xterm);
+    gppi(sesskey, "MouseOverride", 1, &cfg->mouse_override);
     for (i = 0; i < 256; i += 32) {
        static char *defaults[] = {
            "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
@@ -467,7 +459,11 @@ void load_settings(char *section, int do_host, Config * cfg)
            cfg->wordness[j] = atoi(q);
        }
     }
-    gpps(sesskey, "LineCodePage", "ISO-8859-1:1987", cfg->line_codepage,
+    /*
+     * The empty default for LineCodePage will be converted later
+     * into a plausible default for the locale.
+     */
+    gpps(sesskey, "LineCodePage", "", cfg->line_codepage,
         sizeof(cfg->line_codepage));
     gppi(sesskey, "ScrollBar", 1, &cfg->scrollbar);
     gppi(sesskey, "ScrollOnKey", 0, &cfg->scroll_on_key);