зеркало из https://github.com/github/putty.git
Give BackendVtable separate id and displayname fields.
The previous 'name' field was awkwardly serving both purposes: it was a machine-readable identifier for the backend used in the saved session format, and it was also used in error messages when Plink wanted to complain that it didn't support a particular backend. Now there are two separate name fields for those purposes.
This commit is contained in:
Родитель
37f26089fa
Коммит
9482f33739
6
putty.h
6
putty.h
|
@ -512,7 +512,11 @@ struct BackendVtable {
|
|||
* connection-sharing upstream exists for a given configuration. */
|
||||
bool (*test_for_upstream)(const char *host, int port, Conf *conf);
|
||||
|
||||
const char *name;
|
||||
/* 'id' is a machine-readable name for the backend, used in
|
||||
* saved-session storage. 'displayname' is a human-readable name
|
||||
* for error messages. */
|
||||
const char *id, *displayname;
|
||||
|
||||
int protocol;
|
||||
int default_port;
|
||||
};
|
||||
|
|
2
raw.c
2
raw.c
|
@ -324,7 +324,7 @@ const struct BackendVtable raw_backend = {
|
|||
raw_unthrottle,
|
||||
raw_cfg_info,
|
||||
NULL /* test_for_upstream */,
|
||||
"raw",
|
||||
"raw", "Raw",
|
||||
PROT_RAW,
|
||||
0
|
||||
};
|
||||
|
|
2
rlogin.c
2
rlogin.c
|
@ -422,7 +422,7 @@ const struct BackendVtable rlogin_backend = {
|
|||
rlogin_unthrottle,
|
||||
rlogin_cfg_info,
|
||||
NULL /* test_for_upstream */,
|
||||
"rlogin",
|
||||
"rlogin", "Rlogin",
|
||||
PROT_RLOGIN,
|
||||
513
|
||||
};
|
||||
|
|
|
@ -82,7 +82,7 @@ const struct BackendVtable *backend_vt_from_name(const char *name)
|
|||
{
|
||||
const struct BackendVtable *const *p;
|
||||
for (p = backends; *p != NULL; p++)
|
||||
if (!strcmp((*p)->name, name))
|
||||
if (!strcmp((*p)->id, name))
|
||||
return *p;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -556,7 +556,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
|
|||
const struct BackendVtable *vt =
|
||||
backend_vt_from_proto(conf_get_int(conf, CONF_protocol));
|
||||
if (vt)
|
||||
p = vt->name;
|
||||
p = vt->id;
|
||||
}
|
||||
write_setting_s(sesskey, "Protocol", p);
|
||||
write_setting_i(sesskey, "PortNumber", conf_get_int(conf, CONF_port));
|
||||
|
|
2
ssh.c
2
ssh.c
|
@ -1190,7 +1190,7 @@ const struct BackendVtable ssh_backend = {
|
|||
ssh_unthrottle,
|
||||
ssh_cfg_info,
|
||||
ssh_test_for_upstream,
|
||||
"ssh",
|
||||
"ssh", "SSH",
|
||||
PROT_SSH,
|
||||
22
|
||||
};
|
||||
|
|
2
telnet.c
2
telnet.c
|
@ -1064,7 +1064,7 @@ const struct BackendVtable telnet_backend = {
|
|||
telnet_unthrottle,
|
||||
telnet_cfg_info,
|
||||
NULL /* test_for_upstream */,
|
||||
"telnet",
|
||||
"telnet", "Telnet",
|
||||
PROT_TELNET,
|
||||
23
|
||||
};
|
||||
|
|
|
@ -57,14 +57,14 @@ const struct BackendVtable null_backend = {
|
|||
null_init, null_free, null_reconfig, null_send, null_sendbuffer, null_size,
|
||||
null_special, null_get_specials, null_connected, null_exitcode, null_sendok,
|
||||
null_ldisc, null_provide_ldisc, null_unthrottle,
|
||||
null_cfg_info, NULL /* test_for_upstream */, "null", -1, 0
|
||||
null_cfg_info, NULL /* test_for_upstream */, "null", "null", -1, 0
|
||||
};
|
||||
|
||||
const struct BackendVtable loop_backend = {
|
||||
loop_init, loop_free, null_reconfig, loop_send, null_sendbuffer, null_size,
|
||||
null_special, null_get_specials, null_connected, null_exitcode, null_sendok,
|
||||
null_ldisc, null_provide_ldisc, null_unthrottle,
|
||||
null_cfg_info, NULL /* test_for_upstream */, "loop", -1, 0
|
||||
null_cfg_info, NULL /* test_for_upstream */, "loop", "loop", -1, 0
|
||||
};
|
||||
|
||||
struct loop_state {
|
||||
|
|
|
@ -891,8 +891,8 @@ int main(int argc, char **argv)
|
|||
|
||||
if (just_test_share_exists) {
|
||||
if (!backvt->test_for_upstream) {
|
||||
fprintf(stderr, "Connection sharing not supported for connection "
|
||||
"type '%s'\n", backvt->name);
|
||||
fprintf(stderr, "Connection sharing not supported for this "
|
||||
"connection type (%s)'\n", backvt->displayname);
|
||||
return 1;
|
||||
}
|
||||
if (backvt->test_for_upstream(conf_get_str(conf, CONF_host),
|
||||
|
|
|
@ -1601,7 +1601,7 @@ const struct BackendVtable pty_backend = {
|
|||
pty_unthrottle,
|
||||
pty_cfg_info,
|
||||
NULL /* test_for_upstream */,
|
||||
"pty",
|
||||
"pty", "pty",
|
||||
-1,
|
||||
0
|
||||
};
|
||||
|
|
|
@ -576,7 +576,7 @@ const struct BackendVtable serial_backend = {
|
|||
serial_unthrottle,
|
||||
serial_cfg_info,
|
||||
NULL /* test_for_upstream */,
|
||||
"serial",
|
||||
"serial", "Serial",
|
||||
PROT_SERIAL,
|
||||
0
|
||||
};
|
||||
|
|
|
@ -413,8 +413,8 @@ int main(int argc, char **argv)
|
|||
|
||||
if (just_test_share_exists) {
|
||||
if (!vt->test_for_upstream) {
|
||||
fprintf(stderr, "Connection sharing not supported for connection "
|
||||
"type '%s'\n", vt->name);
|
||||
fprintf(stderr, "Connection sharing not supported for this "
|
||||
"connection type (%s)'\n", vt->displayname);
|
||||
return 1;
|
||||
}
|
||||
if (vt->test_for_upstream(conf_get_str(conf, CONF_host),
|
||||
|
|
|
@ -444,7 +444,7 @@ const struct BackendVtable serial_backend = {
|
|||
serial_unthrottle,
|
||||
serial_cfg_info,
|
||||
NULL /* test_for_upstream */,
|
||||
"serial",
|
||||
"serial", "Serial",
|
||||
PROT_SERIAL,
|
||||
0
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче