{ "des", CIPHER_DES }
};
-static void gpps(void *handle, char *name, char *def, char *val, int len)
+static void gpps(void *handle, const char *name, const char *def,
+ char *val, int len)
{
if (!read_setting_s(handle, name, val, len)) {
- strncpy(val, def, len);
+ char *pdef;
+
+ pdef = platform_default_s(name);
+ if (pdef) {
+ strncpy(val, pdef, len);
+ sfree(pdef);
+ } else {
+ strncpy(val, def, len);
+ }
+
val[len - 1] = '\0';
}
}
+/*
+ * gppfont and gppfile cannot have local defaults, since the very
+ * format of a Filename or Font is platform-dependent. So the
+ * platform-dependent functions MUST return some sort of value.
+ */
+static void gppfont(void *handle, const char *name, FontSpec *result)
+{
+ if (!read_setting_fontspec(handle, name, result))
+ *result = platform_default_fontspec(name);
+}
+static void gppfile(void *handle, const char *name, Filename *result)
+{
+ if (!read_setting_filename(handle, name, result))
+ *result = platform_default_filename(name);
+}
+
static void gppi(void *handle, char *name, int def, int *i)
{
+ def = platform_default_i(name, def);
*i = read_setting_i(handle, name, def);
}
write_setting_s(sesskey, name, buf);
}
-void save_settings(char *section, int do_host, Config * cfg)
+char *save_settings(char *section, int do_host, Config * cfg)
{
- int i;
- char *p;
void *sesskey;
+ char *errmsg;
- sesskey = open_settings_w(section);
+ sesskey = open_settings_w(section, &errmsg);
if (!sesskey)
- return;
+ return errmsg;
+ save_open_settings(sesskey, do_host, cfg);
+ close_settings_w(sesskey);
+ return NULL;
+}
+
+void save_open_settings(void *sesskey, int do_host, Config *cfg)
+{
+ int i;
+ char *p;
write_setting_i(sesskey, "Present", 1);
if (do_host) {
write_setting_s(sesskey, "HostName", cfg->host);
- write_setting_s(sesskey, "LogFileName", cfg->logfilename);
+ write_setting_filename(sesskey, "LogFileName", cfg->logfilename);
write_setting_i(sesskey, "LogType", cfg->logtype);
write_setting_i(sesskey, "LogFileClash", cfg->logxfovr);
}
}
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 */
/* proxy settings */
write_setting_s(sesskey, "ProxyExcludeList", cfg->proxy_exclude_list);
- write_setting_i(sesskey, "ProxyType", cfg->proxy_type);
+ write_setting_i(sesskey, "ProxyDNS", (cfg->proxy_dns+2)%3);
+ write_setting_i(sesskey, "ProxyLocalhost", cfg->even_proxy_localhost);
+ write_setting_i(sesskey, "ProxyMethod", cfg->proxy_type);
write_setting_s(sesskey, "ProxyHost", cfg->proxy_host);
write_setting_i(sesskey, "ProxyPort", cfg->proxy_port);
write_setting_s(sesskey, "ProxyUsername", cfg->proxy_username);
write_setting_s(sesskey, "ProxyPassword", cfg->proxy_password);
write_setting_s(sesskey, "ProxyTelnetCommand", cfg->proxy_telnet_command);
- write_setting_i(sesskey, "ProxySOCKSVersion", cfg->proxy_socks_version);
{
char buf[2 * sizeof(cfg->environmt)], *p, *q;
write_setting_i(sesskey, "AuthKI", cfg->try_ki_auth);
write_setting_i(sesskey, "SshProt", cfg->sshprot);
write_setting_i(sesskey, "SSH2DES", cfg->ssh2_des_cbc);
- write_setting_s(sesskey, "PublicKeyFile", cfg->keyfile);
+ write_setting_filename(sesskey, "PublicKeyFile", cfg->keyfile);
write_setting_s(sesskey, "RemoteCommand", cfg->remote_cmd);
write_setting_i(sesskey, "RFCEnviron", cfg->rfc_environ);
write_setting_i(sesskey, "PassiveTelnet", cfg->passive_telnet);
write_setting_i(sesskey, "NoRemoteResize", cfg->no_remote_resize);
write_setting_i(sesskey, "NoAltScreen", cfg->no_alt_screen);
write_setting_i(sesskey, "NoRemoteWinTitle", cfg->no_remote_wintitle);
+ write_setting_i(sesskey, "NoRemoteQTitle", cfg->no_remote_qtitle);
write_setting_i(sesskey, "NoDBackspace", cfg->no_dbackspace);
write_setting_i(sesskey, "NoRemoteCharset", cfg->no_remote_charset);
write_setting_i(sesskey, "ApplicationCursorKeys", cfg->app_cursor);
write_setting_i(sesskey, "BlinkCur", cfg->blink_cur);
write_setting_i(sesskey, "Beep", cfg->beep);
write_setting_i(sesskey, "BeepInd", cfg->beep_ind);
- write_setting_s(sesskey, "BellWaveFile", cfg->bell_wavefile);
+ write_setting_filename(sesskey, "BellWaveFile", cfg->bell_wavefile);
write_setting_i(sesskey, "BellOverload", cfg->bellovl);
write_setting_i(sesskey, "BellOverloadN", cfg->bellovl_n);
write_setting_i(sesskey, "BellOverloadT", cfg->bellovl_t);
write_setting_s(sesskey, "WinTitle", cfg->wintitle);
write_setting_i(sesskey, "TermWidth", cfg->width);
write_setting_i(sesskey, "TermHeight", cfg->height);
- write_setting_s(sesskey, "Font", cfg->font);
- write_setting_i(sesskey, "FontIsBold", cfg->fontisbold);
- write_setting_i(sesskey, "FontCharSet", cfg->fontcharset);
- write_setting_i(sesskey, "FontHeight", cfg->fontheight);
+ write_setting_fontspec(sesskey, "Font", cfg->font);
write_setting_i(sesskey, "FontVTMode", cfg->vtmode);
write_setting_i(sesskey, "TryPalette", cfg->try_palette);
write_setting_i(sesskey, "BoldAsColour", cfg->bold_colour);
write_setting_i(sesskey, "ScrollBarFullScreen", cfg->scrollbar_in_fullscreen);
write_setting_i(sesskey, "ScrollOnKey", cfg->scroll_on_key);
write_setting_i(sesskey, "ScrollOnDisp", cfg->scroll_on_disp);
+ write_setting_i(sesskey, "EraseToScrollback", cfg->erase_to_scrollback);
write_setting_i(sesskey, "LockSize", cfg->resize_action);
write_setting_i(sesskey, "BCE", cfg->bce);
write_setting_i(sesskey, "BlinkText", cfg->blinktext);
write_setting_i(sesskey, "X11Forward", cfg->x11_forward);
write_setting_s(sesskey, "X11Display", cfg->x11_display);
+ write_setting_i(sesskey, "X11AuthType", cfg->x11_auth);
write_setting_i(sesskey, "LocalPortAcceptAll", cfg->lport_acceptall);
write_setting_i(sesskey, "RemotePortAcceptAll", cfg->rport_acceptall);
{
*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, "BugPKSessID2", 2-cfg->sshbug_pksessid2);
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);
- write_setting_s(sesskey, "BoldFont", cfg->boldfont);
+ write_setting_fontspec(sesskey, "BoldFont", cfg->boldfont);
+ write_setting_i(sesskey, "ShadowBold", cfg->shadowbold);
write_setting_i(sesskey, "ShadowBoldOffset", cfg->shadowboldoffset);
- close_settings_w(sesskey);
}
void load_settings(char *section, int do_host, Config * cfg)
{
- int i;
- char prot[10];
void *sesskey;
sesskey = open_settings_r(section);
+ load_open_settings(sesskey, do_host, cfg);
+ close_settings_r(sesskey);
+}
+
+void load_open_settings(void *sesskey, int do_host, Config *cfg)
+{
+ int i;
+ char prot[10];
cfg->ssh_subsys = 0; /* FIXME: load this properly */
cfg->remote_cmd_ptr = cfg->remote_cmd;
} else {
cfg->host[0] = '\0'; /* blank hostname */
}
- gpps(sesskey, "LogFileName", "putty.log",
- cfg->logfilename, sizeof(cfg->logfilename));
+ gppfile(sesskey, "LogFileName", &cfg->logfilename);
gppi(sesskey, "LogType", 0, &cfg->logtype);
gppi(sesskey, "LogFileClash", LGXF_ASK, &cfg->logxfovr);
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",
-#ifdef _WINDOWS
- COE_NORMAL,
-#else
- COE_ALWAYS,
-#endif
- &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 */
/* proxy settings */
gpps(sesskey, "ProxyExcludeList", "", cfg->proxy_exclude_list,
sizeof(cfg->proxy_exclude_list));
- gppi(sesskey, "ProxyType", PROXY_NONE, &i); cfg->proxy_type = i;
+ gppi(sesskey, "ProxyDNS", 1, &i); cfg->proxy_dns = (i+1)%3;
+ gppi(sesskey, "ProxyLocalhost", 0, &cfg->even_proxy_localhost);
+ gppi(sesskey, "ProxyMethod", -1, &cfg->proxy_type);
+ if (cfg->proxy_type == -1) {
+ int i;
+ gppi(sesskey, "ProxyType", 0, &i);
+ if (i == 0)
+ cfg->proxy_type = PROXY_NONE;
+ else if (i == 1)
+ cfg->proxy_type = PROXY_HTTP;
+ else if (i == 3)
+ cfg->proxy_type = PROXY_TELNET;
+ else if (i == 4)
+ cfg->proxy_type = PROXY_CMD;
+ else {
+ gppi(sesskey, "ProxySOCKSVersion", 5, &i);
+ if (i == 5)
+ cfg->proxy_type = PROXY_SOCKS5;
+ else
+ cfg->proxy_type = PROXY_SOCKS4;
+ }
+ }
gpps(sesskey, "ProxyHost", "proxy", cfg->proxy_host,
sizeof(cfg->proxy_host));
gppi(sesskey, "ProxyPort", 80, &cfg->proxy_port);
sizeof(cfg->proxy_password));
gpps(sesskey, "ProxyTelnetCommand", "connect %host %port\\n",
cfg->proxy_telnet_command, sizeof(cfg->proxy_telnet_command));
- gppi(sesskey, "ProxySOCKSVersion", 5, &cfg->proxy_socks_version);
{
char buf[2 * sizeof(cfg->environmt)], *p, *q;
gppi(sesskey, "SSH2DES", 0, &cfg->ssh2_des_cbc);
gppi(sesskey, "AuthTIS", 0, &cfg->try_tis_auth);
gppi(sesskey, "AuthKI", 1, &cfg->try_ki_auth);
- gpps(sesskey, "PublicKeyFile", "", cfg->keyfile, sizeof(cfg->keyfile));
+ gppfile(sesskey, "PublicKeyFile", &cfg->keyfile);
gpps(sesskey, "RemoteCommand", "", cfg->remote_cmd,
sizeof(cfg->remote_cmd));
gppi(sesskey, "RFCEnviron", 0, &cfg->rfc_environ);
gppi(sesskey, "NoRemoteResize", 0, &cfg->no_remote_resize);
gppi(sesskey, "NoAltScreen", 0, &cfg->no_alt_screen);
gppi(sesskey, "NoRemoteWinTitle", 0, &cfg->no_remote_wintitle);
+ gppi(sesskey, "NoRemoteQTitle", 1, &cfg->no_remote_qtitle);
gppi(sesskey, "NoDBackspace", 0, &cfg->no_dbackspace);
gppi(sesskey, "NoRemoteCharset", 0, &cfg->no_remote_charset);
gppi(sesskey, "ApplicationCursorKeys", 0, &cfg->app_cursor);
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);
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;
- gpps(sesskey, "BellWaveFile", "", cfg->bell_wavefile,
- sizeof(cfg->bell_wavefile));
+ gppi(sesskey, "Beep", 1, &cfg->beep);
+ gppi(sesskey, "BeepInd", 0, &cfg->beep_ind);
+ gppfile(sesskey, "BellWaveFile", &cfg->bell_wavefile);
gppi(sesskey, "BellOverload", 1, &cfg->bellovl);
gppi(sesskey, "BellOverloadN", 5, &cfg->bellovl_n);
gppi(sesskey, "BellOverloadT", 2*TICKSPERSEC, &cfg->bellovl_t);
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);
-#ifdef _WINDOWS
- gpps(sesskey, "Font", "Courier New", cfg->font, sizeof(cfg->font));
-#elif defined(macintosh)
- gpps(sesskey, "Font", "Monaco", cfg->font, sizeof(cfg->font));
-#else
- gpps(sesskey, "Font", "fixed", cfg->font, sizeof(cfg->font));
-#endif
- gppi(sesskey, "FontIsBold", 0, &cfg->fontisbold);
-#ifdef _WINDOWS
- gppi(sesskey, "FontCharSet", ANSI_CHARSET, &cfg->fontcharset);
-#endif
-#ifdef macintosh
- gppi(sesskey, "FontHeight", 9, &cfg->fontheight);
-#else
- gppi(sesskey, "FontHeight", 10, &cfg->fontheight);
-#endif
-#ifdef _WINDOWS
- if (cfg->fontheight < 0) {
- int oldh, newh;
- HDC hdc = GetDC(NULL);
- int logpix = GetDeviceCaps(hdc, LOGPIXELSY);
- ReleaseDC(NULL, hdc);
-
- oldh = -cfg->fontheight;
- newh = MulDiv(oldh, 72, logpix) + 1;
- if (MulDiv(newh, logpix, 72) > oldh)
- newh--;
- cfg->fontheight = newh;
- }
-#endif
+ gppfont(sesskey, "Font", &cfg->font);
gppi(sesskey, "FontVTMode", VT_UNICODE, (int *) &cfg->vtmode);
gppi(sesskey, "TryPalette", 0, &cfg->try_palette);
gppi(sesskey, "BoldAsColour", 1, &cfg->bold_colour);
for (i = 0; i < 22; i++) {
- static char *defaults[] = {
+ static const char *const defaults[] = {
"187,187,187", "255,255,255", "0,0,0", "85,85,85", "0,0,0",
"0,255,0", "0,0,0", "85,85,85", "187,0,0", "255,85,85",
"0,187,0", "85,255,85", "187,187,0", "255,255,85", "0,0,187",
cfg->colours[i][2] = c2;
}
}
-#ifndef _WINDOWS
- /* Non-raw cut and paste of line-drawing chars works badly on the
- * current Unix stub implementation of the Unicode functions.
- * So I'm going to temporarily set the default to raw mode so
- * that the failure mode isn't quite so drastically horrid.
- * When Unicode comes in, this can all be put right. */
- gppi(sesskey, "RawCNP", 1, &cfg->rawcnp);
-#else
gppi(sesskey, "RawCNP", 0, &cfg->rawcnp);
-#endif
gppi(sesskey, "PasteRTF", 0, &cfg->rtf_paste);
gppi(sesskey, "MouseIsXterm", 0, &cfg->mouse_is_xterm);
gppi(sesskey, "RectSelect", 0, &cfg->rect_select);
gppi(sesskey, "MouseOverride", 1, &cfg->mouse_override);
for (i = 0; i < 256; i += 32) {
- static char *defaults[] = {
+ static const char *const 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",
"0,1,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1",
"1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,2",
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, "EraseToScrollback", 1, &cfg->erase_to_scrollback);
+ 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);
gpps(sesskey, "X11Display", "localhost:0", cfg->x11_display,
sizeof(cfg->x11_display));
+ gppi(sesskey, "X11AuthType", X11_MIT, &cfg->x11_auth);
gppi(sesskey, "LocalPortAcceptAll", 0, &cfg->lport_acceptall);
gppi(sesskey, "RemotePortAcceptAll", 0, &cfg->rport_acceptall);
}
*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, "BugPKSessID2", 0, &i); cfg->sshbug_pksessid2 = 2-i;
gppi(sesskey, "StampUtmp", 1, &cfg->stamp_utmp);
gppi(sesskey, "LoginShell", 1, &cfg->login_shell);
gppi(sesskey, "ScrollbarOnLeft", 0, &cfg->scrollbar_on_left);
- gpps(sesskey, "BoldFont", "", cfg->boldfont, sizeof(cfg->boldfont));
+ gppi(sesskey, "ShadowBold", 0, &cfg->shadowbold);
+ gppfont(sesskey, "BoldFont", &cfg->boldfont);
+ gppfont(sesskey, "WideFont", &cfg->widefont);
+ gppfont(sesskey, "WideBoldFont", &cfg->wideboldfont);
gppi(sesskey, "ShadowBoldOffset", 1, &cfg->shadowboldoffset);
-
- close_settings_r(sesskey);
}
void do_defaults(char *session, Config * cfg)
{
- if (session)
- load_settings(session, TRUE, cfg);
- else
- load_settings("Default Settings", FALSE, cfg);
+ load_settings(session, (session != NULL && *session), cfg);
}
static int sessioncmp(const void *av, const void *bv)
int len = strlen(otherbuf) + 1;
if (bufsize < buflen + len) {
bufsize = buflen + len + 2048;
- list->buffer = srealloc(list->buffer, bufsize);
+ list->buffer = sresize(list->buffer, bufsize, char);
}
strcpy(list->buffer + buflen, otherbuf);
buflen += strlen(list->buffer + buflen) + 1;
} while (ret);
enum_settings_finish(handle);
}
- list->buffer = srealloc(list->buffer, buflen + 1);
+ list->buffer = sresize(list->buffer, buflen + 1, char);
list->buffer[buflen] = '\0';
/*
p++;
}
- list->sessions = smalloc((list->nsessions + 1) * sizeof(char *));
+ list->sessions = snewn(list->nsessions + 1, char *);
list->sessions[0] = "Default Settings";
p = list->buffer;
i = 1;