X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/c85623f918b8a6c639afc15604414f9b113bb20d..5ecd7ad009cc5148c67b9d665f79a64083fae254:/settings.c diff --git a/settings.c b/settings.c index ed9007da..8dc31f4d 100644 --- a/settings.c +++ b/settings.c @@ -127,13 +127,19 @@ static void wprefs(void *sesskey, char *name, void save_settings(char *section, int do_host, Config * cfg) { - int i; - char *p; void *sesskey; sesskey = open_settings_w(section); if (!sesskey) return; + save_open_settings(sesskey, do_host, cfg); + close_settings_w(sesskey); +} + +void save_open_settings(void *sesskey, int do_host, Config *cfg) +{ + int i; + char *p; write_setting_i(sesskey, "Present", 1); if (do_host) { @@ -327,7 +333,6 @@ void save_settings(char *section, int do_host, Config * cfg) write_setting_i(sesskey, "ScrollbarOnLeft", cfg->scrollbar_on_left); write_setting_s(sesskey, "BoldFont", cfg->boldfont); write_setting_i(sesskey, "ShadowBoldOffset", cfg->shadowboldoffset); - close_settings_w(sesskey); } void load_settings(char *section, int do_host, Config * cfg) @@ -368,17 +373,7 @@ 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); + gppi(sesskey, "CloseOnExit", AUTO, &cfg->close_on_exit); gppi(sesskey, "WarnOnClose", 1, &cfg->warn_on_close); { /* This is two values for backward compatibility with 0.50/0.51 */ @@ -396,9 +391,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", AUTO, &cfg->proxy_dns); 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); @@ -469,8 +464,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); @@ -481,8 +476,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); @@ -493,7 +488,7 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg) gppi(sesskey, "DECOriginMode", 0, &cfg->dec_om); gppi(sesskey, "AutoWrapMode", 1, &cfg->wrap_mode); gppi(sesskey, "LFImpliesCR", 0, &cfg->lfhascr); - gppi(sesskey, "WinNameAlways", 0, &cfg->win_name_always); + gppi(sesskey, "WinNameAlways", 1, &cfg->win_name_always); gpps(sesskey, "WinTitle", "", cfg->wintitle, sizeof(cfg->wintitle)); gppi(sesskey, "TermWidth", 80, &cfg->width); gppi(sesskey, "TermHeight", 24, &cfg->height); @@ -578,7 +573,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); @@ -608,21 +603,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", AUTO, &cfg->sshbug_ignore1); + gppi(sesskey, "BugPlainPW1", AUTO, &cfg->sshbug_plainpw1); + gppi(sesskey, "BugRSA1", AUTO, &cfg->sshbug_rsa1); { int i; - gppi(sesskey, "BugHMAC2", BUG_AUTO, &i); cfg->sshbug_hmac2 = i; - if (cfg->sshbug_hmac2 == BUG_AUTO) { + gppi(sesskey, "BugHMAC2", AUTO, &cfg->sshbug_hmac2); + 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", AUTO, &cfg->sshbug_derivekey2); + gppi(sesskey, "BugRSAPad2", AUTO, &cfg->sshbug_rsapad2); + gppi(sesskey, "BugDHGEx2", AUTO, &cfg->sshbug_dhgex2); gppi(sesskey, "StampUtmp", 1, &cfg->stamp_utmp); gppi(sesskey, "LoginShell", 1, &cfg->login_shell); gppi(sesskey, "ScrollbarOnLeft", 0, &cfg->scrollbar_on_left);