1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 09:27:59 +00:00

Switch some Conf settings over to being bool.

I think this is the full set of things that ought logically to be
boolean.

One annoyance is that quite a few radio-button controls in config.c
address Conf fields that are now bool rather than int, which means
that the shared handler function can't just access them all with
conf_{get,set}_int. Rather than back out the rigorous separation of
int and bool in conf.c itself, I've just added a similar alternative
handler function for the bool-typed ones.
This commit is contained in:
Simon Tatham 2018-10-29 19:57:31 +00:00
parent 5691805cbd
commit 1378bb049a
31 changed files with 658 additions and 578 deletions

View File

@ -594,7 +594,7 @@ int cmdline_process_param(const char *p, char *value,
fclose(fp);
conf_set_str(conf, CONF_remote_cmd, command);
conf_set_str(conf, CONF_remote_cmd2, "");
conf_set_int(conf, CONF_nopty, true); /* command => no terminal */
conf_set_bool(conf, CONF_nopty, true); /* command => no terminal */
sfree(command);
}
if (!strcmp(p, "-P")) {
@ -626,78 +626,78 @@ int cmdline_process_param(const char *p, char *value,
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
SAVEABLE(0);
conf_set_int(conf, CONF_tryagent, true);
conf_set_bool(conf, CONF_tryagent, true);
}
if (!strcmp(p, "-noagent") || !strcmp(p, "-nopagent") ||
!strcmp(p, "-nopageant")) {
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
SAVEABLE(0);
conf_set_int(conf, CONF_tryagent, false);
conf_set_bool(conf, CONF_tryagent, false);
}
if (!strcmp(p, "-share")) {
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
SAVEABLE(0);
conf_set_int(conf, CONF_ssh_connection_sharing, true);
conf_set_bool(conf, CONF_ssh_connection_sharing, true);
}
if (!strcmp(p, "-noshare")) {
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
SAVEABLE(0);
conf_set_int(conf, CONF_ssh_connection_sharing, false);
conf_set_bool(conf, CONF_ssh_connection_sharing, false);
}
if (!strcmp(p, "-A")) {
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_FILETRANSFER | TOOLTYPE_NONNETWORK);
SAVEABLE(0);
conf_set_int(conf, CONF_agentfwd, 1);
conf_set_bool(conf, CONF_agentfwd, true);
}
if (!strcmp(p, "-a")) {
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_FILETRANSFER | TOOLTYPE_NONNETWORK);
SAVEABLE(0);
conf_set_int(conf, CONF_agentfwd, 0);
conf_set_bool(conf, CONF_agentfwd, false);
}
if (!strcmp(p, "-X")) {
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_FILETRANSFER | TOOLTYPE_NONNETWORK);
SAVEABLE(0);
conf_set_int(conf, CONF_x11_forward, 1);
conf_set_bool(conf, CONF_x11_forward, true);
}
if (!strcmp(p, "-x")) {
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_FILETRANSFER | TOOLTYPE_NONNETWORK);
SAVEABLE(0);
conf_set_int(conf, CONF_x11_forward, 0);
conf_set_bool(conf, CONF_x11_forward, false);
}
if (!strcmp(p, "-t")) {
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_FILETRANSFER | TOOLTYPE_NONNETWORK);
SAVEABLE(1); /* lower priority than -m */
conf_set_int(conf, CONF_nopty, 0);
conf_set_bool(conf, CONF_nopty, false);
}
if (!strcmp(p, "-T")) {
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_FILETRANSFER | TOOLTYPE_NONNETWORK);
SAVEABLE(1);
conf_set_int(conf, CONF_nopty, 1);
conf_set_bool(conf, CONF_nopty, true);
}
if (!strcmp(p, "-N")) {
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_FILETRANSFER | TOOLTYPE_NONNETWORK);
SAVEABLE(0);
conf_set_int(conf, CONF_ssh_no_shell, 1);
conf_set_bool(conf, CONF_ssh_no_shell, true);
}
if (!strcmp(p, "-C")) {
RETURN(1);
UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
SAVEABLE(0);
conf_set_int(conf, CONF_compression, 1);
conf_set_bool(conf, CONF_compression, true);
}
if (!strcmp(p, "-1")) {

View File

@ -43,11 +43,39 @@ void conf_radiobutton_handler(union control *ctrl, dlgparam *dlg,
}
}
void conf_radiobutton_bool_handler(union control *ctrl, dlgparam *dlg,
void *data, int event)
{
int button;
Conf *conf = (Conf *)data;
/*
* Same as conf_radiobutton_handler, but using conf_set_bool in
* place of conf_set_int, because it's dealing with a bool-typed
* config option.
*/
if (event == EVENT_REFRESH) {
int val = conf_get_bool(conf, ctrl->radio.context.i);
for (button = 0; button < ctrl->radio.nbuttons; button++)
if (val == ctrl->radio.buttondata[button].i)
break;
/* We expected that `break' to happen, in all circumstances. */
assert(button < ctrl->radio.nbuttons);
dlg_radiobutton_set(ctrl, dlg, button);
} else if (event == EVENT_VALCHANGE) {
button = dlg_radiobutton_get(ctrl, dlg);
assert(button >= 0 && button < ctrl->radio.nbuttons);
conf_set_bool(conf, ctrl->radio.context.i,
ctrl->radio.buttondata[button].i);
}
}
#define CHECKBOX_INVERT (1<<30)
void conf_checkbox_handler(union control *ctrl, dlgparam *dlg,
void *data, int event)
{
int key, invert;
int key;
bool invert;
Conf *conf = (Conf *)data;
/*
@ -68,10 +96,10 @@ void conf_checkbox_handler(union control *ctrl, dlgparam *dlg,
*/
if (event == EVENT_REFRESH) {
int val = conf_get_int(conf, key);
bool val = conf_get_bool(conf, key);
dlg_checkbox_set(ctrl, dlg, (!val ^ !invert));
} else if (event == EVENT_VALCHANGE) {
conf_set_int(conf, key, !dlg_checkbox_get(ctrl,dlg) ^ !invert);
conf_set_bool(conf, key, !dlg_checkbox_get(ctrl,dlg) ^ !invert);
}
}
@ -328,9 +356,9 @@ static void numeric_keypad_handler(union control *ctrl, dlgparam *dlg,
* handler, but it has to handle two fields in Conf.
*/
if (event == EVENT_REFRESH) {
if (conf_get_int(conf, CONF_nethack_keypad))
if (conf_get_bool(conf, CONF_nethack_keypad))
button = 2;
else if (conf_get_int(conf, CONF_app_keypad))
else if (conf_get_bool(conf, CONF_app_keypad))
button = 1;
else
button = 0;
@ -340,11 +368,11 @@ static void numeric_keypad_handler(union control *ctrl, dlgparam *dlg,
button = dlg_radiobutton_get(ctrl, dlg);
assert(button >= 0 && button < ctrl->radio.nbuttons);
if (button == 2) {
conf_set_int(conf, CONF_app_keypad, false);
conf_set_int(conf, CONF_nethack_keypad, true);
conf_set_bool(conf, CONF_app_keypad, false);
conf_set_bool(conf, CONF_nethack_keypad, true);
} else {
conf_set_int(conf, CONF_app_keypad, (button != 0));
conf_set_int(conf, CONF_nethack_keypad, false);
conf_set_bool(conf, CONF_app_keypad, (button != 0));
conf_set_bool(conf, CONF_nethack_keypad, false);
}
}
}
@ -1701,14 +1729,14 @@ void setup_config_box(struct controlbox *b, int midsession,
"Change the sequences sent by:");
ctrl_radiobuttons(s, "The Backspace key", 'b', 2,
HELPCTX(keyboard_backspace),
conf_radiobutton_handler,
conf_radiobutton_bool_handler,
I(CONF_bksp_is_delete),
"Control-H", I(0), "Control-? (127)", I(1), NULL);
ctrl_radiobuttons(s, "The Home and End keys", 'e', 2,
HELPCTX(keyboard_homeend),
conf_radiobutton_handler,
conf_radiobutton_bool_handler,
I(CONF_rxvt_homeend),
"Standard", I(0), "rxvt", I(1), NULL);
"Standard", I(false), "rxvt", I(true), NULL);
ctrl_radiobuttons(s, "The Function keys and keypad", 'f', 3,
HELPCTX(keyboard_funkeys),
conf_radiobutton_handler,
@ -1720,7 +1748,7 @@ void setup_config_box(struct controlbox *b, int midsession,
"Application keypad settings:");
ctrl_radiobuttons(s, "Initial state of cursor keys:", 'r', 3,
HELPCTX(keyboard_appcursor),
conf_radiobutton_handler,
conf_radiobutton_bool_handler,
I(CONF_app_cursor),
"Normal", I(0), "Application", I(1), NULL);
ctrl_radiobuttons(s, "Initial state of numeric keypad:", 'n', 3,
@ -1960,10 +1988,10 @@ void setup_config_box(struct controlbox *b, int midsession,
"Default selection mode (Alt+drag does the other one):",
NO_SHORTCUT, 2,
HELPCTX(selection_rect),
conf_radiobutton_handler,
conf_radiobutton_bool_handler,
I(CONF_rect_select),
"Normal", 'n', I(0),
"Rectangular block", 'r', I(1), NULL);
"Normal", 'n', I(false),
"Rectangular block", 'r', I(true), NULL);
s = ctrl_getset(b, "Window/Selection", "clipboards",
"Assign copy/paste actions to clipboards");
@ -2142,7 +2170,7 @@ void setup_config_box(struct controlbox *b, int midsession,
sfree(user);
ctrl_radiobuttons(s, "When username is not specified:", 'n', 4,
HELPCTX(connection_username_from_env),
conf_radiobutton_handler,
conf_radiobutton_bool_handler,
I(CONF_username_from_env),
"Prompt", I(false),
userlabel, I(true),
@ -2281,15 +2309,15 @@ void setup_config_box(struct controlbox *b, int midsession,
ctrl_radiobuttons(s, "Handling of OLD_ENVIRON ambiguity:",
NO_SHORTCUT, 2,
HELPCTX(telnet_oldenviron),
conf_radiobutton_handler,
conf_radiobutton_bool_handler,
I(CONF_rfc_environ),
"BSD (commonplace)", 'b', I(0),
"RFC 1408 (unusual)", 'f', I(1), NULL);
"BSD (commonplace)", 'b', I(false),
"RFC 1408 (unusual)", 'f', I(true), NULL);
ctrl_radiobuttons(s, "Telnet negotiation mode:", 't', 2,
HELPCTX(telnet_passive),
conf_radiobutton_handler,
conf_radiobutton_bool_handler,
I(CONF_passive_telnet),
"Passive", I(1), "Active", I(0), NULL);
"Passive", I(true), "Active", I(false), NULL);
}
ctrl_checkbox(s, "Keyboard sends Telnet special commands", 'k',
HELPCTX(telnet_specialkeys),

View File

@ -25,7 +25,7 @@ int main(int argc, char **argv)
conf = conf_new();
do_defaults(NULL, conf);
init_ucs(&ucsdata, conf_get_str(conf, CONF_line_codepage),
conf_get_int(conf, CONF_utf8_override),
conf_get_bool(conf, CONF_utf8_override),
CS_NONE, conf_get_int(conf, CONF_vtmode));
term = term_init(conf, &ucsdata, &termwin);
@ -188,6 +188,11 @@ char *platform_default_s(const char *name)
return NULL;
}
bool platform_default_b(const char *name, bool def)
{
return def;
}
int platform_default_i(const char *name, int def)
{
return def;

View File

@ -103,8 +103,8 @@ Ldisc *ldisc_create(Conf *conf, Terminal *term, Backend *backend, Seat *seat)
void ldisc_configure(Ldisc *ldisc, Conf *conf)
{
ldisc->telnet_keyboard = conf_get_int(conf, CONF_telnet_keyboard);
ldisc->telnet_newline = conf_get_int(conf, CONF_telnet_newline);
ldisc->telnet_keyboard = conf_get_bool(conf, CONF_telnet_keyboard);
ldisc->telnet_newline = conf_get_bool(conf, CONF_telnet_newline);
ldisc->protocol = conf_get_int(conf, CONF_protocol);
ldisc->localecho = conf_get_int(conf, CONF_localecho);
ldisc->localedit = conf_get_int(conf, CONF_localedit);

View File

@ -102,7 +102,7 @@ static void logfopen_callback(void *vctx, int mode)
}
}
if (ctx->state == L_OPEN && conf_get_int(ctx->conf, CONF_logheader)) {
if (ctx->state == L_OPEN && conf_get_bool(ctx->conf, CONF_logheader)) {
/* Write header line into log file. */
tm = ltime();
strftime(buf, 24, "%Y.%m.%d %H:%M:%S", &tm);

View File

@ -78,7 +78,7 @@ mainchan *mainchan_new(
{
mainchan *mc;
if (conf_get_int(conf, CONF_ssh_no_shell))
if (conf_get_bool(conf, CONF_ssh_no_shell))
return NULL; /* no main channel at all */
mc = snew(mainchan);
@ -141,7 +141,7 @@ static void mainchan_open_confirmation(Channel *chan)
struct X11FakeAuth *x11auth;
int retry_cmd_now = false;
if (conf_get_int(mc->conf, CONF_x11_forward)) {;
if (conf_get_bool(mc->conf, CONF_x11_forward)) {;
char *x11_setup_err;
if ((x11disp = x11_setup_display(
conf_get_str(mc->conf, CONF_x11_display),
@ -165,7 +165,7 @@ static void mainchan_open_confirmation(Channel *chan)
mc->req_agent = true;
}
if (!conf_get_int(mc->conf, CONF_nopty)) {
if (!conf_get_bool(mc->conf, CONF_nopty)) {
sshfwd_request_pty(
mc->sc, true, mc->conf, mc->term_width, mc->term_height);
mc->req_pty = true;
@ -181,7 +181,7 @@ static void mainchan_open_confirmation(Channel *chan)
ppl_logevent(("Sent %d environment variables", mc->n_req_env));
cmd = conf_get_str(mc->conf, CONF_remote_cmd);
if (conf_get_int(mc->conf, CONF_ssh_subsys)) {
if (conf_get_bool(mc->conf, CONF_ssh_subsys)) {
retry_cmd_now = !sshfwd_start_subsystem(mc->sc, true, cmd);
} else if (*cmd) {
sshfwd_start_command(mc->sc, true, cmd);
@ -204,7 +204,7 @@ static void mainchan_open_confirmation(Channel *chan)
static void mainchan_try_fallback_command(mainchan *mc)
{
const char *cmd = conf_get_str(mc->conf, CONF_remote_cmd2);
if (conf_get_int(mc->conf, CONF_ssh_subsys2)) {
if (conf_get_bool(mc->conf, CONF_ssh_subsys2)) {
sshfwd_start_subsystem(mc->sc, true, cmd);
} else {
sshfwd_start_command(mc->sc, true, cmd);

View File

@ -587,7 +587,7 @@ static char *pfl_listen(const char *desthost, int destport,
pl->cl = cl;
pl->s = new_listener(srcaddr, port, &pl->plug,
!conf_get_int(conf, CONF_lport_acceptall),
!conf_get_bool(conf, CONF_lport_acceptall),
conf, address_family);
if ((err = sk_socket_error(pl->s)) != NULL) {
char *err_ret = dupstr(err);
@ -1024,7 +1024,7 @@ void portfwdmgr_config(PortFwdManager *mgr, Conf *conf)
if (pfr->saddr) {
shost = pfr->saddr;
} else if (conf_get_int(conf, CONF_rport_acceptall)) {
} else if (conf_get_bool(conf, CONF_rport_acceptall)) {
shost = "";
} else {
shost = "localhost";

View File

@ -283,7 +283,7 @@ int proxy_for_destination (SockAddr *addr, const char *hostname,
* Check the host name and IP against the hard-coded
* representations of `localhost'.
*/
if (!conf_get_int(conf, CONF_even_proxy_localhost) &&
if (!conf_get_bool(conf, CONF_even_proxy_localhost) &&
(sk_hostname_is_local(hostname) ||
(addr && sk_address_is_local(addr))))
return 0; /* do not proxy */

18
pscp.c
View File

@ -437,9 +437,9 @@ static void do_cmd(char *host, char *user, char *cmd)
* things like SCP and SFTP: agent forwarding, port forwarding,
* X forwarding.
*/
conf_set_int(conf, CONF_x11_forward, 0);
conf_set_int(conf, CONF_agentfwd, 0);
conf_set_int(conf, CONF_ssh_simple, true);
conf_set_bool(conf, CONF_x11_forward, false);
conf_set_bool(conf, CONF_agentfwd, false);
conf_set_bool(conf, CONF_ssh_simple, true);
{
char *key;
while ((key = conf_get_str_nthstrkey(conf, CONF_portfwd, 0)) != NULL)
@ -457,12 +457,12 @@ static void do_cmd(char *host, char *user, char *cmd)
/* First choice is SFTP subsystem. */
main_cmd_is_sftp = 1;
conf_set_str(conf, CONF_remote_cmd, "sftp");
conf_set_int(conf, CONF_ssh_subsys, true);
conf_set_bool(conf, CONF_ssh_subsys, true);
if (try_scp) {
/* Fallback is to use the provided scp command. */
fallback_cmd_is_sftp = 0;
conf_set_str(conf, CONF_remote_cmd2, cmd);
conf_set_int(conf, CONF_ssh_subsys2, false);
conf_set_bool(conf, CONF_ssh_subsys2, false);
} else {
/* Since we're not going to try SCP, we may as well try
* harder to find an SFTP server, since in the current
@ -475,15 +475,15 @@ static void do_cmd(char *host, char *user, char *cmd)
"test -x /usr/local/lib/sftp-server &&"
" exec /usr/local/lib/sftp-server\n"
"exec sftp-server");
conf_set_int(conf, CONF_ssh_subsys2, false);
conf_set_bool(conf, CONF_ssh_subsys2, false);
}
} else {
/* Don't try SFTP at all; just try the scp command. */
main_cmd_is_sftp = 0;
conf_set_str(conf, CONF_remote_cmd, cmd);
conf_set_int(conf, CONF_ssh_subsys, false);
conf_set_bool(conf, CONF_ssh_subsys, false);
}
conf_set_int(conf, CONF_nopty, true);
conf_set_bool(conf, CONF_nopty, true);
logctx = log_init(default_logpolicy, conf);
@ -493,7 +493,7 @@ static void do_cmd(char *host, char *user, char *cmd)
conf_get_str(conf, CONF_host),
conf_get_int(conf, CONF_port),
&realhost, 0,
conf_get_int(conf, CONF_tcp_keepalives));
conf_get_bool(conf, CONF_tcp_keepalives));
if (err != NULL)
bump("ssh_init: %s", err);
ssh_scp_init();

14
psftp.c
View File

@ -2761,9 +2761,9 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
* things like SCP and SFTP: agent forwarding, port forwarding,
* X forwarding.
*/
conf_set_int(conf, CONF_x11_forward, 0);
conf_set_int(conf, CONF_agentfwd, 0);
conf_set_int(conf, CONF_ssh_simple, true);
conf_set_bool(conf, CONF_x11_forward, false);
conf_set_bool(conf, CONF_agentfwd, false);
conf_set_bool(conf, CONF_ssh_simple, true);
{
char *key;
while ((key = conf_get_str_nthstrkey(conf, CONF_portfwd, 0)) != NULL)
@ -2772,8 +2772,8 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
/* Set up subsystem name. */
conf_set_str(conf, CONF_remote_cmd, "sftp");
conf_set_int(conf, CONF_ssh_subsys, true);
conf_set_int(conf, CONF_nopty, true);
conf_set_bool(conf, CONF_ssh_subsys, true);
conf_set_bool(conf, CONF_nopty, true);
/*
* Set up fallback option, for SSH-1 servers or servers with the
@ -2798,7 +2798,7 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
"test -x /usr/local/lib/sftp-server &&"
" exec /usr/local/lib/sftp-server\n"
"exec sftp-server");
conf_set_int(conf, CONF_ssh_subsys2, false);
conf_set_bool(conf, CONF_ssh_subsys2, false);
logctx = log_init(default_logpolicy, conf);
@ -2808,7 +2808,7 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
conf_get_str(conf, CONF_host),
conf_get_int(conf, CONF_port),
&realhost, 0,
conf_get_int(conf, CONF_tcp_keepalives));
conf_get_bool(conf, CONF_tcp_keepalives));
if (err != NULL) {
fprintf(stderr, "ssh_init: %s\n", err);
return 1;

250
putty.h
View File

@ -1155,37 +1155,37 @@ void cleanup_exit(int);
/* X(value-type, subkey-type, keyword) */ \
X(STR, NONE, host) \
X(INT, NONE, port) \
X(INT, NONE, protocol) \
X(INT, NONE, addressfamily) \
X(INT, NONE, close_on_exit) \
X(INT, NONE, warn_on_close) \
X(INT, NONE, protocol) /* PROT_SSH, PROT_TELNET etc */ \
X(INT, NONE, addressfamily) /* ADDRTYPE_IPV[46] or ADDRTYPE_UNSPEC */ \
X(INT, NONE, close_on_exit) /* FORCE_ON, FORCE_OFF, AUTO */ \
X(BOOL, NONE, warn_on_close) \
X(INT, NONE, ping_interval) /* in seconds */ \
X(INT, NONE, tcp_nodelay) \
X(INT, NONE, tcp_keepalives) \
X(BOOL, NONE, tcp_nodelay) \
X(BOOL, NONE, tcp_keepalives) \
X(STR, NONE, loghost) /* logical host being contacted, for host key check */ \
/* Proxy options */ \
X(STR, NONE, proxy_exclude_list) \
X(INT, NONE, proxy_dns) \
X(INT, NONE, even_proxy_localhost) \
X(INT, NONE, proxy_type) \
X(INT, NONE, proxy_dns) /* FORCE_ON, FORCE_OFF, AUTO */ \
X(BOOL, NONE, even_proxy_localhost) \
X(INT, NONE, proxy_type) /* PROXY_NONE, PROXY_SOCKS4, ... */ \
X(STR, NONE, proxy_host) \
X(INT, NONE, proxy_port) \
X(STR, NONE, proxy_username) \
X(STR, NONE, proxy_password) \
X(STR, NONE, proxy_telnet_command) \
X(INT, NONE, proxy_log_to_term) \
X(INT, NONE, proxy_log_to_term) /* FORCE_ON, FORCE_OFF, AUTO */ \
/* SSH options */ \
X(STR, NONE, remote_cmd) \
X(STR, NONE, remote_cmd2) /* fallback if remote_cmd fails; never loaded or saved */ \
X(INT, NONE, nopty) \
X(INT, NONE, compression) \
X(BOOL, NONE, nopty) \
X(BOOL, NONE, compression) \
X(INT, INT, ssh_kexlist) \
X(INT, INT, ssh_hklist) \
X(INT, NONE, ssh_rekey_time) /* in minutes */ \
X(STR, NONE, ssh_rekey_data) /* string encoding e.g. "100K", "2M", "1G" */ \
X(INT, NONE, tryagent) \
X(INT, NONE, agentfwd) \
X(INT, NONE, change_username) /* allow username switching in SSH-2 */ \
X(BOOL, NONE, tryagent) \
X(BOOL, NONE, agentfwd) \
X(BOOL, NONE, change_username) /* allow username switching in SSH-2 */ \
X(INT, INT, ssh_cipherlist) \
X(FILENAME, NONE, keyfile) \
/* \
@ -1202,20 +1202,20 @@ void cleanup_exit(int);
* downgrades PuTTY. So it's easier to use these numbers internally too. \
*/ \
X(INT, NONE, sshprot) \
X(INT, NONE, ssh2_des_cbc) /* "des-cbc" unrecommended SSH-2 cipher */ \
X(INT, NONE, ssh_no_userauth) /* bypass "ssh-userauth" (SSH-2 only) */ \
X(INT, NONE, ssh_show_banner) /* show USERAUTH_BANNERs (SSH-2 only) */ \
X(INT, NONE, try_tis_auth) \
X(INT, NONE, try_ki_auth) \
X(INT, NONE, try_gssapi_auth) /* attempt gssapi auth via ssh userauth */ \
X(INT, NONE, try_gssapi_kex) /* attempt gssapi auth via ssh kex */ \
X(INT, NONE, gssapifwd) /* forward tgt via gss */ \
X(BOOL, NONE, ssh2_des_cbc) /* "des-cbc" unrecommended SSH-2 cipher */ \
X(BOOL, NONE, ssh_no_userauth) /* bypass "ssh-userauth" (SSH-2 only) */ \
X(BOOL, NONE, ssh_show_banner) /* show USERAUTH_BANNERs (SSH-2 only) */ \
X(BOOL, NONE, try_tis_auth) \
X(BOOL, NONE, try_ki_auth) \
X(BOOL, NONE, try_gssapi_auth) /* attempt gssapi auth via ssh userauth */ \
X(BOOL, NONE, try_gssapi_kex) /* attempt gssapi auth via ssh kex */ \
X(BOOL, NONE, gssapifwd) /* forward tgt via gss */ \
X(INT, NONE, gssapirekey) /* KEXGSS refresh interval (mins) */ \
X(INT, INT, ssh_gsslist) /* preference order for local GSS libs */ \
X(FILENAME, NONE, ssh_gss_custom) \
X(INT, NONE, ssh_subsys) /* run a subsystem rather than a command */ \
X(INT, NONE, ssh_subsys2) /* fallback to go with remote_cmd_ptr2 */ \
X(INT, NONE, ssh_no_shell) /* avoid running a shell */ \
X(BOOL, NONE, ssh_subsys) /* run a subsystem rather than a command */ \
X(BOOL, NONE, ssh_subsys2) /* fallback to go with remote_cmd_ptr2 */ \
X(BOOL, NONE, ssh_no_shell) /* avoid running a shell */ \
X(STR, NONE, ssh_nc_host) /* host to connect to in `nc' mode */ \
X(INT, NONE, ssh_nc_port) /* port to connect to in `nc' mode */ \
/* Telnet options */ \
@ -1224,127 +1224,128 @@ void cleanup_exit(int);
X(STR, STR, ttymodes) /* values are "Vvalue" or "A" */ \
X(STR, STR, environmt) \
X(STR, NONE, username) \
X(INT, NONE, username_from_env) \
X(BOOL, NONE, username_from_env) \
X(STR, NONE, localusername) \
X(INT, NONE, rfc_environ) \
X(INT, NONE, passive_telnet) \
X(BOOL, NONE, rfc_environ) \
X(BOOL, NONE, passive_telnet) \
/* Serial port options */ \
X(STR, NONE, serline) \
X(INT, NONE, serspeed) \
X(INT, NONE, serdatabits) \
X(INT, NONE, serstopbits) \
X(INT, NONE, serparity) \
X(INT, NONE, serflow) \
X(INT, NONE, serparity) /* SER_PAR_NONE, SER_PAR_ODD, ... */ \
X(INT, NONE, serflow) /* SER_FLOW_NONE, SER_FLOW_XONXOFF, ... */ \
/* Keyboard options */ \
X(INT, NONE, bksp_is_delete) \
X(INT, NONE, rxvt_homeend) \
X(INT, NONE, funky_type) \
X(INT, NONE, no_applic_c) /* totally disable app cursor keys */ \
X(INT, NONE, no_applic_k) /* totally disable app keypad */ \
X(INT, NONE, no_mouse_rep) /* totally disable mouse reporting */ \
X(INT, NONE, no_remote_resize) /* disable remote resizing */ \
X(INT, NONE, no_alt_screen) /* disable alternate screen */ \
X(INT, NONE, no_remote_wintitle) /* disable remote retitling */ \
X(INT, NONE, no_remote_clearscroll) /* disable ESC[3J */ \
X(INT, NONE, no_dbackspace) /* disable destructive backspace */ \
X(INT, NONE, no_remote_charset) /* disable remote charset config */ \
X(INT, NONE, remote_qtitle_action) /* remote win title query action */ \
X(INT, NONE, app_cursor) \
X(INT, NONE, app_keypad) \
X(INT, NONE, nethack_keypad) \
X(INT, NONE, telnet_keyboard) \
X(INT, NONE, telnet_newline) \
X(INT, NONE, alt_f4) /* is it special? */ \
X(INT, NONE, alt_space) /* is it special? */ \
X(INT, NONE, alt_only) /* is it special? */ \
X(INT, NONE, localecho) \
X(INT, NONE, localedit) \
X(INT, NONE, alwaysontop) \
X(INT, NONE, fullscreenonaltenter) \
X(INT, NONE, scroll_on_key) \
X(INT, NONE, scroll_on_disp) \
X(INT, NONE, erase_to_scrollback) \
X(INT, NONE, compose_key) \
X(INT, NONE, ctrlaltkeys) \
X(INT, NONE, osx_option_meta) \
X(INT, NONE, osx_command_meta) \
X(BOOL, NONE, bksp_is_delete) \
X(BOOL, NONE, rxvt_homeend) \
X(INT, NONE, funky_type) /* FUNKY_XTERM, FUNKY_LINUX, ... */ \
X(BOOL, NONE, no_applic_c) /* totally disable app cursor keys */ \
X(BOOL, NONE, no_applic_k) /* totally disable app keypad */ \
X(BOOL, NONE, no_mouse_rep) /* totally disable mouse reporting */ \
X(BOOL, NONE, no_remote_resize) /* disable remote resizing */ \
X(BOOL, NONE, no_alt_screen) /* disable alternate screen */ \
X(BOOL, NONE, no_remote_wintitle) /* disable remote retitling */ \
X(BOOL, NONE, no_remote_clearscroll) /* disable ESC[3J */ \
X(BOOL, NONE, no_dbackspace) /* disable destructive backspace */ \
X(BOOL, NONE, no_remote_charset) /* disable remote charset config */ \
X(INT, NONE, remote_qtitle_action) /* remote win title query action
* (TITLE_NONE, TITLE_EMPTY, ...) */ \
X(BOOL, NONE, app_cursor) \
X(BOOL, NONE, app_keypad) \
X(BOOL, NONE, nethack_keypad) \
X(BOOL, NONE, telnet_keyboard) \
X(BOOL, NONE, telnet_newline) \
X(BOOL, NONE, alt_f4) /* is it special? */ \
X(BOOL, NONE, alt_space) /* is it special? */ \
X(BOOL, NONE, alt_only) /* is it special? */ \
X(INT, NONE, localecho) /* FORCE_ON, FORCE_OFF, AUTO */ \
X(INT, NONE, localedit) /* FORCE_ON, FORCE_OFF, AUTO */ \
X(BOOL, NONE, alwaysontop) \
X(BOOL, NONE, fullscreenonaltenter) \
X(BOOL, NONE, scroll_on_key) \
X(BOOL, NONE, scroll_on_disp) \
X(BOOL, NONE, erase_to_scrollback) \
X(BOOL, NONE, compose_key) \
X(BOOL, NONE, ctrlaltkeys) \
X(BOOL, NONE, osx_option_meta) \
X(BOOL, NONE, osx_command_meta) \
X(STR, NONE, wintitle) /* initial window title */ \
/* Terminal options */ \
X(INT, NONE, savelines) \
X(INT, NONE, dec_om) \
X(INT, NONE, wrap_mode) \
X(INT, NONE, lfhascr) \
X(BOOL, NONE, dec_om) \
X(BOOL, NONE, wrap_mode) \
X(BOOL, NONE, lfhascr) \
X(INT, NONE, cursor_type) /* 0=block 1=underline 2=vertical */ \
X(INT, NONE, blink_cur) \
X(INT, NONE, beep) \
X(INT, NONE, beep_ind) \
X(INT, NONE, bellovl) /* bell overload protection active? */ \
X(BOOL, NONE, blink_cur) \
X(INT, NONE, beep) /* BELL_DISABLED, BELL_DEFAULT, ... */ \
X(INT, NONE, beep_ind) /* B_IND_DISABLED, B_IND_FLASH, ... */ \
X(BOOL, NONE, bellovl) /* bell overload protection active? */ \
X(INT, NONE, bellovl_n) /* number of bells to cause overload */ \
X(INT, NONE, bellovl_t) /* time interval for overload (seconds) */ \
X(INT, NONE, bellovl_s) /* period of silence to re-enable bell (s) */ \
X(FILENAME, NONE, bell_wavefile) \
X(INT, NONE, scrollbar) \
X(INT, NONE, scrollbar_in_fullscreen) \
X(INT, NONE, resize_action) \
X(INT, NONE, bce) \
X(INT, NONE, blinktext) \
X(INT, NONE, win_name_always) \
X(BOOL, NONE, scrollbar) \
X(BOOL, NONE, scrollbar_in_fullscreen) \
X(INT, NONE, resize_action) /* RESIZE_TERM, RESIZE_DISABLED, ... */ \
X(BOOL, NONE, bce) \
X(BOOL, NONE, blinktext) \
X(BOOL, NONE, win_name_always) \
X(INT, NONE, width) \
X(INT, NONE, height) \
X(FONT, NONE, font) \
X(INT, NONE, font_quality) \
X(INT, NONE, font_quality) /* FQ_DEFAULT, FQ_ANTIALIASED, ... */ \
X(FILENAME, NONE, logfilename) \
X(INT, NONE, logtype) \
X(INT, NONE, logxfovr) \
X(INT, NONE, logflush) \
X(INT, NONE, logheader) \
X(INT, NONE, logomitpass) \
X(INT, NONE, logomitdata) \
X(INT, NONE, hide_mouseptr) \
X(INT, NONE, sunken_edge) \
X(INT, NONE, window_border) \
X(INT, NONE, logtype) /* LGTYP_NONE, LGTYPE_ASCII, ... */ \
X(INT, NONE, logxfovr) /* LGXF_OVR, LGXF_APN, LGXF_ASK */ \
X(BOOL, NONE, logflush) \
X(BOOL, NONE, logheader) \
X(BOOL, NONE, logomitpass) \
X(BOOL, NONE, logomitdata) \
X(BOOL, NONE, hide_mouseptr) \
X(BOOL, NONE, sunken_edge) \
X(INT, NONE, window_border) /* in pixels */ \
X(STR, NONE, answerback) \
X(STR, NONE, printer) \
X(INT, NONE, arabicshaping) \
X(INT, NONE, bidi) \
X(BOOL, NONE, arabicshaping) \
X(BOOL, NONE, bidi) \
/* Colour options */ \
X(INT, NONE, ansi_colour) \
X(INT, NONE, xterm_256_colour) \
X(INT, NONE, true_colour) \
X(INT, NONE, system_colour) \
X(INT, NONE, try_palette) \
X(INT, NONE, bold_style) \
X(BOOL, NONE, ansi_colour) \
X(BOOL, NONE, xterm_256_colour) \
X(BOOL, NONE, true_colour) \
X(BOOL, NONE, system_colour) \
X(BOOL, NONE, try_palette) \
X(INT, NONE, bold_style) /* 1=font 2=colour (3=both) */ \
X(INT, INT, colours) \
/* Selection options */ \
X(INT, NONE, mouse_is_xterm) \
X(INT, NONE, rect_select) \
X(INT, NONE, paste_controls) \
X(INT, NONE, rawcnp) \
X(INT, NONE, utf8linedraw) \
X(INT, NONE, rtf_paste) \
X(INT, NONE, mouse_override) \
X(INT, NONE, mouse_is_xterm) /* 0=compromise 1=xterm 2=Windows */ \
X(BOOL, NONE, rect_select) \
X(BOOL, NONE, paste_controls) \
X(BOOL, NONE, rawcnp) \
X(BOOL, NONE, utf8linedraw) \
X(BOOL, NONE, rtf_paste) \
X(BOOL, NONE, mouse_override) \
X(INT, INT, wordness) \
X(INT, NONE, mouseautocopy) \
X(INT, NONE, mousepaste) \
X(INT, NONE, ctrlshiftins) \
X(INT, NONE, ctrlshiftcv) \
X(BOOL, NONE, mouseautocopy) \
X(INT, NONE, mousepaste) /* CLIPUI_IMPLICIT, CLIPUI_EXPLICIT, ... */ \
X(INT, NONE, ctrlshiftins) /* CLIPUI_IMPLICIT, CLIPUI_EXPLICIT, ... */ \
X(INT, NONE, ctrlshiftcv) /* CLIPUI_IMPLICIT, CLIPUI_EXPLICIT, ... */ \
X(STR, NONE, mousepaste_custom) \
X(STR, NONE, ctrlshiftins_custom) \
X(STR, NONE, ctrlshiftcv_custom) \
/* translations */ \
X(INT, NONE, vtmode) \
X(INT, NONE, vtmode) /* VT_XWINDOWS, VT_OEMANSI, ... */ \
X(STR, NONE, line_codepage) \
X(INT, NONE, cjk_ambig_wide) \
X(INT, NONE, utf8_override) \
X(INT, NONE, xlat_capslockcyr) \
X(BOOL, NONE, cjk_ambig_wide) \
X(BOOL, NONE, utf8_override) \
X(BOOL, NONE, xlat_capslockcyr) \
/* X11 forwarding */ \
X(INT, NONE, x11_forward) \
X(BOOL, NONE, x11_forward) \
X(STR, NONE, x11_display) \
X(INT, NONE, x11_auth) \
X(INT, NONE, x11_auth) /* X11_NO_AUTH, X11_MIT, X11_XDM */ \
X(FILENAME, NONE, xauthfile) \
/* port forwarding */ \
X(INT, NONE, lport_acceptall) /* accept conns from hosts other than localhost */ \
X(INT, NONE, rport_acceptall) /* same for remote forwarded ports (SSH-2 only) */ \
X(BOOL, NONE, lport_acceptall) /* accept conns from hosts other than localhost */ \
X(BOOL, NONE, rport_acceptall) /* same for remote forwarded ports (SSH-2 only) */ \
/* \
* Subkeys for 'portfwd' can have the following forms: \
* \
@ -1356,7 +1357,7 @@ void cleanup_exit(int);
* should be of the form 'host:port'. \
*/ \
X(STR, STR, portfwd) \
/* SSH bug compatibility modes */ \
/* SSH bug compatibility modes. All FORCE_ON/FORCE_OFF/AUTO */ \
X(INT, NONE, sshbug_ignore1) \
X(INT, NONE, sshbug_plainpw1) \
X(INT, NONE, sshbug_rsa1) \
@ -1375,10 +1376,10 @@ void cleanup_exit(int);
* other than the main one, which means it can safely use a very \
* large window in SSH-2. \
*/ \
X(INT, NONE, ssh_simple) \
X(INT, NONE, ssh_connection_sharing) \
X(INT, NONE, ssh_connection_sharing_upstream) \
X(INT, NONE, ssh_connection_sharing_downstream) \
X(BOOL, NONE, ssh_simple) \
X(BOOL, NONE, ssh_connection_sharing) \
X(BOOL, NONE, ssh_connection_sharing_upstream) \
X(BOOL, NONE, ssh_connection_sharing_downstream) \
/*
* ssh_manual_hostkeys is conceptually a set rather than a
* dictionary: the string subkeys are the important thing, and the
@ -1386,15 +1387,15 @@ void cleanup_exit(int);
*/ \
X(STR, STR, ssh_manual_hostkeys) \
/* Options for pterm. Should split out into platform-dependent part. */ \
X(INT, NONE, stamp_utmp) \
X(INT, NONE, login_shell) \
X(INT, NONE, scrollbar_on_left) \
X(INT, NONE, shadowbold) \
X(BOOL, NONE, stamp_utmp) \
X(BOOL, NONE, login_shell) \
X(BOOL, NONE, scrollbar_on_left) \
X(BOOL, NONE, shadowbold) \
X(FONT, NONE, boldfont) \
X(FONT, NONE, widefont) \
X(FONT, NONE, wideboldfont) \
X(INT, NONE, shadowboldoffset) \
X(INT, NONE, crhaslf) \
X(INT, NONE, shadowboldoffset) /* in pixels */ \
X(BOOL, NONE, crhaslf) \
X(STR, NONE, winclass) \
/* Now define the actual enum of option keywords using that macro. */
@ -1494,6 +1495,7 @@ void registry_cleanup(void);
* transferred to the caller, and must be freed.
*/
char *platform_default_s(const char *name);
bool platform_default_b(const char *name, bool def);
int platform_default_i(const char *name, int def);
Filename *platform_default_filename(const char *name);
FontSpec *platform_default_fontspec(const char *name);

View File

@ -97,7 +97,7 @@ char *get_remote_username(Conf *conf)
char *username = conf_get_str(conf, CONF_username);
if (*username) {
return dupstr(username);
} else if (conf_get_int(conf, CONF_username_from_env)) {
} else if (conf_get_bool(conf, CONF_username_from_env)) {
/* Use local username. */
return get_username(); /* might still be NULL */
} else {
@ -147,6 +147,18 @@ static void gppfile(settings_r *sesskey, const char *name,
filename_free(result);
}
static bool gppb_raw(settings_r *sesskey, const char *name, bool def)
{
def = platform_default_b(name, def);
return sesskey ? read_setting_i(sesskey, name, def) != 0 : def;
}
static void gppb(settings_r *sesskey, const char *name, int def,
Conf *conf, conf_BOOL_NONE primary)
{
conf_set_bool(conf, primary, gppb_raw(sesskey, name, def));
}
static int gppi_raw(settings_r *sesskey, const char *name, int def)
{
def = platform_default_i(name, def);
@ -455,6 +467,11 @@ static void wprefs(settings_w *sesskey, const char *name,
sfree(buf);
}
static void write_setting_b(settings_w *handle, const char *key, bool value)
{
write_setting_i(handle, key, value ? 1 : 0);
}
static void write_clip_setting(settings_w *sesskey, const char *savekey,
Conf *conf, int confkey, int strconfkey)
{
@ -526,10 +543,10 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
write_setting_filename(sesskey, "LogFileName", conf_get_filename(conf, CONF_logfilename));
write_setting_i(sesskey, "LogType", conf_get_int(conf, CONF_logtype));
write_setting_i(sesskey, "LogFileClash", conf_get_int(conf, CONF_logxfovr));
write_setting_i(sesskey, "LogFlush", conf_get_int(conf, CONF_logflush));
write_setting_i(sesskey, "LogHeader", conf_get_int(conf, CONF_logheader));
write_setting_i(sesskey, "SSHLogOmitPasswords", conf_get_int(conf, CONF_logomitpass));
write_setting_i(sesskey, "SSHLogOmitData", conf_get_int(conf, CONF_logomitdata));
write_setting_b(sesskey, "LogFlush", conf_get_bool(conf, CONF_logflush));
write_setting_b(sesskey, "LogHeader", conf_get_bool(conf, CONF_logheader));
write_setting_b(sesskey, "SSHLogOmitPasswords", conf_get_bool(conf, CONF_logomitpass));
write_setting_b(sesskey, "SSHLogOmitData", conf_get_bool(conf, CONF_logomitdata));
p = "raw";
{
const struct BackendVtable *vt =
@ -542,11 +559,11 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
/* The CloseOnExit numbers are arranged in a different order from
* the standard FORCE_ON / FORCE_OFF / AUTO. */
write_setting_i(sesskey, "CloseOnExit", (conf_get_int(conf, CONF_close_on_exit)+2)%3);
write_setting_i(sesskey, "WarnOnClose", !!conf_get_int(conf, CONF_warn_on_close));
write_setting_b(sesskey, "WarnOnClose", !!conf_get_bool(conf, CONF_warn_on_close));
write_setting_i(sesskey, "PingInterval", conf_get_int(conf, CONF_ping_interval) / 60); /* minutes */
write_setting_i(sesskey, "PingIntervalSecs", conf_get_int(conf, CONF_ping_interval) % 60); /* seconds */
write_setting_i(sesskey, "TCPNoDelay", conf_get_int(conf, CONF_tcp_nodelay));
write_setting_i(sesskey, "TCPKeepalives", conf_get_int(conf, CONF_tcp_keepalives));
write_setting_b(sesskey, "TCPNoDelay", conf_get_bool(conf, CONF_tcp_nodelay));
write_setting_b(sesskey, "TCPKeepalives", conf_get_bool(conf, CONF_tcp_keepalives));
write_setting_s(sesskey, "TerminalType", conf_get_str(conf, CONF_termtype));
write_setting_s(sesskey, "TerminalSpeed", conf_get_str(conf, CONF_termspeed));
wmap(sesskey, "TerminalModes", conf, CONF_ttymodes, true);
@ -557,7 +574,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
/* proxy settings */
write_setting_s(sesskey, "ProxyExcludeList", conf_get_str(conf, CONF_proxy_exclude_list));
write_setting_i(sesskey, "ProxyDNS", (conf_get_int(conf, CONF_proxy_dns)+2)%3);
write_setting_i(sesskey, "ProxyLocalhost", conf_get_int(conf, CONF_even_proxy_localhost));
write_setting_b(sesskey, "ProxyLocalhost", conf_get_bool(conf, CONF_even_proxy_localhost));
write_setting_i(sesskey, "ProxyMethod", conf_get_int(conf, CONF_proxy_type));
write_setting_s(sesskey, "ProxyHost", conf_get_str(conf, CONF_proxy_host));
write_setting_i(sesskey, "ProxyPort", conf_get_int(conf, CONF_proxy_port));
@ -567,79 +584,79 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
write_setting_i(sesskey, "ProxyLogToTerm", conf_get_int(conf, CONF_proxy_log_to_term));
wmap(sesskey, "Environment", conf, CONF_environmt, true);
write_setting_s(sesskey, "UserName", conf_get_str(conf, CONF_username));
write_setting_i(sesskey, "UserNameFromEnvironment", conf_get_int(conf, CONF_username_from_env));
write_setting_b(sesskey, "UserNameFromEnvironment", conf_get_bool(conf, CONF_username_from_env));
write_setting_s(sesskey, "LocalUserName", conf_get_str(conf, CONF_localusername));
write_setting_i(sesskey, "NoPTY", conf_get_int(conf, CONF_nopty));
write_setting_i(sesskey, "Compression", conf_get_int(conf, CONF_compression));
write_setting_i(sesskey, "TryAgent", conf_get_int(conf, CONF_tryagent));
write_setting_i(sesskey, "AgentFwd", conf_get_int(conf, CONF_agentfwd));
write_setting_i(sesskey, "GssapiFwd", conf_get_int(conf, CONF_gssapifwd));
write_setting_i(sesskey, "ChangeUsername", conf_get_int(conf, CONF_change_username));
write_setting_b(sesskey, "NoPTY", conf_get_bool(conf, CONF_nopty));
write_setting_b(sesskey, "Compression", conf_get_bool(conf, CONF_compression));
write_setting_b(sesskey, "TryAgent", conf_get_bool(conf, CONF_tryagent));
write_setting_b(sesskey, "AgentFwd", conf_get_bool(conf, CONF_agentfwd));
write_setting_b(sesskey, "GssapiFwd", conf_get_bool(conf, CONF_gssapifwd));
write_setting_b(sesskey, "ChangeUsername", conf_get_bool(conf, CONF_change_username));
wprefs(sesskey, "Cipher", ciphernames, CIPHER_MAX, conf, CONF_ssh_cipherlist);
wprefs(sesskey, "KEX", kexnames, KEX_MAX, conf, CONF_ssh_kexlist);
wprefs(sesskey, "HostKey", hknames, HK_MAX, conf, CONF_ssh_hklist);
write_setting_i(sesskey, "RekeyTime", conf_get_int(conf, CONF_ssh_rekey_time));
write_setting_i(sesskey, "GssapiRekey", conf_get_int(conf, CONF_gssapirekey));
write_setting_s(sesskey, "RekeyBytes", conf_get_str(conf, CONF_ssh_rekey_data));
write_setting_i(sesskey, "SshNoAuth", conf_get_int(conf, CONF_ssh_no_userauth));
write_setting_i(sesskey, "SshBanner", conf_get_int(conf, CONF_ssh_show_banner));
write_setting_i(sesskey, "AuthTIS", conf_get_int(conf, CONF_try_tis_auth));
write_setting_i(sesskey, "AuthKI", conf_get_int(conf, CONF_try_ki_auth));
write_setting_i(sesskey, "AuthGSSAPI", conf_get_int(conf, CONF_try_gssapi_auth));
write_setting_i(sesskey, "AuthGSSAPIKEX", conf_get_int(conf, CONF_try_gssapi_kex));
write_setting_b(sesskey, "SshNoAuth", conf_get_bool(conf, CONF_ssh_no_userauth));
write_setting_b(sesskey, "SshBanner", conf_get_bool(conf, CONF_ssh_show_banner));
write_setting_b(sesskey, "AuthTIS", conf_get_bool(conf, CONF_try_tis_auth));
write_setting_b(sesskey, "AuthKI", conf_get_bool(conf, CONF_try_ki_auth));
write_setting_b(sesskey, "AuthGSSAPI", conf_get_bool(conf, CONF_try_gssapi_auth));
write_setting_b(sesskey, "AuthGSSAPIKEX", conf_get_bool(conf, CONF_try_gssapi_kex));
#ifndef NO_GSSAPI
wprefs(sesskey, "GSSLibs", gsslibkeywords, ngsslibs, conf, CONF_ssh_gsslist);
write_setting_filename(sesskey, "GSSCustom", conf_get_filename(conf, CONF_ssh_gss_custom));
#endif
write_setting_i(sesskey, "SshNoShell", conf_get_int(conf, CONF_ssh_no_shell));
write_setting_b(sesskey, "SshNoShell", conf_get_bool(conf, CONF_ssh_no_shell));
write_setting_i(sesskey, "SshProt", conf_get_int(conf, CONF_sshprot));
write_setting_s(sesskey, "LogHost", conf_get_str(conf, CONF_loghost));
write_setting_i(sesskey, "SSH2DES", conf_get_int(conf, CONF_ssh2_des_cbc));
write_setting_b(sesskey, "SSH2DES", conf_get_bool(conf, CONF_ssh2_des_cbc));
write_setting_filename(sesskey, "PublicKeyFile", conf_get_filename(conf, CONF_keyfile));
write_setting_s(sesskey, "RemoteCommand", conf_get_str(conf, CONF_remote_cmd));
write_setting_i(sesskey, "RFCEnviron", conf_get_int(conf, CONF_rfc_environ));
write_setting_i(sesskey, "PassiveTelnet", conf_get_int(conf, CONF_passive_telnet));
write_setting_i(sesskey, "BackspaceIsDelete", conf_get_int(conf, CONF_bksp_is_delete));
write_setting_i(sesskey, "RXVTHomeEnd", conf_get_int(conf, CONF_rxvt_homeend));
write_setting_b(sesskey, "RFCEnviron", conf_get_bool(conf, CONF_rfc_environ));
write_setting_b(sesskey, "PassiveTelnet", conf_get_bool(conf, CONF_passive_telnet));
write_setting_b(sesskey, "BackspaceIsDelete", conf_get_bool(conf, CONF_bksp_is_delete));
write_setting_b(sesskey, "RXVTHomeEnd", conf_get_bool(conf, CONF_rxvt_homeend));
write_setting_i(sesskey, "LinuxFunctionKeys", conf_get_int(conf, CONF_funky_type));
write_setting_i(sesskey, "NoApplicationKeys", conf_get_int(conf, CONF_no_applic_k));
write_setting_i(sesskey, "NoApplicationCursors", conf_get_int(conf, CONF_no_applic_c));
write_setting_i(sesskey, "NoMouseReporting", conf_get_int(conf, CONF_no_mouse_rep));
write_setting_i(sesskey, "NoRemoteResize", conf_get_int(conf, CONF_no_remote_resize));
write_setting_i(sesskey, "NoAltScreen", conf_get_int(conf, CONF_no_alt_screen));
write_setting_i(sesskey, "NoRemoteWinTitle", conf_get_int(conf, CONF_no_remote_wintitle));
write_setting_i(sesskey, "NoRemoteClearScroll", conf_get_int(conf, CONF_no_remote_clearscroll));
write_setting_b(sesskey, "NoApplicationKeys", conf_get_bool(conf, CONF_no_applic_k));
write_setting_b(sesskey, "NoApplicationCursors", conf_get_bool(conf, CONF_no_applic_c));
write_setting_b(sesskey, "NoMouseReporting", conf_get_bool(conf, CONF_no_mouse_rep));
write_setting_b(sesskey, "NoRemoteResize", conf_get_bool(conf, CONF_no_remote_resize));
write_setting_b(sesskey, "NoAltScreen", conf_get_bool(conf, CONF_no_alt_screen));
write_setting_b(sesskey, "NoRemoteWinTitle", conf_get_bool(conf, CONF_no_remote_wintitle));
write_setting_b(sesskey, "NoRemoteClearScroll", conf_get_bool(conf, CONF_no_remote_clearscroll));
write_setting_i(sesskey, "RemoteQTitleAction", conf_get_int(conf, CONF_remote_qtitle_action));
write_setting_i(sesskey, "NoDBackspace", conf_get_int(conf, CONF_no_dbackspace));
write_setting_i(sesskey, "NoRemoteCharset", conf_get_int(conf, CONF_no_remote_charset));
write_setting_i(sesskey, "ApplicationCursorKeys", conf_get_int(conf, CONF_app_cursor));
write_setting_i(sesskey, "ApplicationKeypad", conf_get_int(conf, CONF_app_keypad));
write_setting_i(sesskey, "NetHackKeypad", conf_get_int(conf, CONF_nethack_keypad));
write_setting_i(sesskey, "AltF4", conf_get_int(conf, CONF_alt_f4));
write_setting_i(sesskey, "AltSpace", conf_get_int(conf, CONF_alt_space));
write_setting_i(sesskey, "AltOnly", conf_get_int(conf, CONF_alt_only));
write_setting_i(sesskey, "ComposeKey", conf_get_int(conf, CONF_compose_key));
write_setting_i(sesskey, "CtrlAltKeys", conf_get_int(conf, CONF_ctrlaltkeys));
write_setting_b(sesskey, "NoDBackspace", conf_get_bool(conf, CONF_no_dbackspace));
write_setting_b(sesskey, "NoRemoteCharset", conf_get_bool(conf, CONF_no_remote_charset));
write_setting_b(sesskey, "ApplicationCursorKeys", conf_get_bool(conf, CONF_app_cursor));
write_setting_b(sesskey, "ApplicationKeypad", conf_get_bool(conf, CONF_app_keypad));
write_setting_b(sesskey, "NetHackKeypad", conf_get_bool(conf, CONF_nethack_keypad));
write_setting_b(sesskey, "AltF4", conf_get_bool(conf, CONF_alt_f4));
write_setting_b(sesskey, "AltSpace", conf_get_bool(conf, CONF_alt_space));
write_setting_b(sesskey, "AltOnly", conf_get_bool(conf, CONF_alt_only));
write_setting_b(sesskey, "ComposeKey", conf_get_bool(conf, CONF_compose_key));
write_setting_b(sesskey, "CtrlAltKeys", conf_get_bool(conf, CONF_ctrlaltkeys));
#ifdef OSX_META_KEY_CONFIG
write_setting_i(sesskey, "OSXOptionMeta", conf_get_int(conf, CONF_osx_option_meta));
write_setting_i(sesskey, "OSXCommandMeta", conf_get_int(conf, CONF_osx_command_meta));
write_setting_b(sesskey, "OSXOptionMeta", conf_get_bool(conf, CONF_osx_option_meta));
write_setting_b(sesskey, "OSXCommandMeta", conf_get_bool(conf, CONF_osx_command_meta));
#endif
write_setting_i(sesskey, "TelnetKey", conf_get_int(conf, CONF_telnet_keyboard));
write_setting_i(sesskey, "TelnetRet", conf_get_int(conf, CONF_telnet_newline));
write_setting_b(sesskey, "TelnetKey", conf_get_bool(conf, CONF_telnet_keyboard));
write_setting_b(sesskey, "TelnetRet", conf_get_bool(conf, CONF_telnet_newline));
write_setting_i(sesskey, "LocalEcho", conf_get_int(conf, CONF_localecho));
write_setting_i(sesskey, "LocalEdit", conf_get_int(conf, CONF_localedit));
write_setting_s(sesskey, "Answerback", conf_get_str(conf, CONF_answerback));
write_setting_i(sesskey, "AlwaysOnTop", conf_get_int(conf, CONF_alwaysontop));
write_setting_i(sesskey, "FullScreenOnAltEnter", conf_get_int(conf, CONF_fullscreenonaltenter));
write_setting_i(sesskey, "HideMousePtr", conf_get_int(conf, CONF_hide_mouseptr));
write_setting_i(sesskey, "SunkenEdge", conf_get_int(conf, CONF_sunken_edge));
write_setting_b(sesskey, "AlwaysOnTop", conf_get_bool(conf, CONF_alwaysontop));
write_setting_b(sesskey, "FullScreenOnAltEnter", conf_get_bool(conf, CONF_fullscreenonaltenter));
write_setting_b(sesskey, "HideMousePtr", conf_get_bool(conf, CONF_hide_mouseptr));
write_setting_b(sesskey, "SunkenEdge", conf_get_bool(conf, CONF_sunken_edge));
write_setting_i(sesskey, "WindowBorder", conf_get_int(conf, CONF_window_border));
write_setting_i(sesskey, "CurType", conf_get_int(conf, CONF_cursor_type));
write_setting_i(sesskey, "BlinkCur", conf_get_int(conf, CONF_blink_cur));
write_setting_b(sesskey, "BlinkCur", conf_get_bool(conf, CONF_blink_cur));
write_setting_i(sesskey, "Beep", conf_get_int(conf, CONF_beep));
write_setting_i(sesskey, "BeepInd", conf_get_int(conf, CONF_beep_ind));
write_setting_filename(sesskey, "BellWaveFile", conf_get_filename(conf, CONF_bell_wavefile));
write_setting_i(sesskey, "BellOverload", conf_get_int(conf, CONF_bellovl));
write_setting_b(sesskey, "BellOverload", conf_get_bool(conf, CONF_bellovl));
write_setting_i(sesskey, "BellOverloadN", conf_get_int(conf, CONF_bellovl_n));
write_setting_i(sesskey, "BellOverloadT", conf_get_int(conf, CONF_bellovl_t)
#ifdef PUTTY_UNIX_H
@ -652,24 +669,24 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
#endif
);
write_setting_i(sesskey, "ScrollbackLines", conf_get_int(conf, CONF_savelines));
write_setting_i(sesskey, "DECOriginMode", conf_get_int(conf, CONF_dec_om));
write_setting_i(sesskey, "AutoWrapMode", conf_get_int(conf, CONF_wrap_mode));
write_setting_i(sesskey, "LFImpliesCR", conf_get_int(conf, CONF_lfhascr));
write_setting_i(sesskey, "CRImpliesLF", conf_get_int(conf, CONF_crhaslf));
write_setting_i(sesskey, "DisableArabicShaping", conf_get_int(conf, CONF_arabicshaping));
write_setting_i(sesskey, "DisableBidi", conf_get_int(conf, CONF_bidi));
write_setting_i(sesskey, "WinNameAlways", conf_get_int(conf, CONF_win_name_always));
write_setting_b(sesskey, "DECOriginMode", conf_get_bool(conf, CONF_dec_om));
write_setting_b(sesskey, "AutoWrapMode", conf_get_bool(conf, CONF_wrap_mode));
write_setting_b(sesskey, "LFImpliesCR", conf_get_bool(conf, CONF_lfhascr));
write_setting_b(sesskey, "CRImpliesLF", conf_get_bool(conf, CONF_crhaslf));
write_setting_b(sesskey, "DisableArabicShaping", conf_get_bool(conf, CONF_arabicshaping));
write_setting_b(sesskey, "DisableBidi", conf_get_bool(conf, CONF_bidi));
write_setting_b(sesskey, "WinNameAlways", conf_get_bool(conf, CONF_win_name_always));
write_setting_s(sesskey, "WinTitle", conf_get_str(conf, CONF_wintitle));
write_setting_i(sesskey, "TermWidth", conf_get_int(conf, CONF_width));
write_setting_i(sesskey, "TermHeight", conf_get_int(conf, CONF_height));
write_setting_fontspec(sesskey, "Font", conf_get_fontspec(conf, CONF_font));
write_setting_i(sesskey, "FontQuality", conf_get_int(conf, CONF_font_quality));
write_setting_i(sesskey, "FontVTMode", conf_get_int(conf, CONF_vtmode));
write_setting_i(sesskey, "UseSystemColours", conf_get_int(conf, CONF_system_colour));
write_setting_i(sesskey, "TryPalette", conf_get_int(conf, CONF_try_palette));
write_setting_i(sesskey, "ANSIColour", conf_get_int(conf, CONF_ansi_colour));
write_setting_i(sesskey, "Xterm256Colour", conf_get_int(conf, CONF_xterm_256_colour));
write_setting_i(sesskey, "TrueColour", conf_get_int(conf, CONF_true_colour));
write_setting_b(sesskey, "UseSystemColours", conf_get_bool(conf, CONF_system_colour));
write_setting_b(sesskey, "TryPalette", conf_get_bool(conf, CONF_try_palette));
write_setting_b(sesskey, "ANSIColour", conf_get_bool(conf, CONF_ansi_colour));
write_setting_b(sesskey, "Xterm256Colour", conf_get_bool(conf, CONF_xterm_256_colour));
write_setting_b(sesskey, "TrueColour", conf_get_bool(conf, CONF_true_colour));
write_setting_i(sesskey, "BoldAsColour", conf_get_int(conf, CONF_bold_style)-1);
for (i = 0; i < 22; i++) {
@ -681,13 +698,13 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
conf_get_int_int(conf, CONF_colours, i*3+2));
write_setting_s(sesskey, buf, buf2);
}
write_setting_i(sesskey, "RawCNP", conf_get_int(conf, CONF_rawcnp));
write_setting_i(sesskey, "UTF8linedraw", conf_get_int(conf, CONF_utf8linedraw));
write_setting_i(sesskey, "PasteRTF", conf_get_int(conf, CONF_rtf_paste));
write_setting_b(sesskey, "RawCNP", conf_get_bool(conf, CONF_rawcnp));
write_setting_b(sesskey, "UTF8linedraw", conf_get_bool(conf, CONF_utf8linedraw));
write_setting_b(sesskey, "PasteRTF", conf_get_bool(conf, CONF_rtf_paste));
write_setting_i(sesskey, "MouseIsXterm", conf_get_int(conf, CONF_mouse_is_xterm));
write_setting_i(sesskey, "RectSelect", conf_get_int(conf, CONF_rect_select));
write_setting_i(sesskey, "PasteControls", conf_get_int(conf, CONF_paste_controls));
write_setting_i(sesskey, "MouseOverride", conf_get_int(conf, CONF_mouse_override));
write_setting_b(sesskey, "RectSelect", conf_get_bool(conf, CONF_rect_select));
write_setting_b(sesskey, "PasteControls", conf_get_bool(conf, CONF_paste_controls));
write_setting_b(sesskey, "MouseOverride", conf_get_bool(conf, CONF_mouse_override));
for (i = 0; i < 256; i += 32) {
char buf[20], buf2[256];
int j;
@ -700,8 +717,8 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
}
write_setting_s(sesskey, buf, buf2);
}
write_setting_i(sesskey, "MouseAutocopy",
conf_get_int(conf, CONF_mouseautocopy));
write_setting_b(sesskey, "MouseAutocopy",
conf_get_bool(conf, CONF_mouseautocopy));
write_clip_setting(sesskey, "MousePaste", conf,
CONF_mousepaste, CONF_mousepaste_custom);
write_clip_setting(sesskey, "CtrlShiftIns", conf,
@ -709,24 +726,24 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
write_clip_setting(sesskey, "CtrlShiftCV", conf,
CONF_ctrlshiftcv, CONF_ctrlshiftcv_custom);
write_setting_s(sesskey, "LineCodePage", conf_get_str(conf, CONF_line_codepage));
write_setting_i(sesskey, "CJKAmbigWide", conf_get_int(conf, CONF_cjk_ambig_wide));
write_setting_i(sesskey, "UTF8Override", conf_get_int(conf, CONF_utf8_override));
write_setting_b(sesskey, "CJKAmbigWide", conf_get_bool(conf, CONF_cjk_ambig_wide));
write_setting_b(sesskey, "UTF8Override", conf_get_bool(conf, CONF_utf8_override));
write_setting_s(sesskey, "Printer", conf_get_str(conf, CONF_printer));
write_setting_i(sesskey, "CapsLockCyr", conf_get_int(conf, CONF_xlat_capslockcyr));
write_setting_i(sesskey, "ScrollBar", conf_get_int(conf, CONF_scrollbar));
write_setting_i(sesskey, "ScrollBarFullScreen", conf_get_int(conf, CONF_scrollbar_in_fullscreen));
write_setting_i(sesskey, "ScrollOnKey", conf_get_int(conf, CONF_scroll_on_key));
write_setting_i(sesskey, "ScrollOnDisp", conf_get_int(conf, CONF_scroll_on_disp));
write_setting_i(sesskey, "EraseToScrollback", conf_get_int(conf, CONF_erase_to_scrollback));
write_setting_b(sesskey, "CapsLockCyr", conf_get_bool(conf, CONF_xlat_capslockcyr));
write_setting_b(sesskey, "ScrollBar", conf_get_bool(conf, CONF_scrollbar));
write_setting_b(sesskey, "ScrollBarFullScreen", conf_get_bool(conf, CONF_scrollbar_in_fullscreen));
write_setting_b(sesskey, "ScrollOnKey", conf_get_bool(conf, CONF_scroll_on_key));
write_setting_b(sesskey, "ScrollOnDisp", conf_get_bool(conf, CONF_scroll_on_disp));
write_setting_b(sesskey, "EraseToScrollback", conf_get_bool(conf, CONF_erase_to_scrollback));
write_setting_i(sesskey, "LockSize", conf_get_int(conf, CONF_resize_action));
write_setting_i(sesskey, "BCE", conf_get_int(conf, CONF_bce));
write_setting_i(sesskey, "BlinkText", conf_get_int(conf, CONF_blinktext));
write_setting_i(sesskey, "X11Forward", conf_get_int(conf, CONF_x11_forward));
write_setting_b(sesskey, "BCE", conf_get_bool(conf, CONF_bce));
write_setting_b(sesskey, "BlinkText", conf_get_bool(conf, CONF_blinktext));
write_setting_b(sesskey, "X11Forward", conf_get_bool(conf, CONF_x11_forward));
write_setting_s(sesskey, "X11Display", conf_get_str(conf, CONF_x11_display));
write_setting_i(sesskey, "X11AuthType", conf_get_int(conf, CONF_x11_auth));
write_setting_filename(sesskey, "X11AuthFile", conf_get_filename(conf, CONF_xauthfile));
write_setting_i(sesskey, "LocalPortAcceptAll", conf_get_int(conf, CONF_lport_acceptall));
write_setting_i(sesskey, "RemotePortAcceptAll", conf_get_int(conf, CONF_rport_acceptall));
write_setting_b(sesskey, "LocalPortAcceptAll", conf_get_bool(conf, CONF_lport_acceptall));
write_setting_b(sesskey, "RemotePortAcceptAll", conf_get_bool(conf, CONF_rport_acceptall));
wmap(sesskey, "PortForwardings", conf, CONF_portfwd, true);
write_setting_i(sesskey, "BugIgnore1", 2-conf_get_int(conf, CONF_sshbug_ignore1));
write_setting_i(sesskey, "BugPlainPW1", 2-conf_get_int(conf, CONF_sshbug_plainpw1));
@ -741,13 +758,13 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
write_setting_i(sesskey, "BugOldGex2", 2-conf_get_int(conf, CONF_sshbug_oldgex2));
write_setting_i(sesskey, "BugWinadj", 2-conf_get_int(conf, CONF_sshbug_winadj));
write_setting_i(sesskey, "BugChanReq", 2-conf_get_int(conf, CONF_sshbug_chanreq));
write_setting_i(sesskey, "StampUtmp", conf_get_int(conf, CONF_stamp_utmp));
write_setting_i(sesskey, "LoginShell", conf_get_int(conf, CONF_login_shell));
write_setting_i(sesskey, "ScrollbarOnLeft", conf_get_int(conf, CONF_scrollbar_on_left));
write_setting_b(sesskey, "StampUtmp", conf_get_bool(conf, CONF_stamp_utmp));
write_setting_b(sesskey, "LoginShell", conf_get_bool(conf, CONF_login_shell));
write_setting_b(sesskey, "ScrollbarOnLeft", conf_get_bool(conf, CONF_scrollbar_on_left));
write_setting_fontspec(sesskey, "BoldFont", conf_get_fontspec(conf, CONF_boldfont));
write_setting_fontspec(sesskey, "WideFont", conf_get_fontspec(conf, CONF_widefont));
write_setting_fontspec(sesskey, "WideBoldFont", conf_get_fontspec(conf, CONF_wideboldfont));
write_setting_i(sesskey, "ShadowBold", conf_get_int(conf, CONF_shadowbold));
write_setting_b(sesskey, "ShadowBold", conf_get_bool(conf, CONF_shadowbold));
write_setting_i(sesskey, "ShadowBoldOffset", conf_get_int(conf, CONF_shadowboldoffset));
write_setting_s(sesskey, "SerialLine", conf_get_str(conf, CONF_serline));
write_setting_i(sesskey, "SerialSpeed", conf_get_int(conf, CONF_serspeed));
@ -756,9 +773,9 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
write_setting_i(sesskey, "SerialParity", conf_get_int(conf, CONF_serparity));
write_setting_i(sesskey, "SerialFlowControl", conf_get_int(conf, CONF_serflow));
write_setting_s(sesskey, "WindowClass", conf_get_str(conf, CONF_winclass));
write_setting_i(sesskey, "ConnectionSharing", conf_get_int(conf, CONF_ssh_connection_sharing));
write_setting_i(sesskey, "ConnectionSharingUpstream", conf_get_int(conf, CONF_ssh_connection_sharing_upstream));
write_setting_i(sesskey, "ConnectionSharingDownstream", conf_get_int(conf, CONF_ssh_connection_sharing_downstream));
write_setting_b(sesskey, "ConnectionSharing", conf_get_bool(conf, CONF_ssh_connection_sharing));
write_setting_b(sesskey, "ConnectionSharingUpstream", conf_get_bool(conf, CONF_ssh_connection_sharing_upstream));
write_setting_b(sesskey, "ConnectionSharingDownstream", conf_get_bool(conf, CONF_ssh_connection_sharing_downstream));
wmap(sesskey, "SSHManualHostKeys", conf, CONF_ssh_manual_hostkeys, false);
}
@ -779,7 +796,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
int i;
char *prot;
conf_set_int(conf, CONF_ssh_subsys, 0); /* FIXME: load this properly */
conf_set_bool(conf, CONF_ssh_subsys, false); /* FIXME: load this properly */
conf_set_str(conf, CONF_remote_cmd, "");
conf_set_str(conf, CONF_remote_cmd2, "");
conf_set_str(conf, CONF_ssh_nc_host, "");
@ -788,10 +805,10 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
gppfile(sesskey, "LogFileName", conf, CONF_logfilename);
gppi(sesskey, "LogType", 0, conf, CONF_logtype);
gppi(sesskey, "LogFileClash", LGXF_ASK, conf, CONF_logxfovr);
gppi(sesskey, "LogFlush", 1, conf, CONF_logflush);
gppi(sesskey, "LogHeader", 1, conf, CONF_logheader);
gppi(sesskey, "SSHLogOmitPasswords", 1, conf, CONF_logomitpass);
gppi(sesskey, "SSHLogOmitData", 0, conf, CONF_logomitdata);
gppb(sesskey, "LogFlush", 1, conf, CONF_logflush);
gppb(sesskey, "LogHeader", 1, conf, CONF_logheader);
gppb(sesskey, "SSHLogOmitPasswords", 1, conf, CONF_logomitpass);
gppb(sesskey, "SSHLogOmitData", 0, conf, CONF_logomitdata);
prot = gpps_raw(sesskey, "Protocol", "default");
conf_set_int(conf, CONF_protocol, default_protocol);
@ -811,7 +828,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
/* The CloseOnExit numbers are arranged in a different order from
* the standard FORCE_ON / FORCE_OFF / AUTO. */
i = gppi_raw(sesskey, "CloseOnExit", 1); conf_set_int(conf, CONF_close_on_exit, (i+1)%3);
gppi(sesskey, "WarnOnClose", 1, conf, CONF_warn_on_close);
gppb(sesskey, "WarnOnClose", 1, conf, CONF_warn_on_close);
{
/* This is two values for backward compatibility with 0.50/0.51 */
int pingmin, pingsec;
@ -819,8 +836,8 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
pingsec = gppi_raw(sesskey, "PingIntervalSecs", 0);
conf_set_int(conf, CONF_ping_interval, pingmin * 60 + pingsec);
}
gppi(sesskey, "TCPNoDelay", 1, conf, CONF_tcp_nodelay);
gppi(sesskey, "TCPKeepalives", 0, conf, CONF_tcp_keepalives);
gppb(sesskey, "TCPNoDelay", 1, conf, CONF_tcp_nodelay);
gppb(sesskey, "TCPKeepalives", 0, conf, CONF_tcp_keepalives);
gpps(sesskey, "TerminalType", "xterm", conf, CONF_termtype);
gpps(sesskey, "TerminalSpeed", "38400,38400", conf, CONF_termspeed);
if (gppmap(sesskey, "TerminalModes", conf, CONF_ttymodes)) {
@ -877,7 +894,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
/* proxy settings */
gpps(sesskey, "ProxyExcludeList", "", conf, CONF_proxy_exclude_list);
i = gppi_raw(sesskey, "ProxyDNS", 1); conf_set_int(conf, CONF_proxy_dns, (i+1)%3);
gppi(sesskey, "ProxyLocalhost", 0, conf, CONF_even_proxy_localhost);
gppb(sesskey, "ProxyLocalhost", 0, conf, CONF_even_proxy_localhost);
gppi(sesskey, "ProxyMethod", -1, conf, CONF_proxy_type);
if (conf_get_int(conf, CONF_proxy_type) == -1) {
int i;
@ -907,14 +924,14 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
gppi(sesskey, "ProxyLogToTerm", FORCE_OFF, conf, CONF_proxy_log_to_term);
gppmap(sesskey, "Environment", conf, CONF_environmt);
gpps(sesskey, "UserName", "", conf, CONF_username);
gppi(sesskey, "UserNameFromEnvironment", 0, conf, CONF_username_from_env);
gppb(sesskey, "UserNameFromEnvironment", 0, conf, CONF_username_from_env);
gpps(sesskey, "LocalUserName", "", conf, CONF_localusername);
gppi(sesskey, "NoPTY", 0, conf, CONF_nopty);
gppi(sesskey, "Compression", 0, conf, CONF_compression);
gppi(sesskey, "TryAgent", 1, conf, CONF_tryagent);
gppi(sesskey, "AgentFwd", 0, conf, CONF_agentfwd);
gppi(sesskey, "ChangeUsername", 0, conf, CONF_change_username);
gppi(sesskey, "GssapiFwd", 0, conf, CONF_gssapifwd);
gppb(sesskey, "NoPTY", 0, conf, CONF_nopty);
gppb(sesskey, "Compression", 0, conf, CONF_compression);
gppb(sesskey, "TryAgent", 1, conf, CONF_tryagent);
gppb(sesskey, "AgentFwd", 0, conf, CONF_agentfwd);
gppb(sesskey, "ChangeUsername", 0, conf, CONF_change_username);
gppb(sesskey, "GssapiFwd", 0, conf, CONF_gssapifwd);
gprefs(sesskey, "Cipher", "\0",
ciphernames, CIPHER_MAX, conf, CONF_ssh_cipherlist);
{
@ -979,33 +996,33 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
conf_set_int(conf, CONF_sshprot, sshprot);
}
gpps(sesskey, "LogHost", "", conf, CONF_loghost);
gppi(sesskey, "SSH2DES", 0, conf, CONF_ssh2_des_cbc);
gppi(sesskey, "SshNoAuth", 0, conf, CONF_ssh_no_userauth);
gppi(sesskey, "SshBanner", 1, conf, CONF_ssh_show_banner);
gppi(sesskey, "AuthTIS", 0, conf, CONF_try_tis_auth);
gppi(sesskey, "AuthKI", 1, conf, CONF_try_ki_auth);
gppi(sesskey, "AuthGSSAPI", 1, conf, CONF_try_gssapi_auth);
gppi(sesskey, "AuthGSSAPIKEX", 1, conf, CONF_try_gssapi_kex);
gppb(sesskey, "SSH2DES", 0, conf, CONF_ssh2_des_cbc);
gppb(sesskey, "SshNoAuth", 0, conf, CONF_ssh_no_userauth);
gppb(sesskey, "SshBanner", 1, conf, CONF_ssh_show_banner);
gppb(sesskey, "AuthTIS", 0, conf, CONF_try_tis_auth);
gppb(sesskey, "AuthKI", 1, conf, CONF_try_ki_auth);
gppb(sesskey, "AuthGSSAPI", 1, conf, CONF_try_gssapi_auth);
gppb(sesskey, "AuthGSSAPIKEX", 1, conf, CONF_try_gssapi_kex);
#ifndef NO_GSSAPI
gprefs(sesskey, "GSSLibs", "\0",
gsslibkeywords, ngsslibs, conf, CONF_ssh_gsslist);
gppfile(sesskey, "GSSCustom", conf, CONF_ssh_gss_custom);
#endif
gppi(sesskey, "SshNoShell", 0, conf, CONF_ssh_no_shell);
gppb(sesskey, "SshNoShell", 0, conf, CONF_ssh_no_shell);
gppfile(sesskey, "PublicKeyFile", conf, CONF_keyfile);
gpps(sesskey, "RemoteCommand", "", conf, CONF_remote_cmd);
gppi(sesskey, "RFCEnviron", 0, conf, CONF_rfc_environ);
gppi(sesskey, "PassiveTelnet", 0, conf, CONF_passive_telnet);
gppi(sesskey, "BackspaceIsDelete", 1, conf, CONF_bksp_is_delete);
gppi(sesskey, "RXVTHomeEnd", 0, conf, CONF_rxvt_homeend);
gppb(sesskey, "RFCEnviron", 0, conf, CONF_rfc_environ);
gppb(sesskey, "PassiveTelnet", 0, conf, CONF_passive_telnet);
gppb(sesskey, "BackspaceIsDelete", 1, conf, CONF_bksp_is_delete);
gppb(sesskey, "RXVTHomeEnd", 0, conf, CONF_rxvt_homeend);
gppi(sesskey, "LinuxFunctionKeys", 0, conf, CONF_funky_type);
gppi(sesskey, "NoApplicationKeys", 0, conf, CONF_no_applic_k);
gppi(sesskey, "NoApplicationCursors", 0, conf, CONF_no_applic_c);
gppi(sesskey, "NoMouseReporting", 0, conf, CONF_no_mouse_rep);
gppi(sesskey, "NoRemoteResize", 0, conf, CONF_no_remote_resize);
gppi(sesskey, "NoAltScreen", 0, conf, CONF_no_alt_screen);
gppi(sesskey, "NoRemoteWinTitle", 0, conf, CONF_no_remote_wintitle);
gppi(sesskey, "NoRemoteClearScroll", 0, conf, CONF_no_remote_clearscroll);
gppb(sesskey, "NoApplicationKeys", 0, conf, CONF_no_applic_k);
gppb(sesskey, "NoApplicationCursors", 0, conf, CONF_no_applic_c);
gppb(sesskey, "NoMouseReporting", 0, conf, CONF_no_mouse_rep);
gppb(sesskey, "NoRemoteResize", 0, conf, CONF_no_remote_resize);
gppb(sesskey, "NoAltScreen", 0, conf, CONF_no_alt_screen);
gppb(sesskey, "NoRemoteWinTitle", 0, conf, CONF_no_remote_wintitle);
gppb(sesskey, "NoRemoteClearScroll", 0, conf, CONF_no_remote_clearscroll);
{
/* Backward compatibility */
int no_remote_qtitle = gppi_raw(sesskey, "NoRemoteQTitle", 1);
@ -1016,37 +1033,37 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
no_remote_qtitle ? TITLE_EMPTY : TITLE_REAL,
conf, CONF_remote_qtitle_action);
}
gppi(sesskey, "NoDBackspace", 0, conf, CONF_no_dbackspace);
gppi(sesskey, "NoRemoteCharset", 0, conf, CONF_no_remote_charset);
gppi(sesskey, "ApplicationCursorKeys", 0, conf, CONF_app_cursor);
gppi(sesskey, "ApplicationKeypad", 0, conf, CONF_app_keypad);
gppi(sesskey, "NetHackKeypad", 0, conf, CONF_nethack_keypad);
gppi(sesskey, "AltF4", 1, conf, CONF_alt_f4);
gppi(sesskey, "AltSpace", 0, conf, CONF_alt_space);
gppi(sesskey, "AltOnly", 0, conf, CONF_alt_only);
gppi(sesskey, "ComposeKey", 0, conf, CONF_compose_key);
gppi(sesskey, "CtrlAltKeys", 1, conf, CONF_ctrlaltkeys);
gppb(sesskey, "NoDBackspace", 0, conf, CONF_no_dbackspace);
gppb(sesskey, "NoRemoteCharset", 0, conf, CONF_no_remote_charset);
gppb(sesskey, "ApplicationCursorKeys", 0, conf, CONF_app_cursor);
gppb(sesskey, "ApplicationKeypad", 0, conf, CONF_app_keypad);
gppb(sesskey, "NetHackKeypad", 0, conf, CONF_nethack_keypad);
gppb(sesskey, "AltF4", 1, conf, CONF_alt_f4);
gppb(sesskey, "AltSpace", 0, conf, CONF_alt_space);
gppb(sesskey, "AltOnly", 0, conf, CONF_alt_only);
gppb(sesskey, "ComposeKey", 0, conf, CONF_compose_key);
gppb(sesskey, "CtrlAltKeys", 1, conf, CONF_ctrlaltkeys);
#ifdef OSX_META_KEY_CONFIG
gppi(sesskey, "OSXOptionMeta", 1, conf, CONF_osx_option_meta);
gppi(sesskey, "OSXCommandMeta", 0, conf, CONF_osx_command_meta);
gppb(sesskey, "OSXOptionMeta", 1, conf, CONF_osx_option_meta);
gppb(sesskey, "OSXCommandMeta", 0, conf, CONF_osx_command_meta);
#endif
gppi(sesskey, "TelnetKey", 0, conf, CONF_telnet_keyboard);
gppi(sesskey, "TelnetRet", 1, conf, CONF_telnet_newline);
gppb(sesskey, "TelnetKey", 0, conf, CONF_telnet_keyboard);
gppb(sesskey, "TelnetRet", 1, conf, CONF_telnet_newline);
gppi(sesskey, "LocalEcho", AUTO, conf, CONF_localecho);
gppi(sesskey, "LocalEdit", AUTO, conf, CONF_localedit);
gpps(sesskey, "Answerback", "PuTTY", conf, CONF_answerback);
gppi(sesskey, "AlwaysOnTop", 0, conf, CONF_alwaysontop);
gppi(sesskey, "FullScreenOnAltEnter", 0, conf, CONF_fullscreenonaltenter);
gppi(sesskey, "HideMousePtr", 0, conf, CONF_hide_mouseptr);
gppi(sesskey, "SunkenEdge", 0, conf, CONF_sunken_edge);
gppb(sesskey, "AlwaysOnTop", 0, conf, CONF_alwaysontop);
gppb(sesskey, "FullScreenOnAltEnter", 0, conf, CONF_fullscreenonaltenter);
gppb(sesskey, "HideMousePtr", 0, conf, CONF_hide_mouseptr);
gppb(sesskey, "SunkenEdge", 0, conf, CONF_sunken_edge);
gppi(sesskey, "WindowBorder", 1, conf, CONF_window_border);
gppi(sesskey, "CurType", 0, conf, CONF_cursor_type);
gppi(sesskey, "BlinkCur", 0, conf, CONF_blink_cur);
gppb(sesskey, "BlinkCur", 0, conf, CONF_blink_cur);
/* pedantic compiler tells me I can't use conf, CONF_beep as an int * :-) */
gppi(sesskey, "Beep", 1, conf, CONF_beep);
gppi(sesskey, "BeepInd", 0, conf, CONF_beep_ind);
gppfile(sesskey, "BellWaveFile", conf, CONF_bell_wavefile);
gppi(sesskey, "BellOverload", 1, conf, CONF_bellovl);
gppb(sesskey, "BellOverload", 1, conf, CONF_bellovl);
gppi(sesskey, "BellOverloadN", 5, conf, CONF_bellovl_n);
i = gppi_raw(sesskey, "BellOverloadT", 2*TICKSPERSEC
#ifdef PUTTY_UNIX_H
@ -1069,24 +1086,24 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
#endif
);
gppi(sesskey, "ScrollbackLines", 2000, conf, CONF_savelines);
gppi(sesskey, "DECOriginMode", 0, conf, CONF_dec_om);
gppi(sesskey, "AutoWrapMode", 1, conf, CONF_wrap_mode);
gppi(sesskey, "LFImpliesCR", 0, conf, CONF_lfhascr);
gppi(sesskey, "CRImpliesLF", 0, conf, CONF_crhaslf);
gppi(sesskey, "DisableArabicShaping", 0, conf, CONF_arabicshaping);
gppi(sesskey, "DisableBidi", 0, conf, CONF_bidi);
gppi(sesskey, "WinNameAlways", 1, conf, CONF_win_name_always);
gppb(sesskey, "DECOriginMode", 0, conf, CONF_dec_om);
gppb(sesskey, "AutoWrapMode", 1, conf, CONF_wrap_mode);
gppb(sesskey, "LFImpliesCR", 0, conf, CONF_lfhascr);
gppb(sesskey, "CRImpliesLF", 0, conf, CONF_crhaslf);
gppb(sesskey, "DisableArabicShaping", 0, conf, CONF_arabicshaping);
gppb(sesskey, "DisableBidi", 0, conf, CONF_bidi);
gppb(sesskey, "WinNameAlways", 1, conf, CONF_win_name_always);
gpps(sesskey, "WinTitle", "", conf, CONF_wintitle);
gppi(sesskey, "TermWidth", 80, conf, CONF_width);
gppi(sesskey, "TermHeight", 24, conf, CONF_height);
gppfont(sesskey, "Font", conf, CONF_font);
gppi(sesskey, "FontQuality", FQ_DEFAULT, conf, CONF_font_quality);
gppi(sesskey, "FontVTMode", VT_UNICODE, conf, CONF_vtmode);
gppi(sesskey, "UseSystemColours", 0, conf, CONF_system_colour);
gppi(sesskey, "TryPalette", 0, conf, CONF_try_palette);
gppi(sesskey, "ANSIColour", 1, conf, CONF_ansi_colour);
gppi(sesskey, "Xterm256Colour", 1, conf, CONF_xterm_256_colour);
gppi(sesskey, "TrueColour", 1, conf, CONF_true_colour);
gppb(sesskey, "UseSystemColours", 0, conf, CONF_system_colour);
gppb(sesskey, "TryPalette", 0, conf, CONF_try_palette);
gppb(sesskey, "ANSIColour", 1, conf, CONF_ansi_colour);
gppb(sesskey, "Xterm256Colour", 1, conf, CONF_xterm_256_colour);
gppb(sesskey, "TrueColour", 1, conf, CONF_true_colour);
i = gppi_raw(sesskey, "BoldAsColour", 1); conf_set_int(conf, CONF_bold_style, i+1);
for (i = 0; i < 22; i++) {
@ -1108,13 +1125,13 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
}
sfree(buf2);
}
gppi(sesskey, "RawCNP", 0, conf, CONF_rawcnp);
gppi(sesskey, "UTF8linedraw", 0, conf, CONF_utf8linedraw);
gppi(sesskey, "PasteRTF", 0, conf, CONF_rtf_paste);
gppb(sesskey, "RawCNP", 0, conf, CONF_rawcnp);
gppb(sesskey, "UTF8linedraw", 0, conf, CONF_utf8linedraw);
gppb(sesskey, "PasteRTF", 0, conf, CONF_rtf_paste);
gppi(sesskey, "MouseIsXterm", 0, conf, CONF_mouse_is_xterm);
gppi(sesskey, "RectSelect", 0, conf, CONF_rect_select);
gppi(sesskey, "PasteControls", 0, conf, CONF_paste_controls);
gppi(sesskey, "MouseOverride", 1, conf, CONF_mouse_override);
gppb(sesskey, "RectSelect", 0, conf, CONF_rect_select);
gppb(sesskey, "PasteControls", 0, conf, CONF_paste_controls);
gppb(sesskey, "MouseOverride", 1, conf, CONF_mouse_override);
for (i = 0; i < 256; i += 32) {
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",
@ -1141,7 +1158,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
}
sfree(buf2);
}
gppi(sesskey, "MouseAutocopy", CLIPUI_DEFAULT_AUTOCOPY,
gppb(sesskey, "MouseAutocopy", CLIPUI_DEFAULT_AUTOCOPY,
conf, CONF_mouseautocopy);
read_clip_setting(sesskey, "MousePaste", CLIPUI_DEFAULT_MOUSE,
conf, CONF_mousepaste, CONF_mousepaste_custom);
@ -1154,25 +1171,25 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
* into a plausible default for the locale.
*/
gpps(sesskey, "LineCodePage", "", conf, CONF_line_codepage);
gppi(sesskey, "CJKAmbigWide", 0, conf, CONF_cjk_ambig_wide);
gppi(sesskey, "UTF8Override", 1, conf, CONF_utf8_override);
gppb(sesskey, "CJKAmbigWide", 0, conf, CONF_cjk_ambig_wide);
gppb(sesskey, "UTF8Override", 1, conf, CONF_utf8_override);
gpps(sesskey, "Printer", "", conf, CONF_printer);
gppi(sesskey, "CapsLockCyr", 0, conf, CONF_xlat_capslockcyr);
gppi(sesskey, "ScrollBar", 1, conf, CONF_scrollbar);
gppi(sesskey, "ScrollBarFullScreen", 0, conf, CONF_scrollbar_in_fullscreen);
gppi(sesskey, "ScrollOnKey", 0, conf, CONF_scroll_on_key);
gppi(sesskey, "ScrollOnDisp", 1, conf, CONF_scroll_on_disp);
gppi(sesskey, "EraseToScrollback", 1, conf, CONF_erase_to_scrollback);
gppb(sesskey, "CapsLockCyr", 0, conf, CONF_xlat_capslockcyr);
gppb(sesskey, "ScrollBar", 1, conf, CONF_scrollbar);
gppb(sesskey, "ScrollBarFullScreen", 0, conf, CONF_scrollbar_in_fullscreen);
gppb(sesskey, "ScrollOnKey", 0, conf, CONF_scroll_on_key);
gppb(sesskey, "ScrollOnDisp", 1, conf, CONF_scroll_on_disp);
gppb(sesskey, "EraseToScrollback", 1, conf, CONF_erase_to_scrollback);
gppi(sesskey, "LockSize", 0, conf, CONF_resize_action);
gppi(sesskey, "BCE", 1, conf, CONF_bce);
gppi(sesskey, "BlinkText", 0, conf, CONF_blinktext);
gppi(sesskey, "X11Forward", 0, conf, CONF_x11_forward);
gppb(sesskey, "BCE", 1, conf, CONF_bce);
gppb(sesskey, "BlinkText", 0, conf, CONF_blinktext);
gppb(sesskey, "X11Forward", 0, conf, CONF_x11_forward);
gpps(sesskey, "X11Display", "", conf, CONF_x11_display);
gppi(sesskey, "X11AuthType", X11_MIT, conf, CONF_x11_auth);
gppfile(sesskey, "X11AuthFile", conf, CONF_xauthfile);
gppi(sesskey, "LocalPortAcceptAll", 0, conf, CONF_lport_acceptall);
gppi(sesskey, "RemotePortAcceptAll", 0, conf, CONF_rport_acceptall);
gppb(sesskey, "LocalPortAcceptAll", 0, conf, CONF_lport_acceptall);
gppb(sesskey, "RemotePortAcceptAll", 0, conf, CONF_rport_acceptall);
gppmap(sesskey, "PortForwardings", conf, CONF_portfwd);
i = gppi_raw(sesskey, "BugIgnore1", 0); conf_set_int(conf, CONF_sshbug_ignore1, 2-i);
i = gppi_raw(sesskey, "BugPlainPW1", 0); conf_set_int(conf, CONF_sshbug_plainpw1, 2-i);
@ -1195,11 +1212,11 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
i = gppi_raw(sesskey, "BugOldGex2", 0); conf_set_int(conf, CONF_sshbug_oldgex2, 2-i);
i = gppi_raw(sesskey, "BugWinadj", 0); conf_set_int(conf, CONF_sshbug_winadj, 2-i);
i = gppi_raw(sesskey, "BugChanReq", 0); conf_set_int(conf, CONF_sshbug_chanreq, 2-i);
conf_set_int(conf, CONF_ssh_simple, false);
gppi(sesskey, "StampUtmp", 1, conf, CONF_stamp_utmp);
gppi(sesskey, "LoginShell", 1, conf, CONF_login_shell);
gppi(sesskey, "ScrollbarOnLeft", 0, conf, CONF_scrollbar_on_left);
gppi(sesskey, "ShadowBold", 0, conf, CONF_shadowbold);
conf_set_bool(conf, CONF_ssh_simple, false);
gppb(sesskey, "StampUtmp", 1, conf, CONF_stamp_utmp);
gppb(sesskey, "LoginShell", 1, conf, CONF_login_shell);
gppb(sesskey, "ScrollbarOnLeft", 0, conf, CONF_scrollbar_on_left);
gppb(sesskey, "ShadowBold", 0, conf, CONF_shadowbold);
gppfont(sesskey, "BoldFont", conf, CONF_boldfont);
gppfont(sesskey, "WideFont", conf, CONF_widefont);
gppfont(sesskey, "WideBoldFont", conf, CONF_wideboldfont);
@ -1211,9 +1228,9 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
gppi(sesskey, "SerialParity", SER_PAR_NONE, conf, CONF_serparity);
gppi(sesskey, "SerialFlowControl", SER_FLOW_XONXOFF, conf, CONF_serflow);
gpps(sesskey, "WindowClass", "", conf, CONF_winclass);
gppi(sesskey, "ConnectionSharing", 0, conf, CONF_ssh_connection_sharing);
gppi(sesskey, "ConnectionSharingUpstream", 1, conf, CONF_ssh_connection_sharing_upstream);
gppi(sesskey, "ConnectionSharingDownstream", 1, conf, CONF_ssh_connection_sharing_downstream);
gppb(sesskey, "ConnectionSharing", 0, conf, CONF_ssh_connection_sharing);
gppb(sesskey, "ConnectionSharingUpstream", 1, conf, CONF_ssh_connection_sharing_upstream);
gppb(sesskey, "ConnectionSharingDownstream", 1, conf, CONF_ssh_connection_sharing_downstream);
gppmap(sesskey, "SSHManualHostKeys", conf, CONF_ssh_manual_hostkeys);
}

22
ssh.c
View File

@ -177,8 +177,8 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv,
* ourselves), since then the assumption that we have only
* one channel to worry about is not true after all.
*/
int is_simple =
(conf_get_int(ssh->conf, CONF_ssh_simple) && !ssh->connshare);
bool is_simple =
(conf_get_bool(ssh->conf, CONF_ssh_simple) && !ssh->connshare);
ssh->bpp = ssh2_bpp_new(ssh->logctx, &ssh->stats, false);
ssh_connect_bpp(ssh);
@ -218,7 +218,7 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv,
ssh_verstring_get_remote(old_bpp), &ssh->cl);
ssh_connect_ppl(ssh, connection_layer);
if (conf_get_int(ssh->conf, CONF_ssh_no_userauth)) {
if (conf_get_bool(ssh->conf, CONF_ssh_no_userauth)) {
userauth_layer = NULL;
transport_child_layer = connection_layer;
} else {
@ -227,12 +227,12 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv,
userauth_layer = ssh2_userauth_new(
connection_layer, ssh->savedhost, ssh->fullhostname,
conf_get_filename(ssh->conf, CONF_keyfile),
conf_get_int(ssh->conf, CONF_tryagent), username,
conf_get_int(ssh->conf, CONF_change_username),
conf_get_int(ssh->conf, CONF_try_ki_auth),
conf_get_int(ssh->conf, CONF_try_gssapi_auth),
conf_get_int(ssh->conf, CONF_try_gssapi_kex),
conf_get_int(ssh->conf, CONF_gssapifwd),
conf_get_bool(ssh->conf, CONF_tryagent), username,
conf_get_bool(ssh->conf, CONF_change_username),
conf_get_bool(ssh->conf, CONF_try_ki_auth),
conf_get_bool(ssh->conf, CONF_try_gssapi_auth),
conf_get_bool(ssh->conf, CONF_try_gssapi_kex),
conf_get_bool(ssh->conf, CONF_gssapifwd),
&ssh->gss_state);
ssh_connect_ppl(ssh, userauth_layer);
transport_child_layer = userauth_layer;
@ -781,8 +781,8 @@ static void ssh_throttle_all(Ssh *ssh, int enable, int bufsize)
static void ssh_cache_conf_values(Ssh *ssh)
{
ssh->pls.omit_passwords = conf_get_int(ssh->conf, CONF_logomitpass);
ssh->pls.omit_data = conf_get_int(ssh->conf, CONF_logomitdata);
ssh->pls.omit_passwords = conf_get_bool(ssh->conf, CONF_logomitpass);
ssh->pls.omit_data = conf_get_bool(ssh->conf, CONF_logomitdata);
}
/*

View File

@ -663,7 +663,7 @@ static int ssh1_agent_forwarding_permitted(ConnectionLayer *cl)
{
struct ssh1_connection_state *s =
container_of(cl, struct ssh1_connection_state, cl);
return conf_get_int(s->conf, CONF_agentfwd) && agent_exists();
return conf_get_bool(s->conf, CONF_agentfwd) && agent_exists();
}
static void ssh1_connection_special_cmd(PacketProtocolLayer *ppl,

View File

@ -481,7 +481,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
/* Check whether we're configured to try Pageant, and also whether
* it's available. */
s->try_agent_auth = (conf_get_int(s->conf, CONF_tryagent) &&
s->try_agent_auth = (conf_get_bool(s->conf, CONF_tryagent) &&
agent_exists());
while (pktin->type == SSH1_SMSG_FAILURE) {
@ -793,7 +793,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
*/
s->cur_prompt = new_prompts(s->ppl.seat);
if (conf_get_int(s->conf, CONF_try_tis_auth) &&
if (conf_get_bool(s->conf, CONF_try_tis_auth) &&
(s->supported_auths_mask & (1 << SSH1_AUTH_TIS)) &&
!s->tis_auth_refused) {
s->pwpkt_type = SSH1_CMSG_AUTH_TIS_RESPONSE;
@ -842,7 +842,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
ssh1_pkt_type(pktin->type));
return;
}
} else if (conf_get_int(s->conf, CONF_try_tis_auth) &&
} else if (conf_get_bool(s->conf, CONF_try_tis_auth) &&
(s->supported_auths_mask & (1 << SSH1_AUTH_CCARD)) &&
!s->ccard_auth_refused) {
s->pwpkt_type = SSH1_CMSG_AUTH_CCARD_RESPONSE;
@ -1059,7 +1059,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
ppl_logevent(("Authentication successful"));
if (conf_get_int(s->conf, CONF_compression)) {
if (conf_get_bool(s->conf, CONF_compression)) {
ppl_logevent(("Requesting compression"));
pkt = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_REQUEST_COMPRESSION);
put_uint32(pkt, 6); /* gzip compression level */

View File

@ -256,7 +256,7 @@ PacketProtocolLayer *ssh2_connection_new(
* any at all channels (because our purpose is probably to be a
* background port forwarder).
*/
s->persistent = conf_get_int(s->conf, CONF_ssh_no_shell);
s->persistent = conf_get_bool(s->conf, CONF_ssh_no_shell);
s->connshare = connshare;
s->peer_verstring = dupstr(peer_verstring);
@ -1526,7 +1526,7 @@ static int ssh2_agent_forwarding_permitted(ConnectionLayer *cl)
{
struct ssh2_connection_state *s =
container_of(cl, struct ssh2_connection_state, cl);
return conf_get_int(s->conf, CONF_agentfwd) && agent_exists();
return conf_get_bool(s->conf, CONF_agentfwd) && agent_exists();
}
static int ssh2_connection_get_specials(

View File

@ -485,7 +485,7 @@ static void ssh2_write_kexinit_lists(
preferred_ciphers[n_preferred_ciphers++] = &ssh2_blowfish;
break;
case CIPHER_DES:
if (conf_get_int(conf, CONF_ssh2_des_cbc))
if (conf_get_bool(conf, CONF_ssh2_des_cbc))
preferred_ciphers[n_preferred_ciphers++] = &ssh2_des;
break;
case CIPHER_3DES:
@ -513,7 +513,7 @@ static void ssh2_write_kexinit_lists(
/*
* Set up preferred compression.
*/
if (conf_get_int(conf, CONF_compression))
if (conf_get_bool(conf, CONF_compression))
preferred_comp = &ssh_zlib;
else
preferred_comp = &ssh_comp_none;
@ -993,7 +993,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
* where the flag was set on the previous key exchange.)
*/
s->can_gssapi_keyex = false;
} else if (conf_get_int(s->conf, CONF_try_gssapi_kex)) {
} else if (conf_get_bool(s->conf, CONF_try_gssapi_kex)) {
/*
* We always check if we have GSS creds before we come up with
* the kex algorithm list, otherwise future rekeys will fail
@ -1026,7 +1026,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
*/
if (!s->got_session_id && (s->gss_status & GSS_CTXT_MAYFAIL) != 0)
s->can_gssapi_keyex = 0;
s->gss_delegate = conf_get_int(s->conf, CONF_gssapifwd);
s->gss_delegate = conf_get_bool(s->conf, CONF_gssapifwd);
} else {
s->can_gssapi_keyex = false;
}
@ -1676,8 +1676,8 @@ static void ssh2_transport_gss_update(struct ssh2_transport_state *s,
*/
if (s->shgss->libs->nlibraries == 0)
return;
if (!conf_get_int(s->conf, CONF_try_gssapi_auth) &&
!conf_get_int(s->conf, CONF_try_gssapi_kex))
if (!conf_get_bool(s->conf, CONF_try_gssapi_auth) &&
!conf_get_bool(s->conf, CONF_try_gssapi_kex))
return;
/* Import server name and cache it */
@ -1754,7 +1754,7 @@ static void ssh2_transport_gss_update(struct ssh2_transport_state *s,
* refresh them. We must avoid setting GSS_CRED_UPDATED or
* GSS_CTXT_EXPIRES when credential delegation is disabled.
*/
if (conf_get_int(s->conf, CONF_gssapifwd) == 0)
if (conf_get_bool(s->conf, CONF_gssapifwd) == 0)
return;
if (s->gss_cred_expiry != GSS_NO_EXPIRATION &&
@ -1918,8 +1918,8 @@ static void ssh2_transport_reconfigure(PacketProtocolLayer *ppl, Conf *conf)
}
}
if (conf_get_int(s->conf, CONF_compression) !=
conf_get_int(conf, CONF_compression)) {
if (conf_get_bool(s->conf, CONF_compression) !=
conf_get_bool(conf, CONF_compression)) {
rekey_reason = "compression setting changed";
rekey_mandatory = true;
}
@ -1930,8 +1930,8 @@ static void ssh2_transport_reconfigure(PacketProtocolLayer *ppl, Conf *conf)
rekey_reason = "cipher settings changed";
rekey_mandatory = true;
}
if (conf_get_int(s->conf, CONF_ssh2_des_cbc) !=
conf_get_int(conf, CONF_ssh2_des_cbc)) {
if (conf_get_bool(s->conf, CONF_ssh2_des_cbc) !=
conf_get_bool(conf, CONF_ssh2_des_cbc)) {
rekey_reason = "cipher settings changed";
rekey_mandatory = true;
}

View File

@ -221,7 +221,7 @@ Plug *ssh_server_plug(
srv->plug.vt = &ssh_server_plugvt;
srv->conf = conf_copy(conf);
srv->logctx = log_init(logpolicy, conf);
conf_set_int(srv->conf, CONF_ssh_no_shell, true);
conf_set_bool(srv->conf, CONF_ssh_no_shell, true);
srv->nhostkeys = nhostkeys;
srv->hostkeys = hostkeys;
srv->hostkey1 = hostkey1;
@ -418,7 +418,7 @@ static void server_got_ssh_version(struct ssh_version_receiver *rcv,
ssh2connection_server_configure(connection_layer, srv->sftpserver_vt);
server_connect_ppl(srv, connection_layer);
if (conf_get_int(srv->conf, CONF_ssh_no_userauth)) {
if (conf_get_bool(srv->conf, CONF_ssh_no_userauth)) {
userauth_layer = NULL;
transport_child_layer = connection_layer;
} else {

View File

@ -2077,12 +2077,12 @@ Socket *ssh_connection_sharing_init(
Socket *sock, *toret = NULL;
struct ssh_sharing_state *sharestate;
if (!conf_get_int(conf, CONF_ssh_connection_sharing))
if (!conf_get_bool(conf, CONF_ssh_connection_sharing))
return NULL; /* do not share anything */
can_upstream = share_can_be_upstream &&
conf_get_int(conf, CONF_ssh_connection_sharing_upstream);
conf_get_bool(conf, CONF_ssh_connection_sharing_upstream);
can_downstream = share_can_be_downstream &&
conf_get_int(conf, CONF_ssh_connection_sharing_downstream);
conf_get_bool(conf, CONF_ssh_connection_sharing_downstream);
if (!can_upstream && !can_downstream)
return NULL;

View File

@ -412,7 +412,7 @@ static void process_subneg(Telnet *telnet)
logeventf(telnet->logctx, "server:\tSB %s SEND",
telopt(telnet->sb_opt));
if (telnet->sb_opt == TELOPT_OLD_ENVIRON) {
if (conf_get_int(telnet->conf, CONF_rfc_environ)) {
if (conf_get_bool(telnet->conf, CONF_rfc_environ)) {
value = RFC_VALUE;
var = RFC_VAR;
} else {
@ -746,7 +746,7 @@ static const char *telnet_init(Seat *seat, Backend **backend_handle,
/*
* Initialise option states.
*/
if (conf_get_int(telnet->conf, CONF_passive_telnet)) {
if (conf_get_bool(telnet->conf, CONF_passive_telnet)) {
const struct Opt *const *o;
for (o = opts; *o; o++)

View File

@ -1286,11 +1286,11 @@ static void power_on(Terminal *term, int clear)
for (i = 0; i < term->cols; i++)
term->tabs[i] = (i % 8 == 0 ? true : false);
}
term->alt_om = term->dec_om = conf_get_int(term->conf, CONF_dec_om);
term->alt_om = term->dec_om = conf_get_bool(term->conf, CONF_dec_om);
term->alt_ins = term->insert = false;
term->alt_wnext = term->wrapnext =
term->save_wnext = term->alt_save_wnext = false;
term->alt_wrap = term->wrap = conf_get_int(term->conf, CONF_wrap_mode);
term->alt_wrap = term->wrap = conf_get_bool(term->conf, CONF_wrap_mode);
term->alt_cset = term->cset = term->save_cset = term->alt_save_cset = 0;
term->alt_utf = term->utf = term->save_utf = term->alt_save_utf = 0;
term->utf_state = 0;
@ -1307,10 +1307,10 @@ static void power_on(Terminal *term, int clear)
term->curr_truecolour.fg = term->curr_truecolour.bg = optionalrgb_none;
term->save_truecolour = term->alt_save_truecolour = term->curr_truecolour;
term->term_editing = term->term_echoing = false;
term->app_cursor_keys = conf_get_int(term->conf, CONF_app_cursor);
term->app_keypad_keys = conf_get_int(term->conf, CONF_app_keypad);
term->use_bce = conf_get_int(term->conf, CONF_bce);
term->blink_is_real = conf_get_int(term->conf, CONF_blinktext);
term->app_cursor_keys = conf_get_bool(term->conf, CONF_app_cursor);
term->app_keypad_keys = conf_get_bool(term->conf, CONF_app_keypad);
term->use_bce = conf_get_bool(term->conf, CONF_bce);
term->blink_is_real = conf_get_bool(term->conf, CONF_blinktext);
term->erase_char = term->basic_erase_char;
term->alt_which = 0;
term_print_finish(term);
@ -1429,46 +1429,46 @@ static void set_erase_char(Terminal *term)
*/
void term_copy_stuff_from_conf(Terminal *term)
{
term->ansi_colour = conf_get_int(term->conf, CONF_ansi_colour);
term->arabicshaping = conf_get_int(term->conf, CONF_arabicshaping);
term->ansi_colour = conf_get_bool(term->conf, CONF_ansi_colour);
term->arabicshaping = conf_get_bool(term->conf, CONF_arabicshaping);
term->beep = conf_get_int(term->conf, CONF_beep);
term->bellovl = conf_get_int(term->conf, CONF_bellovl);
term->bellovl = conf_get_bool(term->conf, CONF_bellovl);
term->bellovl_n = conf_get_int(term->conf, CONF_bellovl_n);
term->bellovl_s = conf_get_int(term->conf, CONF_bellovl_s);
term->bellovl_t = conf_get_int(term->conf, CONF_bellovl_t);
term->bidi = conf_get_int(term->conf, CONF_bidi);
term->bksp_is_delete = conf_get_int(term->conf, CONF_bksp_is_delete);
term->blink_cur = conf_get_int(term->conf, CONF_blink_cur);
term->blinktext = conf_get_int(term->conf, CONF_blinktext);
term->cjk_ambig_wide = conf_get_int(term->conf, CONF_cjk_ambig_wide);
term->bidi = conf_get_bool(term->conf, CONF_bidi);
term->bksp_is_delete = conf_get_bool(term->conf, CONF_bksp_is_delete);
term->blink_cur = conf_get_bool(term->conf, CONF_blink_cur);
term->blinktext = conf_get_bool(term->conf, CONF_blinktext);
term->cjk_ambig_wide = conf_get_bool(term->conf, CONF_cjk_ambig_wide);
term->conf_height = conf_get_int(term->conf, CONF_height);
term->conf_width = conf_get_int(term->conf, CONF_width);
term->crhaslf = conf_get_int(term->conf, CONF_crhaslf);
term->erase_to_scrollback = conf_get_int(term->conf, CONF_erase_to_scrollback);
term->crhaslf = conf_get_bool(term->conf, CONF_crhaslf);
term->erase_to_scrollback = conf_get_bool(term->conf, CONF_erase_to_scrollback);
term->funky_type = conf_get_int(term->conf, CONF_funky_type);
term->lfhascr = conf_get_int(term->conf, CONF_lfhascr);
term->logflush = conf_get_int(term->conf, CONF_logflush);
term->lfhascr = conf_get_bool(term->conf, CONF_lfhascr);
term->logflush = conf_get_bool(term->conf, CONF_logflush);
term->logtype = conf_get_int(term->conf, CONF_logtype);
term->mouse_override = conf_get_int(term->conf, CONF_mouse_override);
term->nethack_keypad = conf_get_int(term->conf, CONF_nethack_keypad);
term->no_alt_screen = conf_get_int(term->conf, CONF_no_alt_screen);
term->no_applic_c = conf_get_int(term->conf, CONF_no_applic_c);
term->no_applic_k = conf_get_int(term->conf, CONF_no_applic_k);
term->no_dbackspace = conf_get_int(term->conf, CONF_no_dbackspace);
term->no_mouse_rep = conf_get_int(term->conf, CONF_no_mouse_rep);
term->no_remote_charset = conf_get_int(term->conf, CONF_no_remote_charset);
term->no_remote_resize = conf_get_int(term->conf, CONF_no_remote_resize);
term->no_remote_wintitle = conf_get_int(term->conf, CONF_no_remote_wintitle);
term->no_remote_clearscroll = conf_get_int(term->conf, CONF_no_remote_clearscroll);
term->rawcnp = conf_get_int(term->conf, CONF_rawcnp);
term->utf8linedraw = conf_get_int(term->conf, CONF_utf8linedraw);
term->rect_select = conf_get_int(term->conf, CONF_rect_select);
term->mouse_override = conf_get_bool(term->conf, CONF_mouse_override);
term->nethack_keypad = conf_get_bool(term->conf, CONF_nethack_keypad);
term->no_alt_screen = conf_get_bool(term->conf, CONF_no_alt_screen);
term->no_applic_c = conf_get_bool(term->conf, CONF_no_applic_c);
term->no_applic_k = conf_get_bool(term->conf, CONF_no_applic_k);
term->no_dbackspace = conf_get_bool(term->conf, CONF_no_dbackspace);
term->no_mouse_rep = conf_get_bool(term->conf, CONF_no_mouse_rep);
term->no_remote_charset = conf_get_bool(term->conf, CONF_no_remote_charset);
term->no_remote_resize = conf_get_bool(term->conf, CONF_no_remote_resize);
term->no_remote_wintitle = conf_get_bool(term->conf, CONF_no_remote_wintitle);
term->no_remote_clearscroll = conf_get_bool(term->conf, CONF_no_remote_clearscroll);
term->rawcnp = conf_get_bool(term->conf, CONF_rawcnp);
term->utf8linedraw = conf_get_bool(term->conf, CONF_utf8linedraw);
term->rect_select = conf_get_bool(term->conf, CONF_rect_select);
term->remote_qtitle_action = conf_get_int(term->conf, CONF_remote_qtitle_action);
term->rxvt_homeend = conf_get_int(term->conf, CONF_rxvt_homeend);
term->scroll_on_disp = conf_get_int(term->conf, CONF_scroll_on_disp);
term->scroll_on_key = conf_get_int(term->conf, CONF_scroll_on_key);
term->xterm_256_colour = conf_get_int(term->conf, CONF_xterm_256_colour);
term->true_colour = conf_get_int(term->conf, CONF_true_colour);
term->rxvt_homeend = conf_get_bool(term->conf, CONF_rxvt_homeend);
term->scroll_on_disp = conf_get_bool(term->conf, CONF_scroll_on_disp);
term->scroll_on_key = conf_get_bool(term->conf, CONF_scroll_on_key);
term->xterm_256_colour = conf_get_bool(term->conf, CONF_xterm_256_colour);
term->true_colour = conf_get_bool(term->conf, CONF_true_colour);
/*
* Parse the control-character escapes in the configured
@ -1512,14 +1512,14 @@ void term_reconfig(Terminal *term, Conf *conf)
int reset_wrap, reset_decom, reset_bce, reset_tblink, reset_charclass;
int i;
reset_wrap = (conf_get_int(term->conf, CONF_wrap_mode) !=
conf_get_int(conf, CONF_wrap_mode));
reset_decom = (conf_get_int(term->conf, CONF_dec_om) !=
conf_get_int(conf, CONF_dec_om));
reset_bce = (conf_get_int(term->conf, CONF_bce) !=
conf_get_int(conf, CONF_bce));
reset_tblink = (conf_get_int(term->conf, CONF_blinktext) !=
conf_get_int(conf, CONF_blinktext));
reset_wrap = (conf_get_bool(term->conf, CONF_wrap_mode) !=
conf_get_bool(conf, CONF_wrap_mode));
reset_decom = (conf_get_bool(term->conf, CONF_dec_om) !=
conf_get_bool(conf, CONF_dec_om));
reset_bce = (conf_get_bool(term->conf, CONF_bce) !=
conf_get_bool(conf, CONF_bce));
reset_tblink = (conf_get_bool(term->conf, CONF_blinktext) !=
conf_get_bool(conf, CONF_blinktext));
reset_charclass = 0;
for (i = 0; i < 256; i++)
if (conf_get_int_int(term->conf, CONF_wordness, i) !=
@ -1530,10 +1530,10 @@ void term_reconfig(Terminal *term, Conf *conf)
* If the bidi or shaping settings have changed, flush the bidi
* cache completely.
*/
if (conf_get_int(term->conf, CONF_arabicshaping) !=
conf_get_int(conf, CONF_arabicshaping) ||
conf_get_int(term->conf, CONF_bidi) !=
conf_get_int(conf, CONF_bidi)) {
if (conf_get_bool(term->conf, CONF_arabicshaping) !=
conf_get_bool(conf, CONF_arabicshaping) ||
conf_get_bool(term->conf, CONF_bidi) !=
conf_get_bool(conf, CONF_bidi)) {
for (i = 0; i < term->bidi_cache_size; i++) {
sfree(term->pre_bidi_cache[i].chars);
sfree(term->post_bidi_cache[i].chars);
@ -1548,27 +1548,27 @@ void term_reconfig(Terminal *term, Conf *conf)
term->conf = conf_copy(conf);
if (reset_wrap)
term->alt_wrap = term->wrap = conf_get_int(term->conf, CONF_wrap_mode);
term->alt_wrap = term->wrap = conf_get_bool(term->conf, CONF_wrap_mode);
if (reset_decom)
term->alt_om = term->dec_om = conf_get_int(term->conf, CONF_dec_om);
term->alt_om = term->dec_om = conf_get_bool(term->conf, CONF_dec_om);
if (reset_bce) {
term->use_bce = conf_get_int(term->conf, CONF_bce);
term->use_bce = conf_get_bool(term->conf, CONF_bce);
set_erase_char(term);
}
if (reset_tblink) {
term->blink_is_real = conf_get_int(term->conf, CONF_blinktext);
term->blink_is_real = conf_get_bool(term->conf, CONF_blinktext);
}
if (reset_charclass)
for (i = 0; i < 256; i++)
term->wordness[i] = conf_get_int_int(term->conf, CONF_wordness, i);
if (conf_get_int(term->conf, CONF_no_alt_screen))
if (conf_get_bool(term->conf, CONF_no_alt_screen))
swap_screen(term, 0, false, false);
if (conf_get_int(term->conf, CONF_no_mouse_rep)) {
if (conf_get_bool(term->conf, CONF_no_mouse_rep)) {
term->xterm_mouse = 0;
win_set_raw_mouse_mode(term->win, 0);
}
if (conf_get_int(term->conf, CONF_no_remote_charset)) {
if (conf_get_bool(term->conf, CONF_no_remote_charset)) {
term->cset_attr[0] = term->cset_attr[1] = CSET_ASCII;
term->sco_acs = term->alt_sco_acs = 0;
term->utf = 0;
@ -6065,7 +6065,7 @@ static int wstartswith(const wchar_t *a, size_t alen,
void term_do_paste(Terminal *term, const wchar_t *data, int len)
{
const wchar_t *p;
int paste_controls = conf_get_int(term->conf, CONF_paste_controls);
int paste_controls = conf_get_bool(term->conf, CONF_paste_controls);
/*
* Pasting data into the terminal counts as a keyboard event (for

View File

@ -486,31 +486,31 @@ int do_cmdline(int argc, char **argv, int do_everything, Conf *conf)
} else if (!strcmp(p, "-ut-") || !strcmp(p, "+ut")) {
SECOND_PASS_ONLY;
conf_set_int(conf, CONF_stamp_utmp, 0);
conf_set_bool(conf, CONF_stamp_utmp, false);
} else if (!strcmp(p, "-ut")) {
SECOND_PASS_ONLY;
conf_set_int(conf, CONF_stamp_utmp, 1);
conf_set_bool(conf, CONF_stamp_utmp, true);
} else if (!strcmp(p, "-ls-") || !strcmp(p, "+ls")) {
SECOND_PASS_ONLY;
conf_set_int(conf, CONF_login_shell, 0);
conf_set_bool(conf, CONF_login_shell, false);
} else if (!strcmp(p, "-ls")) {
SECOND_PASS_ONLY;
conf_set_int(conf, CONF_login_shell, 1);
conf_set_bool(conf, CONF_login_shell, true);
} else if (!strcmp(p, "-nethack")) {
SECOND_PASS_ONLY;
conf_set_int(conf, CONF_nethack_keypad, 1);
conf_set_bool(conf, CONF_nethack_keypad, true);
} else if (!strcmp(p, "-sb-") || !strcmp(p, "+sb")) {
SECOND_PASS_ONLY;
conf_set_int(conf, CONF_scrollbar, 0);
conf_set_bool(conf, CONF_scrollbar, false);
} else if (!strcmp(p, "-sb")) {
SECOND_PASS_ONLY;
conf_set_int(conf, CONF_scrollbar, 1);
conf_set_bool(conf, CONF_scrollbar, true);
} else if (!strcmp(p, "-name")) {
EXPECTS_ARG;

View File

@ -194,9 +194,9 @@ static void cache_conf_values(GtkFrontend *inst)
inst->cursor_type = conf_get_int(inst->conf, CONF_cursor_type);
#ifdef OSX_META_KEY_CONFIG
inst->meta_mod_mask = 0;
if (conf_get_int(inst->conf, CONF_osx_option_meta))
if (conf_get_bool(inst->conf, CONF_osx_option_meta))
inst->meta_mod_mask |= GDK_MOD1_MASK;
if (conf_get_int(inst->conf, CONF_osx_command_meta))
if (conf_get_bool(inst->conf, CONF_osx_command_meta))
inst->meta_mod_mask |= GDK_MOD2_MASK;
inst->system_mod_mask = GDK_MOD2_MASK & ~inst->meta_mod_mask;
#else
@ -292,12 +292,19 @@ char *platform_default_s(const char *name)
return NULL;
}
bool platform_default_b(const char *name, bool def)
{
if (!strcmp(name, "WinNameAlways")) {
/* X natively supports icon titles, so use 'em by default */
return false;
}
return def;
}
int platform_default_i(const char *name, int def)
{
if (!strcmp(name, "CloseOnExit"))
return 2; /* maps to FORCE_ON after painful rearrangement :-( */
if (!strcmp(name, "WinNameAlways"))
return 0; /* X natively supports icon titles, so use 'em by default */
return def;
}
@ -629,7 +636,7 @@ static void warn_on_close_callback(void *vctx, int result)
*/
gint delete_window(GtkWidget *widget, GdkEvent *event, GtkFrontend *inst)
{
if (!inst->exited && conf_get_int(inst->conf, CONF_warn_on_close)) {
if (!inst->exited && conf_get_bool(inst->conf, CONF_warn_on_close)) {
/*
* We're not going to exit right now. We must put up a
* warn-on-close dialog, unless one already exists, in which
@ -678,7 +685,7 @@ static void update_mouseptr(GtkFrontend *inst)
static void show_mouseptr(GtkFrontend *inst, int show)
{
if (!conf_get_int(inst->conf, CONF_hide_mouseptr))
if (!conf_get_bool(inst->conf, CONF_hide_mouseptr))
show = 1;
inst->mouseptr_visible = show;
update_mouseptr(inst);
@ -973,8 +980,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
char output[256];
wchar_t ucsoutput[2];
int ucsval, start, end, special, output_charset, use_ucsoutput;
int nethack_mode, app_keypad_mode;
int generated_something = false;
bool nethack_mode, app_keypad_mode;
bool generated_something = false;
#ifdef OSX_META_KEY_CONFIG
if (event->state & inst->system_mod_mask)
@ -1371,9 +1378,9 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
special = false;
use_ucsoutput = false;
nethack_mode = conf_get_int(inst->conf, CONF_nethack_keypad);
nethack_mode = conf_get_bool(inst->conf, CONF_nethack_keypad);
app_keypad_mode = (inst->term->app_keypad_keys &&
!conf_get_int(inst->conf, CONF_no_applic_k));
!conf_get_bool(inst->conf, CONF_no_applic_k));
/* ALT+things gives leading Escape. */
output[0] = '\033';
@ -1709,7 +1716,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
/* We don't let GTK tell us what Backspace is! We know better. */
if (event->keyval == GDK_KEY_BackSpace &&
!(event->state & GDK_SHIFT_MASK)) {
output[1] = conf_get_int(inst->conf, CONF_bksp_is_delete) ?
output[1] = conf_get_bool(inst->conf, CONF_bksp_is_delete) ?
'\x7F' : '\x08';
#ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Backspace, translating as %02x\n",
@ -1722,7 +1729,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
/* For Shift Backspace, do opposite of what is configured. */
if (event->keyval == GDK_KEY_BackSpace &&
(event->state & GDK_SHIFT_MASK)) {
output[1] = conf_get_int(inst->conf, CONF_bksp_is_delete) ?
output[1] = conf_get_bool(inst->conf, CONF_bksp_is_delete) ?
'\x08' : '\x7F';
#ifdef KEY_EVENT_DIAGNOSTICS
debug((" - Shift-Backspace, translating as %02x\n",
@ -2049,7 +2056,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
goto done;
}
if ((code == 1 || code == 4) &&
conf_get_int(inst->conf, CONF_rxvt_homeend)) {
conf_get_bool(inst->conf, CONF_rxvt_homeend)) {
#ifdef KEY_EVENT_DIAGNOSTICS
debug((" - rxvt style Home/End"));
#endif
@ -2249,8 +2256,8 @@ gboolean scroll_internal(GtkFrontend *inst, gdouble delta, guint state,
y = (ey - inst->window_border) / inst->font_height;
raw_mouse_mode =
send_raw_mouse && !(shift && conf_get_int(inst->conf,
CONF_mouse_override));
send_raw_mouse && !(shift && conf_get_bool(inst->conf,
CONF_mouse_override));
inst->cumulative_scroll += delta * SCROLL_INCREMENT_LINES;
@ -2300,8 +2307,8 @@ static gboolean button_internal(GtkFrontend *inst, GdkEventButton *event)
alt = event->state & inst->meta_mod_mask;
raw_mouse_mode =
send_raw_mouse && !(shift && conf_get_int(inst->conf,
CONF_mouse_override));
send_raw_mouse && !(shift && conf_get_bool(inst->conf,
CONF_mouse_override));
if (!raw_mouse_mode) {
if (event->button == 4 && event->type == GDK_BUTTON_PRESS) {
@ -2593,7 +2600,7 @@ static void gtk_seat_set_busy_status(Seat *seat, BusyStatus status)
static void gtkwin_set_raw_mouse_mode(TermWin *tw, int activate)
{
GtkFrontend *inst = container_of(tw, GtkFrontend, termwin);
activate = activate && !conf_get_int(inst->conf, CONF_no_mouse_rep);
activate = activate && !conf_get_bool(inst->conf, CONF_no_mouse_rep);
send_raw_mouse = activate;
update_mouseptr(inst);
}
@ -3471,7 +3478,7 @@ static void set_window_titles(GtkFrontend *inst)
* is life.
*/
gtk_window_set_title(GTK_WINDOW(inst->window), inst->wintitle);
if (!conf_get_int(inst->conf, CONF_win_name_always))
if (!conf_get_bool(inst->conf, CONF_win_name_always))
gdk_window_set_icon_name(gtk_widget_get_window(inst->window),
inst->icontitle);
}
@ -3504,7 +3511,7 @@ void set_title_and_icon(GtkFrontend *inst, char *title, char *icon)
static void gtkwin_set_scrollbar(TermWin *tw, int total, int start, int page)
{
GtkFrontend *inst = container_of(tw, GtkFrontend, termwin);
if (!conf_get_int(inst->conf, CONF_scrollbar))
if (!conf_get_bool(inst->conf, CONF_scrollbar))
return;
inst->ignore_sbar = true;
gtk_adjustment_set_lower(inst->sbar_adjust, 0);
@ -3521,7 +3528,7 @@ static void gtkwin_set_scrollbar(TermWin *tw, int total, int start, int page)
void scrollbar_moved(GtkAdjustment *adj, GtkFrontend *inst)
{
if (!conf_get_int(inst->conf, CONF_scrollbar))
if (!conf_get_bool(inst->conf, CONF_scrollbar))
return;
if (!inst->ignore_sbar)
term_scroll(inst->term, 1, (int)gtk_adjustment_get_value(adj));
@ -4269,7 +4276,7 @@ static int gtkwin_is_utf8(TermWin *tw)
char *setup_fonts_ucs(GtkFrontend *inst)
{
int shadowbold = conf_get_int(inst->conf, CONF_shadowbold);
int shadowbold = conf_get_bool(inst->conf, CONF_shadowbold);
int shadowboldoffset = conf_get_int(inst->conf, CONF_shadowboldoffset);
FontSpec *fs;
unifont *fonts[4];
@ -4349,7 +4356,7 @@ char *setup_fonts_ucs(GtkFrontend *inst)
inst->direct_to_font = init_ucs(&inst->ucsdata,
conf_get_str(inst->conf, CONF_line_codepage),
conf_get_int(inst->conf, CONF_utf8_override),
conf_get_bool(inst->conf, CONF_utf8_override),
inst->fonts[0]->public_charset,
conf_get_int(inst->conf, CONF_vtmode));
@ -4559,7 +4566,7 @@ void setup_clipboards(GtkFrontend *inst, Terminal *term, Conf *conf)
term->mouse_select_clipboards[
term->n_mouse_select_clipboards++] = MOUSE_SELECT_CLIPBOARD;
if (conf_get_int(conf, CONF_mouseautocopy)) {
if (conf_get_bool(conf, CONF_mouseautocopy)) {
term->mouse_select_clipboards[
term->n_mouse_select_clipboards++] = CLIP_CLIPBOARD;
}
@ -4730,15 +4737,15 @@ static void after_change_settings_dialog(void *vctx, int retval)
* If the scrollbar needs to be shown, hidden, or moved
* from one end to the other of the window, do so now.
*/
if (conf_get_int(oldconf, CONF_scrollbar) !=
conf_get_int(newconf, CONF_scrollbar)) {
show_scrollbar(inst, conf_get_int(newconf, CONF_scrollbar));
if (conf_get_bool(oldconf, CONF_scrollbar) !=
conf_get_bool(newconf, CONF_scrollbar)) {
show_scrollbar(inst, conf_get_bool(newconf, CONF_scrollbar));
need_size = true;
}
if (conf_get_int(oldconf, CONF_scrollbar_on_left) !=
conf_get_int(newconf, CONF_scrollbar_on_left)) {
if (conf_get_bool(oldconf, CONF_scrollbar_on_left) !=
conf_get_bool(newconf, CONF_scrollbar_on_left)) {
gtk_box_reorder_child(inst->hbox, inst->sbar,
conf_get_int(newconf, CONF_scrollbar_on_left)
conf_get_bool(newconf, CONF_scrollbar_on_left)
? 0 : 1);
}
@ -4765,12 +4772,12 @@ static void after_change_settings_dialog(void *vctx, int retval)
conf_get_fontspec(newconf, CONF_wideboldfont)->name) ||
strcmp(conf_get_str(oldconf, CONF_line_codepage),
conf_get_str(newconf, CONF_line_codepage)) ||
conf_get_int(oldconf, CONF_utf8_override) !=
conf_get_int(newconf, CONF_utf8_override) ||
conf_get_bool(oldconf, CONF_utf8_override) !=
conf_get_bool(newconf, CONF_utf8_override) ||
conf_get_int(oldconf, CONF_vtmode) !=
conf_get_int(newconf, CONF_vtmode) ||
conf_get_int(oldconf, CONF_shadowbold) !=
conf_get_int(newconf, CONF_shadowbold) ||
conf_get_bool(oldconf, CONF_shadowbold) !=
conf_get_bool(newconf, CONF_shadowbold) ||
conf_get_int(oldconf, CONF_shadowboldoffset) !=
conf_get_int(newconf, CONF_shadowboldoffset)) {
char *errmsg = setup_fonts_ucs(inst);
@ -5119,8 +5126,8 @@ static void start_backend(GtkFrontend *inst)
conf_get_str(inst->conf, CONF_host),
conf_get_int(inst->conf, CONF_port),
&realhost,
conf_get_int(inst->conf, CONF_tcp_nodelay),
conf_get_int(inst->conf, CONF_tcp_keepalives));
conf_get_bool(inst->conf, CONF_tcp_nodelay),
conf_get_bool(inst->conf, CONF_tcp_keepalives));
if (error) {
char *msg = dupprintf("Unable to open connection to %s:\n%s",
@ -5330,16 +5337,16 @@ void new_session_window(Conf *conf, const char *geometry_string)
* unwanted, so we can pop it up quickly if it suddenly becomes
* desirable.
*/
if (conf_get_int(inst->conf, CONF_scrollbar_on_left))
if (conf_get_bool(inst->conf, CONF_scrollbar_on_left))
gtk_box_pack_start(inst->hbox, inst->sbar, false, false, 0);
gtk_box_pack_start(inst->hbox, inst->area, true, true, 0);
if (!conf_get_int(inst->conf, CONF_scrollbar_on_left))
if (!conf_get_bool(inst->conf, CONF_scrollbar_on_left))
gtk_box_pack_start(inst->hbox, inst->sbar, false, false, 0);
gtk_container_add(GTK_CONTAINER(inst->window), GTK_WIDGET(inst->hbox));
gtk_widget_show(inst->area);
show_scrollbar(inst, conf_get_int(inst->conf, CONF_scrollbar));
show_scrollbar(inst, conf_get_bool(inst->conf, CONF_scrollbar));
gtk_widget_show(GTK_WIDGET(inst->hbox));
/*
@ -5441,7 +5448,7 @@ void new_session_window(Conf *conf, const char *geometry_string)
g_signal_connect(G_OBJECT(inst->imc), "commit",
G_CALLBACK(input_method_commit_event), inst);
#endif
if (conf_get_int(inst->conf, CONF_scrollbar))
if (conf_get_bool(inst->conf, CONF_scrollbar))
g_signal_connect(G_OBJECT(inst->sbar_adjust), "value_changed",
G_CALLBACK(scrollbar_moved), inst);
gtk_widget_add_events(GTK_WIDGET(inst->area),

View File

@ -54,6 +54,7 @@ void random_save_seed(void) {}
void random_destroy_seed(void) {}
void noise_ultralight(unsigned long data) {}
char *platform_default_s(const char *name) { return NULL; }
bool platform_default_b(const char *name, bool def) { return def; }
int platform_default_i(const char *name, int def) { return def; }
FontSpec *platform_default_fontspec(const char *name) { return fontspec_new(""); }
Filename *platform_default_filename(const char *name) { return filename_from_str(""); }

View File

@ -55,6 +55,11 @@ char *platform_default_s(const char *name)
return NULL;
}
bool platform_default_b(const char *name, bool def)
{
return def;
}
int platform_default_i(const char *name, int def)
{
return def;
@ -674,7 +679,7 @@ int main(int argc, char **argv)
/* change trailing blank to NUL */
conf_set_str(conf, CONF_remote_cmd, command);
conf_set_str(conf, CONF_remote_cmd2, "");
conf_set_int(conf, CONF_nopty, true); /* command => no tty */
conf_set_bool(conf, CONF_nopty, true); /* command => no tty */
break; /* done with cmdline */
} else {
@ -713,7 +718,7 @@ int main(int argc, char **argv)
* Apply subsystem status.
*/
if (use_subsystem)
conf_set_int(conf, CONF_ssh_subsys, true);
conf_set_bool(conf, CONF_ssh_subsys, true);
if (!*conf_get_str(conf, CONF_remote_cmd) &&
!*conf_get_str(conf, CONF_remote_cmd2) &&
@ -769,10 +774,10 @@ int main(int argc, char **argv)
* the "simple" flag.
*/
if (conf_get_int(conf, CONF_protocol) == PROT_SSH &&
!conf_get_int(conf, CONF_x11_forward) &&
!conf_get_int(conf, CONF_agentfwd) &&
!conf_get_bool(conf, CONF_x11_forward) &&
!conf_get_bool(conf, CONF_agentfwd) &&
!conf_get_str_nthstrkey(conf, CONF_portfwd, 0))
conf_set_int(conf, CONF_ssh_simple, true);
conf_set_bool(conf, CONF_ssh_simple, true);
if (just_test_share_exists) {
if (!backvt->test_for_upstream) {
@ -795,7 +800,7 @@ int main(int argc, char **argv)
const char *error;
char *realhost;
/* nodelay is only useful if stdin is a terminal device */
int nodelay = conf_get_int(conf, CONF_tcp_nodelay) && isatty(0);
int nodelay = conf_get_bool(conf, CONF_tcp_nodelay) && isatty(0);
/* This is a good place for a fuzzer to fork us. */
#ifdef __AFL_HAVE_MANUAL_CONTROL
@ -806,7 +811,7 @@ int main(int argc, char **argv)
conf_get_str(conf, CONF_host),
conf_get_int(conf, CONF_port),
&realhost, nodelay,
conf_get_int(conf, CONF_tcp_keepalives));
conf_get_bool(conf, CONF_tcp_keepalives));
if (error) {
fprintf(stderr, "Unable to open connection:\n%s\n", error);
return 1;

View File

@ -920,7 +920,7 @@ Backend *pty_backend_create(
* or not.
*/
if (pty_utmp_helper_pipe >= 0) { /* if it's < 0, we can't anyway */
if (!conf_get_int(conf, CONF_stamp_utmp)) {
if (!conf_get_bool(conf, CONF_stamp_utmp)) {
/* We're not stamping utmp, so just let the child
* process die that was waiting to unstamp it later. */
close(pty_utmp_helper_pipe);
@ -1046,7 +1046,7 @@ Backend *pty_backend_create(
* Set the backspace character to be whichever of ^H and
* ^? is specified by bksp_is_delete.
*/
attrs.c_cc[VERASE] = conf_get_int(conf, CONF_bksp_is_delete)
attrs.c_cc[VERASE] = conf_get_bool(conf, CONF_bksp_is_delete)
? '\177' : '\010';
/*
@ -1176,7 +1176,7 @@ Backend *pty_backend_create(
} else {
char *shell = getenv("SHELL");
char *shellname;
if (conf_get_int(conf, CONF_login_shell)) {
if (conf_get_bool(conf, CONF_login_shell)) {
char *p = strrchr(shell, '/');
shellname = snewn(2+strlen(shell), char);
p = p ? p+1 : shell;

View File

@ -73,6 +73,11 @@ char *platform_default_s(const char *name)
return NULL;
}
bool platform_default_b(const char *name, bool def)
{
return def;
}
int platform_default_i(const char *name, int def)
{
return def;

View File

@ -47,6 +47,11 @@ char *platform_default_s(const char *name)
return NULL;
}
bool platform_default_b(const char *name, bool def)
{
return def;
}
int platform_default_i(const char *name, int def)
{
return def;

View File

@ -29,6 +29,11 @@ char *platform_default_s(const char *name)
return NULL;
}
bool platform_default_b(const char *name, bool def)
{
return def;
}
int platform_default_i(const char *name, int def)
{
return def;

View File

@ -375,8 +375,8 @@ static void start_backend(void)
conf_get_str(conf, CONF_host),
conf_get_int(conf, CONF_port),
&realhost,
conf_get_int(conf, CONF_tcp_nodelay),
conf_get_int(conf, CONF_tcp_keepalives));
conf_get_bool(conf, CONF_tcp_nodelay),
conf_get_bool(conf, CONF_tcp_keepalives));
if (error) {
char *str = dupprintf("%s Error", appname);
sprintf(msg, "Unable to open connection to\n"
@ -710,13 +710,13 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
int winmode = WS_OVERLAPPEDWINDOW | WS_VSCROLL;
int exwinmode = 0;
wchar_t *uappname = dup_mb_to_wc(DEFAULT_CODEPAGE, 0, appname);
if (!conf_get_int(conf, CONF_scrollbar))
if (!conf_get_bool(conf, CONF_scrollbar))
winmode &= ~(WS_VSCROLL);
if (conf_get_int(conf, CONF_resize_action) == RESIZE_DISABLED)
winmode &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX);
if (conf_get_int(conf, CONF_alwaysontop))
if (conf_get_bool(conf, CONF_alwaysontop))
exwinmode |= WS_EX_TOPMOST;
if (conf_get_int(conf, CONF_sunken_edge))
if (conf_get_bool(conf, CONF_sunken_edge))
exwinmode |= WS_EX_CLIENTEDGE;
hwnd = CreateWindowExW(exwinmode, uappname, uappname,
winmode, CW_USEDEFAULT, CW_USEDEFAULT,
@ -960,7 +960,7 @@ static void setup_clipboards(Terminal *term, Conf *conf)
term->n_mouse_select_clipboards = 1;
if (conf_get_int(conf, CONF_mouseautocopy)) {
if (conf_get_bool(conf, CONF_mouseautocopy)) {
term->mouse_select_clipboards[
term->n_mouse_select_clipboards++] = CLIP_SYSTEM;
}
@ -1168,7 +1168,7 @@ static void win_seat_set_busy_status(Seat *seat, BusyStatus status)
*/
static void wintw_set_raw_mouse_mode(TermWin *tw, int activate)
{
activate = activate && !conf_get_int(conf, CONF_no_mouse_rep);
activate = activate && !conf_get_bool(conf, CONF_no_mouse_rep);
send_raw_mouse = activate;
update_mouse_pointer();
}
@ -1251,7 +1251,7 @@ static void conftopalette(void)
}
/* Override with system colours if appropriate */
if (conf_get_int(conf, CONF_system_colour))
if (conf_get_bool(conf, CONF_system_colour))
systopalette();
}
@ -1304,7 +1304,7 @@ static void init_palette(void)
int i;
HDC hdc = GetDC(hwnd);
if (hdc) {
if (conf_get_int(conf, CONF_try_palette) &&
if (conf_get_bool(conf, CONF_try_palette) &&
GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE) {
/*
* This is a genuine case where we must use smalloc
@ -2003,7 +2003,7 @@ static void click(Mouse_Button b, int x, int y, int shift, int ctrl, int alt)
int thistime = GetMessageTime();
if (send_raw_mouse &&
!(shift && conf_get_int(conf, CONF_mouse_override))) {
!(shift && conf_get_bool(conf, CONF_mouse_override))) {
lastbtn = MBT_NOTHING;
term_mouse(term, b, translate_button(b), MA_CLICK,
x, y, shift, ctrl, alt);
@ -2046,7 +2046,7 @@ static void show_mouseptr(int show)
/* NB that the counter in ShowCursor() is also frobbed by
* update_mouse_pointer() */
static int cursor_visible = 1;
if (!conf_get_int(conf, CONF_hide_mouseptr))
if (!conf_get_bool(conf, CONF_hide_mouseptr))
show = 1; /* override if this feature disabled */
if (cursor_visible && !show)
ShowCursor(false);
@ -2169,7 +2169,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
char *str;
show_mouseptr(1);
str = dupprintf("%s Exit Confirmation", appname);
if (session_closed || !conf_get_int(conf, CONF_warn_on_close) ||
if (session_closed || !conf_get_bool(conf, CONF_warn_on_close) ||
MessageBox(hwnd,
"Are you sure you want to close this session?",
str, MB_ICONWARNING | MB_OKCANCEL | MB_DEFBUTTON1)
@ -2384,9 +2384,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
GetWindowLongPtr(hwnd, GWL_EXSTYLE);
nexflag = exflag;
if (conf_get_int(conf, CONF_alwaysontop) !=
conf_get_int(prev_conf, CONF_alwaysontop)) {
if (conf_get_int(conf, CONF_alwaysontop)) {
if (conf_get_bool(conf, CONF_alwaysontop) !=
conf_get_bool(prev_conf, CONF_alwaysontop)) {
if (conf_get_bool(conf, CONF_alwaysontop)) {
nexflag |= WS_EX_TOPMOST;
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE);
@ -2396,15 +2396,15 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
SWP_NOMOVE | SWP_NOSIZE);
}
}
if (conf_get_int(conf, CONF_sunken_edge))
if (conf_get_bool(conf, CONF_sunken_edge))
nexflag |= WS_EX_CLIENTEDGE;
else
nexflag &= ~(WS_EX_CLIENTEDGE);
nflg = flag;
if (conf_get_int(conf, is_full_screen() ?
CONF_scrollbar_in_fullscreen :
CONF_scrollbar))
if (conf_get_bool(conf, is_full_screen() ?
CONF_scrollbar_in_fullscreen :
CONF_scrollbar))
nflg |= WS_VSCROLL;
else
nflg &= ~WS_VSCROLL;
@ -2444,7 +2444,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
win_set_title(wintw, conf_get_str(conf, CONF_wintitle));
if (IsIconic(hwnd)) {
SetWindowText(hwnd,
conf_get_int(conf, CONF_win_name_always) ?
conf_get_bool(conf, CONF_win_name_always) ?
window_name : icon_name);
}
@ -2985,7 +2985,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
#endif
if (wParam == SIZE_MINIMIZED)
SetWindowText(hwnd,
conf_get_int(conf, CONF_win_name_always) ?
conf_get_bool(conf, CONF_win_name_always) ?
window_name : icon_name);
if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED)
SetWindowText(hwnd, window_name);
@ -3315,7 +3315,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
}
return 0;
case WM_SYSCOLORCHANGE:
if (conf_get_int(conf, CONF_system_colour)) {
if (conf_get_bool(conf, CONF_system_colour)) {
/* Refresh palette from system colours. */
/* XXX actually this zaps the entire palette. */
systopalette();
@ -3366,7 +3366,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
break;
if (send_raw_mouse &&
!(conf_get_int(conf, CONF_mouse_override) &&
!(conf_get_bool(conf, CONF_mouse_override) &&
shift_pressed)) {
/* Mouse wheel position is in screen coordinates for
* some reason */
@ -4061,9 +4061,9 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
unsigned char *p = output;
static int alt_sum = 0;
int funky_type = conf_get_int(conf, CONF_funky_type);
int no_applic_k = conf_get_int(conf, CONF_no_applic_k);
int ctrlaltkeys = conf_get_int(conf, CONF_ctrlaltkeys);
int nethack_keypad = conf_get_int(conf, CONF_nethack_keypad);
bool no_applic_k = conf_get_bool(conf, CONF_no_applic_k);
bool ctrlaltkeys = conf_get_bool(conf, CONF_ctrlaltkeys);
bool nethack_keypad = conf_get_bool(conf, CONF_nethack_keypad);
HKL kbd_layout = GetKeyboardLayout(0);
@ -4199,7 +4199,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
/* Note if AltGr was pressed and if it was used as a compose key */
if (!compose_state) {
compose_keycode = 0x100;
if (conf_get_int(conf, CONF_compose_key)) {
if (conf_get_bool(conf, CONF_compose_key)) {
if (wParam == VK_MENU && (HIWORD(lParam) & KF_EXTENDED))
compose_keycode = wParam;
}
@ -4356,16 +4356,16 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
}
return 0;
}
if (left_alt && wParam == VK_F4 && conf_get_int(conf, CONF_alt_f4)) {
if (left_alt && wParam == VK_F4 && conf_get_bool(conf, CONF_alt_f4)) {
return -1;
}
if (left_alt && wParam == VK_SPACE && conf_get_int(conf,
CONF_alt_space)) {
if (left_alt && wParam == VK_SPACE && conf_get_bool(conf,
CONF_alt_space)) {
SendMessage(hwnd, WM_SYSCOMMAND, SC_KEYMENU, 0);
return -1;
}
if (left_alt && wParam == VK_RETURN &&
conf_get_int(conf, CONF_fullscreenonaltenter) &&
conf_get_bool(conf, CONF_fullscreenonaltenter) &&
(conf_get_int(conf, CONF_resize_action) != RESIZE_DISABLED)) {
if ((HIWORD(lParam) & (KF_UP | KF_REPEAT)) != KF_REPEAT)
flip_full_screen();
@ -4509,13 +4509,13 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
}
if (wParam == VK_BACK && shift_state == 0) { /* Backspace */
*p++ = (conf_get_int(conf, CONF_bksp_is_delete) ? 0x7F : 0x08);
*p++ = (conf_get_bool(conf, CONF_bksp_is_delete) ? 0x7F : 0x08);
*p++ = 0;
return -2;
}
if (wParam == VK_BACK && shift_state == 1) { /* Shift Backspace */
/* We do the opposite of what is configured */
*p++ = (conf_get_int(conf, CONF_bksp_is_delete) ? 0x08 : 0x7F);
*p++ = (conf_get_bool(conf, CONF_bksp_is_delete) ? 0x08 : 0x7F);
*p++ = 0;
return -2;
}
@ -4725,7 +4725,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
return p - output;
}
if ((code == 1 || code == 4) &&
conf_get_int(conf, CONF_rxvt_homeend)) {
conf_get_bool(conf, CONF_rxvt_homeend)) {
p += sprintf((char *) p, code == 1 ? "\x1B[H" : "\x1BOw");
return p - output;
}
@ -4786,7 +4786,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
/* helg: clear CAPS LOCK state if caps lock switches to cyrillic */
if(keystate[VK_CAPITAL] != 0 &&
conf_get_int(conf, CONF_xlat_capslockcyr)) {
conf_get_bool(conf, CONF_xlat_capslockcyr)) {
capsOn= !left_alt;
keystate[VK_CAPITAL] = 0;
}
@ -4936,7 +4936,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
* we return -1, which means Windows will give the keystroke
* its default handling (i.e. bring up the System menu).
*/
if (wParam == VK_MENU && !conf_get_int(conf, CONF_alt_only))
if (wParam == VK_MENU && !conf_get_bool(conf, CONF_alt_only))
return 0;
return -1;
@ -4947,7 +4947,7 @@ static void wintw_set_title(TermWin *tw, const char *title)
sfree(window_name);
window_name = snewn(1 + strlen(title), char);
strcpy(window_name, title);
if (conf_get_int(conf, CONF_win_name_always) || !IsIconic(hwnd))
if (conf_get_bool(conf, CONF_win_name_always) || !IsIconic(hwnd))
SetWindowText(hwnd, title);
}
@ -4956,7 +4956,7 @@ static void wintw_set_icon_title(TermWin *tw, const char *title)
sfree(icon_name);
icon_name = snewn(1 + strlen(title), char);
strcpy(icon_name, title);
if (!conf_get_int(conf, CONF_win_name_always) && IsIconic(hwnd))
if (!conf_get_bool(conf, CONF_win_name_always) && IsIconic(hwnd))
SetWindowText(hwnd, title);
}
@ -4964,8 +4964,8 @@ static void wintw_set_scrollbar(TermWin *tw, int total, int start, int page)
{
SCROLLINFO si;
if (!conf_get_int(conf, is_full_screen() ?
CONF_scrollbar_in_fullscreen : CONF_scrollbar))
if (!conf_get_bool(conf, is_full_screen() ?
CONF_scrollbar_in_fullscreen : CONF_scrollbar))
return;
si.cbSize = sizeof(si);
@ -5150,7 +5150,7 @@ static void wintw_clip_write(
memcpy(lock, data, len * sizeof(wchar_t));
WideCharToMultiByte(CP_ACP, 0, data, len, lock2, len2, NULL, NULL);
if (conf_get_int(conf, CONF_rtf_paste)) {
if (conf_get_bool(conf, CONF_rtf_paste)) {
wchar_t unitab[256];
char *rtf = NULL;
unsigned char *tdata = (unsigned char *)lock2;
@ -5814,7 +5814,7 @@ static void wintw_move(TermWin *tw, int x, int y)
*/
static void wintw_set_zorder(TermWin *tw, int top)
{
if (conf_get_int(conf, CONF_alwaysontop))
if (conf_get_bool(conf, CONF_alwaysontop))
return; /* ignore */
SetWindowPos(hwnd, top ? HWND_TOP : HWND_BOTTOM, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE);
@ -5936,7 +5936,7 @@ static void make_full_screen()
/* Remove the window furniture. */
style = GetWindowLongPtr(hwnd, GWL_STYLE);
style &= ~(WS_CAPTION | WS_BORDER | WS_THICKFRAME);
if (conf_get_int(conf, CONF_scrollbar_in_fullscreen))
if (conf_get_bool(conf, CONF_scrollbar_in_fullscreen))
style |= WS_VSCROLL;
else
style &= ~WS_VSCROLL;
@ -5975,7 +5975,7 @@ static void clear_full_screen()
style &= ~WS_THICKFRAME;
else
style |= WS_THICKFRAME;
if (conf_get_int(conf, CONF_scrollbar))
if (conf_get_bool(conf, CONF_scrollbar))
style |= WS_VSCROLL;
else
style &= ~WS_VSCROLL;

View File

@ -362,7 +362,7 @@ int main(int argc, char **argv)
/* change trailing blank to NUL */
conf_set_str(conf, CONF_remote_cmd, command);
conf_set_str(conf, CONF_remote_cmd2, "");
conf_set_int(conf, CONF_nopty, true); /* command => no tty */
conf_set_bool(conf, CONF_nopty, true); /* command => no tty */
break; /* done with cmdline */
} else {
@ -389,7 +389,7 @@ int main(int argc, char **argv)
* Apply subsystem status.
*/
if (use_subsystem)
conf_set_int(conf, CONF_ssh_subsys, true);
conf_set_bool(conf, CONF_ssh_subsys, true);
if (!*conf_get_str(conf, CONF_remote_cmd) &&
!*conf_get_str(conf, CONF_remote_cmd2) &&
@ -419,10 +419,10 @@ int main(int argc, char **argv)
* the "simple" flag.
*/
if (conf_get_int(conf, CONF_protocol) == PROT_SSH &&
!conf_get_int(conf, CONF_x11_forward) &&
!conf_get_int(conf, CONF_agentfwd) &&
!conf_get_bool(conf, CONF_x11_forward) &&
!conf_get_bool(conf, CONF_agentfwd) &&
!conf_get_str_nthstrkey(conf, CONF_portfwd, 0))
conf_set_int(conf, CONF_ssh_simple, true);
conf_set_bool(conf, CONF_ssh_simple, true);
logctx = log_init(default_logpolicy, conf);
@ -451,14 +451,14 @@ int main(int argc, char **argv)
const char *error;
char *realhost;
/* nodelay is only useful if stdin is a character device (console) */
int nodelay = conf_get_int(conf, CONF_tcp_nodelay) &&
int nodelay = conf_get_bool(conf, CONF_tcp_nodelay) &&
(GetFileType(GetStdHandle(STD_INPUT_HANDLE)) == FILE_TYPE_CHAR);
error = backend_init(vt, plink_seat, &backend, logctx, conf,
conf_get_str(conf, CONF_host),
conf_get_int(conf, CONF_port),
&realhost, nodelay,
conf_get_int(conf, CONF_tcp_keepalives));
conf_get_bool(conf, CONF_tcp_keepalives));
if (error) {
fprintf(stderr, "Unable to open connection:\n%s", error);
return 1;