зеркало из https://github.com/github/putty.git
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:
Родитель
69b216c116
Коммит
55123b105d
8
putty.h
8
putty.h
|
@ -1516,16 +1516,20 @@ void random_destroy_seed(void);
|
|||
|
||||
/*
|
||||
* Exports from settings.c.
|
||||
*
|
||||
* load_settings() and do_defaults() return false if the provided
|
||||
* session name didn't actually exist. But they still fill in the
|
||||
* provided Conf with _something_.
|
||||
*/
|
||||
const struct BackendVtable *backend_vt_from_name(const char *name);
|
||||
const struct BackendVtable *backend_vt_from_proto(int proto);
|
||||
char *get_remote_username(Conf *conf); /* dynamically allocated */
|
||||
char *save_settings(const char *section, Conf *conf);
|
||||
void save_open_settings(settings_w *sesskey, Conf *conf);
|
||||
void load_settings(const char *section, Conf *conf);
|
||||
bool load_settings(const char *section, Conf *conf);
|
||||
void load_open_settings(settings_r *sesskey, Conf *conf);
|
||||
void get_sesslist(struct sesslist *, bool allocate);
|
||||
void do_defaults(const char *, Conf *);
|
||||
bool do_defaults(const char *, Conf *);
|
||||
void registry_cleanup(void);
|
||||
|
||||
/*
|
||||
|
|
11
settings.c
11
settings.c
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче