1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

load_settings, do_defaults: return a boolean success flag.

Now the caller of one of those functions can tell whether the session
it loaded actually existed at all, or whether it was made up by
settings.c.
This commit is contained in:
Simon Tatham
2019-02-27 20:30:47 +00:00
parent 69b216c116
commit 55123b105d
2 changed files with 13 additions and 6 deletions

View File

@ -780,16 +780,19 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
wmap(sesskey, "SSHManualHostKeys", conf, CONF_ssh_manual_hostkeys, false);
}
void load_settings(const char *section, Conf *conf)
bool load_settings(const char *section, Conf *conf)
{
settings_r *sesskey;
sesskey = open_settings_r(section);
bool exists = (sesskey != NULL);
load_open_settings(sesskey, conf);
close_settings_r(sesskey);
if (conf_launchable(conf))
if (exists && conf_launchable(conf))
add_session_to_jumplist(section);
return exists;
}
void load_open_settings(settings_r *sesskey, Conf *conf)
@ -1242,9 +1245,9 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
gppmap(sesskey, "SSHManualHostKeys", conf, CONF_ssh_manual_hostkeys);
}
void do_defaults(const char *session, Conf *conf)
bool do_defaults(const char *session, Conf *conf)
{
load_settings(session, conf);
return load_settings(session, conf);
}
static int sessioncmp(const void *av, const void *bv)