86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
-
+
|
* We export this function so that platform-specific config
* routines can use it to conveniently identify the protocol radio
* buttons in order to add to them.
*/
void config_protocolbuttons_handler(union control *ctrl, void *dlg,
void *data, int event)
{
int button, defport;
int button;
Config *cfg = (Config *)data;
struct hostport *hp = (struct hostport *)ctrl->radio.context.p;
/*
* This function works just like the standard radio-button
* handler, except that it also has to change the setting of
* the port box, and refresh both host and port boxes when. We
|
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
|
dlg_radiobutton_set(ctrl, dlg, button);
} else if (event == EVENT_VALCHANGE) {
int oldproto = cfg->protocol;
button = dlg_radiobutton_get(ctrl, dlg);
assert(button >= 0 && button < ctrl->radio.nbuttons);
cfg->protocol = ctrl->radio.buttondata[button].i;
if (oldproto != cfg->protocol) {
defport = -1;
switch (cfg->protocol) {
case PROT_SSH: defport = 22; break;
case PROT_TELNET: defport = 23; break;
case PROT_RLOGIN: defport = 513; break;
Backend *ob = backend_from_proto(oldproto);
Backend *nb = backend_from_proto(cfg->protocol);
assert(ob);
assert(nb);
/* Iff the user hasn't changed the port from the protocol
* default (if any), update it with the new protocol's
* default.
* (XXX: this isn't perfect; a default can become permanent
* by going via the serial backend. However, it helps with
* the common case of tabbing through the controls in order
* and setting a non-default port.) */
if (cfg->port == ob->default_port &&
}
if (defport > 0 && cfg->port != defport) {
cfg->port = defport;
cfg->port > 0 && nb->default_port > 0)
cfg->port = nb->default_port;
}
}
dlg_refresh(hp->host, dlg);
dlg_refresh(hp->port, dlg);
}
}
static void loggingbuttons_handler(union control *ctrl, void *dlg,
|