diff --git a/agentf.c b/agentf.c index e2a26065..db4f702a 100644 --- a/agentf.c +++ b/agentf.c @@ -178,10 +178,10 @@ Channel *agentf_new(SshChannel *c) af->c = c; af->chan.vt = &agentf_channelvt; af->chan.initial_fixed_window_size = 0; - af->rcvd_eof = FALSE; + af->rcvd_eof = false; bufchain_init(&af->inbuffer); af->pending = NULL; - af->input_wanted = TRUE; + af->input_wanted = true; return &af->chan; } @@ -220,7 +220,7 @@ static void agentf_send_eof(Channel *chan) assert(chan->vt == &agentf_channelvt); agentf *af = container_of(chan, agentf, chan); - af->rcvd_eof = TRUE; + af->rcvd_eof = true; /* Call try_forward, which will respond to the EOF now if * appropriate, or wait until the queue of outstanding requests is diff --git a/callback.c b/callback.c index 6a888e89..b0ecbca2 100644 --- a/callback.c +++ b/callback.c @@ -29,7 +29,7 @@ void request_callback_notifications(toplevel_callback_notify_fn_t fn, static void run_idempotent_callback(void *ctx) { struct IdempotentCallback *ic = (struct IdempotentCallback *)ctx; - ic->queued = FALSE; + ic->queued = false; ic->fn(ic->ctx); } @@ -37,7 +37,7 @@ void queue_idempotent_callback(struct IdempotentCallback *ic) { if (ic->queued) return; - ic->queued = TRUE; + ic->queued = true; queue_toplevel_callback(run_idempotent_callback, ic); } @@ -101,7 +101,7 @@ void queue_toplevel_callback(toplevel_callback_fn_t fn, void *ctx) int run_toplevel_callbacks(void) { - int done_something = FALSE; + int done_something = false; if (cbhead) { /* @@ -122,7 +122,7 @@ int run_toplevel_callbacks(void) sfree(cbcurr); cbcurr = NULL; - done_something = TRUE; + done_something = true; } return done_something; } diff --git a/cmdgen.c b/cmdgen.c index 78ac274e..16c63a5d 100644 --- a/cmdgen.c +++ b/cmdgen.c @@ -134,7 +134,7 @@ void help(void) */ printf("PuTTYgen: key generator and converter for the PuTTY tools\n" "%s\n", ver); - usage(FALSE); + usage(false); printf(" -t specify key type when generating (ed25519, ecdsa, rsa, " "dsa, rsa1)\n" " -b specify number of bits when generating key\n" @@ -177,9 +177,9 @@ static int move(char *from, char *to) } if (ret) { perror("puttygen: cannot move new file on to old one"); - return FALSE; + return false; } - return TRUE; + return true; } static char *readpassphrase(const char *filename) @@ -208,7 +208,7 @@ static char *readpassphrase(const char *filename) #define DEFAULT_RSADSA_BITS 2048 /* For Unix in particular, but harmless if this main() is reused elsewhere */ -const int buildinfo_gtk_relevant = FALSE; +const int buildinfo_gtk_relevant = false; int main(int argc, char **argv) { @@ -220,8 +220,8 @@ int main(int argc, char **argv) OPENSSH_NEW, SSHCOM } outtype = PRIVATE; int bits = -1; char *comment = NULL, *origcomment = NULL; - int change_passphrase = FALSE; - int errs = FALSE, nogo = FALSE; + int change_passphrase = false; + int errs = false, nogo = false; int intype = SSH_KEYTYPE_UNOPENABLE; int sshver = 0; struct ssh2_userkey *ssh2key = NULL; @@ -242,7 +242,7 @@ int main(int argc, char **argv) * return success. */ if (argc <= 1) { - usage(TRUE); + usage(true); return 0; } @@ -275,68 +275,68 @@ int main(int argc, char **argv) if (!strcmp(opt, "-help")) { if (val) { - errs = TRUE; + errs = true; fprintf(stderr, "puttygen: option `-%s'" " expects no argument\n", opt); } else { help(); - nogo = TRUE; + nogo = true; } } else if (!strcmp(opt, "-version")) { if (val) { - errs = TRUE; + errs = true; fprintf(stderr, "puttygen: option `-%s'" " expects no argument\n", opt); } else { showversion(); - nogo = TRUE; + nogo = true; } } else if (!strcmp(opt, "-pgpfp")) { if (val) { - errs = TRUE; + errs = true; fprintf(stderr, "puttygen: option `-%s'" " expects no argument\n", opt); } else { /* support --pgpfp for consistency */ pgp_fingerprints(); - nogo = TRUE; + nogo = true; } } else if (!strcmp(opt, "-old-passphrase")) { if (!val && argc > 1) --argc, val = *++argv; if (!val) { - errs = TRUE; + errs = true; fprintf(stderr, "puttygen: option `-%s'" " expects an argument\n", opt); } else { old_passphrase = readpassphrase(val); if (!old_passphrase) - errs = TRUE; + errs = true; } } else if (!strcmp(opt, "-new-passphrase")) { if (!val && argc > 1) --argc, val = *++argv; if (!val) { - errs = TRUE; + errs = true; fprintf(stderr, "puttygen: option `-%s'" " expects an argument\n", opt); } else { new_passphrase = readpassphrase(val); if (!new_passphrase) - errs = TRUE; + errs = true; } } else if (!strcmp(opt, "-random-device")) { if (!val && argc > 1) --argc, val = *++argv; if (!val) { - errs = TRUE; + errs = true; fprintf(stderr, "puttygen: option `-%s'" " expects an argument\n", opt); } else { random_device = val; } } else { - errs = TRUE; + errs = true; fprintf(stderr, "puttygen: no such option `-%s'\n", opt); } @@ -356,14 +356,14 @@ int main(int argc, char **argv) switch (c) { case 'h': help(); - nogo = TRUE; + nogo = true; break; case 'V': showversion(); - nogo = TRUE; + nogo = true; break; case 'P': - change_passphrase = TRUE; + change_passphrase = true; break; case 'l': outtype = FP; @@ -393,7 +393,7 @@ int main(int argc, char **argv) else if (!*p) { fprintf(stderr, "puttygen: option `-%c' expects a" " parameter\n", c); - errs = TRUE; + errs = true; } /* * Now c is the option and p is the parameter. @@ -413,7 +413,7 @@ int main(int argc, char **argv) else { fprintf(stderr, "puttygen: unknown key type `%s'\n", p); - errs = TRUE; + errs = true; } break; case 'b': @@ -440,7 +440,7 @@ int main(int argc, char **argv) else { fprintf(stderr, "puttygen: unknown output type `%s'\n", p); - errs = TRUE; + errs = true; } break; case 'o': @@ -453,7 +453,7 @@ int main(int argc, char **argv) /* * Unrecognised option. */ - errs = TRUE; + errs = true; fprintf(stderr, "puttygen: no such option `-%c'\n", c); break; } @@ -465,7 +465,7 @@ int main(int argc, char **argv) if (!infile) infile = p; else { - errs = TRUE; + errs = true; fprintf(stderr, "puttygen: cannot handle more than one" " input file\n"); } @@ -492,19 +492,19 @@ int main(int argc, char **argv) if (keytype == ECDSA && (bits != 256 && bits != 384 && bits != 521)) { fprintf(stderr, "puttygen: invalid bits for ECDSA, choose 256, 384 or 521\n"); - errs = TRUE; + errs = true; } if (keytype == ED25519 && (bits != 256)) { fprintf(stderr, "puttygen: invalid bits for ED25519, choose 256\n"); - errs = TRUE; + errs = true; } if (keytype == RSA2 || keytype == RSA1 || keytype == DSA) { if (bits < 256) { fprintf(stderr, "puttygen: cannot generate %s keys shorter than" " 256 bits\n", (keytype == DSA ? "DSA" : "RSA")); - errs = TRUE; + errs = true; } else if (bits < DEFAULT_RSADSA_BITS) { fprintf(stderr, "puttygen: warning: %s keys shorter than" " %d bits are probably not secure\n", @@ -524,7 +524,7 @@ int main(int argc, char **argv) * ones, print the usage message and return failure. */ if (!infile && keytype == NOKEYGEN) { - usage(TRUE); + usage(true); return 1; } @@ -648,9 +648,9 @@ int main(int argc, char **argv) intype == SSH_KEYTYPE_OPENSSH_PEM || intype == SSH_KEYTYPE_OPENSSH_NEW || intype == SSH_KEYTYPE_SSHCOM) - load_encrypted = TRUE; + load_encrypted = true; else - load_encrypted = FALSE; + load_encrypted = false; if (load_encrypted && (intype == SSH_KEYTYPE_SSH1_PUBLIC || intype == SSH_KEYTYPE_SSH2_PUBLIC_RFC4716 || @@ -756,9 +756,9 @@ int main(int argc, char **argv) if (!old_passphrase) { prompts_t *p = new_prompts(); int ret; - p->to_server = FALSE; + p->to_server = false; p->name = dupstr("SSH key passphrase"); - add_prompt(p, dupstr("Enter passphrase to load key: "), FALSE); + add_prompt(p, dupstr("Enter passphrase to load key: "), false); ret = console_get_userpass_input(p); assert(ret >= 0); if (!ret) { @@ -891,10 +891,10 @@ int main(int argc, char **argv) prompts_t *p = new_prompts(NULL); int ret; - p->to_server = FALSE; + p->to_server = false; p->name = dupstr("New SSH key passphrase"); - add_prompt(p, dupstr("Enter passphrase to save key: "), FALSE); - add_prompt(p, dupstr("Re-enter passphrase to verify: "), FALSE); + add_prompt(p, dupstr("Enter passphrase to save key: "), false); + add_prompt(p, dupstr("Re-enter passphrase to verify: "), false); ret = console_get_userpass_input(p); assert(ret >= 0); if (!ret) { @@ -960,7 +960,7 @@ int main(int argc, char **argv) FILE *fp; if (outfile) { - fp = f_open(outfilename, "w", FALSE); + fp = f_open(outfilename, "w", false); if (!fp) { fprintf(stderr, "unable to open output file\n"); exit(1); @@ -1009,7 +1009,7 @@ int main(int argc, char **argv) } if (outfile) { - fp = f_open(outfilename, "w", FALSE); + fp = f_open(outfilename, "w", false); if (!fp) { fprintf(stderr, "unable to open output file\n"); exit(1); diff --git a/cmdline.c b/cmdline.c index cf25e584..5e94e866 100644 --- a/cmdline.c +++ b/cmdline.c @@ -159,8 +159,8 @@ static int cmdline_check_unavailable(int flag, const char *p) if (need_save < 0) return x; \ } while (0) -static int seen_hostname_argument = FALSE; -static int seen_port_argument = FALSE; +static int seen_hostname_argument = false; +static int seen_port_argument = false; int cmdline_process_param(const char *p, char *value, int need_save, Conf *conf) @@ -227,7 +227,7 @@ int cmdline_process_param(const char *p, char *value, buf = dupprintf("%.*s", (int)(p - host), host); conf_set_str(conf, CONF_host, buf); sfree(buf); - seen_hostname_argument = TRUE; + seen_hostname_argument = true; } /* @@ -243,7 +243,7 @@ int cmdline_process_param(const char *p, char *value, * the next argument as a separate port; this one * counts as explicitly provided. */ - seen_port_argument = TRUE; + seen_port_argument = true; } else { conf_set_int(conf, CONF_port, -1); } @@ -322,7 +322,7 @@ int cmdline_process_param(const char *p, char *value, while (len > 0 && (hostname[len-1] == ' ' || hostname[len-1] == '\t')) hostname[--len] = '\0'; - seen_hostname_argument = TRUE; + seen_hostname_argument = true; conf_set_str(conf, CONF_host, hostname); if ((cmdline_tooltype & TOOLTYPE_HOST_ARG_CAN_BE_SESSION) && @@ -353,7 +353,7 @@ int cmdline_process_param(const char *p, char *value, do_defaults(hostname_after_user, conf2); if (conf_launchable(conf2)) { conf_copy_into(conf, conf2); - loaded_session = TRUE; + loaded_session = true; /* And override the username if one was given. */ if (user) conf_set_str(conf, CONF_username, user); @@ -385,7 +385,7 @@ int cmdline_process_param(const char *p, char *value, int retd = cmdline_process_param("-P", dup, 1, conf); sfree(dup); assert(retd == 2); - seen_port_argument = TRUE; + seen_port_argument = true; return 1; } else { /* @@ -401,7 +401,7 @@ int cmdline_process_param(const char *p, char *value, /* This parameter must be processed immediately rather than being * saved. */ do_defaults(value, conf); - loaded_session = TRUE; + loaded_session = true; cmdline_session_name = dupstr(value); return 2; } @@ -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_int(conf, CONF_nopty, true); /* command => no terminal */ sfree(command); } if (!strcmp(p, "-P")) { @@ -626,26 +626,26 @@ 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_int(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_int(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_int(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_int(conf, CONF_ssh_connection_sharing, false); } if (!strcmp(p, "-A")) { RETURN(1); @@ -860,7 +860,7 @@ int cmdline_process_param(const char *p, char *value, !strcmp(p, "-restrictacl")) { RETURN(1); restrict_process_acl(); - restricted_acl = TRUE; + restricted_acl = true; } #endif @@ -884,7 +884,7 @@ void cmdline_run_saved(Conf *conf) int cmdline_host_ok(Conf *conf) { /* - * Return TRUE if the command-line arguments we've processed in + * Return true if the command-line arguments we've processed in * TOOLTYPE_HOST_ARG mode are sufficient to justify launching a * session. */ @@ -895,7 +895,7 @@ int cmdline_host_ok(Conf *conf) * clearly no. */ if (!conf_launchable(conf)) - return FALSE; + return false; /* * But also, if we haven't seen either a -load option or a @@ -908,7 +908,7 @@ int cmdline_host_ok(Conf *conf) * option to connect to something else or change the setting. */ if (!seen_hostname_argument && !loaded_session) - return FALSE; + return false; - return TRUE; + return true; } diff --git a/conf.c b/conf.c index 118e5944..a8578b10 100644 --- a/conf.c +++ b/conf.c @@ -513,11 +513,11 @@ int conf_deserialise(Conf *conf, BinarySource *src) primary = get_uint32(src); if (get_err(src)) - return FALSE; + return false; if (primary == 0xFFFFFFFFU) - return TRUE; + return true; if (primary >= N_CONFIG_OPTIONS) - return FALSE; + return false; entry = snew(struct conf_entry); entry->key.primary = primary; @@ -548,7 +548,7 @@ int conf_deserialise(Conf *conf, BinarySource *src) if (get_err(src)) { free_entry(entry); - return FALSE; + return false; } conf_insert(conf, entry); diff --git a/config.c b/config.c index 18c41f8f..3205b862 100644 --- a/config.c +++ b/config.c @@ -340,11 +340,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_int(conf, CONF_app_keypad, false); + conf_set_int(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_int(conf, CONF_nethack_keypad, false); } } } @@ -613,7 +613,7 @@ struct sessionsaver_data { static void sessionsaver_data_free(void *ssdv) { struct sessionsaver_data *ssd = (struct sessionsaver_data *)ssdv; - get_sesslist(&ssd->sesslist, FALSE); + get_sesslist(&ssd->sesslist, false); sfree(ssd->savedsession); sfree(ssd); } @@ -685,7 +685,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, dlg_listbox_select(ssd->listbox, dlg, top); } } else if (event == EVENT_ACTION) { - int mbl = FALSE; + int mbl = false; if (!ssd->midsession && (ctrl == ssd->listbox || (ssd->loadbutton && ctrl == ssd->loadbutton))) { @@ -720,8 +720,8 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, sfree(errmsg); } } - get_sesslist(&ssd->sesslist, FALSE); - get_sesslist(&ssd->sesslist, TRUE); + get_sesslist(&ssd->sesslist, false); + get_sesslist(&ssd->sesslist, true); dlg_refresh(ssd->editbox, dlg); dlg_refresh(ssd->listbox, dlg); } else if (!ssd->midsession && @@ -731,8 +731,8 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, dlg_beep(dlg); } else { del_settings(ssd->sesslist.sessions[i]); - get_sesslist(&ssd->sesslist, FALSE); - get_sesslist(&ssd->sesslist, TRUE); + get_sesslist(&ssd->sesslist, false); + get_sesslist(&ssd->sesslist, true); dlg_refresh(ssd->listbox, dlg); } } else if (ctrl == ssd->okbutton) { @@ -751,7 +751,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg, if (dlg_last_focused(ctrl, dlg) == ssd->listbox && !conf_launchable(conf)) { Conf *conf2 = conf_new(); - int mbl = FALSE; + int mbl = false; if (!load_selected_session(ssd, dlg, conf2, &mbl)) { dlg_beep(dlg); conf_free(conf2); @@ -847,7 +847,7 @@ static void colour_handler(union control *ctrl, dlgparam *dlg, Conf *conf = (Conf *)data; struct colour_data *cd = (struct colour_data *)ctrl->generic.context.p; - int update = FALSE, clear = FALSE, r, g, b; + int update = false, clear = false, r, g, b; if (event == EVENT_REFRESH) { if (ctrl == cd->listbox) { @@ -857,22 +857,22 @@ static void colour_handler(union control *ctrl, dlgparam *dlg, for (i = 0; i < lenof(colours); i++) dlg_listbox_add(ctrl, dlg, colours[i]); dlg_update_done(ctrl, dlg); - clear = TRUE; - update = TRUE; + clear = true; + update = true; } } else if (event == EVENT_SELCHANGE) { if (ctrl == cd->listbox) { /* The user has selected a colour. Update the RGB text. */ int i = dlg_listbox_index(ctrl, dlg); if (i < 0) { - clear = TRUE; + clear = true; } else { - clear = FALSE; + clear = false; r = conf_get_int_int(conf, CONF_colours, i*3+0); g = conf_get_int_int(conf, CONF_colours, i*3+1); b = conf_get_int_int(conf, CONF_colours, i*3+2); } - update = TRUE; + update = true; } } else if (event == EVENT_VALCHANGE) { if (ctrl == cd->redit || ctrl == cd->gedit || ctrl == cd->bedit) { @@ -925,8 +925,8 @@ static void colour_handler(union control *ctrl, dlgparam *dlg, conf_set_int_int(conf, CONF_colours, i*3+0, r); conf_set_int_int(conf, CONF_colours, i*3+1, g); conf_set_int_int(conf, CONF_colours, i*3+2, b); - clear = FALSE; - update = TRUE; + clear = false; + update = true; } } } @@ -1468,11 +1468,11 @@ void setup_config_box(struct controlbox *b, int midsession, (char)(midsession ? 'a' : 'o'), HELPCTX(no_help), sessionsaver_handler, P(ssd)); - ssd->okbutton->button.isdefault = TRUE; + ssd->okbutton->button.isdefault = true; ssd->okbutton->generic.column = 3; ssd->cancelbutton = ctrl_pushbutton(s, "Cancel", 'c', HELPCTX(no_help), sessionsaver_handler, P(ssd)); - ssd->cancelbutton->button.iscancel = TRUE; + ssd->cancelbutton->button.iscancel = true; ssd->cancelbutton->generic.column = 4; /* We carefully don't close the 5-column part, so that platform- * specific add-ons can put extra buttons alongside Open and Cancel. */ @@ -1530,7 +1530,7 @@ void setup_config_box(struct controlbox *b, int midsession, midsession ? "Save the current session settings" : "Load, save or delete a stored session"); ctrl_columns(s, 2, 75, 25); - get_sesslist(&ssd->sesslist, TRUE); + get_sesslist(&ssd->sesslist, true); ssd->editbox = ctrl_editbox(s, "Saved Sessions", 'e', 100, HELPCTX(session_saved), sessionsaver_handler, P(ssd), P(NULL)); @@ -1613,7 +1613,7 @@ void setup_config_box(struct controlbox *b, int midsession, NULL); } ctrl_filesel(s, "Log file name:", 'f', - NULL, TRUE, "Select session log file name", + NULL, true, "Select session log file name", HELPCTX(logging_filename), conf_filesel_handler, I(CONF_logfilename)); ctrl_text(s, "(Log file name can contain &Y, &M, &D for date," @@ -2144,8 +2144,8 @@ void setup_config_box(struct controlbox *b, int midsession, HELPCTX(connection_username_from_env), conf_radiobutton_handler, I(CONF_username_from_env), - "Prompt", I(FALSE), - userlabel, I(TRUE), + "Prompt", I(false), + userlabel, I(true), NULL); sfree(userlabel); } @@ -2482,7 +2482,7 @@ void setup_config_box(struct controlbox *b, int midsession, * it become really unhelpful if a horizontal scrollbar * appears, so we suppress that. */ mh->listbox->listbox.height = 2; - mh->listbox->listbox.hscroll = FALSE; + mh->listbox->listbox.hscroll = false; ctrl_tabdelay(s, mh->rembutton); mh->keybox = ctrl_editbox(s, "Key", 'k', 80, HELPCTX(ssh_kex_manual_hostkeys), @@ -2558,7 +2558,7 @@ void setup_config_box(struct controlbox *b, int midsession, conf_checkbox_handler, I(CONF_change_username)); ctrl_filesel(s, "Private key file for authentication:", 'k', - FILTER_KEY_FILES, FALSE, "Select private key file", + FILTER_KEY_FILES, false, "Select private key file", HELPCTX(ssh_auth_privkey), conf_filesel_handler, I(CONF_keyfile)); @@ -2615,7 +2615,7 @@ void setup_config_box(struct controlbox *b, int midsession, */ ctrl_filesel(s, "User-supplied GSSAPI library path:", 's', - FILTER_DYNLIB_FILES, FALSE, "Select library file", + FILTER_DYNLIB_FILES, false, "Select library file", HELPCTX(ssh_gssapi_libraries), conf_filesel_handler, I(CONF_ssh_gss_custom)); diff --git a/contrib/cygtermd/telnet.c b/contrib/cygtermd/telnet.c index a41e6cea..6c96eed5 100644 --- a/contrib/cygtermd/telnet.c +++ b/contrib/cygtermd/telnet.c @@ -5,6 +5,7 @@ #include #include +#include #include #include "sel.h" @@ -12,13 +13,6 @@ #include "malloc.h" #include "pty.h" -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - #define IAC 255 /* interpret as command: */ #define DONT 254 /* you are not to use option */ #define DO 253 /* please, you use option */ diff --git a/defs.h b/defs.h index 809f7ed4..6a789389 100644 --- a/defs.h +++ b/defs.h @@ -13,6 +13,7 @@ #include #include +#include #if defined _MSC_VER && _MSC_VER < 1800 /* Work around lack of inttypes.h in older MSVC */ @@ -22,13 +23,6 @@ #include #endif -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - typedef struct conf_tag Conf; typedef struct terminal_tag Terminal; diff --git a/dialog.c b/dialog.c index 31a9627b..e712c452 100644 --- a/dialog.c +++ b/dialog.c @@ -364,7 +364,7 @@ union control *ctrl_listbox(struct controlset *s, const char *label, c->listbox.percentwidth = 100; c->listbox.ncols = 0; c->listbox.percentages = NULL; - c->listbox.hscroll = TRUE; + c->listbox.hscroll = true; return c; } @@ -381,7 +381,7 @@ union control *ctrl_droplist(struct controlset *s, const char *label, c->listbox.percentwidth = percentage; c->listbox.ncols = 0; c->listbox.percentages = NULL; - c->listbox.hscroll = FALSE; + c->listbox.hscroll = false; return c; } @@ -398,7 +398,7 @@ union control *ctrl_draglist(struct controlset *s, const char *label, c->listbox.percentwidth = 100; c->listbox.ncols = 0; c->listbox.percentages = NULL; - c->listbox.hscroll = FALSE; + c->listbox.hscroll = false; return c; } diff --git a/dialog.h b/dialog.h index 4b708489..fe32da72 100644 --- a/dialog.h +++ b/dialog.h @@ -340,7 +340,7 @@ union control { int ncols; /* number of columns */ int *percentages; /* % width of each column */ /* - * Flag which can be set to FALSE to suppress the horizontal + * Flag which can be set to false to suppress the horizontal * scroll bar if a list box entry goes off the right-hand * side. */ diff --git a/fuzzterm.c b/fuzzterm.c index d6a8337f..2e35677f 100644 --- a/fuzzterm.c +++ b/fuzzterm.c @@ -7,7 +7,7 @@ #include "terminal.h" /* For Unix in particular, but harmless if this main() is reused elsewhere */ -const int buildinfo_gtk_relevant = FALSE; +const int buildinfo_gtk_relevant = false; static const TermWinVtable fuzz_termwin_vt; @@ -44,7 +44,7 @@ int main(int argc, char **argv) } /* functions required by terminal.c */ -static int fuzz_setup_draw_ctx(TermWin *tw) { return TRUE; } +static int fuzz_setup_draw_ctx(TermWin *tw) { return true; } static void fuzz_draw_text( TermWin *tw, int x, int y, wchar_t *text, int len, unsigned long attr, int lattr, truecolour tc) @@ -84,18 +84,18 @@ static void fuzz_request_resize(TermWin *tw, int w, int h) {} static void fuzz_set_title(TermWin *tw, const char *title) {} static void fuzz_set_icon_title(TermWin *tw, const char *icontitle) {} static void fuzz_set_minimised(TermWin *tw, int minimised) {} -static int fuzz_is_minimised(TermWin *tw) { return FALSE; } +static int fuzz_is_minimised(TermWin *tw) { return false; } static void fuzz_set_maximised(TermWin *tw, int maximised) {} static void fuzz_move(TermWin *tw, int x, int y) {} static void fuzz_set_zorder(TermWin *tw, int top) {} static int fuzz_palette_get(TermWin *tw, int n, int *r, int *g, int *b) -{ return FALSE; } +{ return false; } static void fuzz_palette_set(TermWin *tw, int n, int r, int g, int b) {} static void fuzz_palette_reset(TermWin *tw) {} static void fuzz_get_pos(TermWin *tw, int *x, int *y) { *x = *y = 0; } static void fuzz_get_pixels(TermWin *tw, int *x, int *y) { *x = *y = 0; } static const char *fuzz_get_title(TermWin *tw, int icon) { return "moo"; } -static int fuzz_is_utf8(TermWin *tw) { return TRUE; } +static int fuzz_is_utf8(TermWin *tw) { return true; } static const TermWinVtable fuzz_termwin_vt = { fuzz_setup_draw_ctx, diff --git a/import.c b/import.c index 66be77cb..d3b1d331 100644 --- a/import.c +++ b/import.c @@ -316,7 +316,7 @@ static struct openssh_pem_key *load_openssh_pem_key(const Filename *filename, ret = snew(struct openssh_pem_key); ret->keyblob = strbuf_new(); - fp = f_open(filename, "r", FALSE); + fp = f_open(filename, "r", false); if (!fp) { errmsg = "unable to open key file"; goto error; @@ -355,7 +355,7 @@ static struct openssh_pem_key *load_openssh_pem_key(const Filename *filename, sfree(line); line = NULL; - ret->encrypted = FALSE; + ret->encrypted = false; memset(ret->iv, 0, sizeof(ret->iv)); headers_done = 0; @@ -385,7 +385,7 @@ static struct openssh_pem_key *load_openssh_pem_key(const Filename *filename, } p += 2; if (!strcmp(p, "ENCRYPTED")) - ret->encrypted = TRUE; + ret->encrypted = true; } else if (!strcmp(line, "DEK-Info")) { int i, ivlen; @@ -1048,7 +1048,7 @@ int openssh_pem_write(const Filename *filename, struct ssh2_userkey *key, * And save it. We'll use Unix line endings just in case it's * subsequently transferred in binary mode. */ - fp = f_open(filename, "wb", TRUE); /* ensure Unix line endings */ + fp = f_open(filename, "wb", true); /* ensure Unix line endings */ if (!fp) goto error; fputs(header, fp); @@ -1125,7 +1125,7 @@ static struct openssh_new_key *load_openssh_new_key(const Filename *filename, ret->keyblob = NULL; ret->keyblob_len = ret->keyblob_size = 0; - fp = f_open(filename, "r", FALSE); + fp = f_open(filename, "r", false); if (!fp) { errmsg = "unable to open key file"; goto error; @@ -1621,7 +1621,7 @@ int openssh_new_write(const Filename *filename, struct ssh2_userkey *key, * And save it. We'll use Unix line endings just in case it's * subsequently transferred in binary mode. */ - fp = f_open(filename, "wb", TRUE); /* ensure Unix line endings */ + fp = f_open(filename, "wb", true); /* ensure Unix line endings */ if (!fp) goto error; fputs("-----BEGIN OPENSSH PRIVATE KEY-----\n", fp); @@ -1762,7 +1762,7 @@ static struct sshcom_key *load_sshcom_key(const Filename *filename, ret->keyblob = NULL; ret->keyblob_len = ret->keyblob_size = 0; - fp = f_open(filename, "r", FALSE); + fp = f_open(filename, "r", false); if (!fp) { errmsg = "unable to open key file"; goto error; @@ -1910,7 +1910,7 @@ int sshcom_encrypted(const Filename *filename, char **comment) struct sshcom_key *key = load_sshcom_key(filename, NULL); BinarySource src[1]; ptrlen str; - int answer = FALSE; + int answer = false; *comment = NULL; if (!key) @@ -1926,7 +1926,7 @@ int sshcom_encrypted(const Filename *filename, char **comment) if (get_err(src)) goto done; /* key is invalid */ if (!ptrlen_eq_string(str, "none")) - answer = TRUE; + answer = true; done: if (key) { @@ -2338,7 +2338,7 @@ int sshcom_write(const Filename *filename, struct ssh2_userkey *key, * And save it. We'll use Unix line endings just in case it's * subsequently transferred in binary mode. */ - fp = f_open(filename, "wb", TRUE); /* ensure Unix line endings */ + fp = f_open(filename, "wb", true); /* ensure Unix line endings */ if (!fp) goto error; fputs("---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----\n", fp); diff --git a/ldisc.c b/ldisc.c index a72adbcb..449e6659 100644 --- a/ldisc.c +++ b/ldisc.c @@ -233,7 +233,7 @@ void ldisc_send(Ldisc *ldisc, const void *vbuf, int len, int interactive) } break; case CTRL('V'): /* quote next char */ - ldisc->quotenext = TRUE; + ldisc->quotenext = true; break; case CTRL('D'): /* logout or send */ if (ldisc->buflen == 0) { @@ -298,7 +298,7 @@ void ldisc_send(Ldisc *ldisc, const void *vbuf, int len, int interactive) ldisc->buf[ldisc->buflen++] = c; if (ECHOING) pwrite(ldisc, (unsigned char) c); - ldisc->quotenext = FALSE; + ldisc->quotenext = false; break; } } diff --git a/logging.c b/logging.c index a04ca633..bf747b27 100644 --- a/logging.c +++ b/logging.c @@ -87,18 +87,18 @@ static void logfopen_callback(void *vctx, int mode) char buf[256], *event; struct tm tm; const char *fmode; - int shout = FALSE; + int shout = false; if (mode == 0) { ctx->state = L_ERROR; /* disable logging */ } else { fmode = (mode == 1 ? "ab" : "wb"); - ctx->lgfp = f_open(ctx->currlogfilename, fmode, FALSE); + ctx->lgfp = f_open(ctx->currlogfilename, fmode, false); if (ctx->lgfp) { ctx->state = L_OPEN; } else { ctx->state = L_ERROR; - shout = TRUE; + shout = true; } } @@ -425,9 +425,9 @@ void log_reconfig(LogContext *ctx, Conf *conf) conf_get_filename(conf, CONF_logfilename)) || conf_get_int(ctx->conf, CONF_logtype) != conf_get_int(conf, CONF_logtype)) - reset_logging = TRUE; + reset_logging = true; else - reset_logging = FALSE; + reset_logging = false; if (reset_logging) logfclose(ctx); @@ -463,7 +463,7 @@ static Filename *xlatlognam(Filename *src, char *hostname, int port, s = filename_to_str(src); while (*s) { - int sanitise = FALSE; + int sanitise = false; /* Let (bufp, len) be the string to append. */ bufp = buf; /* don't usually override this */ if (*s == '&') { @@ -501,7 +501,7 @@ static Filename *xlatlognam(Filename *src, char *hostname, int port, * auto-format directives. E.g. 'hostname' can contain * colons, if it's an IPv6 address, and colons aren't * legal in filenames on Windows. */ - sanitise = TRUE; + sanitise = true; } else { buf[0] = *s++; size = 1; diff --git a/mainchan.c b/mainchan.c index c0738151..bf2deabb 100644 --- a/mainchan.c +++ b/mainchan.c @@ -139,7 +139,7 @@ static void mainchan_open_confirmation(Channel *chan) char *key, *val, *cmd; struct X11Display *x11disp; struct X11FakeAuth *x11auth; - int retry_cmd_now = FALSE; + int retry_cmd_now = false; if (conf_get_int(mc->conf, CONF_x11_forward)) {; char *x11_setup_err; @@ -154,27 +154,27 @@ static void mainchan_open_confirmation(Channel *chan) mc->cl, conf_get_int(mc->conf, CONF_x11_auth), x11disp); sshfwd_request_x11_forwarding( - mc->sc, TRUE, x11auth->protoname, x11auth->datastring, - x11disp->screennum, FALSE); - mc->req_x11 = TRUE; + mc->sc, true, x11auth->protoname, x11auth->datastring, + x11disp->screennum, false); + mc->req_x11 = true; } } if (ssh_agent_forwarding_permitted(mc->cl)) { - sshfwd_request_agent_forwarding(mc->sc, TRUE); - mc->req_agent = TRUE; + sshfwd_request_agent_forwarding(mc->sc, true); + mc->req_agent = true; } if (!conf_get_int(mc->conf, CONF_nopty)) { sshfwd_request_pty( - mc->sc, TRUE, mc->conf, mc->term_width, mc->term_height); - mc->req_pty = TRUE; + mc->sc, true, mc->conf, mc->term_width, mc->term_height); + mc->req_pty = true; } for (val = conf_get_str_strs(mc->conf, CONF_environmt, NULL, &key); val != NULL; val = conf_get_str_strs(mc->conf, CONF_environmt, key, &key)) { - sshfwd_send_env_var(mc->sc, TRUE, key, val); + sshfwd_send_env_var(mc->sc, true, key, val); mc->n_req_env++; } if (mc->n_req_env) @@ -182,21 +182,21 @@ static void mainchan_open_confirmation(Channel *chan) cmd = conf_get_str(mc->conf, CONF_remote_cmd); if (conf_get_int(mc->conf, CONF_ssh_subsys)) { - retry_cmd_now = !sshfwd_start_subsystem(mc->sc, TRUE, cmd); + retry_cmd_now = !sshfwd_start_subsystem(mc->sc, true, cmd); } else if (*cmd) { - sshfwd_start_command(mc->sc, TRUE, cmd); + sshfwd_start_command(mc->sc, true, cmd); } else { - sshfwd_start_shell(mc->sc, TRUE); + sshfwd_start_shell(mc->sc, true); } if (retry_cmd_now) mainchan_try_fallback_command(mc); else - mc->req_cmd_primary = TRUE; + mc->req_cmd_primary = true; } else { - ssh_set_ldisc_option(mc->cl, LD_ECHO, TRUE); - ssh_set_ldisc_option(mc->cl, LD_EDIT, TRUE); + ssh_set_ldisc_option(mc->cl, LD_ECHO, true); + ssh_set_ldisc_option(mc->cl, LD_EDIT, true); mainchan_ready(mc); } } @@ -205,11 +205,11 @@ 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)) { - sshfwd_start_subsystem(mc->sc, TRUE, cmd); + sshfwd_start_subsystem(mc->sc, true, cmd); } else { - sshfwd_start_command(mc->sc, TRUE, cmd); + sshfwd_start_command(mc->sc, true, cmd); } - mc->req_cmd_fallback = TRUE; + mc->req_cmd_fallback = true; } static void mainchan_request_response(Channel *chan, int success) @@ -219,7 +219,7 @@ static void mainchan_request_response(Channel *chan, int success) PacketProtocolLayer *ppl = mc->ppl; /* for ppl_logevent */ if (mc->req_x11) { - mc->req_x11 = FALSE; + mc->req_x11 = false; if (success) { ppl_logevent(("X11 forwarding enabled")); @@ -231,7 +231,7 @@ static void mainchan_request_response(Channel *chan, int success) } if (mc->req_agent) { - mc->req_agent = FALSE; + mc->req_agent = false; if (success) { ppl_logevent(("Agent forwarding enabled")); @@ -243,16 +243,16 @@ static void mainchan_request_response(Channel *chan, int success) } if (mc->req_pty) { - mc->req_pty = FALSE; + mc->req_pty = false; if (success) { ppl_logevent(("Allocated pty")); - mc->got_pty = TRUE; + mc->got_pty = true; } else { ppl_logevent(("Server refused to allocate pty")); ppl_printf(("Server refused to allocate pty\r\n")); - ssh_set_ldisc_option(mc->cl, LD_ECHO, TRUE); - ssh_set_ldisc_option(mc->cl, LD_EDIT, TRUE); + ssh_set_ldisc_option(mc->cl, LD_ECHO, true); + ssh_set_ldisc_option(mc->cl, LD_EDIT, true); } return; } @@ -282,7 +282,7 @@ static void mainchan_request_response(Channel *chan, int success) } if (mc->req_cmd_primary) { - mc->req_cmd_primary = FALSE; + mc->req_cmd_primary = false; if (success) { ppl_logevent(("Started a shell/command")); @@ -302,7 +302,7 @@ static void mainchan_request_response(Channel *chan, int success) } if (mc->req_cmd_fallback) { - mc->req_cmd_fallback = FALSE; + mc->req_cmd_fallback = false; if (success) { ppl_logevent(("Started a shell/command")); @@ -318,14 +318,14 @@ static void mainchan_request_response(Channel *chan, int success) static void mainchan_ready(mainchan *mc) { - mc->ready = TRUE; + mc->ready = true; - ssh_set_wants_user_input(mc->cl, TRUE); + ssh_set_wants_user_input(mc->cl, true); ssh_ppl_got_user_input(mc->ppl); /* in case any is already queued */ /* If an EOF arrived before we were ready, handle it now. */ if (mc->eof_pending) { - mc->eof_pending = FALSE; + mc->eof_pending = false; mainchan_special_cmd(mc, SS_EOF, 0); } @@ -387,8 +387,8 @@ static void mainchan_send_eof(Channel *chan) sshfwd_write_eof(mc->sc); ppl_logevent(("Sent EOF message")); } - mc->eof_sent = TRUE; - ssh_set_wants_user_input(mc->cl, FALSE); /* now stop reading from stdin */ + mc->eof_sent = true; + ssh_set_wants_user_input(mc->cl, false); /* now stop reading from stdin */ } static void mainchan_set_input_wanted(Channel *chan, int wanted) @@ -418,7 +418,7 @@ static int mainchan_rcvd_exit_status(Channel *chan, int status) ssh_got_exitcode(mc->ppl->ssh, status); ppl_logevent(("Session sent command exit status %d", status)); - return TRUE; + return true; } static void mainchan_log_exit_signal_common( @@ -466,7 +466,7 @@ static int mainchan_rcvd_exit_signal( signame_str = dupprintf("signal SIG%.*s", PTRLEN_PRINTF(signame)); mainchan_log_exit_signal_common(mc, signame_str, core_dumped, msg); sfree(signame_str); - return TRUE; + return true; } static int mainchan_rcvd_exit_signal_numeric( @@ -480,7 +480,7 @@ static int mainchan_rcvd_exit_signal_numeric( signum_str = dupprintf("signal %d", signum); mainchan_log_exit_signal_common(mc, signum_str, core_dumped, msg); sfree(signum_str); - return TRUE; + return true; } void mainchan_get_specials( @@ -533,17 +533,17 @@ void mainchan_special_cmd(mainchan *mc, SessionSpecialCode code, int arg) * Buffer the EOF to send as soon as the main channel is * fully set up. */ - mc->eof_pending = TRUE; + mc->eof_pending = true; } else if (!mc->eof_sent) { sshfwd_write_eof(mc->sc); - mc->eof_sent = TRUE; + mc->eof_sent = true; } } else if (code == SS_BRK) { sshfwd_send_serial_break( - mc->sc, FALSE, 0 /* default break length */); + mc->sc, false, 0 /* default break length */); } else if ((signame = ssh_signal_lookup(code)) != NULL) { /* It's a signal. */ - sshfwd_send_signal(mc->sc, FALSE, signame); + sshfwd_send_signal(mc->sc, false, signame); ppl_logevent(("Sent signal SIG%s", signame)); } } diff --git a/marshal.c b/marshal.c index c4fd268b..349367aa 100644 --- a/marshal.c +++ b/marshal.c @@ -88,10 +88,10 @@ int BinarySink_put_pstring(BinarySink *bs, const char *str) { size_t len = strlen(str); if (len > 255) - return FALSE; /* can't write a Pascal-style string this long */ + return false; /* can't write a Pascal-style string this long */ BinarySink_put_byte(bs, len); bs->write(bs, str, len); - return TRUE; + return true; } /* ---------------------------------------------------------------------- */ @@ -99,13 +99,13 @@ int BinarySink_put_pstring(BinarySink *bs, const char *str) static int BinarySource_data_avail(BinarySource *src, size_t wanted) { if (src->err) - return FALSE; + return false; if (wanted <= src->len - src->pos) - return TRUE; + return true; src->err = BSE_OUT_OF_DATA; - return FALSE; + return false; } #define avail(wanted) BinarySource_data_avail(src, wanted) diff --git a/misc.c b/misc.c index 39e77f76..b1f0a0ec 100644 --- a/misc.c +++ b/misc.c @@ -123,7 +123,7 @@ static const char *host_strchr_internal(const char *s, const char *set, } size_t host_strcspn(const char *s, const char *set) { - const char *answer = host_strchr_internal(s, set, TRUE); + const char *answer = host_strchr_internal(s, set, true); if (answer) return answer - s; else @@ -134,14 +134,14 @@ char *host_strchr(const char *s, int c) char set[2]; set[0] = c; set[1] = '\0'; - return (char *) host_strchr_internal(s, set, TRUE); + return (char *) host_strchr_internal(s, set, true); } char *host_strrchr(const char *s, int c) { char set[2]; set[0] = c; set[1] = '\0'; - return (char *) host_strchr_internal(s, set, FALSE); + return (char *) host_strchr_internal(s, set, false); } #ifdef TEST_HOST_STRFOO @@ -235,9 +235,9 @@ prompts_t *new_prompts(void) p->prompts = NULL; p->n_prompts = 0; p->data = NULL; - p->to_server = TRUE; /* to be on the safe side */ + p->to_server = true; /* to be on the safe side */ p->name = p->instruction = NULL; - p->name_reqd = p->instr_reqd = FALSE; + p->name_reqd = p->instr_reqd = false; return p; } void add_prompt(prompts_t *p, char *promptstr, int echo) @@ -830,9 +830,9 @@ int bufchain_try_fetch_consume(bufchain *ch, void *data, int len) { if (ch->buffersize >= len) { bufchain_fetch_consume(ch, data, len); - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -1113,11 +1113,11 @@ void smemclr(void *b, size_t n) { /* * Validate a manual host key specification (either entered in the - * GUI, or via -hostkey). If valid, we return TRUE, and update 'key' + * GUI, or via -hostkey). If valid, we return true, and update 'key' * to contain a canonicalised version of the key string in 'key' * (which is guaranteed to take up at most as much space as the * original version), suitable for putting into the Conf. If not - * valid, we return FALSE. + * valid, we return false. */ int validate_manual_hostkey(char *key) { @@ -1154,7 +1154,7 @@ int validate_manual_hostkey(char *key) for (i = 0; i < 16*3 - 1; i++) key[i] = tolower(q[i]); key[16*3 - 1] = '\0'; - return TRUE; + return true; } not_fingerprint:; @@ -1200,12 +1200,12 @@ int validate_manual_hostkey(char *key) goto not_ssh2_blob; /* sorry */ strcpy(key, q); - return TRUE; + return true; } not_ssh2_blob:; } - return FALSE; + return false; } int smemeq(const void *av, const void *bv, size_t len) @@ -1272,9 +1272,9 @@ int ptrlen_startswith(ptrlen whole, ptrlen prefix, ptrlen *tail) tail->ptr = (const char *)whole.ptr + prefix.len; tail->len = whole.len - prefix.len; } - return TRUE; + return true; } - return FALSE; + return false; } char *mkstr(ptrlen pl) @@ -1391,7 +1391,7 @@ char *buildinfo(const char *newline) int nullseat_output( Seat *seat, int is_stderr, const void *data, int len) { return 0; } -int nullseat_eof(Seat *seat) { return TRUE; } +int nullseat_eof(Seat *seat) { return true; } int nullseat_get_userpass_input( Seat *seat, prompts_t *p, bufchain *input) { return 0; } void nullseat_notify_remote_exit(Seat *seat) {} @@ -1409,13 +1409,13 @@ int nullseat_confirm_weak_crypto_primitive( int nullseat_confirm_weak_cached_hostkey( Seat *seat, const char *algname, const char *betteralgs, void (*callback)(void *ctx, int result), void *ctx) { return 0; } -int nullseat_is_never_utf8(Seat *seat) { return FALSE; } -int nullseat_is_always_utf8(Seat *seat) { return TRUE; } +int nullseat_is_never_utf8(Seat *seat) { return false; } +int nullseat_is_always_utf8(Seat *seat) { return true; } void nullseat_echoedit_update(Seat *seat, int echoing, int editing) {} const char *nullseat_get_x_display(Seat *seat) { return NULL; } -int nullseat_get_windowid(Seat *seat, long *id_out) { return FALSE; } +int nullseat_get_windowid(Seat *seat, long *id_out) { return false; } int nullseat_get_window_pixel_size( - Seat *seat, int *width, int *height) { return FALSE; } + Seat *seat, int *width, int *height) { return false; } void sk_free_peer_info(SocketPeerInfo *pi) { diff --git a/nocmdline.c b/nocmdline.c index a6f62bf5..090bfba7 100644 --- a/nocmdline.c +++ b/nocmdline.c @@ -33,7 +33,7 @@ int cmdline_get_passwd_input(prompts_t *p) int cmdline_process_param(const char *p, char *value, int need_save, Conf *conf) { - assert(FALSE && "cmdline_process_param should never be called"); + assert(false && "cmdline_process_param should never be called"); } /* diff --git a/pageant.c b/pageant.c index bde0f66e..a50a4397 100644 --- a/pageant.c +++ b/pageant.c @@ -27,7 +27,7 @@ int random_byte(void) return 0; /* unreachable, but placate optimiser */ } -static int pageant_local = FALSE; +static int pageant_local = false; /* * rsakeys stores SSH-1 RSA keys. ssh2keys stores all SSH-2 keys. @@ -627,7 +627,7 @@ void pageant_failure_msg(BinarySink *bs, void pageant_init(void) { - pageant_local = TRUE; + pageant_local = true; rsakeys = newtree234(cmpkeys_rsa); ssh2keys = newtree234(cmpkeys_ssh2); } @@ -666,18 +666,18 @@ int pageant_delete_ssh1_key(struct RSAKey *rkey) { struct RSAKey *deleted = del234(rsakeys, rkey); if (!deleted) - return FALSE; + return false; assert(deleted == rkey); - return TRUE; + return true; } int pageant_delete_ssh2_key(struct ssh2_userkey *skey) { struct ssh2_userkey *deleted = del234(ssh2keys, skey); if (!deleted) - return FALSE; + return false; assert(deleted == skey); - return TRUE; + return true; } /* ---------------------------------------------------------------------- @@ -842,7 +842,7 @@ static int pageant_listen_accepting(Plug *plug, if ((err = sk_socket_error(pc->connsock)) != NULL) { sk_close(pc->connsock); sfree(pc); - return TRUE; + return true; } sk_set_frozen(pc->connsock, 0); diff --git a/pinger.c b/pinger.c index e14c32d1..d03210e2 100644 --- a/pinger.c +++ b/pinger.c @@ -20,7 +20,7 @@ static void pinger_timer(void *ctx, unsigned long now) if (pinger->pending && now == pinger->next) { backend_special(pinger->backend, SS_PING, 0); - pinger->pending = FALSE; + pinger->pending = false; pinger_schedule(pinger); } } @@ -30,7 +30,7 @@ static void pinger_schedule(Pinger *pinger) unsigned long next; if (!pinger->interval) { - pinger->pending = FALSE; /* cancel any pending ping */ + pinger->pending = false; /* cancel any pending ping */ return; } @@ -40,7 +40,7 @@ static void pinger_schedule(Pinger *pinger) (next - pinger->when_set) < (pinger->next - pinger->when_set)) { pinger->next = next; pinger->when_set = timing_last_clock(); - pinger->pending = TRUE; + pinger->pending = true; } } @@ -49,7 +49,7 @@ Pinger *pinger_new(Conf *conf, Backend *backend) Pinger *pinger = snew(Pinger); pinger->interval = conf_get_int(conf, CONF_ping_interval); - pinger->pending = FALSE; + pinger->pending = false; pinger->backend = backend; pinger_schedule(pinger); diff --git a/portfwd.c b/portfwd.c index af4b541d..c4a3210b 100644 --- a/portfwd.c +++ b/portfwd.c @@ -254,7 +254,7 @@ static void pfd_receive(Plug *plug, int urgent, char *data, int len) return; if (socks_version == 4 && message_type == 1) { /* CONNECT message */ - int name_based = FALSE; + int name_based = false; port = get_uint16(src); ipv4 = get_uint32(src); @@ -264,7 +264,7 @@ static void pfd_receive(Plug *plug, int urgent, char *data, int len) * extension to specify a hostname, which comes * after the username. */ - name_based = TRUE; + name_based = true; } get_asciz(src); /* skip username */ socks4_hostname = name_based ? get_asciz(src) : NULL; @@ -475,12 +475,12 @@ Channel *portfwd_raw_new(ConnectionLayer *cl, Plug **plug) pf->plug.vt = &PortForwarding_plugvt; pf->chan.initial_fixed_window_size = 0; pf->chan.vt = &PortForwarding_channelvt; - pf->input_wanted = TRUE; + pf->input_wanted = true; pf->c = NULL; pf->cl = cl; - pf->input_wanted = TRUE; + pf->input_wanted = true; pf->ready = 0; pf->socks_state = SOCKS_NONE; @@ -526,7 +526,7 @@ static int pfl_accepting(Plug *p, accept_fn_t constructor, accept_ctx_t ctx) s = constructor(ctx, plug); if ((err = sk_socket_error(s)) != NULL) { portfwd_raw_free(chan); - return TRUE; + return true; } pf = container_of(chan, struct PortForwarding, chan); @@ -581,9 +581,9 @@ static char *pfl_listen(const char *desthost, int destport, if (desthost) { pl->hostname = dupstr(desthost); pl->port = destport; - pl->is_dynamic = FALSE; + pl->is_dynamic = false; } else - pl->is_dynamic = TRUE; + pl->is_dynamic = true; pl->cl = cl; pl->s = new_listener(srcaddr, port, &pl->plug, @@ -1072,7 +1072,7 @@ int portfwdmgr_listen(PortFwdManager *mgr, const char *host, int port, * We had this record already. Return failure. */ pfr_free(pfr); - return FALSE; + return false; } char *err = pfl_listen(keyhost, keyport, host, port, @@ -1085,10 +1085,10 @@ int portfwdmgr_listen(PortFwdManager *mgr, const char *host, int port, sfree(err); del234(mgr->forwardings, pfr); pfr_free(pfr); - return FALSE; + return false; } - return TRUE; + return true; } int portfwdmgr_unlisten(PortFwdManager *mgr, const char *host, int port) @@ -1108,12 +1108,12 @@ int portfwdmgr_unlisten(PortFwdManager *mgr, const char *host, int port) PortFwdRecord *pfr = del234(mgr->forwardings, &pfr_key); if (!pfr) - return FALSE; + return false; logeventf(mgr->cl->logctx, "Closing listening port %s:%d", host, port); pfr_free(pfr); - return TRUE; + return true; } /* @@ -1152,7 +1152,7 @@ char *portfwdmgr_connect(PortFwdManager *mgr, Channel **chan_ret, pf->plug.vt = &PortForwarding_plugvt; pf->chan.initial_fixed_window_size = 0; pf->chan.vt = &PortForwarding_channelvt; - pf->input_wanted = TRUE; + pf->input_wanted = true; pf->ready = 1; pf->c = c; pf->cl = mgr->cl; diff --git a/proxy.c b/proxy.c index 14f72e2b..0e1eeeed 100644 --- a/proxy.c +++ b/proxy.c @@ -778,7 +778,7 @@ int proxy_socks4_negotiate (ProxySocket *p, int change) strbuf *command = strbuf_new(); char hostname[512]; - int write_hostname = FALSE; + int write_hostname = false; put_byte(command, 4); /* SOCKS version 4 */ put_byte(command, 1); /* CONNECT command */ @@ -795,7 +795,7 @@ int proxy_socks4_negotiate (ProxySocket *p, int change) case ADDRTYPE_NAME: sk_getaddr(p->remote_addr, hostname, lenof(hostname)); put_uint32(command, 1); - write_hostname = TRUE; + write_hostname = true; break; case ADDRTYPE_IPV6: p->error = "Proxy error: SOCKS version 4 does not support IPv6"; diff --git a/pscp.c b/pscp.c index 86525270..11f3f5c9 100644 --- a/pscp.c +++ b/pscp.c @@ -44,7 +44,7 @@ static int uploading = 0; static Backend *backend; static Conf *conf; -int sent_eof = FALSE; +int sent_eof = false; static void source(const char *src); static void rsource(const char *src); @@ -199,7 +199,7 @@ static int pscp_eof(Seat *seat) seat_connection_fatal( pscp_seat, "Received unexpected end-of-file from server"); } - return FALSE; + return false; } static int ssh_scp_recv(void *buf, int len) { @@ -286,7 +286,7 @@ static void bump(const char *fmt, ...) if (backend && backend_connected(backend)) { char ch; backend_special(backend, SS_EOF, 0); - sent_eof = TRUE; + sent_eof = true; ssh_scp_recv(&ch, 1); } @@ -439,7 +439,7 @@ static void do_cmd(char *host, char *user, char *cmd) */ 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_int(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_int(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_int(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_int(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_int(conf, CONF_ssh_subsys, false); } - conf_set_int(conf, CONF_nopty, TRUE); + conf_set_int(conf, CONF_nopty, true); logctx = log_init(default_logpolicy, conf); @@ -2239,8 +2239,8 @@ void cmdline_error(const char *p, ...) exit(1); } -const int share_can_be_downstream = TRUE; -const int share_can_be_upstream = FALSE; +const int share_can_be_downstream = true; +const int share_can_be_upstream = false; /* * Main program. (Called `psftp_main' because it gets called from @@ -2263,7 +2263,7 @@ int psftp_main(int argc, char *argv[]) /* Load Default Settings before doing anything else. */ conf = conf_new(); do_defaults(NULL, conf); - loaded_session = FALSE; + loaded_session = false; for (i = 1; i < argc; i++) { int ret; @@ -2336,7 +2336,7 @@ int psftp_main(int argc, char *argv[]) if (backend && backend_connected(backend)) { char ch; backend_special(backend, SS_EOF, 0); - sent_eof = TRUE; + sent_eof = true; ssh_scp_recv(&ch, 1); } random_save_seed(); diff --git a/psftp.c b/psftp.c index 6e65d83a..6ab158b9 100644 --- a/psftp.c +++ b/psftp.c @@ -35,7 +35,7 @@ void do_sftp_cleanup(); char *pwd, *homedir; static Backend *backend; static Conf *conf; -int sent_eof = FALSE; +int sent_eof = false; /* ------------------------------------------------------------ * Seat vtable. @@ -235,7 +235,7 @@ int sftp_get_file(char *fname, char *outfname, int recurse, int restart) struct fxp_xfer *xfer; uint64_t offset; WFile *file; - int ret, shown_err = FALSE; + int ret, shown_err = false; struct fxp_attrs attrs; /* @@ -378,7 +378,7 @@ int sftp_get_file(char *fname, char *outfname, int recurse, int restart) nextfname = dupcat(fname, "/", ournames[i]->filename, NULL); nextoutfname = dir_file_cat(outfname, ournames[i]->filename); ret = sftp_get_file(nextfname, nextoutfname, recurse, restart); - restart = FALSE; /* after first partial file, do full */ + restart = false; /* after first partial file, do full */ sfree(nextoutfname); sfree(nextfname); if (!ret) { @@ -469,7 +469,7 @@ int sftp_get_file(char *fname, char *outfname, int recurse, int restart) if (ret <= 0) { if (!shown_err) { printf("error while reading: %s\n", fxp_error()); - shown_err = TRUE; + shown_err = true; } if (ret == INT_MIN) /* pktin not even freed */ sfree(pktin); @@ -622,7 +622,7 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart) nextfname = dir_file_cat(fname, ournames[i]); nextoutfname = dupcat(outfname, "/", ournames[i], NULL); ret = sftp_put_file(nextfname, nextoutfname, recurse, restart); - restart = FALSE; /* after first partial file, do full */ + restart = false; /* after first partial file, do full */ sfree(nextoutfname); sfree(nextfname); if (!ret) { @@ -914,7 +914,7 @@ int wildcard_iterate(char *filename, int (*func)(void *, char *), void *ctx) if (is_wc) { SftpWildcardMatcher *swcm = sftp_begin_wildcard_matching(filename); - int matched = FALSE; + int matched = false; sfree(unwcfname); if (!swcm) @@ -929,7 +929,7 @@ int wildcard_iterate(char *filename, int (*func)(void *, char *), void *ctx) ret = 0; } sfree(newname); - matched = TRUE; + matched = true; ret &= func(ctx, cname); sfree(cname); } @@ -1000,7 +1000,7 @@ int sftp_cmd_close(struct sftp_command *cmd) if (backend_connected(backend)) { char ch; backend_special(backend, SS_EOF, 0); - sent_eof = TRUE; + sent_eof = true; sftp_recvdata(&ch, 1); } do_sftp_cleanup(); @@ -1211,7 +1211,7 @@ int sftp_general_get(struct sftp_command *cmd, int restart, int multiple) { char *fname, *unwcfname, *origfname, *origwfname, *outfname; int i, ret; - int recurse = FALSE; + int recurse = false; if (!backend) { not_connected(); @@ -1225,7 +1225,7 @@ int sftp_general_get(struct sftp_command *cmd, int restart, int multiple) i++; break; } else if (!strcmp(cmd->words[i], "-r")) { - recurse = TRUE; + recurse = true; } else { printf("%s: unrecognised option '%s'\n", cmd->words[0], cmd->words[i]); return 0; @@ -1327,7 +1327,7 @@ int sftp_general_put(struct sftp_command *cmd, int restart, int multiple) { char *fname, *wfname, *origoutfname, *outfname; int i, ret; - int recurse = FALSE; + int recurse = false; if (!backend) { not_connected(); @@ -1341,7 +1341,7 @@ int sftp_general_put(struct sftp_command *cmd, int restart, int multiple) i++; break; } else if (!strcmp(cmd->words[i], "-r")) { - recurse = TRUE; + recurse = true; } else { printf("%s: unrecognised option '%s'\n", cmd->words[0], cmd->words[i]); return 0; @@ -1359,7 +1359,7 @@ int sftp_general_put(struct sftp_command *cmd, int restart, int multiple) WildcardMatcher *wcm; fname = cmd->words[i++]; - if (multiple && test_wildcard(fname, FALSE) == WCTYPE_WILDCARD) { + if (multiple && test_wildcard(fname, false) == WCTYPE_WILDCARD) { wcm = begin_wildcard_matching(fname); wfname = wildcard_get_filename(wcm); if (!wfname) { @@ -1560,9 +1560,9 @@ static int check_is_dir(char *dstfname) if (result && (attrs.flags & SSH_FILEXFER_ATTR_PERMISSIONS) && (attrs.permissions & 0040000)) - return TRUE; + return true; else - return FALSE; + return false; } struct sftp_context_mv { @@ -1935,20 +1935,20 @@ static struct sftp_cmd_lookup { * in ASCII order. */ { - "!", TRUE, "run a local command", + "!", true, "run a local command", "\n" /* FIXME: this example is crap for non-Windows. */ " Runs a local command. For example, \"!del myfile\".\n", sftp_cmd_pling }, { - "bye", TRUE, "finish your SFTP session", + "bye", true, "finish your SFTP session", "\n" " Terminates your SFTP session and quits the PSFTP program.\n", sftp_cmd_quit }, { - "cd", TRUE, "change your remote working directory", + "cd", true, "change your remote working directory", " [ ]\n" " Change the remote working directory for your SFTP session.\n" " If a new working directory is not supplied, you will be\n" @@ -1956,7 +1956,7 @@ static struct sftp_cmd_lookup { sftp_cmd_cd }, { - "chmod", TRUE, "change file permissions and modes", + "chmod", true, "change file permissions and modes", " [ ... ]\n" " Change the file permissions on one or more remote files or\n" " directories.\n" @@ -1984,7 +1984,7 @@ static struct sftp_cmd_lookup { sftp_cmd_chmod }, { - "close", TRUE, "finish your SFTP session but do not quit PSFTP", + "close", true, "finish your SFTP session but do not quit PSFTP", "\n" " Terminates your SFTP session, but does not quit the PSFTP\n" " program. You can then use \"open\" to start another SFTP\n" @@ -1992,16 +1992,16 @@ static struct sftp_cmd_lookup { sftp_cmd_close }, { - "del", TRUE, "delete files on the remote server", + "del", true, "delete files on the remote server", " [ ... ]\n" " Delete a file or files from the server.\n", sftp_cmd_rm }, { - "delete", FALSE, "del", NULL, sftp_cmd_rm + "delete", false, "del", NULL, sftp_cmd_rm }, { - "dir", TRUE, "list remote files", + "dir", true, "list remote files", " [ ]/[ ]\n" " List the contents of a specified directory on the server.\n" " If is not given, the current working directory\n" @@ -2011,10 +2011,10 @@ static struct sftp_cmd_lookup { sftp_cmd_ls }, { - "exit", TRUE, "bye", NULL, sftp_cmd_quit + "exit", true, "bye", NULL, sftp_cmd_quit }, { - "get", TRUE, "download a file from the server to your local machine", + "get", true, "download a file from the server to your local machine", " [ -r ] [ -- ] [ ]\n" " Downloads a file on the server and stores it locally under\n" " the same name, or under a different one if you supply the\n" @@ -2023,7 +2023,7 @@ static struct sftp_cmd_lookup { sftp_cmd_get }, { - "help", TRUE, "give help", + "help", true, "give help", " [ [ ... ] ]\n" " Give general help if no commands are specified.\n" " If one or more commands are specified, give specific help on\n" @@ -2031,25 +2031,25 @@ static struct sftp_cmd_lookup { sftp_cmd_help }, { - "lcd", TRUE, "change local working directory", + "lcd", true, "change local working directory", " \n" " Change the local working directory of the PSFTP program (the\n" " default location where the \"get\" command will save files).\n", sftp_cmd_lcd }, { - "lpwd", TRUE, "print local working directory", + "lpwd", true, "print local working directory", "\n" " Print the local working directory of the PSFTP program (the\n" " default location where the \"get\" command will save files).\n", sftp_cmd_lpwd }, { - "ls", TRUE, "dir", NULL, + "ls", true, "dir", NULL, sftp_cmd_ls }, { - "mget", TRUE, "download multiple files at once", + "mget", true, "download multiple files at once", " [ -r ] [ -- ] [ ... ]\n" " Downloads many files from the server, storing each one under\n" " the same name it has on the server side. You can use wildcards\n" @@ -2058,13 +2058,13 @@ static struct sftp_cmd_lookup { sftp_cmd_mget }, { - "mkdir", TRUE, "create directories on the remote server", + "mkdir", true, "create directories on the remote server", " [ ... ]\n" " Creates directories with the given names on the server.\n", sftp_cmd_mkdir }, { - "mput", TRUE, "upload multiple files at once", + "mput", true, "upload multiple files at once", " [ -r ] [ -- ] [ ... ]\n" " Uploads many files to the server, storing each one under the\n" " same name it has on the client side. You can use wildcards\n" @@ -2073,7 +2073,7 @@ static struct sftp_cmd_lookup { sftp_cmd_mput }, { - "mv", TRUE, "move or rename file(s) on the remote server", + "mv", true, "move or rename file(s) on the remote server", " [ ... ] \n" " Moves or renames (s) on the server to ,\n" " also on the server.\n" @@ -2085,14 +2085,14 @@ static struct sftp_cmd_lookup { sftp_cmd_mv }, { - "open", TRUE, "connect to a host", + "open", true, "connect to a host", " [@] []\n" " Establishes an SFTP connection to a given host. Only usable\n" " when you are not already connected to a server.\n", sftp_cmd_open }, { - "put", TRUE, "upload a file from your local machine to the server", + "put", true, "upload a file from your local machine to the server", " [ -r ] [ -- ] [ ]\n" " Uploads a file to the server and stores it there under\n" " the same name, or under a different one if you supply the\n" @@ -2101,17 +2101,17 @@ static struct sftp_cmd_lookup { sftp_cmd_put }, { - "pwd", TRUE, "print your remote working directory", + "pwd", true, "print your remote working directory", "\n" " Print the current remote working directory for your SFTP session.\n", sftp_cmd_pwd }, { - "quit", TRUE, "bye", NULL, + "quit", true, "bye", NULL, sftp_cmd_quit }, { - "reget", TRUE, "continue downloading files", + "reget", true, "continue downloading files", " [ -r ] [ -- ] [ ]\n" " Works exactly like the \"get\" command, but the local file\n" " must already exist. The download will begin at the end of the\n" @@ -2120,15 +2120,15 @@ static struct sftp_cmd_lookup { sftp_cmd_reget }, { - "ren", TRUE, "mv", NULL, + "ren", true, "mv", NULL, sftp_cmd_mv }, { - "rename", FALSE, "mv", NULL, + "rename", false, "mv", NULL, sftp_cmd_mv }, { - "reput", TRUE, "continue uploading files", + "reput", true, "continue uploading files", " [ -r ] [ -- ] [ ]\n" " Works exactly like the \"put\" command, but the remote file\n" " must already exist. The upload will begin at the end of the\n" @@ -2137,11 +2137,11 @@ static struct sftp_cmd_lookup { sftp_cmd_reput }, { - "rm", TRUE, "del", NULL, + "rm", true, "del", NULL, sftp_cmd_rm }, { - "rmdir", TRUE, "remove directories on the remote server", + "rmdir", true, "remove directories on the remote server", " [ ... ]\n" " Removes the directory with the given name on the server.\n" " The directory will not be removed unless it is empty.\n" @@ -2382,7 +2382,7 @@ void do_sftp_cleanup() char ch; if (backend) { backend_special(backend, SS_EOF, 0); - sent_eof = TRUE; + sent_eof = true; sftp_recvdata(&ch, 1); backend_free(backend); sftp_cleanup_request(); @@ -2545,7 +2545,7 @@ static int psftp_eof(Seat *seat) seat_connection_fatal( psftp_seat, "Received unexpected end-of-file from SFTP server"); } - return FALSE; + return false; } int sftp_recvdata(char *buf, int len) @@ -2763,7 +2763,7 @@ static int psftp_connect(char *userhost, char *user, int portnumber) */ 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_int(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_int(conf, CONF_ssh_subsys, true); + conf_set_int(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_int(conf, CONF_ssh_subsys2, false); logctx = log_init(default_logpolicy, conf); @@ -2839,8 +2839,8 @@ void cmdline_error(const char *p, ...) exit(1); } -const int share_can_be_downstream = TRUE; -const int share_can_be_upstream = FALSE; +const int share_can_be_downstream = true; +const int share_can_be_upstream = false; /* * Main program. Parse arguments etc. @@ -2867,7 +2867,7 @@ int psftp_main(int argc, char *argv[]) /* Load Default Settings before doing anything else. */ conf = conf_new(); do_defaults(NULL, conf); - loaded_session = FALSE; + loaded_session = false; for (i = 1; i < argc; i++) { int ret; @@ -2948,7 +2948,7 @@ int psftp_main(int argc, char *argv[]) if (backend && backend_connected(backend)) { char ch; backend_special(backend, SS_EOF, 0); - sent_eof = TRUE; + sent_eof = true; sftp_recvdata(&ch, 1); } do_sftp_cleanup(); diff --git a/psftp.h b/psftp.h index 33c03453..c41675a9 100644 --- a/psftp.h +++ b/psftp.h @@ -36,11 +36,11 @@ int ssh_sftp_loop_iteration(void); * Read a command line for PSFTP from standard input. Caller must * free. * - * If `backend_required' is TRUE, should also listen for activity + * If `backend_required' is true, should also listen for activity * at the backend (rekeys, clientalives, unexpected closures etc) * and respond as necessary, and if the backend closes it should * treat this as a failure condition. If `backend_required' is - * FALSE, a back end is not (intentionally) active at all (e.g. + * false, a back end is not (intentionally) active at all (e.g. * psftp before an `open' command). */ char *ssh_sftp_get_cmdline(const char *prompt, int backend_required); @@ -166,7 +166,7 @@ void finish_wildcard_matching(WildcardMatcher *dir); * to filenames returned from FXP_READDIR, which means we can panic * if we see _anything_ resembling a directory separator. * - * Returns TRUE if the filename is kosher, FALSE if dangerous. + * Returns true if the filename is kosher, false if dangerous. */ int vet_filename(const char *name); diff --git a/putty.h b/putty.h index 010935a7..0212d083 100644 --- a/putty.h +++ b/putty.h @@ -511,7 +511,7 @@ struct BackendVtable { const SessionSpecial *(*get_specials) (Backend *be); int (*connected) (Backend *be); int (*exitcode) (Backend *be); - /* If back->sendok() returns FALSE, the backend doesn't currently + /* If back->sendok() returns false, the backend doesn't currently * want input data, so the frontend should avoid acquiring any if * possible (passing back-pressure on to its sender). */ int (*sendok) (Backend *be); @@ -593,7 +593,7 @@ GLOBAL int default_protocol; GLOBAL int default_port; /* - * This is set TRUE by cmdline.c iff a session is loaded with "-load". + * This is set true by cmdline.c iff a session is loaded with "-load". */ GLOBAL int loaded_session; /* @@ -746,9 +746,9 @@ struct SeatVtable { /* * Called when the back end wants to indicate that EOF has arrived - * on the server-to-client stream. Returns FALSE to indicate that + * on the server-to-client stream. Returns false to indicate that * we intend to keep the session open in the other direction, or - * TRUE to indicate that if they're closing so are we. + * true to indicate that if they're closing so are we. */ int (*eof)(Seat *seat); @@ -901,16 +901,16 @@ struct SeatVtable { /* * Return the X11 id of the X terminal window relevant to a seat, - * by returning TRUE and filling in the output pointer. Return - * FALSE if there isn't one or if the concept is meaningless. + * by returning true and filling in the output pointer. Return + * false if there isn't one or if the concept is meaningless. */ int (*get_windowid)(Seat *seat, long *id_out); /* * Return the size of the terminal window in pixels. If the * concept is meaningless or the information is unavailable, - * return FALSE; otherwise fill in the output pointers and return - * TRUE. + * return false; otherwise fill in the output pointers and return + * true. */ int (*get_window_pixel_size)(Seat *seat, int *width, int *height); }; @@ -953,9 +953,9 @@ void seat_connection_fatal(Seat *seat, const char *fmt, ...); /* Handy aliases for seat_output which set is_stderr to a fixed value. */ #define seat_stdout(seat, data, len) \ - seat_output(seat, FALSE, data, len) + seat_output(seat, false, data, len) #define seat_stderr(seat, data, len) \ - seat_output(seat, TRUE, data, len) + seat_output(seat, true, data, len) /* * Stub methods for seat implementations that want to use the obvious @@ -1922,9 +1922,9 @@ int open_for_write_would_lose_data(const Filename *fn); * run_timers() is called from the front end when it has reason to * think some timers have reached their moment, or when it simply * needs to know how long to wait next. We pass it the time we - * think it is. It returns TRUE and places the time when the next + * think it is. It returns true and places the time when the next * timer needs to go off in `next', or alternatively it returns - * FALSE if there are no timers at all pending. + * false if there are no timers at all pending. * * timer_change_notify() must be supplied by the front end; it * notifies the front end that a new timer has been added to the @@ -2020,7 +2020,7 @@ unsigned long timing_last_clock(void); * call) then it can call toplevel_callback_pending(), which will * return true if at least one callback is in the queue. * - * run_toplevel_callbacks() returns TRUE if it ran any actual code. + * run_toplevel_callbacks() returns true if it ran any actual code. * This can be used as a means of speculatively terminating a select * loop, as in PSFTP, for example - if a callback has run then perhaps * it might have done whatever the loop's caller was waiting for. diff --git a/raw.c b/raw.c index b6fcbe96..827193ea 100644 --- a/raw.c +++ b/raw.c @@ -66,7 +66,7 @@ static void raw_closing(Plug *plug, const char *error_msg, int error_code, if (raw->s) { sk_close(raw->s); raw->s = NULL; - raw->closed_on_socket_error = TRUE; + raw->closed_on_socket_error = true; seat_notify_remote_exit(raw->seat); } logevent(raw->logctx, error_msg); @@ -81,10 +81,10 @@ static void raw_closing(Plug *plug, const char *error_msg, int error_code, if (!raw->sent_socket_eof) { if (raw->s) sk_write_eof(raw->s); - raw->sent_socket_eof= TRUE; + raw->sent_socket_eof= true; } } - raw->sent_console_eof = TRUE; + raw->sent_console_eof = true; raw_check_close(raw); } } @@ -95,7 +95,7 @@ static void raw_receive(Plug *plug, int urgent, char *data, int len) c_write(raw, data, len); /* We count 'session start', for proxy logging purposes, as being * when data is received from the network and printed. */ - raw->session_started = TRUE; + raw->session_started = true; } static void raw_sent(Plug *plug, int bufsize) @@ -134,11 +134,11 @@ static const char *raw_init(Seat *seat, Backend **backend_handle, raw->plug.vt = &Raw_plugvt; raw->backend.vt = &raw_backend; raw->s = NULL; - raw->closed_on_socket_error = FALSE; + raw->closed_on_socket_error = false; *backend_handle = &raw->backend; - raw->sent_console_eof = raw->sent_socket_eof = FALSE; + raw->sent_console_eof = raw->sent_socket_eof = false; raw->bufsize = 0; - raw->session_started = FALSE; + raw->session_started = false; raw->conf = conf_copy(conf); raw->seat = seat; @@ -239,7 +239,7 @@ static void raw_special(Backend *be, SessionSpecialCode code, int arg) Raw *raw = container_of(be, Raw, backend); if (code == SS_EOF && raw->s) { sk_write_eof(raw->s); - raw->sent_socket_eof= TRUE; + raw->sent_socket_eof= true; raw_check_close(raw); } diff --git a/rlogin.c b/rlogin.c index d91b93cc..1b70443e 100644 --- a/rlogin.c +++ b/rlogin.c @@ -61,7 +61,7 @@ static void rlogin_closing(Plug *plug, const char *error_msg, int error_code, sk_close(rlogin->s); rlogin->s = NULL; if (error_msg) - rlogin->closed_on_socket_error = TRUE; + rlogin->closed_on_socket_error = true; seat_notify_remote_exit(rlogin->seat); } if (error_msg) { @@ -166,7 +166,7 @@ static const char *rlogin_init(Seat *seat, Backend **backend_handle, rlogin->plug.vt = &Rlogin_plugvt; rlogin->backend.vt = &rlogin_backend; rlogin->s = NULL; - rlogin->closed_on_socket_error = FALSE; + rlogin->closed_on_socket_error = false; rlogin->seat = seat; rlogin->logctx = logctx; rlogin->term_width = conf_get_int(conf, CONF_width); @@ -224,9 +224,9 @@ static const char *rlogin_init(Seat *seat, Backend **backend_handle, int ret; rlogin->prompt = new_prompts(); - rlogin->prompt->to_server = TRUE; + rlogin->prompt->to_server = true; rlogin->prompt->name = dupstr("Rlogin login name"); - add_prompt(rlogin->prompt, dupstr("rlogin username: "), TRUE); + add_prompt(rlogin->prompt, dupstr("rlogin username: "), true); ret = seat_get_userpass_input(rlogin->seat, rlogin->prompt, NULL); if (ret >= 0) { rlogin_startup(rlogin, rlogin->prompt->prompts[0]->result); diff --git a/scpserver.c b/scpserver.c index 8ba902f6..1c9912a3 100644 --- a/scpserver.c +++ b/scpserver.c @@ -268,14 +268,14 @@ struct ScpReplyReceiver { static void scp_reply_ok(SftpReplyBuilder *srb) { ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb); - reply->err = FALSE; + reply->err = false; } static void scp_reply_error( SftpReplyBuilder *srb, unsigned code, const char *msg) { ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb); - reply->err = TRUE; + reply->err = true; reply->code = code; sfree(reply->errmsg); reply->errmsg = dupstr(msg); @@ -284,7 +284,7 @@ static void scp_reply_error( static void scp_reply_name_count(SftpReplyBuilder *srb, unsigned count) { ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb); - reply->err = FALSE; + reply->err = false; } static void scp_reply_full_name( @@ -293,7 +293,7 @@ static void scp_reply_full_name( { ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb); char *p; - reply->err = FALSE; + reply->err = false; sfree((void *)reply->name.ptr); reply->name.ptr = p = mkstr(name); reply->name.len = name.len; @@ -303,14 +303,14 @@ static void scp_reply_full_name( static void scp_reply_simple_name(SftpReplyBuilder *srb, ptrlen name) { ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb); - reply->err = FALSE; + reply->err = false; } static void scp_reply_handle(SftpReplyBuilder *srb, ptrlen handle) { ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb); char *p; - reply->err = FALSE; + reply->err = false; sfree((void *)reply->handle.ptr); reply->handle.ptr = p = mkstr(handle); reply->handle.len = handle.len; @@ -320,7 +320,7 @@ static void scp_reply_data(SftpReplyBuilder *srb, ptrlen data) { ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb); char *p; - reply->err = FALSE; + reply->err = false; sfree((void *)reply->data.ptr); reply->data.ptr = p = mkstr(data); reply->data.len = data.len; @@ -330,7 +330,7 @@ static void scp_reply_attrs( SftpReplyBuilder *srb, struct fxp_attrs attrs) { ScpReplyReceiver *reply = container_of(srb, ScpReplyReceiver, srb); - reply->err = FALSE; + reply->err = false; reply->attrs = attrs; } @@ -426,8 +426,8 @@ static void scp_source_push(ScpSource *scp, ScpSourceNodeType type, static char *scp_source_err_base(ScpSource *scp, const char *fmt, va_list ap) { char *msg = dupvprintf(fmt, ap); - sshfwd_write_ext(scp->sc, TRUE, msg, strlen(msg)); - sshfwd_write_ext(scp->sc, TRUE, "\012", 1); + sshfwd_write_ext(scp->sc, true, msg, strlen(msg)); + sshfwd_write_ext(scp->sc, true, "\012", 1); return msg; } static void scp_source_err(ScpSource *scp, const char *fmt, ...) @@ -451,7 +451,7 @@ static void scp_source_abort(ScpSource *scp, const char *fmt, ...) sshfwd_write_eof(scp->sc); sshfwd_initiate_close(scp->sc, msg); - scp->finished = TRUE; + scp->finished = true; } static void scp_source_push_name( @@ -687,7 +687,7 @@ static void scp_source_process_stack(ScpSource *scp) * wildcard (if any) we're using to match the filenames we get * back. */ - sftpsrv_stat(scp->sf, &scp->reply.srb, pathname, TRUE); + sftpsrv_stat(scp->sf, &scp->reply.srb, pathname, true); if (scp->reply.err) { scp_source_abort( scp, "%.*s: unable to access: %s", @@ -755,7 +755,7 @@ static void scp_source_process_stack(ScpSource *scp) sshfwd_send_exit_status(scp->sc, 0); sshfwd_write_eof(scp->sc); sshfwd_initiate_close(scp->sc, NULL); - scp->finished = TRUE; + scp->finished = true; return; } @@ -766,7 +766,7 @@ static void scp_source_process_stack(ScpSource *scp) scp->head = node->next; if (node->type == SCP_READDIR) { - sftpsrv_readdir(scp->sf, &scp->reply.srb, node->handle, 1, TRUE); + sftpsrv_readdir(scp->sf, &scp->reply.srb, node->handle, 1, true); if (scp->reply.err) { if (scp->reply.code != SSH_FX_EOF) scp_source_err(scp, "%.*s: unable to list directory: %s", @@ -871,7 +871,7 @@ static int scp_source_send(ScpServer *s, const void *vdata, size_t length) if (scp->expect_newline) { if (data[i] == '\012') { /* End of an error message following a 1 byte */ - scp->expect_newline = FALSE; + scp->expect_newline = false; scp->acks++; } } else { @@ -880,7 +880,7 @@ static int scp_source_send(ScpServer *s, const void *vdata, size_t length) scp->acks++; break; case 1: /* non-fatal error; consume it */ - scp->expect_newline = TRUE; + scp->expect_newline = true; break; case 2: scp_source_abort( @@ -918,7 +918,7 @@ static void scp_source_eof(ScpServer *s) if (scp->finished) return; - scp->eof = TRUE; + scp->eof = true; scp_source_process_stack(scp); } @@ -962,8 +962,8 @@ struct ScpSinkStackEntry { ptrlen destpath; /* - * If isdir is TRUE, then destpath identifies a directory that the - * files we receive should be created inside. If it's FALSE, then + * If isdir is true, then destpath identifies a directory that the + * files we receive should be created inside. If it's false, then * it identifies the exact pathname the next file we receive * should be created _as_ - regardless of the filename in the 'C' * command. @@ -1031,11 +1031,11 @@ static ScpSink *scp_sink_new( * directory because of the -d option in the command line, * test it ourself to see whether it is or not. */ - sftpsrv_stat(scp->sf, &scp->reply.srb, pathname, TRUE); + sftpsrv_stat(scp->sf, &scp->reply.srb, pathname, true); if (!scp->reply.err && (scp->reply.attrs.flags & SSH_FILEXFER_ATTR_PERMISSIONS) && (scp->reply.attrs.permissions & PERMS_DIRECTORY)) - pathname_is_definitely_dir = TRUE; + pathname_is_definitely_dir = true; } scp_sink_push(scp, pathname, pathname_is_definitely_dir); @@ -1102,7 +1102,7 @@ static void scp_sink_coroutine(ScpSink *scp) if (sscanf(scp->command->s, "T%lu %lu %lu %lu", &scp->mtime, &dummy1, &scp->atime, &dummy2) != 4) goto parse_error; - scp->got_file_times = TRUE; + scp->got_file_times = true; } else if (scp->command_chr == 'C' || scp->command_chr == 'D') { /* * Common handling of the start of this case, because the @@ -1148,7 +1148,7 @@ static void scp_sink_coroutine(ScpSink *scp) scp->attrs.atime = scp->atime; scp->attrs.flags |= SSH_FILEXFER_ATTR_ACMODTIME; } - scp->got_file_times = FALSE; + scp->got_file_times = false; if (scp->command_chr == 'D') { sftpsrv_mkdir(scp->sf, &scp->reply.srb, @@ -1161,7 +1161,7 @@ static void scp_sink_coroutine(ScpSink *scp) goto done; } - scp_sink_push(scp, scp->filename, TRUE); + scp_sink_push(scp, scp->filename, true); } else { sftpsrv_open(scp->sf, &scp->reply.srb, scp->filename, SSH_FXF_WRITE | SSH_FXF_CREAT | SSH_FXF_TRUNC, @@ -1227,7 +1227,7 @@ static void scp_sink_coroutine(ScpSink *scp) goto done; } scp_sink_pop(scp); - scp->got_file_times = FALSE; + scp->got_file_times = false; } else { ptrlen cmd_pl; @@ -1245,8 +1245,8 @@ static void scp_sink_coroutine(ScpSink *scp) done: if (scp->errmsg) { - sshfwd_write_ext(scp->sc, TRUE, scp->errmsg, strlen(scp->errmsg)); - sshfwd_write_ext(scp->sc, TRUE, "\012", 1); + sshfwd_write_ext(scp->sc, true, scp->errmsg, strlen(scp->errmsg)); + sshfwd_write_ext(scp->sc, true, "\012", 1); sshfwd_send_exit_status(scp->sc, 1); } else { sshfwd_send_exit_status(scp->sc, 0); @@ -1273,7 +1273,7 @@ static void scp_sink_eof(ScpServer *s) { ScpSink *scp = container_of(s, ScpSink, scpserver); - scp->input_eof = TRUE; + scp->input_eof = true; scp_sink_coroutine(scp); } @@ -1307,8 +1307,8 @@ static struct ScpServerVtable ScpError_ScpServer_vt = { static void scp_error_send_message_cb(void *vscp) { ScpError *scp = (ScpError *)vscp; - sshfwd_write_ext(scp->sc, TRUE, scp->message, strlen(scp->message)); - sshfwd_write_ext(scp->sc, TRUE, "\n", 1); + sshfwd_write_ext(scp->sc, true, scp->message, strlen(scp->message)); + sshfwd_write_ext(scp->sc, true, "\n", 1); sshfwd_send_exit_status(scp->sc, 1); sshfwd_write_eof(scp->sc); sshfwd_initiate_close(scp->sc, scp->message); @@ -1353,8 +1353,8 @@ static void scp_error_free(ScpServer *s) ScpServer *scp_recognise_exec( SshChannel *sc, const SftpServerVtable *sftpserver_vt, ptrlen command) { - int recursive = FALSE, preserve = FALSE; - int targetshouldbedirectory = FALSE; + int recursive = false, preserve = false; + int targetshouldbedirectory = false; ptrlen command_orig = command; if (!ptrlen_startswith(command, PTRLEN_LITERAL("scp "), &command)) @@ -1366,15 +1366,15 @@ ScpServer *scp_recognise_exec( continue; } if (ptrlen_startswith(command, PTRLEN_LITERAL("-r "), &command)) { - recursive = TRUE; + recursive = true; continue; } if (ptrlen_startswith(command, PTRLEN_LITERAL("-p "), &command)) { - preserve = TRUE; + preserve = true; continue; } if (ptrlen_startswith(command, PTRLEN_LITERAL("-d "), &command)) { - targetshouldbedirectory = TRUE; + targetshouldbedirectory = true; continue; } break; diff --git a/sesschan.c b/sesschan.c index 9a1c6c44..4a390167 100644 --- a/sesschan.c +++ b/sesschan.c @@ -206,7 +206,7 @@ Channel *sesschan_new(SshChannel *c, LogContext *logctx, sess->conf = conf_new(); load_open_settings(NULL, sess->conf); - /* Set close-on-exit = TRUE to suppress uxpty.c's "[pterm: process + /* Set close-on-exit = true to suppress uxpty.c's "[pterm: process * terminated with status x]" message */ conf_set_int(sess->conf, CONF_close_on_exit, FORCE_ON); @@ -282,10 +282,10 @@ int sesschan_run_shell(Channel *chan) sesschan *sess = container_of(chan, sesschan, chan); if (sess->backend) - return FALSE; + return false; sesschan_start_backend(sess, NULL); - return TRUE; + return true; } int sesschan_run_command(Channel *chan, ptrlen command) @@ -293,21 +293,21 @@ int sesschan_run_command(Channel *chan, ptrlen command) sesschan *sess = container_of(chan, sesschan, chan); if (sess->backend) - return FALSE; + return false; /* FIXME: make this possible to configure off */ if ((sess->scpsrv = scp_recognise_exec(sess->c, sess->sftpserver_vt, command)) != NULL) { sess->chan.vt = &scp_channelvt; logevent(sess->parent_logctx, "Starting built-in SCP server"); - return TRUE; + return true; } char *command_str = mkstr(command); sesschan_start_backend(sess, command_str); sfree(command_str); - return TRUE; + return true; } int sesschan_run_subsystem(Channel *chan, ptrlen subsys) @@ -318,10 +318,10 @@ int sesschan_run_subsystem(Channel *chan, ptrlen subsys) sess->sftpsrv = sftpsrv_new(sess->sftpserver_vt); sess->chan.vt = &sftp_channelvt; logevent(sess->parent_logctx, "Starting built-in SFTP subsystem"); - return TRUE; + return true; } - return FALSE; + return false; } static void fwd_log(Plug *plug, int type, SockAddr *addr, int port, @@ -344,13 +344,13 @@ static int xfwd_accepting(Plug *p, accept_fn_t constructor, accept_ctx_t ctx) s = constructor(ctx, plug); if ((err = sk_socket_error(s)) != NULL) { portfwd_raw_free(chan); - return TRUE; + return true; } pi = sk_peer_info(s); portfwd_raw_setup(chan, s, ssh_serverside_x11_open(sess->c->cl, chan, pi)); sk_free_peer_info(pi); - return FALSE; + return false; } static const PlugVtable xfwd_plugvt = { @@ -371,7 +371,7 @@ int sesschan_enable_x11_forwarding( char screensuffix[32]; if (oneshot) - return FALSE; /* not supported */ + return false; /* not supported */ snprintf(screensuffix, sizeof(screensuffix), ".%u", screen_number); @@ -379,7 +379,7 @@ int sesschan_enable_x11_forwarding( * Decode the authorisation data from ASCII hex into binary. */ if (authdata_hex.len % 2) - return FALSE; /* expected an even number of digits */ + return false; /* expected an even number of digits */ authdata_bin = strbuf_new(); for (i = 0; i < authdata_hex.len; i += 2) { const unsigned char *hex = authdata_hex.ptr; @@ -387,7 +387,7 @@ int sesschan_enable_x11_forwarding( if (!isxdigit(hex[i]) || !isxdigit(hex[i+1])) { strbuf_free(authdata_bin); - return FALSE; /* not hex */ + return false; /* not hex */ } hexbuf[0] = hex[i]; @@ -420,11 +420,11 @@ static int agentfwd_accepting( s = constructor(ctx, plug); if ((err = sk_socket_error(s)) != NULL) { portfwd_raw_free(chan); - return TRUE; + return true; } portfwd_raw_setup(chan, s, ssh_serverside_agent_open(sess->c->cl, chan)); - return FALSE; + return false; } static const PlugVtable agentfwd_plugvt = { @@ -467,20 +467,20 @@ int sesschan_allocate_pty( char *s; if (sess->want_pty) - return FALSE; + return false; s = mkstr(termtype); conf_set_str(sess->conf, CONF_termtype, s); sfree(s); - sess->want_pty = TRUE; + sess->want_pty = true; sess->ttymodes = modes; sess->wc = width; sess->hc = height; sess->wp = pixwidth; sess->hp = pixheight; - return TRUE; + return true; } int sesschan_set_env(Channel *chan, ptrlen var, ptrlen value) @@ -492,7 +492,7 @@ int sesschan_set_env(Channel *chan, ptrlen var, ptrlen value) sfree(svar); sfree(svalue); - return TRUE; + return true; } int sesschan_send_break(Channel *chan, unsigned length) @@ -506,9 +506,9 @@ int sesschan_send_break(Channel *chan, unsigned length) * implementation-defined semantics to _its_ duration * parameter, this all just sounds too difficult. */ backend_special(sess->backend, SS_BRK, 0); - return TRUE; + return true; } - return FALSE; + return false; } int sesschan_send_signal(Channel *chan, ptrlen signame) @@ -527,10 +527,10 @@ int sesschan_send_signal(Channel *chan, ptrlen signame) #undef SIGNAL_SUB if (code == SS_EXITMENU) - return FALSE; + return false; backend_special(sess->backend, code, 0); - return TRUE; + return true; } int sesschan_change_window_size( @@ -540,7 +540,7 @@ int sesschan_change_window_size( sesschan *sess = container_of(chan, sesschan, chan); if (!sess->want_pty) - return FALSE; + return false; sess->wc = width; sess->hc = height; @@ -550,7 +550,7 @@ int sesschan_change_window_size( if (sess->backend) backend_size(sess->backend, sess->wc, sess->hc); - return TRUE; + return true; } static int sesschan_seat_output( @@ -590,10 +590,10 @@ static int sesschan_seat_eof(Seat *seat) sesschan *sess = container_of(seat, sesschan, seat); sshfwd_write_eof(sess->c); - sess->seen_eof = TRUE; + sess->seen_eof = true; queue_toplevel_callback(sesschan_check_close_callback, sess); - return TRUE; + return true; } static void sesschan_notify_remote_exit(Seat *seat) @@ -611,14 +611,14 @@ static void sesschan_notify_remote_exit(Seat *seat) sigmsg = dupstr(""); sshfwd_send_exit_signal( - sess->c, signame, FALSE, ptrlen_from_asciz(sigmsg)); + sess->c, signame, false, ptrlen_from_asciz(sigmsg)); sfree(sigmsg); } else { sshfwd_send_exit_status(sess->c, backend_exitcode(sess->backend)); } - sess->seen_exit = TRUE; + sess->seen_exit = true; queue_toplevel_callback(sesschan_check_close_callback, sess); } @@ -628,9 +628,9 @@ static void sesschan_connection_fatal(Seat *seat, const char *message) /* Closest translation I can think of */ sshfwd_send_exit_signal( - sess->c, PTRLEN_LITERAL("HUP"), FALSE, ptrlen_from_asciz(message)); + sess->c, PTRLEN_LITERAL("HUP"), false, ptrlen_from_asciz(message)); - sess->ignoring_input = TRUE; + sess->ignoring_input = true; } static int sesschan_get_window_pixel_size(Seat *seat, int *width, int *height) @@ -640,7 +640,7 @@ static int sesschan_get_window_pixel_size(Seat *seat, int *width, int *height) *width = sess->wp; *height = sess->hp; - return TRUE; + return true; } /* ---------------------------------------------------------------------- diff --git a/settings.c b/settings.c index e5d40714..73e8e319 100644 --- a/settings.c +++ b/settings.c @@ -183,7 +183,7 @@ static int gppmap(settings_r *sesskey, const char *name, */ buf = gpps_raw(sesskey, name, NULL); if (!buf) - return FALSE; + return false; p = buf; while (*p) { @@ -227,12 +227,12 @@ static int gppmap(settings_r *sesskey, const char *name, } sfree(buf); - return TRUE; + return true; } /* * Write a set of name/value pairs in the above format, or just the - * names if include_values is FALSE. + * names if include_values is false. */ static void wmap(settings_w *sesskey, char const *outkey, Conf *conf, int primary, int include_values) @@ -549,7 +549,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf) write_setting_i(sesskey, "TCPKeepalives", conf_get_int(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); + wmap(sesskey, "TerminalModes", conf, CONF_ttymodes, true); /* Address family selection */ write_setting_i(sesskey, "AddressFamily", conf_get_int(conf, CONF_addressfamily)); @@ -565,7 +565,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf) write_setting_s(sesskey, "ProxyPassword", conf_get_str(conf, CONF_proxy_password)); write_setting_s(sesskey, "ProxyTelnetCommand", conf_get_str(conf, CONF_proxy_telnet_command)); write_setting_i(sesskey, "ProxyLogToTerm", conf_get_int(conf, CONF_proxy_log_to_term)); - wmap(sesskey, "Environment", conf, CONF_environmt, TRUE); + 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_s(sesskey, "LocalUserName", conf_get_str(conf, CONF_localusername)); @@ -727,7 +727,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf) 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)); - wmap(sesskey, "PortForwardings", conf, CONF_portfwd, TRUE); + 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)); write_setting_i(sesskey, "BugRSA1", 2-conf_get_int(conf, CONF_sshbug_rsa1)); @@ -759,7 +759,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf) 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)); - wmap(sesskey, "SSHManualHostKeys", conf, CONF_ssh_manual_hostkeys, FALSE); + wmap(sesskey, "SSHManualHostKeys", conf, CONF_ssh_manual_hostkeys, false); } void load_settings(const char *section, Conf *conf) @@ -1195,7 +1195,7 @@ 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); + 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); diff --git a/sftp.c b/sftp.c index 47ea30c0..c6ef9fde 100644 --- a/sftp.c +++ b/sftp.c @@ -970,7 +970,7 @@ struct fxp_xfer *xfer_download_init(struct fxp_handle *fh, uint64_t offset) { struct fxp_xfer *xfer = xfer_init(fh, offset); - xfer->eof = FALSE; + xfer->eof = false; xfer_download_queue(xfer); return xfer; @@ -999,7 +999,7 @@ int xfer_download_gotpkt(struct fxp_xfer *xfer, struct sftp_packet *pktin) #endif if ((rr->retlen < 0 && fxp_error_type()==SSH_FX_EOF) || rr->retlen == 0) { - xfer->eof = TRUE; + xfer->eof = true; rr->retlen = 0; rr->complete = -1; #ifdef DEBUG_DOWNLOAD diff --git a/sftpserver.c b/sftpserver.c index b84365f2..1ff3d378 100644 --- a/sftpserver.c +++ b/sftpserver.c @@ -125,14 +125,14 @@ struct sftp_packet *sftp_handle_request( path = get_string(req); if (get_err(req)) goto decode_error; - sftpsrv_stat(srv, rb, path, TRUE); + sftpsrv_stat(srv, rb, path, true); break; case SSH_FXP_LSTAT: path = get_string(req); if (get_err(req)) goto decode_error; - sftpsrv_stat(srv, rb, path, FALSE); + sftpsrv_stat(srv, rb, path, false); break; case SSH_FXP_FSTAT: @@ -171,7 +171,7 @@ struct sftp_packet *sftp_handle_request( handle = get_string(req); if (get_err(req)) goto decode_error; - sftpsrv_readdir(srv, rb, handle, INT_MAX, FALSE); + sftpsrv_readdir(srv, rb, handle, INT_MAX, false); break; case SSH_FXP_WRITE: diff --git a/ssh.c b/ssh.c index 251634f1..808833ea 100644 --- a/ssh.c +++ b/ssh.c @@ -98,7 +98,7 @@ struct Ssh { ConnectionLayer cl_dummy; /* - * session_started is FALSE until we initialise the main protocol + * session_started is false until we initialise the main protocol * layers. So it distinguishes between base_layer==NULL meaning * that the SSH protocol hasn't been set up _yet_, and * base_layer==NULL meaning the SSH protocol has run and finished. @@ -153,7 +153,7 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv, BinaryPacketProtocol *old_bpp; PacketProtocolLayer *connection_layer; - ssh->session_started = TRUE; + ssh->session_started = true; /* * We don't support choosing a major protocol version dynamically, @@ -180,7 +180,7 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv, int is_simple = (conf_get_int(ssh->conf, CONF_ssh_simple) && !ssh->connshare); - ssh->bpp = ssh2_bpp_new(ssh->logctx, &ssh->stats, FALSE); + ssh->bpp = ssh2_bpp_new(ssh->logctx, &ssh->stats, false); ssh_connect_bpp(ssh); #ifndef NO_GSSAPI @@ -246,7 +246,7 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv, ssh_verstring_get_local(old_bpp), ssh_verstring_get_remote(old_bpp), &ssh->gss_state, - &ssh->stats, transport_child_layer, FALSE); + &ssh->stats, transport_child_layer, false); ssh_connect_ppl(ssh, ssh->base_layer); if (userauth_layer) @@ -272,7 +272,7 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv, ssh_connect_bpp(ssh); connection_layer = ssh2_connection_new( - ssh, NULL, FALSE, ssh->conf, ssh_verstring_get_remote(old_bpp), + ssh, NULL, false, ssh->conf, ssh_verstring_get_remote(old_bpp), &ssh->cl); ssh_connect_ppl(ssh, connection_layer); ssh->base_layer = connection_layer; @@ -380,13 +380,13 @@ static void ssh_initiate_connection_close(Ssh *ssh) /* Force any remaining queued SSH packets through the BPP, and * schedule closing the network socket after they go out. */ ssh_bpp_handle_output(ssh->bpp); - ssh->pending_close = TRUE; + ssh->pending_close = true; queue_idempotent_callback(&ssh->ic_out_raw); /* Now we expect the other end to close the connection too in * response, so arrange that we'll receive notification of that * via ssh_remote_eof. */ - ssh->bpp->expect_close = TRUE; + ssh->bpp->expect_close = true; } #define GET_FORMATTED_MSG \ @@ -521,7 +521,7 @@ static void ssh_closing(Plug *plug, const char *error_msg, int error_code, if (error_msg) { ssh_remote_error(ssh, "Network error: %s", error_msg); } else if (ssh->bpp) { - ssh->bpp->input_eof = TRUE; + ssh->bpp->input_eof = true; queue_idempotent_callback(&ssh->bpp->ic_in_raw); } } @@ -644,18 +644,18 @@ static const char *connect_to_host(Ssh *ssh, const char *host, int port, * downstream and need to do our connection setup differently. */ ssh->connshare = NULL; - ssh->attempting_connshare = TRUE; /* affects socket logging behaviour */ + ssh->attempting_connshare = true; /* affects socket logging behaviour */ ssh->s = ssh_connection_sharing_init( ssh->savedhost, ssh->savedport, ssh->conf, ssh->logctx, &ssh->plug, &ssh->connshare); if (ssh->connshare) ssh_connshare_provide_connlayer(ssh->connshare, &ssh->cl_dummy); - ssh->attempting_connshare = FALSE; + ssh->attempting_connshare = false; if (ssh->s != NULL) { /* * We are a downstream. */ - ssh->bare_connection = TRUE; + ssh->bare_connection = true; ssh->fullhostname = NULL; *realhost = dupstr(host); /* best we can do */ @@ -718,7 +718,7 @@ static const char *connect_to_host(Ssh *ssh, const char *host, int port, ssh->bpp = ssh_verstring_new( ssh->conf, ssh->logctx, ssh->bare_connection, ssh->version == 1 ? "1.5" : "2.0", &ssh->version_receiver, - FALSE, "PuTTY"); + false, "PuTTY"); ssh_connect_bpp(ssh); queue_idempotent_callback(&ssh->bpp->ic_in_raw); @@ -745,9 +745,9 @@ void ssh_throttle_conn(Ssh *ssh, int adjust) assert(ssh->conn_throttle_count >= 0); if (ssh->conn_throttle_count && !old_count) { - frozen = TRUE; + frozen = true; } else if (!ssh->conn_throttle_count && old_count) { - frozen = FALSE; + frozen = false; } else { return; /* don't change current frozen state */ } @@ -819,7 +819,7 @@ static const char *ssh_init(Seat *seat, Backend **backend_handle, ssh->cl_dummy.logctx = ssh->logctx = logctx; random_ref(); /* do this now - may be needed by sharing setup code */ - ssh->need_random_unref = TRUE; + ssh->need_random_unref = true; p = connect_to_host(ssh, host, port, realhost, nodelay, keepalive); if (p != NULL) { @@ -827,7 +827,7 @@ static const char *ssh_init(Seat *seat, Backend **backend_handle, * frees this useless Ssh object, in case the caller is * impatient and just exits without bothering, in which case * the random seed won't be re-saved. */ - ssh->need_random_unref = FALSE; + ssh->need_random_unref = false; random_unref(); return p; } @@ -1038,7 +1038,7 @@ void ssh_ldisc_update(Ssh *ssh) static int ssh_ldisc(Backend *be, int option) { Ssh *ssh = container_of(be, Ssh, backend); - return ssh->cl ? ssh_ldisc_option(ssh->cl, option) : FALSE; + return ssh->cl ? ssh_ldisc_option(ssh->cl, option) : false; } static void ssh_provide_ldisc(Backend *be, Ldisc *ldisc) @@ -1090,7 +1090,7 @@ extern int ssh_fallback_cmd(Backend *be) void ssh_got_fallback_cmd(Ssh *ssh) { - ssh->fallback_cmd = TRUE; + ssh->fallback_cmd = true; } const struct BackendVtable ssh_backend = { diff --git a/ssh.h b/ssh.h index 5a932fe4..91f15a2f 100644 --- a/ssh.h +++ b/ssh.h @@ -108,22 +108,22 @@ void pq_in_clear(PktInQueue *pq); void pq_out_clear(PktOutQueue *pq); #define pq_push(pq, pkt) \ - TYPECHECK((pq)->after(&(pq)->pqb, NULL, FALSE) == pkt, \ + TYPECHECK((pq)->after(&(pq)->pqb, NULL, false) == pkt, \ pq_base_push(&(pq)->pqb, &(pkt)->qnode)) #define pq_push_front(pq, pkt) \ - TYPECHECK((pq)->after(&(pq)->pqb, NULL, FALSE) == pkt, \ + TYPECHECK((pq)->after(&(pq)->pqb, NULL, false) == pkt, \ pq_base_push_front(&(pq)->pqb, &(pkt)->qnode)) -#define pq_peek(pq) ((pq)->after(&(pq)->pqb, &(pq)->pqb.end, FALSE)) -#define pq_pop(pq) ((pq)->after(&(pq)->pqb, &(pq)->pqb.end, TRUE)) +#define pq_peek(pq) ((pq)->after(&(pq)->pqb, &(pq)->pqb.end, false)) +#define pq_pop(pq) ((pq)->after(&(pq)->pqb, &(pq)->pqb.end, true)) #define pq_concatenate(dst, q1, q2) \ - TYPECHECK((q1)->after(&(q1)->pqb, NULL, FALSE) == \ - (dst)->after(&(dst)->pqb, NULL, FALSE) && \ - (q2)->after(&(q2)->pqb, NULL, FALSE) == \ - (dst)->after(&(dst)->pqb, NULL, FALSE), \ + TYPECHECK((q1)->after(&(q1)->pqb, NULL, false) == \ + (dst)->after(&(dst)->pqb, NULL, false) && \ + (q2)->after(&(q2)->pqb, NULL, false) == \ + (dst)->after(&(dst)->pqb, NULL, false), \ pq_base_concatenate(&(dst)->pqb, &(q1)->pqb, &(q2)->pqb)) #define pq_first(pq) pq_peek(pq) -#define pq_next(pq, pkt) ((pq)->after(&(pq)->pqb, &(pkt)->qnode, FALSE)) +#define pq_next(pq, pkt) ((pq)->after(&(pq)->pqb, &(pkt)->qnode, false)) /* * Packet type contexts, so that ssh2_pkt_type can correctly decode diff --git a/ssh1bpp.c b/ssh1bpp.c index 59fe5104..f4abd98f 100644 --- a/ssh1bpp.c +++ b/ssh1bpp.c @@ -145,7 +145,7 @@ static void ssh1_bpp_handle_input(BinaryPacketProtocol *bpp) */ s->pktin = snew_plus(PktIn, s->biglen); s->pktin->qnode.prev = s->pktin->qnode.next = NULL; - s->pktin->qnode.on_free_queue = FALSE; + s->pktin->qnode.on_free_queue = false; s->pktin->type = 0; s->maxlen = s->biglen; @@ -209,7 +209,7 @@ static void ssh1_bpp_handle_input(BinaryPacketProtocol *bpp) if (s->bpp.logctx) { logblank_t blanks[MAX_BLANKS]; int nblanks = ssh1_censor_packet( - s->bpp.pls, s->pktin->type, FALSE, + s->bpp.pls, s->pktin->type, false, make_ptrlen(s->data, s->length), blanks); log_packet(s->bpp.logctx, PKT_INCOMING, s->pktin->type, ssh1_pkt_type(s->pktin->type), @@ -244,7 +244,7 @@ static void ssh1_bpp_handle_input(BinaryPacketProtocol *bpp) * schedule a run of our output side in case we * had any packets queued up in the meantime. */ - s->pending_compression_request = FALSE; + s->pending_compression_request = false; queue_idempotent_callback(&s->bpp.ic_out_pq); } break; @@ -287,7 +287,7 @@ static void ssh1_bpp_format_packet(struct ssh1_bpp_state *s, PktOut *pkt) pkt->length - pkt->prefix); logblank_t blanks[MAX_BLANKS]; int nblanks = ssh1_censor_packet( - s->bpp.pls, pkt->type, TRUE, pktdata, blanks); + s->bpp.pls, pkt->type, true, pktdata, blanks); log_packet(s->bpp.logctx, PKT_OUTGOING, pkt->type, ssh1_pkt_type(pkt->type), pktdata.ptr, pktdata.len, nblanks, blanks, @@ -353,7 +353,7 @@ static void ssh1_bpp_handle_output(BinaryPacketProtocol *bpp) * the pending flag, and stop processing packets this * time. */ - s->pending_compression_request = TRUE; + s->pending_compression_request = true; break; } } diff --git a/ssh1connection-client.c b/ssh1connection-client.c index db2d5b23..6c7c224f 100644 --- a/ssh1connection-client.c +++ b/ssh1connection-client.c @@ -24,7 +24,7 @@ void ssh1_connection_direction_specific_setup( */ s->mainchan = mainchan_new( &s->ppl, &s->cl, s->conf, s->term_width, s->term_height, - FALSE /* is_simple */, NULL); + false /* is_simple */, NULL); } } @@ -85,7 +85,7 @@ static void ssh1_connection_process_trivial_succfails(void *vs) { struct ssh1_connection_state *s = (struct ssh1_connection_state *)vs; while (s->succfail_head && s->succfail_head->trivial) - ssh1_connection_process_succfail(s, TRUE); + ssh1_connection_process_succfail(s, true); } int ssh1_handle_direction_specific_packet( @@ -107,7 +107,7 @@ int ssh1_handle_direction_specific_packet( ssh_remote_error(s->ppl.ssh, "Received %s with no outstanding request", ssh1_pkt_type(pktin->type)); - return TRUE; + return true; } ssh1_connection_process_succfail( @@ -115,7 +115,7 @@ int ssh1_handle_direction_specific_packet( queue_toplevel_callback( ssh1_connection_process_trivial_succfails, s); - return TRUE; + return true; case SSH1_SMSG_X11_OPEN: remid = get_uint32(pktin); @@ -133,9 +133,9 @@ int ssh1_handle_direction_specific_packet( ssh1_channel_init(c); c->remoteid = remid; c->chan = x11_new_channel(s->x11authtree, &c->sc, - NULL, -1, FALSE); + NULL, -1, false); c->remoteid = remid; - c->halfopen = FALSE; + c->halfopen = false; pktout = ssh_bpp_new_pktout( s->ppl.bpp, SSH1_MSG_CHANNEL_OPEN_CONFIRMATION); @@ -145,7 +145,7 @@ int ssh1_handle_direction_specific_packet( ppl_logevent(("Opened X11 forward channel")); } - return TRUE; + return true; case SSH1_SMSG_AGENT_OPEN: remid = get_uint32(pktin); @@ -162,7 +162,7 @@ int ssh1_handle_direction_specific_packet( ssh1_channel_init(c); c->remoteid = remid; c->chan = agentf_new(&c->sc); - c->halfopen = FALSE; + c->halfopen = false; pktout = ssh_bpp_new_pktout( s->ppl.bpp, SSH1_MSG_CHANNEL_OPEN_CONFIRMATION); @@ -171,7 +171,7 @@ int ssh1_handle_direction_specific_packet( pq_push(s->ppl.out_pq, pktout); } - return TRUE; + return true; case SSH1_MSG_PORT_OPEN: remid = get_uint32(pktin); @@ -211,7 +211,7 @@ int ssh1_handle_direction_specific_packet( } else { ssh1_channel_init(c); c->remoteid = remid; - c->halfopen = FALSE; + c->halfopen = false; pktout = ssh_bpp_new_pktout( s->ppl.bpp, SSH1_MSG_CHANNEL_OPEN_CONFIRMATION); put_uint32(pktout, c->remoteid); @@ -223,7 +223,7 @@ int ssh1_handle_direction_specific_packet( sfree(pf.dhost); - return TRUE; + return true; case SSH1_SMSG_STDOUT_DATA: case SSH1_SMSG_STDERR_DATA: @@ -238,7 +238,7 @@ int ssh1_handle_direction_specific_packet( } } - return TRUE; + return true; case SSH1_SMSG_EXIT_STATUS: { @@ -246,12 +246,12 @@ int ssh1_handle_direction_specific_packet( ppl_logevent(("Server sent command exit status %d", exitcode)); ssh_got_exitcode(s->ppl.ssh, exitcode); - s->session_terminated = TRUE; + s->session_terminated = true; } - return TRUE; + return true; default: - return FALSE; + return false; } } @@ -289,7 +289,7 @@ static void ssh1mainchan_request_x11_forwarding( put_uint32(pktout, screen_number); pq_push(s->ppl.out_pq, pktout); - ssh1mainchan_queue_response(s, want_reply, FALSE); + ssh1mainchan_queue_response(s, want_reply, false); } static void ssh1mainchan_request_agent_forwarding( @@ -303,7 +303,7 @@ static void ssh1mainchan_request_agent_forwarding( s->ppl.bpp, SSH1_CMSG_AGENT_REQUEST_FORWARDING); pq_push(s->ppl.out_pq, pktout); - ssh1mainchan_queue_response(s, want_reply, FALSE); + ssh1mainchan_queue_response(s, want_reply, false); } static void ssh1mainchan_request_pty( @@ -324,13 +324,13 @@ static void ssh1mainchan_request_pty( get_ttymodes_from_conf(s->ppl.seat, conf)); pq_push(s->ppl.out_pq, pktout); - ssh1mainchan_queue_response(s, want_reply, FALSE); + ssh1mainchan_queue_response(s, want_reply, false); } static int ssh1mainchan_send_env_var( SshChannel *sc, int want_reply, const char *var, const char *value) { - return FALSE; /* SSH-1 doesn't support this at all */ + return false; /* SSH-1 doesn't support this at all */ } static void ssh1mainchan_start_shell( @@ -343,7 +343,7 @@ static void ssh1mainchan_start_shell( pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_CMSG_EXEC_SHELL); pq_push(s->ppl.out_pq, pktout); - ssh1mainchan_queue_response(s, want_reply, TRUE); + ssh1mainchan_queue_response(s, want_reply, true); } static void ssh1mainchan_start_command( @@ -357,25 +357,25 @@ static void ssh1mainchan_start_command( put_stringz(pktout, command); pq_push(s->ppl.out_pq, pktout); - ssh1mainchan_queue_response(s, want_reply, TRUE); + ssh1mainchan_queue_response(s, want_reply, true); } static int ssh1mainchan_start_subsystem( SshChannel *sc, int want_reply, const char *subsystem) { - return FALSE; /* SSH-1 doesn't support this at all */ + return false; /* SSH-1 doesn't support this at all */ } static int ssh1mainchan_send_serial_break( SshChannel *sc, int want_reply, int length) { - return FALSE; /* SSH-1 doesn't support this at all */ + return false; /* SSH-1 doesn't support this at all */ } static int ssh1mainchan_send_signal( SshChannel *sc, int want_reply, const char *signame) { - return FALSE; /* SSH-1 doesn't support this at all */ + return false; /* SSH-1 doesn't support this at all */ } static void ssh1mainchan_send_terminal_size_change( @@ -512,7 +512,7 @@ struct ssh_rportfwd *ssh1_rportfwd_alloc( put_uint32(pktout, rpf->dport); pq_push(s->ppl.out_pq, pktout); - ssh1_queue_succfail_handler(s, ssh1_rportfwd_response, rpf, FALSE); + ssh1_queue_succfail_handler(s, ssh1_rportfwd_response, rpf, false); return rpf; } @@ -520,12 +520,12 @@ struct ssh_rportfwd *ssh1_rportfwd_alloc( SshChannel *ssh1_serverside_x11_open( ConnectionLayer *cl, Channel *chan, const SocketPeerInfo *pi) { - assert(FALSE && "Should never be called in the client"); + assert(false && "Should never be called in the client"); return NULL; } SshChannel *ssh1_serverside_agent_open(ConnectionLayer *cl, Channel *chan) { - assert(FALSE && "Should never be called in the client"); + assert(false && "Should never be called in the client"); return NULL; } diff --git a/ssh1connection-server.c b/ssh1connection-server.c index 330b9058..1e8ddeea 100644 --- a/ssh1connection-server.c +++ b/ssh1connection-server.c @@ -72,8 +72,8 @@ int ssh1_handle_direction_specific_packet( ppl_logevent(("Client requested a shell")); chan_run_shell(s->mainchan_chan); - s->finished_setup = TRUE; - return TRUE; + s->finished_setup = true; + return true; case SSH1_CMSG_EXEC_CMD: if (s->finished_setup) @@ -82,8 +82,8 @@ int ssh1_handle_direction_specific_packet( cmd = get_string(pktin); ppl_logevent(("Client sent command '%.*s'", PTRLEN_PRINTF(cmd))); chan_run_command(s->mainchan_chan, cmd); - s->finished_setup = TRUE; - return TRUE; + s->finished_setup = true; + return true; case SSH1_CMSG_REQUEST_COMPRESSION: if (s->compressing) { @@ -99,10 +99,10 @@ int ssh1_handle_direction_specific_packet( /* And now ensure that the _next_ packet will be the first * compressed one. */ ssh1_bpp_start_compression(s->ppl.bpp); - s->compressing = TRUE; + s->compressing = true; } - return TRUE; + return true; case SSH1_CMSG_REQUEST_PTY: if (s->finished_setup) @@ -118,21 +118,21 @@ int ssh1_handle_direction_specific_packet( if (get_err(pktin)) { ppl_logevent(("Unable to decode pty request packet")); - success = FALSE; + success = false; } else if (!chan_allocate_pty( s->mainchan_chan, termtype, width, height, pixwidth, pixheight, modes)) { ppl_logevent(("Unable to allocate a pty")); - success = FALSE; + success = false; } else { - success = TRUE; + success = true; } } pktout = ssh_bpp_new_pktout( s->ppl.bpp, (success ? SSH1_SMSG_SUCCESS : SSH1_SMSG_FAILURE)); pq_push(s->ppl.out_pq, pktout); - return TRUE; + return true; case SSH1_CMSG_PORT_FORWARD_REQUEST: if (s->finished_setup) @@ -153,7 +153,7 @@ int ssh1_handle_direction_specific_packet( pktout = ssh_bpp_new_pktout( s->ppl.bpp, (success ? SSH1_SMSG_SUCCESS : SSH1_SMSG_FAILURE)); pq_push(s->ppl.out_pq, pktout); - return TRUE; + return true; case SSH1_CMSG_X11_REQUEST_FORWARDING: if (s->finished_setup) @@ -167,13 +167,13 @@ int ssh1_handle_direction_specific_packet( screen_number = get_uint32(pktin); success = chan_enable_x11_forwarding( - s->mainchan_chan, FALSE, authproto, authdata, screen_number); + s->mainchan_chan, false, authproto, authdata, screen_number); } pktout = ssh_bpp_new_pktout( s->ppl.bpp, (success ? SSH1_SMSG_SUCCESS : SSH1_SMSG_FAILURE)); pq_push(s->ppl.out_pq, pktout); - return TRUE; + return true; case SSH1_CMSG_AGENT_REQUEST_FORWARDING: if (s->finished_setup) @@ -184,19 +184,19 @@ int ssh1_handle_direction_specific_packet( pktout = ssh_bpp_new_pktout( s->ppl.bpp, (success ? SSH1_SMSG_SUCCESS : SSH1_SMSG_FAILURE)); pq_push(s->ppl.out_pq, pktout); - return TRUE; + return true; case SSH1_CMSG_STDIN_DATA: data = get_string(pktin); - chan_send(s->mainchan_chan, FALSE, data.ptr, data.len); - return TRUE; + chan_send(s->mainchan_chan, false, data.ptr, data.len); + return true; case SSH1_CMSG_EOF: chan_send_eof(s->mainchan_chan); - return TRUE; + return true; case SSH1_CMSG_WINDOW_SIZE: - return TRUE; + return true; case SSH1_MSG_PORT_OPEN: remid = get_uint32(pktin); @@ -226,7 +226,7 @@ int ssh1_handle_direction_specific_packet( } else { ssh1_channel_init(c); c->remoteid = remid; - c->halfopen = FALSE; + c->halfopen = false; pktout = ssh_bpp_new_pktout( s->ppl.bpp, SSH1_MSG_CHANNEL_OPEN_CONFIRMATION); put_uint32(pktout, c->remoteid); @@ -235,10 +235,10 @@ int ssh1_handle_direction_specific_packet( ppl_logevent(("Forwarded port opened successfully")); } - return TRUE; + return true; default: - return FALSE; + return false; } unexpected_setup_packet: @@ -246,12 +246,12 @@ int ssh1_handle_direction_specific_packet( "setup phase, type %d (%s)", pktin->type, ssh1_pkt_type(pktin->type)); /* FIXME: ensure caller copes with us just having freed the whole layer */ - return TRUE; + return true; } SshChannel *ssh1_session_open(ConnectionLayer *cl, Channel *chan) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); } struct ssh_rportfwd *ssh1_rportfwd_alloc( @@ -260,7 +260,7 @@ struct ssh_rportfwd *ssh1_rportfwd_alloc( int addressfamily, const char *log_description, PortFwdRecord *pfr, ssh_sharing_connstate *share_ctx) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); return NULL; } @@ -320,7 +320,7 @@ SshChannel *ssh1_serverside_x11_open( c->connlayer = s; ssh1_channel_init(c); - c->halfopen = TRUE; + c->halfopen = true; c->chan = chan; ppl_logevent(("Forwarding X11 connection to client")); @@ -342,7 +342,7 @@ SshChannel *ssh1_serverside_agent_open(ConnectionLayer *cl, Channel *chan) c->connlayer = s; ssh1_channel_init(c); - c->halfopen = TRUE; + c->halfopen = true; c->chan = chan; ppl_logevent(("Forwarding agent connection to client")); diff --git a/ssh1connection.c b/ssh1connection.c index a64ccb3d..bdbc29b0 100644 --- a/ssh1connection.c +++ b/ssh1connection.c @@ -234,9 +234,9 @@ static int ssh1_connection_filter_queue(struct ssh1_connection_state *s) while (1) { if (ssh1_common_filter_queue(&s->ppl)) - return TRUE; + return true; if ((pktin = pq_peek(s->ppl.in_pq)) == NULL) - return FALSE; + return false; switch (pktin->type) { case SSH1_MSG_CHANNEL_DATA: @@ -263,15 +263,15 @@ static int ssh1_connection_filter_queue(struct ssh1_connection_state *s) ssh1_pkt_type(pktin->type), !c ? "nonexistent" : c->halfopen ? "half-open" : "open", localid); - return TRUE; + return true; } switch (pktin->type) { case SSH1_MSG_CHANNEL_OPEN_CONFIRMATION: assert(c->halfopen); c->remoteid = get_uint32(pktin); - c->halfopen = FALSE; - c->throttling_conn = FALSE; + c->halfopen = false; + c->throttling_conn = false; chan_open_confirmation(c->chan); @@ -288,7 +288,7 @@ static int ssh1_connection_filter_queue(struct ssh1_connection_state *s) * message. We'll have handled that in this code by * having already turned c->chan into a zombie, so its * want_close method (which ssh1_channel_check_close - * will consult) will already be returning TRUE. + * will consult) will already be returning true. */ ssh1_channel_check_close(c); @@ -310,10 +310,10 @@ static int ssh1_connection_filter_queue(struct ssh1_connection_state *s) data = get_string(pktin); if (!get_err(pktin)) { int bufsize = chan_send( - c->chan, FALSE, data.ptr, data.len); + c->chan, false, data.ptr, data.len); if (!c->throttling_conn && bufsize > SSH1_BUFFER_LIMIT) { - c->throttling_conn = TRUE; + c->throttling_conn = true; ssh_throttle_conn(s->ppl.ssh, +1); } } @@ -335,7 +335,7 @@ static int ssh1_connection_filter_queue(struct ssh1_connection_state *s) "Received CHANNEL_CLOSE_CONFIRMATION for channel" " %u for which we never sent CHANNEL_CLOSE\n", c->localid); - return TRUE; + return true; } c->closes |= CLOSES_RCVD_CLOSECONF; @@ -351,9 +351,9 @@ static int ssh1_connection_filter_queue(struct ssh1_connection_state *s) if (ssh1_handle_direction_specific_packet(s, pktin)) { pq_pop(s->ppl.in_pq); if (ssh1_check_termination(s)) - return TRUE; + return true; } else { - return FALSE; + return false; } } } @@ -377,7 +377,7 @@ static void ssh1_connection_process_queue(PacketProtocolLayer *ppl) crBegin(s->crState); portfwdmgr_config(s->portfwdmgr, s->conf); - s->portfwdmgr_configured = TRUE; + s->portfwdmgr_configured = true; while (!s->finished_setup) { ssh1_connection_direction_specific_setup(s); @@ -460,7 +460,7 @@ static void ssh1_channel_try_eof(struct ssh1_channel *c) if (c->halfopen) return; /* can't close: not even opened yet */ - c->pending_eof = FALSE; /* we're about to send it */ + c->pending_eof = false; /* we're about to send it */ pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH1_MSG_CHANNEL_CLOSE); put_uint32(pktout, c->remoteid); @@ -525,10 +525,10 @@ int ssh1_check_termination(struct ssh1_connection_state *s) pq_push(s->ppl.out_pq, pktout); ssh_user_close(s->ppl.ssh, "Session finished"); - return TRUE; + return true; } - return FALSE; + return false; } /* @@ -539,8 +539,8 @@ void ssh1_channel_init(struct ssh1_channel *c) { struct ssh1_connection_state *s = c->connlayer; c->closes = 0; - c->pending_eof = FALSE; - c->throttling_conn = FALSE; + c->pending_eof = false; + c->throttling_conn = false; c->sc.vt = &ssh1channel_vtable; c->sc.cl = &s->cl; c->localid = alloc_channel_id(s->channels, struct ssh1_channel); @@ -561,7 +561,7 @@ static void ssh1channel_write_eof(SshChannel *sc) if (c->closes & CLOSES_SENT_CLOSE) return; - c->pending_eof = TRUE; + c->pending_eof = true; ssh1_channel_try_eof(c); } @@ -573,7 +573,7 @@ static void ssh1channel_initiate_close(SshChannel *sc, const char *err) reason = err ? dupprintf("due to local error: %s", err) : NULL; ssh1_channel_close_local(c, reason); sfree(reason); - c->pending_eof = FALSE; /* this will confuse a zombie channel */ + c->pending_eof = false; /* this will confuse a zombie channel */ ssh1_channel_check_close(c); } @@ -634,7 +634,7 @@ static SshChannel *ssh1_lportfwd_open( c->connlayer = s; ssh1_channel_init(c); - c->halfopen = TRUE; + c->halfopen = true; c->chan = chan; ppl_logevent(("Opening connection to %s:%d for %s", @@ -743,7 +743,7 @@ static void ssh1_enable_x_fwd(ConnectionLayer *cl) struct ssh1_connection_state *s = container_of(cl, struct ssh1_connection_state, cl); - s->X11_fwd_enabled = TRUE; + s->X11_fwd_enabled = true; } static void ssh1_enable_agent_fwd(ConnectionLayer *cl) @@ -751,7 +751,7 @@ static void ssh1_enable_agent_fwd(ConnectionLayer *cl) struct ssh1_connection_state *s = container_of(cl, struct ssh1_connection_state, cl); - s->agent_fwd_enabled = TRUE; + s->agent_fwd_enabled = true; } static void ssh1_set_wants_user_input(ConnectionLayer *cl, int wanted) @@ -760,7 +760,7 @@ static void ssh1_set_wants_user_input(ConnectionLayer *cl, int wanted) container_of(cl, struct ssh1_connection_state, cl); s->want_user_input = wanted; - s->finished_setup = TRUE; + s->finished_setup = true; } static int ssh1_connection_want_user_input(PacketProtocolLayer *ppl) diff --git a/ssh1login-server.c b/ssh1login-server.c index 4e3f5a92..4e0c7ca0 100644 --- a/ssh1login-server.c +++ b/ssh1login-server.c @@ -45,11 +45,11 @@ static void ssh1_login_server_process_queue(PacketProtocolLayer *); static int ssh1_login_server_get_specials( PacketProtocolLayer *ppl, add_special_fn_t add_special, - void *ctx) { return FALSE; } + void *ctx) { return false; } static void ssh1_login_server_special_cmd(PacketProtocolLayer *ppl, SessionSpecialCode code, int arg) {} static int ssh1_login_server_want_user_input( - PacketProtocolLayer *ppl) { return FALSE; } + PacketProtocolLayer *ppl) { return false; } static void ssh1_login_server_got_user_input(PacketProtocolLayer *ppl) {} static void ssh1_login_server_reconfigure( PacketProtocolLayer *ppl, Conf *conf) {} @@ -138,7 +138,7 @@ static void ssh1_login_server_process_queue(PacketProtocolLayer *ppl) s->servkey = snew(struct RSAKey); rsa_generate(s->servkey, server_key_bits, no_progress, NULL); s->servkey->comment = NULL; - s->servkey_generated_here = TRUE; + s->servkey_generated_here = true; } s->local_protoflags = SSH1_PROTOFLAGS_SUPPORTED; diff --git a/ssh1login.c b/ssh1login.c index ae02b314..e58f4cd1 100644 --- a/ssh1login.c +++ b/ssh1login.c @@ -394,9 +394,9 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) if ((s->username = get_remote_username(s->conf)) == NULL) { s->cur_prompt = new_prompts(); - s->cur_prompt->to_server = TRUE; + s->cur_prompt->to_server = true; s->cur_prompt->name = dupstr("SSH login name"); - add_prompt(s->cur_prompt, dupstr("login as: "), TRUE); + add_prompt(s->cur_prompt, dupstr("login as: "), true); s->userpass_ret = seat_get_userpass_input( s->ppl.seat, s->cur_prompt, NULL); while (1) { @@ -408,9 +408,9 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) if (s->userpass_ret >= 0) break; - s->want_user_input = TRUE; + s->want_user_input = true; crReturnV; - s->want_user_input = FALSE; + s->want_user_input = false; } if (!s->userpass_ret) { /* @@ -436,11 +436,11 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) if (!(s->supported_auths_mask & (1 << SSH1_AUTH_RSA))) { /* We must not attempt PK auth. Pretend we've already tried it. */ - s->tried_publickey = s->tried_agent = TRUE; + s->tried_publickey = s->tried_agent = true; } else { - s->tried_publickey = s->tried_agent = FALSE; + s->tried_publickey = s->tried_agent = false; } - s->tis_auth_refused = s->ccard_auth_refused = FALSE; + s->tis_auth_refused = s->ccard_auth_refused = false; /* * Load the public half of any configured keyfile for later use. @@ -491,7 +491,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) /* * Attempt RSA authentication using Pageant. */ - s->authed = FALSE; + s->authed = false; s->tried_agent = 1; ppl_logevent(("Pageant is running. Requesting keys.")); @@ -597,7 +597,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) "agent\r\n", PTRLEN_PRINTF( s->comment))); } - s->authed = TRUE; + s->authed = true; } else ppl_logevent(("Pageant's response not " "accepted")); @@ -638,7 +638,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) ppl_logevent(("Trying public key \"%s\"", filename_to_str(s->keyfile))); s->tried_publickey = 1; - got_passphrase = FALSE; + got_passphrase = false; while (!got_passphrase) { /* * Get a passphrase, if necessary. @@ -652,11 +652,11 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) passphrase = NULL; } else { s->cur_prompt = new_prompts(s->ppl.seat); - s->cur_prompt->to_server = FALSE; + s->cur_prompt->to_server = false; s->cur_prompt->name = dupstr("SSH key passphrase"); add_prompt(s->cur_prompt, dupprintf("Passphrase for key \"%.100s\": ", - s->publickey_comment), FALSE); + s->publickey_comment), false); s->userpass_ret = seat_get_userpass_input( s->ppl.seat, s->cur_prompt, NULL); while (1) { @@ -668,9 +668,9 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) if (s->userpass_ret >= 0) break; - s->want_user_input = TRUE; + s->want_user_input = true; crReturnV; - s->want_user_input = FALSE; + s->want_user_input = false; } if (!s->userpass_ret) { /* Failed to get a passphrase. Terminate. */ @@ -693,19 +693,19 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) } if (retd == 1) { /* Correct passphrase. */ - got_passphrase = TRUE; + got_passphrase = true; } else if (retd == 0) { ppl_printf(("Couldn't load private key from %s (%s).\r\n", filename_to_str(s->keyfile), error)); - got_passphrase = FALSE; + got_passphrase = false; break; /* go and try something else */ } else if (retd == -1) { ppl_printf(("Wrong passphrase.\r\n")); - got_passphrase = FALSE; + got_passphrase = false; /* and try again */ } else { assert(0 && "unexpected return from rsa_ssh1_loadkey()"); - got_passphrase = FALSE; /* placate optimisers */ + got_passphrase = false; /* placate optimisers */ } } @@ -818,7 +818,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) return; } ppl_logevent(("Received TIS challenge")); - s->cur_prompt->to_server = TRUE; + s->cur_prompt->to_server = true; s->cur_prompt->name = dupstr("SSH TIS authentication"); /* Prompt heuristic comes from OpenSSH */ if (!memchr(challenge.ptr, '\n', challenge.len)) { @@ -832,8 +832,8 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) dupprintf("Using TIS authentication.%s%s", (*instr_suf) ? "\n" : "", instr_suf); - s->cur_prompt->instr_reqd = TRUE; - add_prompt(s->cur_prompt, prompt, FALSE); + s->cur_prompt->instr_reqd = true; + add_prompt(s->cur_prompt, prompt, false); sfree(instr_suf); } else { ssh_proto_error(s->ppl.ssh, "Received unexpected packet" @@ -866,9 +866,9 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) return; } ppl_logevent(("Received CryptoCard challenge")); - s->cur_prompt->to_server = TRUE; + s->cur_prompt->to_server = true; s->cur_prompt->name = dupstr("SSH CryptoCard authentication"); - s->cur_prompt->name_reqd = FALSE; + s->cur_prompt->name_reqd = false; /* Prompt heuristic comes from OpenSSH */ if (!memchr(challenge.ptr, '\n', challenge.len)) { instr_suf = dupstr(""); @@ -881,8 +881,8 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) dupprintf("Using CryptoCard authentication.%s%s", (*instr_suf) ? "\n" : "", instr_suf); - s->cur_prompt->instr_reqd = TRUE; - add_prompt(s->cur_prompt, prompt, FALSE); + s->cur_prompt->instr_reqd = true; + add_prompt(s->cur_prompt, prompt, false); sfree(instr_suf); } else { ssh_proto_error(s->ppl.ssh, "Received unexpected packet" @@ -898,11 +898,11 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) "available"); return; } - s->cur_prompt->to_server = TRUE; + s->cur_prompt->to_server = true; s->cur_prompt->name = dupstr("SSH password"); add_prompt(s->cur_prompt, dupprintf("%s@%s's password: ", s->username, s->savedhost), - FALSE); + false); } /* @@ -921,9 +921,9 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl) if (s->userpass_ret >= 0) break; - s->want_user_input = TRUE; + s->want_user_input = true; crReturnV; - s->want_user_input = FALSE; + s->want_user_input = false; } if (!s->userpass_ret) { /* diff --git a/ssh2bpp-bare.c b/ssh2bpp-bare.c index e6dfb710..cabb2cd1 100644 --- a/ssh2bpp-bare.c +++ b/ssh2bpp-bare.c @@ -85,7 +85,7 @@ static void ssh2_bare_bpp_handle_input(BinaryPacketProtocol *bpp) */ s->pktin = snew_plus(PktIn, s->packetlen); s->pktin->qnode.prev = s->pktin->qnode.next = NULL; - s->pktin->qnode.on_free_queue = FALSE; + s->pktin->qnode.on_free_queue = false; s->maxlen = 0; s->data = snew_plus_get_aux(s->pktin); @@ -111,7 +111,7 @@ static void ssh2_bare_bpp_handle_input(BinaryPacketProtocol *bpp) if (s->bpp.logctx) { logblank_t blanks[MAX_BLANKS]; int nblanks = ssh2_censor_packet( - s->bpp.pls, s->pktin->type, FALSE, + s->bpp.pls, s->pktin->type, false, make_ptrlen(s->data, s->packetlen), blanks); log_packet(s->bpp.logctx, PKT_INCOMING, s->pktin->type, ssh2_pkt_type(s->bpp.pls->kctx, s->bpp.pls->actx, @@ -158,7 +158,7 @@ static void ssh2_bare_bpp_format_packet(struct ssh2_bare_bpp_state *s, ptrlen pktdata = make_ptrlen(pkt->data + 5, pkt->length - 5); logblank_t blanks[MAX_BLANKS]; int nblanks = ssh2_censor_packet( - s->bpp.pls, pkt->type, TRUE, pktdata, blanks); + s->bpp.pls, pkt->type, true, pktdata, blanks); log_packet(s->bpp.logctx, PKT_OUTGOING, pkt->type, ssh2_pkt_type(s->bpp.pls->kctx, s->bpp.pls->actx, pkt->type), diff --git a/ssh2bpp.c b/ssh2bpp.c index f67b4ece..fddfce00 100644 --- a/ssh2bpp.c +++ b/ssh2bpp.c @@ -117,7 +117,7 @@ void ssh2_bpp_new_outgoing_crypto( ssh2_cipher_alg(s->out.cipher)->text_name)); } else { s->out.cipher = NULL; - s->cbc_ignore_workaround = FALSE; + s->cbc_ignore_workaround = false; } s->out.etm_mode = etm_mode; if (mac) { @@ -217,7 +217,7 @@ void ssh2_bpp_new_incoming_crypto( /* Clear the pending_newkeys flag, so that handle_input below will * start consuming the input data again. */ - s->pending_newkeys = FALSE; + s->pending_newkeys = false; /* And schedule a run of handle_input, in case there's already * input data in the queue. */ @@ -349,7 +349,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp) s->pktin = snew_plus(PktIn, s->maxlen); s->pktin->qnode.prev = s->pktin->qnode.next = NULL; s->pktin->type = 0; - s->pktin->qnode.on_free_queue = FALSE; + s->pktin->qnode.on_free_queue = false; s->data = snew_plus_get_aux(s->pktin); memcpy(s->data, s->buf, s->maxlen); } else if (s->in.mac && s->in.etm_mode) { @@ -399,7 +399,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp) s->pktin = snew_plus(PktIn, OUR_V2_PACKETLIMIT + s->maclen); s->pktin->qnode.prev = s->pktin->qnode.next = NULL; s->pktin->type = 0; - s->pktin->qnode.on_free_queue = FALSE; + s->pktin->qnode.on_free_queue = false; s->data = snew_plus_get_aux(s->pktin); memcpy(s->data, s->buf, 4); @@ -465,7 +465,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp) s->pktin = snew_plus(PktIn, s->maxlen); s->pktin->qnode.prev = s->pktin->qnode.next = NULL; s->pktin->type = 0; - s->pktin->qnode.on_free_queue = FALSE; + s->pktin->qnode.on_free_queue = false; s->data = snew_plus_get_aux(s->pktin); memcpy(s->data, s->buf, s->cipherblk); @@ -562,7 +562,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp) if (s->bpp.logctx) { logblank_t blanks[MAX_BLANKS]; int nblanks = ssh2_censor_packet( - s->bpp.pls, s->pktin->type, FALSE, + s->bpp.pls, s->pktin->type, false, make_ptrlen(s->data, s->length), blanks); log_packet(s->bpp.logctx, PKT_INCOMING, s->pktin->type, ssh2_pkt_type(s->bpp.pls->kctx, s->bpp.pls->actx, @@ -590,7 +590,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp) * the transport layer has initialised the new keys by * calling ssh2_bpp_new_incoming_crypto above. */ - s->pending_newkeys = TRUE; + s->pending_newkeys = true; crWaitUntilV(!s->pending_newkeys); continue; } @@ -611,7 +611,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp) * that a delayed compression method enabled in any * future rekey will be treated as un-delayed. */ - s->seen_userauth_success = TRUE; + s->seen_userauth_success = true; } if (s->pending_compression && userauth_range(type)) { @@ -627,7 +627,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp) * to authenticate. The next userauth packet we send * will re-block the output direction. */ - s->pending_compression = FALSE; + s->pending_compression = false; queue_idempotent_callback(&s->bpp.ic_out_pq); } } @@ -665,7 +665,7 @@ static void ssh2_bpp_format_packet_inner(struct ssh2_bpp_state *s, PktOut *pkt) pkt->length - pkt->prefix); logblank_t blanks[MAX_BLANKS]; int nblanks = ssh2_censor_packet( - s->bpp.pls, pkt->type, TRUE, pktdata, blanks); + s->bpp.pls, pkt->type, true, pktdata, blanks); log_packet(s->bpp.logctx, PKT_OUTGOING, pkt->type, ssh2_pkt_type(s->bpp.pls->kctx, s->bpp.pls->actx, pkt->type), @@ -894,7 +894,7 @@ static void ssh2_bpp_handle_output(BinaryPacketProtocol *bpp) * USERAUTH_SUCCESS. Block (non-userauth) outgoing packets * until we see the reply. */ - s->pending_compression = TRUE; + s->pending_compression = true; return; } else if (type == SSH2_MSG_USERAUTH_SUCCESS && s->is_server) { ssh2_bpp_enable_pending_compression(s); diff --git a/ssh2connection-client.c b/ssh2connection-client.c index dbccf42a..8a481f50 100644 --- a/ssh2connection-client.c +++ b/ssh2connection-client.c @@ -131,7 +131,7 @@ int ssh2_connection_parse_global_request( * We don't know of any global requests that an SSH client needs * to honour. */ - return FALSE; + return false; } PktOut *ssh2_portfwd_chanopen( @@ -290,7 +290,7 @@ SshChannel *ssh2_session_open(ConnectionLayer *cl, Channel *chan) c->connlayer = s; ssh2_channel_init(c); - c->halfopen = TRUE; + c->halfopen = true; c->chan = chan; ppl_logevent(("Opening main session channel")); @@ -304,13 +304,13 @@ SshChannel *ssh2_session_open(ConnectionLayer *cl, Channel *chan) SshChannel *ssh2_serverside_x11_open( ConnectionLayer *cl, Channel *chan, const SocketPeerInfo *pi) { - assert(FALSE && "Should never be called in the client"); + assert(false && "Should never be called in the client"); return 0; /* placate optimiser */ } SshChannel *ssh2_serverside_agent_open(ConnectionLayer *cl, Channel *chan) { - assert(FALSE && "Should never be called in the client"); + assert(false && "Should never be called in the client"); return 0; /* placate optimiser */ } @@ -353,24 +353,24 @@ int ssh2channel_start_subsystem( put_stringz(pktout, subsystem); pq_push(s->ppl.out_pq, pktout); - return TRUE; + return true; } void ssh2channel_send_exit_status(SshChannel *sc, int status) { - assert(FALSE && "Should never be called in the client"); + assert(false && "Should never be called in the client"); } void ssh2channel_send_exit_signal( SshChannel *sc, ptrlen signame, int core_dumped, ptrlen msg) { - assert(FALSE && "Should never be called in the client"); + assert(false && "Should never be called in the client"); } void ssh2channel_send_exit_signal_numeric( SshChannel *sc, int signum, int core_dumped, ptrlen msg) { - assert(FALSE && "Should never be called in the client"); + assert(false && "Should never be called in the client"); } void ssh2channel_request_x11_forwarding( @@ -434,7 +434,7 @@ int ssh2channel_send_env_var( put_stringz(pktout, value); pq_push(s->ppl.out_pq, pktout); - return TRUE; + return true; } int ssh2channel_send_serial_break(SshChannel *sc, int want_reply, int length) @@ -447,7 +447,7 @@ int ssh2channel_send_serial_break(SshChannel *sc, int want_reply, int length) put_uint32(pktout, length); pq_push(s->ppl.out_pq, pktout); - return TRUE; + return true; } int ssh2channel_send_signal( @@ -461,7 +461,7 @@ int ssh2channel_send_signal( put_stringz(pktout, signame); pq_push(s->ppl.out_pq, pktout); - return TRUE; + return true; } void ssh2channel_send_terminal_size_change(SshChannel *sc, int w, int h) diff --git a/ssh2connection-server.c b/ssh2connection-server.c index 7691ffb1..e49f591e 100644 --- a/ssh2connection-server.c +++ b/ssh2connection-server.c @@ -100,7 +100,7 @@ int ssh2_connection_parse_global_request( return toret; } else { /* Unrecognised request. */ - return FALSE; + return false; } } @@ -142,17 +142,17 @@ struct ssh_rportfwd *ssh2_rportfwd_alloc( int addressfamily, const char *log_description, PortFwdRecord *pfr, ssh_sharing_connstate *share_ctx) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); } void ssh2_rportfwd_remove(ConnectionLayer *cl, struct ssh_rportfwd *rpf) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); } SshChannel *ssh2_session_open(ConnectionLayer *cl, Channel *chan) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); } SshChannel *ssh2_serverside_x11_open( @@ -166,7 +166,7 @@ SshChannel *ssh2_serverside_x11_open( c->connlayer = s; ssh2_channel_init(c); - c->halfopen = TRUE; + c->halfopen = true; c->chan = chan; ppl_logevent(("Forwarding X11 channel to client")); @@ -189,7 +189,7 @@ SshChannel *ssh2_serverside_agent_open(ConnectionLayer *cl, Channel *chan) c->connlayer = s; ssh2_channel_init(c); - c->halfopen = TRUE; + c->halfopen = true; c->chan = chan; ppl_logevent(("Forwarding SSH agent to client")); @@ -202,19 +202,19 @@ SshChannel *ssh2_serverside_agent_open(ConnectionLayer *cl, Channel *chan) void ssh2channel_start_shell(SshChannel *sc, int want_reply) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); } void ssh2channel_start_command( SshChannel *sc, int want_reply, const char *command) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); } int ssh2channel_start_subsystem( SshChannel *sc, int want_reply, const char *subsystem) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); } void ssh2channel_send_exit_status(SshChannel *sc, int status) @@ -262,38 +262,38 @@ void ssh2channel_request_x11_forwarding( SshChannel *sc, int want_reply, const char *authproto, const char *authdata, int screen_number, int oneshot) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); } void ssh2channel_request_agent_forwarding(SshChannel *sc, int want_reply) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); } void ssh2channel_request_pty( SshChannel *sc, int want_reply, Conf *conf, int w, int h) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); } int ssh2channel_send_env_var( SshChannel *sc, int want_reply, const char *var, const char *value) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); } int ssh2channel_send_serial_break(SshChannel *sc, int want_reply, int length) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); } int ssh2channel_send_signal( SshChannel *sc, int want_reply, const char *signame) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); } void ssh2channel_send_terminal_size_change(SshChannel *sc, int w, int h) { - assert(FALSE && "Should never be called in the server"); + assert(false && "Should never be called in the server"); } diff --git a/ssh2connection.c b/ssh2connection.c index b858a04c..04a44740 100644 --- a/ssh2connection.c +++ b/ssh2connection.c @@ -334,9 +334,9 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s) while (1) { if (ssh2_common_filter_queue(&s->ppl)) - return TRUE; + return true; if ((pktin = pq_peek(s->ppl.in_pq)) == NULL) - return FALSE; + return false; switch (pktin->type) { case SSH2_MSG_GLOBAL_REQUEST: @@ -363,7 +363,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s) "Received %s with no outstanding global request", ssh2_pkt_type(s->ppl.bpp->pls->kctx, s->ppl.bpp->pls->actx, pktin->type)); - return TRUE; + return true; } s->globreq_head->handler(s, pktin, s->globreq_head->ctx); @@ -405,7 +405,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s) } c->remoteid = remid; - c->halfopen = FALSE; + c->halfopen = false; if (chanopen_result.outcome == CHANOPEN_RESULT_FAILURE) { pktout = ssh_bpp_new_pktout( s->ppl.bpp, SSH2_MSG_CHANNEL_OPEN_FAILURE); @@ -479,14 +479,14 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s) (!c ? "nonexistent" : c->halfopen ? "half-open" : "open"), localid); - return TRUE; + return true; } switch (pktin->type) { case SSH2_MSG_CHANNEL_OPEN_CONFIRMATION: assert(c->halfopen); c->remoteid = get_uint32(pktin); - c->halfopen = FALSE; + c->halfopen = false; c->remwindow = get_uint32(pktin); c->remmaxpkt = get_uint32(pktin); @@ -505,7 +505,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s) * message. We'll have handled that in this code by * having already turned c->chan into a zombie, so its * want_close method (which ssh2_channel_check_close - * will consult) will already be returning TRUE. + * will consult) will already be returning true. */ ssh2_channel_check_close(c); @@ -569,7 +569,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s) if ((bufsize > c->locmaxwin || (s->ssh_is_simple && bufsize>0)) && !c->throttling_conn) { - c->throttling_conn = TRUE; + c->throttling_conn = true; ssh_throttle_conn(s->ppl.ssh, +1); } } @@ -586,7 +586,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s) type = get_string(pktin); want_reply = get_bool(pktin); - reply_success = FALSE; + reply_success = false; if (c->closes & CLOSES_SENT_CLOSE) { /* @@ -596,7 +596,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s) * side's CHANNEL_CLOSE and arrive after they have * wound the channel up completely. */ - want_reply = FALSE; + want_reply = false; } /* @@ -610,7 +610,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s) } else if (ptrlen_eq_string(type, "exit-signal")) { ptrlen signame; int signum; - int core = FALSE; + int core = false; ptrlen errmsg; int format; @@ -657,7 +657,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s) break; default: /* Couldn't parse this message in either format */ - reply_success = FALSE; + reply_success = false; break; } } else if (ptrlen_eq_string(type, "shell")) { @@ -694,7 +694,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s) if (get_err(bs_modes) || get_avail(bs_modes) > 0) { ppl_logevent(("Unable to decode terminal mode " "string")); - reply_success = FALSE; + reply_success = false; } else { reply_success = chan_allocate_pty( c->chan, termtype, width, height, @@ -740,7 +740,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s) "channel request", ssh2_pkt_type(s->ppl.bpp->pls->kctx, s->ppl.bpp->pls->actx, pktin->type)); - return TRUE; + return true; } ocr->handler(c, pktin, ocr->ctx); c->chanreq_head = ocr->next; @@ -839,7 +839,7 @@ static int ssh2_connection_filter_queue(struct ssh2_connection_state *s) break; default: - return FALSE; + return false; } } } @@ -966,7 +966,7 @@ static void ssh2_connection_process_queue(PacketProtocolLayer *ppl) * Enable port forwardings. */ portfwdmgr_config(s->portfwdmgr, s->conf); - s->portfwdmgr_configured = TRUE; + s->portfwdmgr_configured = true; /* * Create the main session channel, if any. @@ -1051,7 +1051,7 @@ static void ssh2_channel_try_eof(struct ssh2_channel *c) if (bufchain_size(&c->outbuffer) > 0 || bufchain_size(&c->errbuffer) > 0) return; /* can't send EOF: pending outgoing data */ - c->pending_eof = FALSE; /* we're about to send it */ + c->pending_eof = false; /* we're about to send it */ pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_CHANNEL_EOF); put_uint32(pktout, c->remoteid); @@ -1120,7 +1120,7 @@ static void ssh2_try_send_and_unthrottle(struct ssh2_channel *c) return; /* don't send on channels we've EOFed */ bufsize = ssh2_try_send(c); if (bufsize == 0) { - c->throttled_by_backlog = FALSE; + c->throttled_by_backlog = false; ssh2_channel_check_throttle(c); } } @@ -1227,9 +1227,9 @@ void ssh2_channel_init(struct ssh2_channel *c) { struct ssh2_connection_state *s = c->connlayer; c->closes = 0; - c->pending_eof = FALSE; - c->throttling_conn = FALSE; - c->throttled_by_backlog = FALSE; + c->pending_eof = false; + c->throttling_conn = false; + c->throttled_by_backlog = false; c->sharectx = NULL; c->locwindow = c->locmaxwin = c->remlocwin = s->ssh_is_simple ? OUR_V2_BIGWIN : OUR_V2_WINSIZE; @@ -1313,7 +1313,7 @@ static void ssh2channel_write_eof(SshChannel *sc) if (c->closes & CLOSES_SENT_EOF) return; - c->pending_eof = TRUE; + c->pending_eof = true; ssh2_channel_try_eof(c); } @@ -1325,7 +1325,7 @@ static void ssh2channel_initiate_close(SshChannel *sc, const char *err) reason = err ? dupprintf("due to local error: %s", err) : NULL; ssh2_channel_close_local(c, reason); sfree(reason); - c->pending_eof = FALSE; /* this will confuse a zombie channel */ + c->pending_eof = false; /* this will confuse a zombie channel */ ssh2_channel_check_close(c); } @@ -1414,7 +1414,7 @@ static SshChannel *ssh2_lportfwd_open( c->connlayer = s; ssh2_channel_init(c); - c->halfopen = TRUE; + c->halfopen = true; c->chan = chan; pktout = ssh2_portfwd_chanopen(s, c, hostname, port, description, pi); @@ -1534,11 +1534,11 @@ static int ssh2_connection_get_specials( { struct ssh2_connection_state *s = container_of(ppl, struct ssh2_connection_state, ppl); - int toret = FALSE; + int toret = false; if (s->mainchan) { mainchan_get_specials(s->mainchan, add_special, ctx); - toret = TRUE; + toret = true; } /* @@ -1551,7 +1551,7 @@ static int ssh2_connection_get_specials( add_special(ctx, NULL, SS_SEP, 0); add_special(ctx, "IGNORE message", SS_NOP, 0); - toret = TRUE; + toret = true; } return toret; @@ -1642,7 +1642,7 @@ static void ssh2_enable_x_fwd(ConnectionLayer *cl) struct ssh2_connection_state *s = container_of(cl, struct ssh2_connection_state, cl); - s->X11_fwd_enabled = TRUE; + s->X11_fwd_enabled = true; } static void ssh2_enable_agent_fwd(ConnectionLayer *cl) @@ -1650,7 +1650,7 @@ static void ssh2_enable_agent_fwd(ConnectionLayer *cl) struct ssh2_connection_state *s = container_of(cl, struct ssh2_connection_state, cl); - s->agent_fwd_enabled = TRUE; + s->agent_fwd_enabled = true; } static void ssh2_set_wants_user_input(ConnectionLayer *cl, int wanted) diff --git a/ssh2kex-client.c b/ssh2kex-client.c index ff09dcf7..a83f32ec 100644 --- a/ssh2kex-client.c +++ b/ssh2kex-client.c @@ -618,7 +618,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s) return; } - s->gss_kex_used = TRUE; + s->gss_kex_used = true; /*- * If this the first KEX, save the GSS context for "gssapi-keyex" @@ -695,7 +695,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s) * cache. */ if (s->hostkey_alg) { - s->need_gss_transient_hostkey = TRUE; + s->need_gss_transient_hostkey = true; } else { /* * If we negotiated the "null" host key algorithm @@ -718,7 +718,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s) */ if (!s->warned_about_no_gss_transient_hostkey) { ppl_logevent(("No fallback host key available")); - s->warned_about_no_gss_transient_hostkey = TRUE; + s->warned_about_no_gss_transient_hostkey = true; } } } @@ -738,7 +738,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s) ppl_logevent(("Post-GSS rekey provided fallback host key:")); ppl_logevent(("%s", s->fingerprint)); ssh_transient_hostkey_cache_add(s->thc, s->hkey); - s->need_gss_transient_hostkey = FALSE; + s->need_gss_transient_hostkey = false; } else if (!ssh_transient_hostkey_cache_verify(s->thc, s->hkey)) { ppl_logevent(("Non-GSS rekey after initial GSS kex " "used host key:")); @@ -836,7 +836,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s) s->fingerprint = NULL; store_host_key(s->savedhost, s->savedport, ssh_key_cache_id(s->hkey), s->keystr); - s->cross_certifying = FALSE; + s->cross_certifying = false; /* * Don't forget to store the new key as the one we'll be * re-checking in future normal rekeys. diff --git a/ssh2kex-server.c b/ssh2kex-server.c index 4b62d56d..893add05 100644 --- a/ssh2kex-server.c +++ b/ssh2kex-server.c @@ -82,12 +82,12 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s) } if (pktin->type != SSH2_MSG_KEX_DH_GEX_REQUEST_OLD) { - s->dh_got_size_bounds = TRUE; + s->dh_got_size_bounds = true; s->dh_min_size = get_uint32(pktin); s->pbits = get_uint32(pktin); s->dh_max_size = get_uint32(pktin); } else { - s->dh_got_size_bounds = FALSE; + s->dh_got_size_bounds = false; s->pbits = get_uint32(pktin); } diff --git a/ssh2transhk.c b/ssh2transhk.c index 6551f73f..46e2cf58 100644 --- a/ssh2transhk.c +++ b/ssh2transhk.c @@ -91,7 +91,7 @@ int ssh_transient_hostkey_cache_verify( ssh_transient_hostkey_cache *thc, ssh_key *key) { struct ssh_transient_hostkey_cache_entry *ent; - int toret = FALSE; + int toret = false; if ((ent = find234(thc->cache, (void *)ssh_key_alg(key), ssh_transient_hostkey_cache_find)) != NULL) { @@ -101,7 +101,7 @@ int ssh_transient_hostkey_cache_verify( if (this_blob->len == ent->pub_blob->len && !memcmp(this_blob->s, ent->pub_blob->s, this_blob->len)) - toret = TRUE; + toret = true; strbuf_free(this_blob); } diff --git a/ssh2transport.c b/ssh2transport.c index 152d530d..c1f645c0 100644 --- a/ssh2transport.c +++ b/ssh2transport.c @@ -141,7 +141,7 @@ PacketProtocolLayer *ssh2_transport_new( s->shgss->ctx = NULL; #endif s->thc = ssh_transient_hostkey_cache_new(); - s->gss_kex_used = FALSE; + s->gss_kex_used = false; s->outgoing_kexinit = strbuf_new(); s->incoming_kexinit = strbuf_new(); @@ -336,7 +336,7 @@ int ssh2_common_filter_queue(PacketProtocolLayer *ppl) ssh2_disconnect_reasons[reason] : "unknown"), PTRLEN_PRINTF(msg)); pq_pop(ppl->in_pq); - return TRUE; /* indicate that we've been freed */ + return true; /* indicate that we've been freed */ case SSH2_MSG_DEBUG: /* XXX maybe we should actually take notice of the return value */ @@ -352,11 +352,11 @@ int ssh2_common_filter_queue(PacketProtocolLayer *ppl) break; default: - return FALSE; + return false; } } - return FALSE; + return false; } static int ssh2_transport_filter_queue(struct ssh2_transport_state *s) @@ -365,9 +365,9 @@ static int ssh2_transport_filter_queue(struct ssh2_transport_state *s) while (1) { if (ssh2_common_filter_queue(&s->ppl)) - return TRUE; + return true; if ((pktin = pq_peek(s->ppl.in_pq)) == NULL) - return FALSE; + return false; /* Pass on packets to the next layer if they're outside * the range reserved for the transport protocol. */ @@ -381,7 +381,7 @@ static int ssh2_transport_filter_queue(struct ssh2_transport_state *s) ssh2_pkt_type(s->ppl.bpp->pls->kctx, s->ppl.bpp->pls->actx, pktin->type)); - return TRUE; + return true; } pq_pop(s->ppl.in_pq); @@ -389,7 +389,7 @@ static int ssh2_transport_filter_queue(struct ssh2_transport_state *s) } else { /* Anything else is a transport-layer packet that the main * process_queue coroutine should handle. */ - return FALSE; + return false; } } } @@ -522,10 +522,10 @@ static void ssh2_write_kexinit_lists( for (j = 0; j < MAXKEXLIST; j++) kexlists[i][j].name = NULL; /* List key exchange algorithms. */ - warn = FALSE; + warn = false; for (i = 0; i < n_preferred_kex; i++) { const struct ssh_kexes *k = preferred_kex[i]; - if (!k) warn = TRUE; + if (!k) warn = true; else for (j = 0; j < k->nkexes; j++) { alg = ssh2_kexinit_addalg(kexlists[KEXLIST_KEX], k->list[j]->name); @@ -543,7 +543,7 @@ static void ssh2_write_kexinit_lists( alg = ssh2_kexinit_addalg(kexlists[KEXLIST_HOSTKEY], ssh_key_alg(our_hostkeys[i])->ssh_id); alg->u.hk.hostkey = ssh_key_alg(our_hostkeys[i]); - alg->u.hk.warn = FALSE; + alg->u.hk.warn = false; } } else if (first_time) { /* @@ -558,10 +558,10 @@ static void ssh2_write_kexinit_lists( * they surely _do_ want to be alerted that a server * they're actually connecting to is using it. */ - warn = FALSE; + warn = false; for (i = 0; i < n_preferred_hk; i++) { if (preferred_hk[i] == HK_WARN) - warn = TRUE; + warn = true; for (j = 0; j < lenof(ssh2_hostkey_algs); j++) { if (ssh2_hostkey_algs[j].id != preferred_hk[i]) continue; @@ -574,10 +574,10 @@ static void ssh2_write_kexinit_lists( } } } - warn = FALSE; + warn = false; for (i = 0; i < n_preferred_hk; i++) { if (preferred_hk[i] == HK_WARN) - warn = TRUE; + warn = true; for (j = 0; j < lenof(ssh2_hostkey_algs); j++) { if (ssh2_hostkey_algs[j].id != preferred_hk[i]) continue; @@ -601,10 +601,10 @@ static void ssh2_write_kexinit_lists( * in which case the cache will currently be empty, which * isn't helpful! */ - warn = FALSE; + warn = false; for (i = 0; i < n_preferred_hk; i++) { if (preferred_hk[i] == HK_WARN) - warn = TRUE; + warn = true; for (j = 0; j < lenof(ssh2_hostkey_algs); j++) { if (ssh2_hostkey_algs[j].id != preferred_hk[i]) continue; @@ -629,7 +629,7 @@ static void ssh2_write_kexinit_lists( assert(hk_prev); alg = ssh2_kexinit_addalg(kexlists[KEXLIST_HOSTKEY], hk_prev->ssh_id); alg->u.hk.hostkey = hk_prev; - alg->u.hk.warn = FALSE; + alg->u.hk.warn = false; } if (can_gssapi_keyex) { alg = ssh2_kexinit_addalg(kexlists[KEXLIST_HOSTKEY], "null"); @@ -637,7 +637,7 @@ static void ssh2_write_kexinit_lists( } /* List encryption algorithms (client->server then server->client). */ for (k = KEXLIST_CSCIPHER; k <= KEXLIST_SCCIPHER; k++) { - warn = FALSE; + warn = false; #ifdef FUZZING alg = ssh2_kexinit_addalg(kexlists[k], "none"); alg->u.cipher.cipher = NULL; @@ -645,7 +645,7 @@ static void ssh2_write_kexinit_lists( #endif /* FUZZING */ for (i = 0; i < n_preferred_ciphers; i++) { const struct ssh2_ciphers *c = preferred_ciphers[i]; - if (!c) warn = TRUE; + if (!c) warn = true; else for (j = 0; j < c->nciphers; j++) { alg = ssh2_kexinit_addalg(kexlists[k], c->list[j]->name); @@ -671,12 +671,12 @@ static void ssh2_write_kexinit_lists( #ifdef FUZZING alg = ssh2_kexinit_addalg(kexlists[j], "none"); alg->u.mac.mac = NULL; - alg->u.mac.etm = FALSE; + alg->u.mac.etm = false; #endif /* FUZZING */ for (i = 0; i < nmacs; i++) { alg = ssh2_kexinit_addalg(kexlists[j], maclist[i]->name); alg->u.mac.mac = maclist[i]; - alg->u.mac.etm = FALSE; + alg->u.mac.etm = false; } for (i = 0; i < nmacs; i++) { /* For each MAC, there may also be an ETM version, @@ -684,7 +684,7 @@ static void ssh2_write_kexinit_lists( if (maclist[i]->etm_name) { alg = ssh2_kexinit_addalg(kexlists[j], maclist[i]->etm_name); alg->u.mac.mac = maclist[i]; - alg->u.mac.etm = TRUE; + alg->u.mac.etm = true; } } } @@ -697,22 +697,22 @@ static void ssh2_write_kexinit_lists( /* Prefer non-delayed versions */ alg = ssh2_kexinit_addalg(kexlists[j], preferred_comp->name); alg->u.comp.comp = preferred_comp; - alg->u.comp.delayed = FALSE; + alg->u.comp.delayed = false; if (preferred_comp->delayed_name) { alg = ssh2_kexinit_addalg(kexlists[j], preferred_comp->delayed_name); alg->u.comp.comp = preferred_comp; - alg->u.comp.delayed = TRUE; + alg->u.comp.delayed = true; } for (i = 0; i < lenof(compressions); i++) { const struct ssh_compression_alg *c = compressions[i]; alg = ssh2_kexinit_addalg(kexlists[j], c->name); alg->u.comp.comp = c; - alg->u.comp.delayed = FALSE; + alg->u.comp.delayed = false; if (c->delayed_name) { alg = ssh2_kexinit_addalg(kexlists[j], c->delayed_name); alg->u.comp.comp = c; - alg->u.comp.delayed = TRUE; + alg->u.comp.delayed = true; } } } @@ -757,7 +757,7 @@ static int ssh2_scan_kexinits( get_data(client, 1 + 16); get_data(server, 1 + 16); - guess_correct = TRUE; + guess_correct = true; /* Find the matching string in each list, and map it to its * kexinit_algorithm structure. */ @@ -772,13 +772,13 @@ static int ssh2_scan_kexinits( * agree" that we'd generate if we pressed on regardless * and treated the empty get_string() result as genuine */ ssh_proto_error(ssh, "KEXINIT packet was incomplete"); - return FALSE; + return false; } - for (cfirst = TRUE, clist = clists[i]; - get_commasep_word(&clist, &cword); cfirst = FALSE) - for (sfirst = TRUE, slist = slists[i]; - get_commasep_word(&slist, &sword); sfirst = FALSE) + for (cfirst = true, clist = clists[i]; + get_commasep_word(&clist, &cword); cfirst = false) + for (sfirst = true, slist = slists[i]; + get_commasep_word(&slist, &sword); sfirst = false) if (ptrlen_eq_ptrlen(cword, sword)) { found = cword; goto found_match; @@ -798,7 +798,7 @@ static int ssh2_scan_kexinits( * PROTOCOL.chacha20poly1305 or as far as I can see by their * code.) */ - guess_correct = FALSE; + guess_correct = false; continue; @@ -819,7 +819,7 @@ static int ssh2_scan_kexinits( * packet (if any) is officially wrong. */ if ((i == KEXLIST_KEX || i == KEXLIST_HOSTKEY) && !(cfirst || sfirst)) - guess_correct = FALSE; + guess_correct = false; } /* @@ -867,7 +867,7 @@ static int ssh2_scan_kexinits( */ ssh_sw_abort(ssh, "Couldn't agree a %s (available: %.*s)", kexlist_descr[i], PTRLEN_PRINTF(slists[i])); - return FALSE; + return false; } switch (i) { @@ -922,7 +922,7 @@ static int ssh2_scan_kexinits( break; default: - assert(FALSE && "Bad list index in scan_kexinits"); + assert(false && "Bad list index in scan_kexinits"); } } @@ -943,7 +943,7 @@ static int ssh2_scan_kexinits( server_hostkeys[(*n_server_hostkeys)++] = i; } - return TRUE; + return true; } void ssh2transport_finalise_exhash(struct ssh2_transport_state *s) @@ -979,9 +979,9 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl) s->in.mac = s->out.mac = NULL; s->in.comp = s->out.comp = NULL; - s->got_session_id = FALSE; - s->need_gss_transient_hostkey = FALSE; - s->warned_about_no_gss_transient_hostkey = FALSE; + s->got_session_id = false; + s->need_gss_transient_hostkey = false; + s->warned_about_no_gss_transient_hostkey = false; begin_key_exchange: @@ -992,7 +992,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl) * GSS key exchange even if we could. (See comments below, * where the flag was set on the previous key exchange.) */ - s->can_gssapi_keyex = FALSE; + s->can_gssapi_keyex = false; } else if (conf_get_int(s->conf, CONF_try_gssapi_kex)) { /* * We always check if we have GSS creds before we come up with @@ -1007,7 +1007,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl) * state is "fresh". */ if (s->rekey_class != RK_GSS_UPDATE) - ssh2_transport_gss_update(s, TRUE); + ssh2_transport_gss_update(s, true); /* Do GSSAPI KEX when capable */ s->can_gssapi_keyex = s->gss_status & GSS_KEX_CAPABLE; @@ -1028,7 +1028,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl) s->can_gssapi_keyex = 0; s->gss_delegate = conf_get_int(s->conf, CONF_gssapifwd); } else { - s->can_gssapi_keyex = FALSE; + s->can_gssapi_keyex = false; } #endif @@ -1053,7 +1053,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl) !s->got_session_id, s->can_gssapi_keyex, s->gss_kex_used && !s->need_gss_transient_hostkey); /* First KEX packet does _not_ follow, because we're not that brave. */ - put_bool(s->outgoing_kexinit, FALSE); + put_bool(s->outgoing_kexinit, false); put_uint32(s->outgoing_kexinit, 0); /* reserved */ /* @@ -1067,7 +1067,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl) /* * Flag that KEX is in progress. */ - s->kex_in_progress = TRUE; + s->kex_in_progress = true; /* * Wait for the other side's KEXINIT, and save it. @@ -1097,7 +1097,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl) s->kexlists, &s->kex_alg, &s->hostkey_alg, &s->out, &s->in, &s->warn_kex, &s->warn_hk, &s->warn_cscipher, &s->warn_sccipher, s->ppl.ssh, NULL, &s->ignorepkt, &nhk, hks)) - return; /* FALSE means a fatal error function was called */ + return; /* false means a fatal error function was called */ /* * In addition to deciding which host key we're actually going @@ -1147,13 +1147,13 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl) for (j = 0; j < s->n_uncert_hostkeys; j++) { const struct ssh_signkey_with_user_pref_id *hktype = &ssh2_hostkey_algs[s->uncert_hostkeys[j]]; - int better = FALSE; + int better = false; for (k = 0; k < HK_MAX; k++) { int id = conf_get_int_int(s->conf, CONF_ssh_hklist, k); if (id == HK_WARN) { break; } else if (id == hktype->id) { - better = TRUE; + better = true; break; } } @@ -1245,7 +1245,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl) memcpy(s->session_id, s->exchange_hash, sizeof(s->exchange_hash)); s->session_id_len = s->kex_alg->hash->hlen; assert(s->session_id_len <= sizeof(s->session_id)); - s->got_session_id = TRUE; + s->got_session_id = true; } /* @@ -1254,7 +1254,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl) pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_NEWKEYS); pq_push(s->ppl.out_pq, pktout); /* Start counting down the outgoing-data limit for these cipher keys. */ - s->stats->out.running = TRUE; + s->stats->out.running = true; s->stats->out.remaining = s->max_data_size; /* @@ -1317,7 +1317,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl) return; } /* Start counting down the incoming-data limit for these cipher keys. */ - s->stats->in.running = TRUE; + s->stats->in.running = true; s->stats->in.remaining = s->max_data_size; /* @@ -1377,7 +1377,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl) /* * Otherwise, schedule a timer for our next rekey. */ - s->kex_in_progress = FALSE; + s->kex_in_progress = false; s->last_rekey = GETTICKCOUNT(); (void) ssh2_transport_timer_update(s, 0); @@ -1429,7 +1429,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl) pq_push(s->ppl.out_pq, pktout); } - s->higher_layer_ok = TRUE; + s->higher_layer_ok = true; queue_idempotent_callback(&s->higher_layer->ic_process_queue); } @@ -1504,7 +1504,7 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl) s->rekey_reason)); /* Reset the counters, so that at least this message doesn't * hit the event log _too_ often. */ - s->stats->in.running = s->stats->out.running = TRUE; + s->stats->in.running = s->stats->out.running = true; s->stats->in.remaining = s->stats->out.remaining = s->max_data_size; (void) ssh2_transport_timer_update(s, 0); @@ -1556,7 +1556,7 @@ static void ssh2_transport_timer(void *ctx, unsigned long now) * but not if this is unsafe. */ if (conf_get_int(s->conf, CONF_gssapirekey)) { - ssh2_transport_gss_update(s, FALSE); + ssh2_transport_gss_update(s, false); if ((s->gss_status & GSS_KEX_CAPABLE) != 0 && (s->gss_status & GSS_CTXT_MAYFAIL) == 0 && (s->gss_status & (GSS_CRED_UPDATED|GSS_CTXT_EXPIRES)) != 0) { @@ -1797,12 +1797,12 @@ static int ssh2_transport_get_specials( { struct ssh2_transport_state *s = container_of(ppl, struct ssh2_transport_state, ppl); - int need_separator = FALSE; + int need_separator = false; int toret; if (ssh_ppl_get_specials(s->higher_layer, add_special, ctx)) { - need_separator = TRUE; - toret = TRUE; + need_separator = true; + toret = true; } /* @@ -1813,11 +1813,11 @@ static int ssh2_transport_get_specials( if (!(s->ppl.remote_bugs & BUG_SSH2_REKEY)) { if (need_separator) { add_special(ctx, NULL, SS_SEP, 0); - need_separator = FALSE; + need_separator = false; } add_special(ctx, "Repeat key exchange", SS_REKEY, 0); - toret = TRUE; + toret = true; if (s->n_uncert_hostkeys) { int i; @@ -1852,7 +1852,7 @@ static void ssh2_transport_special_cmd(PacketProtocolLayer *ppl, } else if (code == SS_XCERT) { if (!s->kex_in_progress) { s->hostkey_alg = ssh2_hostkey_algs[arg].alg; - s->cross_certifying = TRUE; + s->cross_certifying = true; s->rekey_reason = "cross-certifying new host key"; s->rekey_class = RK_NORMAL; queue_idempotent_callback(&s->ppl.ic_process_queue); @@ -1884,7 +1884,7 @@ static void ssh2_transport_reconfigure(PacketProtocolLayer *ppl, Conf *conf) { struct ssh2_transport_state *s; const char *rekey_reason = NULL; - int rekey_mandatory = FALSE; + int rekey_mandatory = false; unsigned long old_max_data_size, rekey_time; int i; @@ -1921,19 +1921,19 @@ static void ssh2_transport_reconfigure(PacketProtocolLayer *ppl, Conf *conf) if (conf_get_int(s->conf, CONF_compression) != conf_get_int(conf, CONF_compression)) { rekey_reason = "compression setting changed"; - rekey_mandatory = TRUE; + rekey_mandatory = true; } for (i = 0; i < CIPHER_MAX; i++) if (conf_get_int_int(s->conf, CONF_ssh_cipherlist, i) != conf_get_int_int(conf, CONF_ssh_cipherlist, i)) { rekey_reason = "cipher settings changed"; - rekey_mandatory = TRUE; + rekey_mandatory = true; } if (conf_get_int(s->conf, CONF_ssh2_des_cbc) != conf_get_int(conf, CONF_ssh2_des_cbc)) { rekey_reason = "cipher settings changed"; - rekey_mandatory = TRUE; + rekey_mandatory = true; } conf_free(s->conf); diff --git a/ssh2userauth-server.c b/ssh2userauth-server.c index 224097ad..685cf5c0 100644 --- a/ssh2userauth-server.c +++ b/ssh2userauth-server.c @@ -146,13 +146,13 @@ static void ssh2_userauth_server_process_queue(PacketProtocolLayer *ppl) */ pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_USERAUTH_FAILURE); put_stringz(pktout, ""); - put_bool(pktout, FALSE); + put_bool(pktout, false); pq_push(s->ppl.out_pq, pktout); continue; } s->methods = auth_methods(s->authpolicy); - s->partial_success = FALSE; + s->partial_success = false; if (ptrlen_eq_string(s->method, "none")) { s->this_method = AUTHMETHOD_NONE; @@ -327,7 +327,7 @@ static void ssh2_userauth_server_process_queue(PacketProtocolLayer *ppl) */ s->methods = auth_methods(s->authpolicy); } - s->partial_success = TRUE; + s->partial_success = true; failure: pktout = ssh_bpp_new_pktout(s->ppl.bpp, SSH2_MSG_USERAUTH_FAILURE); diff --git a/ssh2userauth.c b/ssh2userauth.c index 7cbb425e..c667ab5e 100644 --- a/ssh2userauth.c +++ b/ssh2userauth.c @@ -206,8 +206,8 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) crBegin(s->crState); #ifndef NO_GSSAPI - s->tried_gssapi = FALSE; - s->tried_gssapi_keyex_auth = FALSE; + s->tried_gssapi = false; + s->tried_gssapi_keyex_auth = false; #endif /* @@ -351,7 +351,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) * the username they will want to be able to get back and * retype it! */ - s->got_username = FALSE; + s->got_username = false; while (1) { /* * Get a username. @@ -364,9 +364,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) */ } else if ((s->username = s->default_username) == NULL) { s->cur_prompt = new_prompts(); - s->cur_prompt->to_server = TRUE; + s->cur_prompt->to_server = true; s->cur_prompt->name = dupstr("SSH login name"); - add_prompt(s->cur_prompt, dupstr("login as: "), TRUE); + add_prompt(s->cur_prompt, dupstr("login as: "), true); s->userpass_ret = seat_get_userpass_input( s->ppl.seat, s->cur_prompt, NULL); while (1) { @@ -378,9 +378,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) if (s->userpass_ret >= 0) break; - s->want_user_input = TRUE; + s->want_user_input = true; crReturnV; - s->want_user_input = FALSE; + s->want_user_input = false; } if (!s->userpass_ret) { /* @@ -397,7 +397,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) if ((flags & FLAG_VERBOSE) || (flags & FLAG_INTERACTIVE)) ppl_printf(("Using username \"%s\".\r\n", s->username)); } - s->got_username = TRUE; + s->got_username = true; /* * Send an authentication request using method "none": (a) @@ -413,11 +413,11 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) pq_push(s->ppl.out_pq, s->pktout); s->type = AUTH_TYPE_NONE; - s->tried_pubkey_config = FALSE; - s->kbd_inter_refused = FALSE; + s->tried_pubkey_config = false; + s->kbd_inter_refused = false; /* Reset agent request state. */ - s->done_agent = FALSE; + s->done_agent = false; if (s->agent_response.ptr) { if (s->pkblob_pos_in_agent) { s->asrc->pos = s->pkblob_pos_in_agent; @@ -590,7 +590,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) /* gssapi-keyex authentication */ s->type = AUTH_TYPE_GSSAPI; - s->tried_gssapi_keyex_auth = TRUE; + s->tried_gssapi_keyex_auth = true; s->ppl.bpp->pls->actx = SSH2_PKTCTX_GSSAPI; if (s->shgss->lib->gsslogmsg) @@ -632,7 +632,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) put_stringz(s->pktout, s->successor_layer->vt->name); put_stringz(s->pktout, "publickey"); /* method */ - put_bool(s->pktout, FALSE); /* no signature included */ + put_bool(s->pktout, false); /* no signature included */ put_stringpl(s->pktout, s->alg); put_stringpl(s->pktout, s->pk); pq_push(s->ppl.out_pq, s->pktout); @@ -663,7 +663,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) put_stringz(s->pktout, s->successor_layer->vt->name); put_stringz(s->pktout, "publickey"); /* method */ - put_bool(s->pktout, TRUE); /* signature included */ + put_bool(s->pktout, true); /* signature included */ put_stringpl(s->pktout, s->alg); put_stringpl(s->pktout, s->pk); @@ -707,12 +707,12 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) /* Do we have any keys left to try? */ if (s->pkblob_pos_in_agent) { - s->done_agent = TRUE; - s->tried_pubkey_config = TRUE; + s->done_agent = true; + s->tried_pubkey_config = true; } else { s->keyi++; if (s->keyi >= s->nkeys) - s->done_agent = TRUE; + s->done_agent = true; } } else if (s->can_pubkey && s->publickey_blob && @@ -723,7 +723,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) s->ppl.bpp->pls->actx = SSH2_PKTCTX_PUBLICKEY; - s->tried_pubkey_config = TRUE; + s->tried_pubkey_config = true; /* * Try the public key supplied in the configuration. @@ -736,7 +736,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) put_stringz(s->pktout, s->username); put_stringz(s->pktout, s->successor_layer->vt->name); put_stringz(s->pktout, "publickey"); /* method */ - put_bool(s->pktout, FALSE); + put_bool(s->pktout, false); /* no signature included */ put_stringz(s->pktout, s->publickey_algorithm); put_string(s->pktout, s->publickey_blob->s, @@ -769,12 +769,12 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) * Get a passphrase from the user. */ s->cur_prompt = new_prompts(); - s->cur_prompt->to_server = FALSE; + s->cur_prompt->to_server = false; s->cur_prompt->name = dupstr("SSH key passphrase"); add_prompt(s->cur_prompt, dupprintf("Passphrase for key \"%.100s\": ", s->publickey_comment), - FALSE); + false); s->userpass_ret = seat_get_userpass_input( s->ppl.seat, s->cur_prompt, NULL); while (1) { @@ -787,9 +787,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) if (s->userpass_ret >= 0) break; - s->want_user_input = TRUE; + s->want_user_input = true; crReturnV; - s->want_user_input = FALSE; + s->want_user_input = false; } if (!s->userpass_ret) { /* Failed to get a passphrase. Terminate. */ @@ -845,7 +845,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) put_stringz(s->pktout, s->username); put_stringz(s->pktout, s->successor_layer->vt->name); put_stringz(s->pktout, "publickey"); /* method */ - put_bool(s->pktout, TRUE); /* signature follows */ + put_bool(s->pktout, true); /* signature follows */ put_stringz(s->pktout, ssh_key_ssh_id(key->key)); pkblob = strbuf_new(); ssh_key_public_blob(key->key, BinarySink_UPCAST(pkblob)); @@ -889,7 +889,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) ptrlen data; s->type = AUTH_TYPE_GSSAPI; - s->tried_gssapi = TRUE; + s->tried_gssapi = true; s->ppl.bpp->pls->actx = SSH2_PKTCTX_GSSAPI; if (s->shgss->lib->gsslogmsg) @@ -1073,7 +1073,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) * Give up on it entirely. */ pq_push_front(s->ppl.in_pq, pktin); s->type = AUTH_TYPE_KEYBOARD_INTERACTIVE_QUIET; - s->kbd_inter_refused = TRUE; /* don't try it again */ + s->kbd_inter_refused = true; /* don't try it again */ continue; } @@ -1093,7 +1093,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) inst = get_string(pktin); get_string(pktin); /* skip language tag */ s->cur_prompt = new_prompts(); - s->cur_prompt->to_server = TRUE; + s->cur_prompt->to_server = true; /* * Get any prompt(s) from the packet. @@ -1119,11 +1119,11 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) * local prompts? */ s->cur_prompt->name = dupprintf("SSH server: %.*s", PTRLEN_PRINTF(name)); - s->cur_prompt->name_reqd = TRUE; + s->cur_prompt->name_reqd = true; } else { s->cur_prompt->name = dupstr("SSH server authentication"); - s->cur_prompt->name_reqd = FALSE; + s->cur_prompt->name_reqd = false; } /* We add a prefix to try to make it clear that a prompt * has come from the server. @@ -1138,9 +1138,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) "authentication.%s%.*s", inst.len ? "\n" : "", PTRLEN_PRINTF(inst)); - s->cur_prompt->instr_reqd = TRUE; + s->cur_prompt->instr_reqd = true; } else { - s->cur_prompt->instr_reqd = FALSE; + s->cur_prompt->instr_reqd = false; } /* @@ -1158,9 +1158,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) if (s->userpass_ret >= 0) break; - s->want_user_input = TRUE; + s->want_user_input = true; crReturnV; - s->want_user_input = FALSE; + s->want_user_input = false; } if (!s->userpass_ret) { /* @@ -1218,11 +1218,11 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) s->ppl.bpp->pls->actx = SSH2_PKTCTX_PASSWORD; s->cur_prompt = new_prompts(); - s->cur_prompt->to_server = TRUE; + s->cur_prompt->to_server = true; s->cur_prompt->name = dupstr("SSH password"); add_prompt(s->cur_prompt, dupprintf("%s@%s's password: ", s->username, s->hostname), - FALSE); + false); s->userpass_ret = seat_get_userpass_input( s->ppl.seat, s->cur_prompt, NULL); @@ -1235,9 +1235,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) if (s->userpass_ret >= 0) break; - s->want_user_input = TRUE; + s->want_user_input = true; crReturnV; - s->want_user_input = FALSE; + s->want_user_input = false; } if (!s->userpass_ret) { /* @@ -1274,7 +1274,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) put_stringz(s->pktout, s->username); put_stringz(s->pktout, s->successor_layer->vt->name); put_stringz(s->pktout, "password"); - put_bool(s->pktout, FALSE); + put_bool(s->pktout, false); put_stringz(s->pktout, s->password); s->pktout->minlen = 256; pq_push(s->ppl.out_pq, s->pktout); @@ -1286,7 +1286,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) * request. */ crMaybeWaitUntilV((pktin = ssh2_userauth_pop(s)) != NULL); - changereq_first_time = TRUE; + changereq_first_time = true; while (pktin->type == SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ) { @@ -1296,7 +1296,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) * Loop until the server accepts it. */ - int got_new = FALSE; /* not live over crReturn */ + int got_new = false; /* not live over crReturn */ ptrlen prompt; /* not live over crReturn */ { @@ -1312,10 +1312,10 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) prompt = get_string(pktin); s->cur_prompt = new_prompts(); - s->cur_prompt->to_server = TRUE; + s->cur_prompt->to_server = true; s->cur_prompt->name = dupstr("New SSH password"); s->cur_prompt->instruction = mkstr(prompt); - s->cur_prompt->instr_reqd = TRUE; + s->cur_prompt->instr_reqd = true; /* * There's no explicit requirement in the protocol * for the "old" passwords in the original and @@ -1330,11 +1330,11 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) */ add_prompt(s->cur_prompt, dupstr("Current password (blank for previously entered password): "), - FALSE); + false); add_prompt(s->cur_prompt, dupstr("Enter new password: "), - FALSE); + false); add_prompt(s->cur_prompt, dupstr("Confirm new password: "), - FALSE); + false); /* * Loop until the user manages to enter the same @@ -1353,9 +1353,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) if (s->userpass_ret >= 0) break; - s->want_user_input = TRUE; + s->want_user_input = true; crReturnV; - s->want_user_input = FALSE; + s->want_user_input = false; } if (!s->userpass_ret) { /* @@ -1409,7 +1409,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) put_stringz(s->pktout, s->username); put_stringz(s->pktout, s->successor_layer->vt->name); put_stringz(s->pktout, "password"); - put_bool(s->pktout, TRUE); + put_bool(s->pktout, true); put_stringz(s->pktout, s->password); put_stringz(s->pktout, s->cur_prompt->prompts[1]->result); @@ -1424,7 +1424,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) * new password.) */ crMaybeWaitUntilV((pktin = ssh2_userauth_pop(s)) != NULL); - changereq_first_time = FALSE; + changereq_first_time = false; } @@ -1638,7 +1638,7 @@ static int ssh2_userauth_get_specials( PacketProtocolLayer *ppl, add_special_fn_t add_special, void *ctx) { /* No specials provided by this layer. */ - return FALSE; + return false; } static void ssh2_userauth_special_cmd(PacketProtocolLayer *ppl, diff --git a/sshbpp.h b/sshbpp.h index 04c1f5ed..2b09fdea 100644 --- a/sshbpp.h +++ b/sshbpp.h @@ -99,8 +99,8 @@ struct DataTransferStats { #define DTS_CONSUME(stats, direction, size) \ ((stats)->direction.running && \ (stats)->direction.remaining <= (size) ? \ - ((stats)->direction.running = FALSE, TRUE) : \ - ((stats)->direction.remaining -= (size), FALSE)) + ((stats)->direction.running = false, true) : \ + ((stats)->direction.remaining -= (size), false)) BinaryPacketProtocol *ssh2_bpp_new( LogContext *logctx, struct DataTransferStats *stats, int is_server); diff --git a/sshchan.h b/sshchan.h index e01d6bb5..dd82fd63 100644 --- a/sshchan.h +++ b/sshchan.h @@ -28,7 +28,7 @@ struct ChannelVtable { int (*want_close)(Channel *, int sent_local_eof, int rcvd_remote_eof); /* A method for every channel request we know of. All of these - * return TRUE for success or FALSE for failure. */ + * return true for success or false for failure. */ int (*rcvd_exit_status)(Channel *, int status); int (*rcvd_exit_signal)( Channel *chan, ptrlen signame, int core_dumped, ptrlen msg); @@ -217,7 +217,7 @@ struct SshChannel { ConnectionLayer *cl; }; -#define sshfwd_write(c, buf, len) ((c)->vt->write(c, FALSE, buf, len)) +#define sshfwd_write(c, buf, len) ((c)->vt->write(c, false, buf, len)) #define sshfwd_write_ext(c, stderr, buf, len) \ ((c)->vt->write(c, stderr, buf, len)) #define sshfwd_write_eof(c) ((c)->vt->write_eof(c)) diff --git a/sshcommon.c b/sshcommon.c index 56f4b420..4f3622a7 100644 --- a/sshcommon.c +++ b/sshcommon.c @@ -52,7 +52,7 @@ void pq_base_push_front(PacketQueueBase *pqb, PacketQueueNode *node) } static PacketQueueNode pktin_freeq_head = { - &pktin_freeq_head, &pktin_freeq_head, TRUE + &pktin_freeq_head, &pktin_freeq_head, true }; static void pktin_free_queue_callback(void *vctx) @@ -68,7 +68,7 @@ static void pktin_free_queue_callback(void *vctx) } static IdempotentCallback ic_pktin_free = { - pktin_free_queue_callback, NULL, FALSE + pktin_free_queue_callback, NULL, false }; static PktIn *pq_in_after(PacketQueueBase *pqb, @@ -86,7 +86,7 @@ static PktIn *pq_in_after(PacketQueueBase *pqb, node->next = &pktin_freeq_head; node->next->prev = node; node->prev->next = node; - node->on_free_queue = TRUE; + node->on_free_queue = true; queue_idempotent_callback(&ic_pktin_free); } @@ -224,7 +224,7 @@ PktOut *ssh_new_packet(void) pkt->downstream_id = 0; pkt->additional_log_text = NULL; pkt->qnode.next = pkt->qnode.prev = NULL; - pkt->qnode.on_free_queue = FALSE; + pkt->qnode.on_free_queue = false; return pkt; } @@ -331,7 +331,7 @@ static void zombiechan_set_input_wanted(Channel *chan, int enable) static int zombiechan_want_close(Channel *chan, int sent_eof, int rcvd_eof) { - return TRUE; + return true; } /* ---------------------------------------------------------------------- @@ -361,75 +361,75 @@ int chan_default_want_close( int chan_no_exit_status(Channel *chan, int status) { - return FALSE; + return false; } int chan_no_exit_signal( Channel *chan, ptrlen signame, int core_dumped, ptrlen msg) { - return FALSE; + return false; } int chan_no_exit_signal_numeric( Channel *chan, int signum, int core_dumped, ptrlen msg) { - return FALSE; + return false; } int chan_no_run_shell(Channel *chan) { - return FALSE; + return false; } int chan_no_run_command(Channel *chan, ptrlen command) { - return FALSE; + return false; } int chan_no_run_subsystem(Channel *chan, ptrlen subsys) { - return FALSE; + return false; } int chan_no_enable_x11_forwarding( Channel *chan, int oneshot, ptrlen authproto, ptrlen authdata, unsigned screen_number) { - return FALSE; + return false; } int chan_no_enable_agent_forwarding(Channel *chan) { - return FALSE; + return false; } int chan_no_allocate_pty( Channel *chan, ptrlen termtype, unsigned width, unsigned height, unsigned pixwidth, unsigned pixheight, struct ssh_ttymodes modes) { - return FALSE; + return false; } int chan_no_set_env(Channel *chan, ptrlen var, ptrlen value) { - return FALSE; + return false; } int chan_no_send_break(Channel *chan, unsigned length) { - return FALSE; + return false; } int chan_no_send_signal(Channel *chan, ptrlen signame) { - return FALSE; + return false; } int chan_no_change_window_size( Channel *chan, unsigned width, unsigned height, unsigned pixwidth, unsigned pixheight) { - return FALSE; + return false; } void chan_no_request_response(Channel *chan, int success) @@ -558,7 +558,7 @@ struct ssh_ttymodes get_ttymodes_from_conf(Seat *seat, Conf *conf) assert(0 && "Bad mode->type"); } - modes.have_mode[mode->opcode] = TRUE; + modes.have_mode[mode->opcode] = true; modes.mode_val[mode->opcode] = ival; } @@ -572,9 +572,9 @@ struct ssh_ttymodes get_ttymodes_from_conf(Seat *seat, Conf *conf) ospeed = ispeed = 38400; /* last-resort defaults */ sscanf(conf_get_str(conf, CONF_termspeed), "%u,%u", &ospeed, &ispeed); /* Currently we unconditionally set these */ - modes.have_mode[TTYMODE_ISPEED] = TRUE; + modes.have_mode[TTYMODE_ISPEED] = true; modes.mode_val[TTYMODE_ISPEED] = ispeed; - modes.have_mode[TTYMODE_OSPEED] = TRUE; + modes.have_mode[TTYMODE_OSPEED] = true; modes.mode_val[TTYMODE_OSPEED] = ospeed; } @@ -613,7 +613,7 @@ struct ssh_ttymodes read_ttymodes_from_packet( our_opcode = our_ttymode_opcode(real_opcode, ssh_version); assert(our_opcode < TTYMODE_LIMIT); - modes.have_mode[our_opcode] = TRUE; + modes.have_mode[our_opcode] = true; if (ssh_version == 1 && real_opcode >= 1 && real_opcode <= 127) modes.mode_val[our_opcode] = get_byte(bs); @@ -709,19 +709,19 @@ int in_commasep_string(char const *needle, char const *haystack, int haylen) char *p; if (!needle || !haystack) /* protect against null pointers */ - return FALSE; + return false; /* * Is it at the start of the string? */ if (first_in_commasep_string(needle, haystack, haylen)) - return TRUE; + return true; /* * If not, search for the next comma and resume after that. * If no comma found, terminate. */ p = memchr(haystack, ',', haylen); if (!p) - return FALSE; + return false; /* + 1 to skip over comma */ return in_commasep_string(needle, p + 1, haylen - (p + 1 - haystack)); } @@ -749,7 +749,7 @@ int get_commasep_word(ptrlen *list, ptrlen *word) } if (!list->len) - return FALSE; + return false; comma = memchr(list->ptr, ',', list->len); if (!comma) { @@ -762,7 +762,7 @@ int get_commasep_word(ptrlen *list, ptrlen *word) list->ptr = (const char *)list->ptr + wordlen + 1; list->len -= wordlen + 1; } - return TRUE; + return true; } /* ---------------------------------------------------------------------- @@ -873,7 +873,7 @@ void ssh_bpp_common_setup(BinaryPacketProtocol *bpp) { pq_in_init(&bpp->in_pq); pq_out_init(&bpp->out_pq); - bpp->input_eof = FALSE; + bpp->input_eof = false; bpp->ic_in_raw.fn = ssh_bpp_input_raw_data_callback; bpp->ic_in_raw.ctx = bpp; bpp->ic_out_pq.fn = ssh_bpp_output_packet_callback; @@ -923,10 +923,10 @@ int ssh2_bpp_check_unimplemented(BinaryPacketProtocol *bpp, PktIn *pktin) PktOut *pkt = ssh_bpp_new_pktout(bpp, SSH2_MSG_UNIMPLEMENTED); put_uint32(pkt, pktin->sequence); pq_push(&bpp->out_pq, pkt); - return TRUE; + return true; } - return FALSE; + return false; } #undef BITMAP_UNIVERSAL @@ -1002,10 +1002,10 @@ int ssh1_common_get_specials( */ if (!(ppl->remote_bugs & BUG_CHOKES_ON_SSH1_IGNORE)) { add_special(ctx, "IGNORE message", SS_NOP, 0); - return TRUE; + return true; } - return FALSE; + return false; } int ssh1_common_filter_queue(PacketProtocolLayer *ppl) @@ -1021,7 +1021,7 @@ int ssh1_common_filter_queue(PacketProtocolLayer *ppl) "Remote side sent disconnect message:\n\"%.*s\"", PTRLEN_PRINTF(msg)); pq_pop(ppl->in_pq); - return TRUE; /* indicate that we've been freed */ + return true; /* indicate that we've been freed */ case SSH1_MSG_DEBUG: msg = get_string(pktin); @@ -1035,11 +1035,11 @@ int ssh1_common_filter_queue(PacketProtocolLayer *ppl) break; default: - return FALSE; + return false; } } - return FALSE; + return false; } void ssh1_compute_session_id( diff --git a/sshecc.c b/sshecc.c index 2806ea51..13e432e2 100644 --- a/sshecc.c +++ b/sshecc.c @@ -2754,10 +2754,10 @@ int ec_nist_alg_and_curve_by_bits(int bits, case 256: *alg = &ssh_ecdsa_nistp256; break; case 384: *alg = &ssh_ecdsa_nistp384; break; case 521: *alg = &ssh_ecdsa_nistp521; break; - default: return FALSE; + default: return false; } *curve = ((struct ecsign_extra *)(*alg)->extra)->curve(); - return TRUE; + return true; } int ec_ed_alg_and_curve_by_bits(int bits, @@ -2766,8 +2766,8 @@ int ec_ed_alg_and_curve_by_bits(int bits, { switch (bits) { case 256: *alg = &ssh_ecdsa_ed25519; break; - default: return FALSE; + default: return false; } *curve = ((struct ecsign_extra *)(*alg)->extra)->curve(); - return TRUE; + return true; } diff --git a/sshpubk.c b/sshpubk.c index 309e634d..a0d73c78 100644 --- a/sshpubk.c +++ b/sshpubk.c @@ -148,7 +148,7 @@ int rsa_ssh1_loadkey(const Filename *filename, struct RSAKey *key, int ret = 0; const char *error = NULL; - fp = f_open(filename, "rb", FALSE); + fp = f_open(filename, "rb", false); if (!fp) { error = "can't open file"; goto end; @@ -162,7 +162,7 @@ int rsa_ssh1_loadkey(const Filename *filename, struct RSAKey *key, /* * This routine will take care of calling fclose() for us. */ - ret = rsa_ssh1_load_main(fp, key, FALSE, NULL, passphrase, &error); + ret = rsa_ssh1_load_main(fp, key, false, NULL, passphrase, &error); fp = NULL; goto end; } @@ -189,7 +189,7 @@ int rsa_ssh1_encrypted(const Filename *filename, char **comment) FILE *fp; char buf[64]; - fp = f_open(filename, "rb", FALSE); + fp = f_open(filename, "rb", false); if (!fp) return 0; /* doesn't even exist */ @@ -202,7 +202,7 @@ int rsa_ssh1_encrypted(const Filename *filename, char **comment) /* * This routine will take care of calling fclose() for us. */ - return rsa_ssh1_load_main(fp, NULL, FALSE, comment, NULL, &dummy); + return rsa_ssh1_load_main(fp, NULL, false, comment, NULL, &dummy); } fclose(fp); return 0; /* wasn't the right kind of file */ @@ -222,9 +222,9 @@ int rsa_ssh1_loadpub(const Filename *filename, BinarySink *bs, const char *error = NULL; /* Default return if we fail. */ - ret = FALSE; + ret = false; - fp = f_open(filename, "rb", FALSE); + fp = f_open(filename, "rb", false); if (!fp) { error = "can't open file"; goto end; @@ -236,10 +236,10 @@ int rsa_ssh1_loadpub(const Filename *filename, BinarySink *bs, */ if (fgets(buf, sizeof(buf), fp) && !strcmp(buf, rsa_signature)) { memset(&key, 0, sizeof(key)); - if (rsa_ssh1_load_main(fp, &key, TRUE, commentptr, NULL, &error)) { + if (rsa_ssh1_load_main(fp, &key, true, commentptr, NULL, &error)) { rsa_ssh1_public_blob(bs, &key, RSA_SSH1_EXPONENT_FIRST); freersakey(&key); - ret = TRUE; + ret = true; } fp = NULL; /* rsa_ssh1_load_main unconditionally closes fp */ } else { @@ -291,7 +291,7 @@ int rsa_ssh1_loadpub(const Filename *filename, BinarySink *bs, freersakey(&key); sfree(line); fclose(fp); - return TRUE; + return true; not_public_either: sfree(line); @@ -375,7 +375,7 @@ int rsa_ssh1_savekey(const Filename *filename, struct RSAKey *key, /* * Done. Write the result to the file. */ - fp = f_open(filename, "wb", TRUE); + fp = f_open(filename, "wb", true); if (fp) { int ret = (fwrite(buf->u, 1, buf->len, fp) == (size_t) (buf->len)); if (fclose(fp)) @@ -536,13 +536,13 @@ static int read_blob(FILE *fp, int nlines, BinarySink *bs) line = read_body(fp); if (!line) { sfree(blob); - return FALSE; + return false; } linelen = strlen(line); if (linelen % 4 != 0 || linelen > 64) { sfree(blob); sfree(line); - return FALSE; + return false; } for (j = 0; j < linelen; j += 4) { unsigned char decoded[3]; @@ -550,13 +550,13 @@ static int read_blob(FILE *fp, int nlines, BinarySink *bs) if (!k) { sfree(line); sfree(blob); - return FALSE; + return false; } put_data(bs, decoded, k); } sfree(line); } - return TRUE; + return true; } /* @@ -605,7 +605,7 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename, encryption = comment = mac = NULL; public_blob = private_blob = NULL; - fp = f_open(filename, "rb", FALSE); + fp = f_open(filename, "rb", false); if (!fp) { error = "can't open file"; goto error; @@ -737,7 +737,7 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename, if (old_fmt) { /* MAC (or hash) only covers the private blob. */ macdata = private_blob; - free_macdata = FALSE; + free_macdata = false; } else { macdata = strbuf_new(); put_stringz(macdata, alg->ssh_id); @@ -747,7 +747,7 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename, public_blob->len); put_string(macdata, private_blob->s, private_blob->len); - free_macdata = TRUE; + free_macdata = true; } if (is_mac) { @@ -957,7 +957,7 @@ int rfc4716_loadpub(FILE *fp, char **algorithm, sfree(comment); put_data(bs, pubblob, pubbloblen); sfree(pubblob); - return TRUE; + return true; error: sfree(line); @@ -965,7 +965,7 @@ int rfc4716_loadpub(FILE *fp, char **algorithm, sfree(pubblob); if (errorstr) *errorstr = error; - return FALSE; + return false; } int openssh_loadpub(FILE *fp, char **algorithm, @@ -1033,7 +1033,7 @@ int openssh_loadpub(FILE *fp, char **algorithm, sfree(line); put_data(bs, pubblob, pubbloblen); sfree(pubblob); - return TRUE; + return true; error: sfree(line); @@ -1041,7 +1041,7 @@ int openssh_loadpub(FILE *fp, char **algorithm, sfree(pubblob); if (errorstr) *errorstr = error; - return FALSE; + return false; } int ssh2_userkey_loadpub(const Filename *filename, char **algorithm, @@ -1055,7 +1055,7 @@ int ssh2_userkey_loadpub(const Filename *filename, char **algorithm, const char *error = NULL; char *comment = NULL; - fp = f_open(filename, "rb", FALSE); + fp = f_open(filename, "rb", false); if (!fp) { error = "can't open file"; goto error; @@ -1128,7 +1128,7 @@ int ssh2_userkey_loadpub(const Filename *filename, char **algorithm, fclose(fp); if (algorithm) *algorithm = dupstr(alg->ssh_id); - return TRUE; + return true; /* * Error processing. @@ -1142,7 +1142,7 @@ int ssh2_userkey_loadpub(const Filename *filename, char **algorithm, sfree(comment); *commentptr = NULL; } - return FALSE; + return false; } int ssh2_userkey_encrypted(const Filename *filename, char **commentptr) @@ -1154,7 +1154,7 @@ int ssh2_userkey_encrypted(const Filename *filename, char **commentptr) if (commentptr) *commentptr = NULL; - fp = f_open(filename, "rb", FALSE); + fp = f_open(filename, "rb", false); if (!fp) return 0; if (!read_header(fp, header) @@ -1323,7 +1323,7 @@ int ssh2_save_userkey(const Filename *filename, struct ssh2_userkey *key, smemclr(&s, sizeof(s)); } - fp = f_open(filename, "w", TRUE); + fp = f_open(filename, "w", true); if (!fp) { strbuf_free(pub_blob); strbuf_free(priv_blob); @@ -1586,7 +1586,7 @@ int key_type(const Filename *filename) FILE *fp; int ret; - fp = f_open(filename, "r", FALSE); + fp = f_open(filename, "r", false); if (!fp) return SSH_KEYTYPE_UNOPENABLE; ret = key_type_fp(fp); diff --git a/sshrand.c b/sshrand.c index 1fcac420..d0448703 100644 --- a/sshrand.c +++ b/sshrand.c @@ -80,7 +80,7 @@ static void random_stir(void) */ if (pool.stir_pending) return; - pool.stir_pending = TRUE; + pool.stir_pending = true; noise_get_light(random_add_noise); @@ -193,7 +193,7 @@ static void random_stir(void) pool.poolpos = sizeof(pool.incoming); - pool.stir_pending = FALSE; + pool.stir_pending = false; #ifdef RANDOM_DIAGNOSTICS { diff --git a/sshrsa.c b/sshrsa.c index 86a392eb..c033bb94 100644 --- a/sshrsa.c +++ b/sshrsa.c @@ -288,7 +288,7 @@ Bignum rsa_ssh1_decrypt(Bignum input, struct RSAKey *key) int rsa_ssh1_decrypt_pkcs1(Bignum input, struct RSAKey *key, strbuf *outbuf) { strbuf *data = strbuf_new(); - int success = FALSE; + int success = false; BinarySource src[1]; { @@ -313,7 +313,7 @@ int rsa_ssh1_decrypt_pkcs1(Bignum input, struct RSAKey *key, strbuf *outbuf) } /* Everything else is the payload */ - success = TRUE; + success = true; put_data(outbuf, get_ptr(src), get_avail(src)); out: diff --git a/sshserver.c b/sshserver.c index 9c3963e1..f12ec5cd 100644 --- a/sshserver.c +++ b/sshserver.c @@ -74,7 +74,7 @@ void share_setup_x11_channel(ssh_sharing_connstate *cs, share_channel *chan, int protomajor, int protominor, const void *initial_data, int initial_len) {} Channel *agentf_new(SshChannel *c) { return NULL; } -int agent_exists(void) { return FALSE; } +int agent_exists(void) { return false; } void ssh_got_exitcode(Ssh *ssh, int exitcode) {} mainchan *mainchan_new( @@ -128,7 +128,7 @@ static void server_closing(Plug *plug, const char *error_msg, int error_code, if (error_msg) { ssh_remote_error(&srv->ssh, "Network error: %s", error_msg); } else if (srv->bpp) { - srv->bpp->input_eof = TRUE; + srv->bpp->input_eof = true; queue_idempotent_callback(&srv->bpp->ic_in_raw); } } @@ -181,9 +181,9 @@ void ssh_throttle_conn(Ssh *ssh, int adjust) assert(srv->conn_throttle_count >= 0); if (srv->conn_throttle_count && !old_count) { - frozen = TRUE; + frozen = true; } else if (!srv->conn_throttle_count && old_count) { - frozen = FALSE; + frozen = false; } else { return; /* don't change current frozen state */ } @@ -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_int(srv->conf, CONF_ssh_no_shell, true); srv->nhostkeys = nhostkeys; srv->hostkeys = hostkeys; srv->hostkey1 = hostkey1; @@ -261,9 +261,9 @@ void ssh_server_start(Plug *plug, Socket *socket) srv->ic_out_raw.ctx = srv; srv->version_receiver.got_ssh_version = server_got_ssh_version; srv->bpp = ssh_verstring_new( - srv->conf, srv->logctx, FALSE /* bare_connection */, + srv->conf, srv->logctx, false /* bare_connection */, our_protoversion, &srv->version_receiver, - TRUE, "Uppity"); + true, "Uppity"); server_connect_bpp(srv); queue_idempotent_callback(&srv->bpp->ic_in_raw); } @@ -304,7 +304,7 @@ static void server_connect_bpp(server *srv) srv->bpp->remote_bugs = srv->remote_bugs; /* Servers don't really have a notion of 'unexpected' connection * closure. The client is free to close if it likes. */ - srv->bpp->expect_close = TRUE; + srv->bpp->expect_close = true; } static void server_connect_ppl(server *srv, PacketProtocolLayer *ppl) @@ -409,11 +409,11 @@ static void server_got_ssh_version(struct ssh_version_receiver *rcv, if (major_version == 2) { PacketProtocolLayer *userauth_layer, *transport_child_layer; - srv->bpp = ssh2_bpp_new(srv->logctx, &srv->stats, TRUE); + srv->bpp = ssh2_bpp_new(srv->logctx, &srv->stats, true); server_connect_bpp(srv); connection_layer = ssh2_connection_new( - &srv->ssh, NULL, FALSE, srv->conf, + &srv->ssh, NULL, false, srv->conf, ssh_verstring_get_local(old_bpp), &srv->cl); ssh2connection_server_configure(connection_layer, srv->sftpserver_vt); server_connect_ppl(srv, connection_layer); @@ -432,7 +432,7 @@ static void server_got_ssh_version(struct ssh_version_receiver *rcv, srv->conf, NULL, 0, NULL, ssh_verstring_get_remote(old_bpp), ssh_verstring_get_local(old_bpp), - &srv->gss_state, &srv->stats, transport_child_layer, TRUE); + &srv->gss_state, &srv->stats, transport_child_layer, true); ssh2_transport_provide_hostkeys( srv->base_layer, srv->hostkeys, srv->nhostkeys); if (userauth_layer) diff --git a/sshserver.h b/sshserver.h index 846c40c5..348004ed 100644 --- a/sshserver.h +++ b/sshserver.h @@ -63,7 +63,7 @@ int auth_ssh1int_response(AuthPolicy *, ptrlen response); struct RSAKey *auth_publickey_ssh1( AuthPolicy *ap, ptrlen username, Bignum rsa_modulus); -/* auth_successful returns FALSE if further authentication is needed */ +/* auth_successful returns false if further authentication is needed */ int auth_successful(AuthPolicy *, ptrlen username, unsigned method); PacketProtocolLayer *ssh2_userauth_server_new( diff --git a/sshshare.c b/sshshare.c index c964de13..227f213a 100644 --- a/sshshare.c +++ b/sshshare.c @@ -631,7 +631,7 @@ static struct share_xchannel *share_add_xchannel struct share_xchannel *xc = snew(struct share_xchannel); xc->upstream_id = upstream_id; xc->server_id = server_id; - xc->live = TRUE; + xc->live = true; xc->msghead = xc->msgtail = NULL; if (add234(cs->xchannels_by_us, xc) != xc) { sfree(xc); @@ -676,7 +676,7 @@ static struct share_forwarding *share_add_forwarding struct share_forwarding *fwd = snew(struct share_forwarding); fwd->host = dupstr(host); fwd->port = port; - fwd->active = FALSE; + fwd->active = false; if (add234(cs->forwardings, fwd) != fwd) { /* Duplicate?! */ sfree(fwd); @@ -875,7 +875,7 @@ static void share_try_cleanup(struct ssh_sharing_connstate *cs) if (fwd->active) { strbuf *packet = strbuf_new(); put_stringz(packet, "cancel-tcpip-forward"); - put_bool(packet, FALSE); /* !want_reply */ + put_bool(packet, false); /* !want_reply */ put_stringz(packet, fwd->host); put_uint32(packet, fwd->port); ssh_send_packet_from_downstream( @@ -997,7 +997,7 @@ void share_dead_xchannel_respond(struct ssh_sharing_connstate *cs, * Handle queued incoming messages from the server destined for an * xchannel which is dead (i.e. downstream sent OPEN_FAILURE). */ - int delete = FALSE; + int delete = false; while (xc->msghead) { struct share_xchannel_message *msg = xc->msghead; xc->msghead = msg->next; @@ -1024,7 +1024,7 @@ void share_dead_xchannel_respond(struct ssh_sharing_connstate *cs, /* * On CHANNEL_CLOSE we can discard the channel completely. */ - delete = TRUE; + delete = true; } sfree(msg); @@ -1092,7 +1092,7 @@ void share_xchannel_failure(struct ssh_sharing_connstate *cs, * Now mark the xchannel as dead, and respond to anything sent on * it until we see CLOSE for it in turn. */ - xc->live = FALSE; + xc->live = false; share_dead_xchannel_respond(cs, xc); } @@ -1183,7 +1183,7 @@ void share_got_pkt_from_server(ssh_sharing_connstate *cs, int type, if (type == SSH2_MSG_REQUEST_FAILURE) { share_remove_forwarding(cs, globreq->fwd); } else { - globreq->fwd->active = TRUE; + globreq->fwd->active = true; } } else if (globreq->type == GLOBREQ_CANCEL_TCPIP_FORWARD) { if (type == SSH2_MSG_REQUEST_SUCCESS) { @@ -1795,7 +1795,7 @@ static void share_receive(Plug *plug, int urgent, char *data, int len) cs->recvlen--; /* trim off \r before \n */ log_downstream(cs, "Downstream version string: %.*s", cs->recvlen, cs->recvbuf); - cs->got_verstring = TRUE; + cs->got_verstring = true; /* * Loop round reading packets. @@ -1861,7 +1861,7 @@ static void share_send_verstring(ssh_sharing_connstate *cs) sk_write(cs->sock, fullstring, strlen(fullstring)); sfree(fullstring); - cs->sent_verstring = TRUE; + cs->sent_verstring = true; } int share_ndownstreams(ssh_sharing_state *sharestate) @@ -1942,11 +1942,11 @@ static int share_listen_accepting(Plug *plug, add234(cs->parent->connections, cs); - cs->sent_verstring = FALSE; + cs->sent_verstring = false; if (sharestate->server_verstring) share_send_verstring(cs); - cs->got_verstring = FALSE; + cs->got_verstring = false; cs->recvlen = 0; cs->crLine = 0; cs->halfchannels = newtree234(share_halfchannel_cmp); @@ -2026,7 +2026,7 @@ int ssh_share_test_for_upstream(const char *host, int port, Conf *conf) sock = NULL; logtext = ds_err = us_err = NULL; result = platform_ssh_share(sockname, conf, nullplug, (Plug *)NULL, &sock, - &logtext, &ds_err, &us_err, FALSE, TRUE); + &logtext, &ds_err, &us_err, false, true); sfree(logtext); sfree(ds_err); @@ -2035,11 +2035,11 @@ int ssh_share_test_for_upstream(const char *host, int port, Conf *conf) if (result == SHARE_NONE) { assert(sock == NULL); - return FALSE; + return false; } else { assert(result == SHARE_DOWNSTREAM); sk_close(sock); - return TRUE; + return true; } } diff --git a/sshverstring.c b/sshverstring.c index 758c9e15..578ee99f 100644 --- a/sshverstring.c +++ b/sshverstring.c @@ -265,7 +265,7 @@ void ssh_verstring_handle_input(BinaryPacketProtocol *bpp) } } - s->found_prefix = TRUE; + s->found_prefix = true; /* * Start a buffer to store the full greeting line. diff --git a/sshzlib.c b/sshzlib.c index d0cbef8f..ae3e28d2 100644 --- a/sshzlib.c +++ b/sshzlib.c @@ -59,13 +59,6 @@ #define sresize(x, n, type) ( (type *) realloc((x), (n) * sizeof(type)) ) #define sfree(x) ( free((x)) ) -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - typedef struct { const struct dummy *vt; } ssh_compressor; typedef struct { const struct dummy *vt; } ssh_decompressor; static const struct dummy { int i; } ssh_zlib; @@ -97,7 +90,7 @@ static int lz77_init(struct LZ77Context *ctx); /* * Supply data to be compressed. Will update the private fields of * the LZ77Context, and will call literal() and match() to output. - * If `compress' is FALSE, it will never emit a match, but will + * If `compress' is false, it will never emit a match, but will * instead call literal() for everything. */ static void lz77_compress(struct LZ77Context *ctx, @@ -657,9 +650,9 @@ void zlib_compress_block(ssh_compressor *sc, unsigned char *block, int len, outbits(out, 0x9C78, 16); out->firstblock = 0; - in_block = FALSE; + in_block = false; } else - in_block = TRUE; + in_block = true; if (!in_block) { /* @@ -674,7 +667,7 @@ void zlib_compress_block(ssh_compressor *sc, unsigned char *block, int len, /* * Do the compression. */ - lz77_compress(&comp->ectx, block, len, TRUE); + lz77_compress(&comp->ectx, block, len, true); /* * End the block (by transmitting code 256, which is @@ -1235,7 +1228,7 @@ int main(int argc, char **argv) unsigned char buf[16], *outbuf; int ret, outlen; ssh_decompressor *handle; - int noheader = FALSE, opts = TRUE; + int noheader = false, opts = true; char *filename = NULL; FILE *fp; @@ -1244,9 +1237,9 @@ int main(int argc, char **argv) if (p[0] == '-' && opts) { if (!strcmp(p, "-d")) - noheader = TRUE; + noheader = true; else if (!strcmp(p, "--")) - opts = FALSE; /* next thing is filename */ + opts = false; /* next thing is filename */ else { fprintf(stderr, "unknown command line option '%s'\n", p); return 1; diff --git a/telnet.c b/telnet.c index bdb24e2f..5c7baa93 100644 --- a/telnet.c +++ b/telnet.c @@ -271,7 +271,7 @@ static void option_side_effects(Telnet *telnet, const struct Opt *o, int enabled telnet->opt_states[o_they_sga.index] = REQUESTED; send_opt(telnet, o_they_sga.send, o_they_sga.option); } - telnet->activated = TRUE; + telnet->activated = true; } } @@ -647,7 +647,7 @@ static void telnet_closing(Plug *plug, const char *error_msg, int error_code, sk_close(telnet->s); telnet->s = NULL; if (error_msg) - telnet->closed_on_socket_error = TRUE; + telnet->closed_on_socket_error = true; seat_notify_remote_exit(telnet->seat); } if (error_msg) { @@ -661,8 +661,8 @@ static void telnet_receive(Plug *plug, int urgent, char *data, int len) { Telnet *telnet = container_of(plug, Telnet, plug); if (urgent) - telnet->in_synch = TRUE; - telnet->session_started = TRUE; + telnet->in_synch = true; + telnet->session_started = true; do_telnet_read(telnet, data, len); } @@ -703,10 +703,10 @@ static const char *telnet_init(Seat *seat, Backend **backend_handle, telnet->backend.vt = &telnet_backend; telnet->conf = conf_copy(conf); telnet->s = NULL; - telnet->closed_on_socket_error = FALSE; - telnet->echoing = TRUE; - telnet->editing = TRUE; - telnet->activated = FALSE; + telnet->closed_on_socket_error = false; + telnet->echoing = true; + telnet->editing = true; + telnet->activated = false; telnet->sb_buf = NULL; telnet->sb_size = 0; telnet->seat = seat; @@ -716,7 +716,7 @@ static const char *telnet_init(Seat *seat, Backend **backend_handle, telnet->state = TOP_LEVEL; telnet->ldisc = NULL; telnet->pinger = NULL; - telnet->session_started = TRUE; + telnet->session_started = true; *backend_handle = &telnet->backend; /* @@ -759,13 +759,13 @@ static const char *telnet_init(Seat *seat, Backend **backend_handle, if (telnet->opt_states[(*o)->index] == REQUESTED) send_opt(telnet, (*o)->send, (*o)->option); } - telnet->activated = TRUE; + telnet->activated = true; } /* * Set up SYNCH state. */ - telnet->in_synch = FALSE; + telnet->in_synch = false; /* * We can send special commands from the start. @@ -1025,7 +1025,7 @@ static int telnet_ldisc(Backend *be, int option) return telnet->echoing; if (option == LD_EDIT) return telnet->editing; - return FALSE; + return false; } static void telnet_provide_ldisc(Backend *be, Ldisc *ldisc) diff --git a/terminal.c b/terminal.c index 6708c61a..ff39968d 100644 --- a/terminal.c +++ b/terminal.c @@ -122,7 +122,7 @@ static termline *newline(Terminal *term, int cols, int bce) line->chars[j] = (bce ? term->erase_char : term->basic_erase_char); line->cols = line->size = cols; line->lattr = LATTR_NORM; - line->temporary = FALSE; + line->temporary = false; line->cc_free = 0; return line; @@ -168,7 +168,7 @@ static void cc_check(termline *line) j += line->chars[j].cc_next; assert(j >= line->cols && j < line->size); assert(!flags[j]); - flags[j] = TRUE; + flags[j] = true; } } @@ -177,7 +177,7 @@ static void cc_check(termline *line) while (1) { assert(j >= line->cols && j < line->size); assert(!flags[j]); - flags[j] = TRUE; + flags[j] = true; if (line->chars[j].cc_next) j += line->chars[j].cc_next; else @@ -283,20 +283,20 @@ static int termchars_equal_override(termchar *a, termchar *b, { /* FULL-TERMCHAR */ if (!truecolour_equal(a->truecolour, b->truecolour)) - return FALSE; + return false; if (a->chr != bchr) - return FALSE; + return false; if ((a->attr &~ DATTR_MASK) != (battr &~ DATTR_MASK)) - return FALSE; + return false; while (a->cc_next || b->cc_next) { if (!a->cc_next || !b->cc_next) - return FALSE; /* one cc-list ends, other does not */ + return false; /* one cc-list ends, other does not */ a += a->cc_next; b += b->cc_next; if (a->chr != b->chr) - return FALSE; + return false; } - return TRUE; + return true; } static int termchars_equal(termchar *a, termchar *b) @@ -385,7 +385,7 @@ static void makerle(struct buf *b, termline *ldata, hdrsize = 0; add(b, 0); prevlen = prevpos = 0; - prev2 = FALSE; + prev2 = false; while (n-- > 0) { thispos = b->len; @@ -461,7 +461,7 @@ static void makerle(struct buf *b, termline *ldata, add(b, 0); /* And ensure this run doesn't interfere with the next. */ prevlen = prevpos = 0; - prev2 = FALSE; + prev2 = false; continue; } else { @@ -470,12 +470,12 @@ static void makerle(struct buf *b, termline *ldata, * identical, in case we find a third identical one * we want to turn into a run. */ - prev2 = TRUE; + prev2 = true; prevlen = thislen; prevpos = thispos; } } else { - prev2 = FALSE; + prev2 = false; prevlen = thislen; prevpos = thispos; } @@ -491,7 +491,7 @@ static void makerle(struct buf *b, termline *ldata, hdrsize = 0; add(b, 0); prevlen = prevpos = 0; - prev2 = FALSE; + prev2 = false; } } @@ -852,7 +852,7 @@ static void readliteral_truecolour(struct buf *b, termchar *c, termline *ldata, int flags = get(b); if (flags & 1) { - c->truecolour.fg.enabled = TRUE; + c->truecolour.fg.enabled = true; c->truecolour.fg.r = get(b); c->truecolour.fg.g = get(b); c->truecolour.fg.b = get(b); @@ -861,7 +861,7 @@ static void readliteral_truecolour(struct buf *b, termchar *c, termline *ldata, } if (flags & 2) { - c->truecolour.bg.enabled = TRUE; + c->truecolour.bg.enabled = true; c->truecolour.bg.r = get(b); c->truecolour.bg.g = get(b); c->truecolour.bg.b = get(b); @@ -912,7 +912,7 @@ static termline *decompressline(unsigned char *data, int *bytes_used) ldata = snew(termline); ldata->chars = snewn(ncols, termchar); ldata->cols = ldata->size = ncols; - ldata->temporary = TRUE; + ldata->temporary = true; ldata->cc_free = 0; /* @@ -1132,8 +1132,8 @@ static termline *lineptr(Terminal *term, int y, int lineno, int screen) return line; } -#define lineptr(x) (lineptr)(term,x,__LINE__,FALSE) -#define scrlineptr(x) (lineptr)(term,x,__LINE__,TRUE) +#define lineptr(x) (lineptr)(term,x,__LINE__,false) +#define scrlineptr(x) (lineptr)(term,x,__LINE__,true) /* * Coerce a termline to the terminal's current width. Unlike the @@ -1157,25 +1157,25 @@ static void term_schedule_cblink(Terminal *term); static void term_timer(void *ctx, unsigned long now) { Terminal *term = (Terminal *)ctx; - int update = FALSE; + int update = false; if (term->tblink_pending && now == term->next_tblink) { term->tblinker = !term->tblinker; - term->tblink_pending = FALSE; + term->tblink_pending = false; term_schedule_tblink(term); - update = TRUE; + update = true; } if (term->cblink_pending && now == term->next_cblink) { term->cblinker = !term->cblinker; - term->cblink_pending = FALSE; + term->cblink_pending = false; term_schedule_cblink(term); - update = TRUE; + update = true; } if (term->in_vbell && now == term->vbell_end) { - term->in_vbell = FALSE; - update = TRUE; + term->in_vbell = false; + update = true; } if (update || @@ -1186,7 +1186,7 @@ static void term_timer(void *ctx, unsigned long now) static void term_schedule_update(Terminal *term) { if (!term->window_update_pending) { - term->window_update_pending = TRUE; + term->window_update_pending = true; term->next_update = schedule_timer(UPDATE_DELAY, term_timer, term); } } @@ -1197,7 +1197,7 @@ static void term_schedule_update(Terminal *term) */ static void seen_disp_event(Terminal *term) { - term->seen_disp_event = TRUE; /* for scrollback-reset-on-activity */ + term->seen_disp_event = true; /* for scrollback-reset-on-activity */ term_schedule_update(term); } @@ -1210,10 +1210,10 @@ static void term_schedule_tblink(Terminal *term) if (term->blink_is_real) { if (!term->tblink_pending) term->next_tblink = schedule_timer(TBLINK_DELAY, term_timer, term); - term->tblink_pending = TRUE; + term->tblink_pending = true; } else { term->tblinker = 1; /* reset when not in use */ - term->tblink_pending = FALSE; + term->tblink_pending = false; } } @@ -1225,10 +1225,10 @@ static void term_schedule_cblink(Terminal *term) if (term->blink_cur && term->has_focus) { if (!term->cblink_pending) term->next_cblink = schedule_timer(CBLINK_DELAY, term_timer, term); - term->cblink_pending = TRUE; + term->cblink_pending = true; } else { term->cblinker = 1; /* reset when not in use */ - term->cblink_pending = FALSE; + term->cblink_pending = false; } } @@ -1239,7 +1239,7 @@ static void term_reset_cblink(Terminal *term) { seen_disp_event(term); term->cblinker = 1; - term->cblink_pending = FALSE; + term->cblink_pending = false; term_schedule_cblink(term); } @@ -1257,11 +1257,11 @@ static void term_schedule_vbell(Terminal *term, int already_started, ticks_already_gone = 0; if (ticks_already_gone < VBELL_DELAY) { - term->in_vbell = TRUE; + term->in_vbell = true; term->vbell_end = schedule_timer(VBELL_DELAY - ticks_already_gone, term_timer, term); } else { - term->in_vbell = FALSE; + term->in_vbell = false; } } @@ -1284,12 +1284,12 @@ static void power_on(Terminal *term, int clear) if (term->cols != -1) { int i; for (i = 0; i < term->cols; i++) - term->tabs[i] = (i % 8 == 0 ? TRUE : FALSE); + term->tabs[i] = (i % 8 == 0 ? true : false); } term->alt_om = term->dec_om = conf_get_int(term->conf, CONF_dec_om); - term->alt_ins = term->insert = FALSE; + term->alt_ins = term->insert = false; term->alt_wnext = term->wrapnext = - term->save_wnext = term->alt_save_wnext = FALSE; + term->save_wnext = term->alt_save_wnext = false; term->alt_wrap = term->wrap = conf_get_int(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; @@ -1299,14 +1299,14 @@ static void power_on(Terminal *term, int clear) term->cset_attr[0] = term->cset_attr[1] = term->save_csattr = term->alt_save_csattr = CSET_ASCII; term->rvideo = 0; - term->in_vbell = FALSE; + term->in_vbell = false; term->cursor_on = 1; term->big_cursor = 0; term->default_attr = term->save_attr = term->alt_save_attr = term->curr_attr = ATTR_DEFAULT; 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->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); @@ -1317,23 +1317,23 @@ static void power_on(Terminal *term, int clear) term->xterm_mouse = 0; term->xterm_extended_mouse = 0; term->urxvt_extended_mouse = 0; - win_set_raw_mouse_mode(term->win, FALSE); - term->bracketed_paste = FALSE; + win_set_raw_mouse_mode(term->win, false); + term->bracketed_paste = false; { int i; for (i = 0; i < 256; i++) term->wordness[i] = conf_get_int_int(term->conf, CONF_wordness, i); } if (term->screen) { - swap_screen(term, 1, FALSE, FALSE); - erase_lots(term, FALSE, TRUE, TRUE); - swap_screen(term, 0, FALSE, FALSE); + swap_screen(term, 1, false, false); + erase_lots(term, false, true, true); + swap_screen(term, 0, false, false); if (clear) - erase_lots(term, FALSE, TRUE, TRUE); + erase_lots(term, false, true, true); term->curs.y = find_last_nonempty_line(term, term->screen) + 1; if (term->curs.y == term->rows) { term->curs.y--; - scroll(term, 0, term->rows - 1, 1, TRUE); + scroll(term, 0, term->rows - 1, 1, true); } } else { term->curs.y = 0; @@ -1348,14 +1348,14 @@ static void power_on(Terminal *term, int clear) */ void term_update(Terminal *term) { - term->window_update_pending = FALSE; + term->window_update_pending = false; if (win_setup_draw_ctx(term->win)) { int need_sbar_update = term->seen_disp_event; if (term->seen_disp_event && term->scroll_on_disp) { term->disptop = 0; /* return to main screen */ term->seen_disp_event = 0; - need_sbar_update = TRUE; + need_sbar_update = true; } if (need_sbar_update) @@ -1380,7 +1380,7 @@ void term_seen_key_event(Terminal *term) * to be intended (e.g. beeps from filename completion * blocking repeatedly). */ - term->beep_overloaded = FALSE; + term->beep_overloaded = false; while (term->beephead) { struct beeptime *tmp = term->beephead; term->beephead = tmp->next; @@ -1563,7 +1563,7 @@ void term_reconfig(Terminal *term, Conf *conf) term->wordness[i] = conf_get_int_int(term->conf, CONF_wordness, i); if (conf_get_int(term->conf, CONF_no_alt_screen)) - swap_screen(term, 0, FALSE, FALSE); + swap_screen(term, 0, false, false); if (conf_get_int(term->conf, CONF_no_mouse_rep)) { term->xterm_mouse = 0; win_set_raw_mouse_mode(term->win, 0); @@ -1648,21 +1648,21 @@ Terminal *term_init(Conf *myconf, struct unicode_data *ucsdata, TermWin *win) term->logctx = NULL; term->compatibility_level = TM_PUTTY; strcpy(term->id_string, "\033[?6c"); - term->cblink_pending = term->tblink_pending = FALSE; + term->cblink_pending = term->tblink_pending = false; term->paste_buffer = NULL; term->paste_len = 0; bufchain_init(&term->inbuf); bufchain_init(&term->printer_buf); - term->printing = term->only_printing = FALSE; + term->printing = term->only_printing = false; term->print_job = NULL; - term->vt52_mode = FALSE; - term->cr_lf_return = FALSE; - term->seen_disp_event = FALSE; - term->mouse_is_down = FALSE; - term->reset_132 = FALSE; + term->vt52_mode = false; + term->cr_lf_return = false; + term->seen_disp_event = false; + term->mouse_is_down = false; + term->reset_132 = false; term->cblinker = term->tblinker = 0; term->has_focus = 1; - term->repeat_off = FALSE; + term->repeat_off = false; term->termstate = TOPLEVEL; term->selstate = NO_SELECTION; term->curstype = 0; @@ -1678,21 +1678,21 @@ Terminal *term_init(Conf *myconf, struct unicode_data *ucsdata, TermWin *win) term->tabs = NULL; deselect(term); term->rows = term->cols = -1; - power_on(term, TRUE); + power_on(term, true); term->beephead = term->beeptail = NULL; term->nbeeps = 0; - term->lastbeep = FALSE; - term->beep_overloaded = FALSE; + term->lastbeep = false; + term->beep_overloaded = false; term->attr_mask = 0xffffffff; term->backend = NULL; - term->in_term_out = FALSE; + term->in_term_out = false; term->ltemp = NULL; term->ltemp_size = 0; term->wcFrom = NULL; term->wcTo = NULL; term->wcFromTo_size = 0; - term->window_update_pending = FALSE; + term->window_update_pending = false; term->bidi_cache_size = 0; term->pre_bidi_cache = term->post_bidi_cache = NULL; @@ -1792,7 +1792,7 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines) if (newcols < 1) newcols = 1; deselect(term); - swap_screen(term, 0, FALSE, FALSE); + swap_screen(term, 0, false, false); term->alt_t = term->marg_t = 0; term->alt_b = term->marg_b = newrows - 1; @@ -1834,7 +1834,7 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines) cline = delpos234(term->scrollback, --sblen); line = decompressline(cline, NULL); sfree(cline); - line->temporary = FALSE; /* reconstituted line is now real */ + line->temporary = false; /* reconstituted line is now real */ term->tempsblines -= 1; addpos234(term->screen, line, 0); term->curs.y += 1; @@ -1843,7 +1843,7 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines) term->alt_savecurs.y += 1; } else { /* Add a new blank line at the bottom of the screen. */ - line = newline(term, newcols, FALSE); + line = newline(term, newcols, false); addpos234(term->screen, line, count234(term->screen)); } term->rows += 1; @@ -1885,7 +1885,7 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines) /* Make a new displayed text buffer. */ newdisp = snewn(newrows, termline *); for (i = 0; i < newrows; i++) { - newdisp[i] = newline(term, newcols, FALSE); + newdisp[i] = newline(term, newcols, false); for (j = 0; j < newcols; j++) newdisp[i]->chars[j].attr = ATTR_INVALID; } @@ -1900,7 +1900,7 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines) /* Make a new alternate screen. */ newalt = newtree234(NULL); for (i = 0; i < newrows; i++) { - line = newline(term, newcols, TRUE); + line = newline(term, newcols, true); addpos234(newalt, line, i); } if (term->alt_screen) { @@ -1915,7 +1915,7 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines) { int i; for (i = (term->cols > 0 ? term->cols : 0); i < newcols; i++) - term->tabs[i] = (i % 8 == 0 ? TRUE : FALSE); + term->tabs[i] = (i % 8 == 0 ? true : false); } /* Check that the cursor positions are still valid. */ @@ -1944,13 +1944,13 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines) if (term->alt_x >= newcols) term->alt_x = newcols - 1; term->alt_x = term->alt_y = 0; - term->wrapnext = term->alt_wnext = FALSE; + term->wrapnext = term->alt_wnext = false; term->rows = newrows; term->cols = newcols; term->savelines = newsavelines; - swap_screen(term, save_alt_which, FALSE, FALSE); + swap_screen(term, save_alt_which, false, false); update_sbar(term); term_update(term); @@ -1987,7 +1987,7 @@ static int find_last_nonempty_line(Terminal * term, tree234 * screen) } /* - * Swap screens. If `reset' is TRUE and we have been asked to + * Swap screens. If `reset' is true and we have been asked to * switch to the alternate screen, we must bring most of its * configuration from the main screen and erase the contents of the * alternate screen completely. (This is even true if we're already @@ -2001,7 +2001,7 @@ static void swap_screen(Terminal *term, int which, int reset, int keep_cur_pos) tree234 *ttr; if (!which) - reset = FALSE; /* do no weird resetting if which==0 */ + reset = false; /* do no weird resetting if which==0 */ if (which != term->alt_which) { term->alt_which = which; @@ -2084,7 +2084,7 @@ static void swap_screen(Terminal *term, int which, int reset, int keep_cur_pos) /* * Yes, this _is_ supposed to honour background-colour-erase. */ - erase_lots(term, FALSE, TRUE, TRUE); + erase_lots(term, false, true, true); } } @@ -2110,7 +2110,7 @@ static void check_selection(Terminal *term, pos from, pos to) /* * Scroll the screen. (`lines' is +ve for scrolling forward, -ve - * for backward.) `sb' is TRUE if the scrolling is permitted to + * for backward.) `sb' is true if the scrolling is permitted to * affect the scrollback buffer. */ static void scroll(Terminal *term, int topline, int botline, int lines, int sb) @@ -2119,7 +2119,7 @@ static void scroll(Terminal *term, int topline, int botline, int lines, int sb) int i, seltop, scrollwinsize; if (topline != 0 || term->alt_which != 0) - sb = FALSE; + sb = false; scrollwinsize = botline - topline + 1; @@ -2269,7 +2269,7 @@ static void move(Terminal *term, int x, int y, int marg_clip) y = term->rows - 1; term->curs.x = x; term->curs.y = y; - term->wrapnext = FALSE; + term->wrapnext = false; } /* @@ -2304,7 +2304,7 @@ static void save_cursor(Terminal *term, int save) * longer at the rightmost edge. */ if (term->wrapnext && term->curs.x < term->cols-1) - term->wrapnext = FALSE; + term->wrapnext = false; term->cset_attr[term->cset] = term->save_csattr; term->sco_acs = term->save_sco_acs; set_erase_char(term); @@ -2368,13 +2368,13 @@ static void erase_lots(Terminal *term, start.x = 0; end.y = term->curs.y + 1; end.x = 0; - erase_lattr = FALSE; + erase_lattr = false; } else { start.y = 0; start.x = 0; end.y = term->rows; end.x = 0; - erase_lattr = TRUE; + erase_lattr = true; } if (!from_begin) { start = term->curs; @@ -2406,7 +2406,7 @@ static void erase_lots(Terminal *term, scrolllines = find_last_nonempty_line(term, term->screen) + 1; } if (scrolllines > 0) - scroll(term, 0, scrolllines - 1, scrolllines, TRUE); + scroll(term, 0, scrolllines - 1, scrolllines, true); } else { termline *ldata = scrlineptr(start.y); while (poslt(start, end)) { @@ -2520,8 +2520,8 @@ static void toggle_mode(Terminal *term, int mode, int query, int state) case 2: /* DECANM: VT52 mode */ term->vt52_mode = !state; if (term->vt52_mode) { - term->blink_is_real = FALSE; - term->vt52_bold = FALSE; + term->blink_is_real = false; + term->vt52_bold = false; } else { term->blink_is_real = term->blinktext; } @@ -2535,7 +2535,7 @@ static void toggle_mode(Terminal *term, int mode, int query, int state) term->alt_t = term->marg_t = 0; term->alt_b = term->marg_b = term->rows - 1; move(term, 0, 0, 0); - erase_lots(term, FALSE, TRUE, TRUE); + erase_lots(term, false, true, true); break; case 5: /* DECSCNM: reverse video */ /* @@ -2546,7 +2546,7 @@ static void toggle_mode(Terminal *term, int mode, int query, int state) */ if (term->rvideo && !state) { /* This is an OFF, so set up a vbell */ - term_schedule_vbell(term, TRUE, term->rvbell_startpoint); + term_schedule_vbell(term, true, term->rvbell_startpoint); } else if (!term->rvideo && state) { /* This is an ON, so we notice the time and save it. */ term->rvbell_startpoint = GETTICKCOUNT(); @@ -2576,7 +2576,7 @@ static void toggle_mode(Terminal *term, int mode, int query, int state) case 47: /* alternate screen */ compatibility(OTHER); deselect(term); - swap_screen(term, term->no_alt_screen ? 0 : state, FALSE, FALSE); + swap_screen(term, term->no_alt_screen ? 0 : state, false, false); if (term->scroll_on_disp) term->disptop = 0; break; @@ -2597,7 +2597,7 @@ static void toggle_mode(Terminal *term, int mode, int query, int state) case 1047: /* alternate screen */ compatibility(OTHER); deselect(term); - swap_screen(term, term->no_alt_screen ? 0 : state, TRUE, TRUE); + swap_screen(term, term->no_alt_screen ? 0 : state, true, true); if (term->scroll_on_disp) term->disptop = 0; break; @@ -2612,14 +2612,14 @@ static void toggle_mode(Terminal *term, int mode, int query, int state) if (!state) seen_disp_event(term); compatibility(OTHER); deselect(term); - swap_screen(term, term->no_alt_screen ? 0 : state, TRUE, FALSE); + swap_screen(term, term->no_alt_screen ? 0 : state, true, false); if (!state && !term->no_alt_screen) save_cursor(term, state); if (term->scroll_on_disp) term->disptop = 0; break; case 2004: /* xterm bracketed paste */ - term->bracketed_paste = state ? TRUE : FALSE; + term->bracketed_paste = state ? true : false; break; } else switch (mode) { @@ -2729,7 +2729,7 @@ static void term_print_finish(Terminal *term) } printer_finish_job(term->print_job); term->print_job = NULL; - term->printing = term->only_printing = FALSE; + term->printing = term->only_printing = false; } static void term_display_graphic_char(Terminal *term, unsigned long c) @@ -2746,11 +2746,11 @@ static void term_display_graphic_char(Terminal *term, unsigned long c) if (term->wrapnext && term->wrap && width > 0) { cline->lattr |= LATTR_WRAPPED; if (term->curs.y == term->marg_b) - scroll(term, term->marg_t, term->marg_b, 1, TRUE); + scroll(term, term->marg_t, term->marg_b, 1, true); else if (term->curs.y < term->rows - 1) term->curs.y++; term->curs.x = 0; - term->wrapnext = FALSE; + term->wrapnext = false; cline = scrlineptr(term->curs.y); } if (term->insert && width > 0) @@ -2788,7 +2788,7 @@ static void term_display_graphic_char(Terminal *term, unsigned long c) cline->lattr |= LATTR_WRAPPED | LATTR_WRAPPED2; if (term->curs.y == term->marg_b) scroll(term, term->marg_t, term->marg_b, - 1, TRUE); + 1, true); else if (term->curs.y < term->rows - 1) term->curs.y++; term->curs.x = 0; @@ -2855,15 +2855,15 @@ static void term_display_graphic_char(Terminal *term, unsigned long c) term->curs.x++; if (term->curs.x == term->cols) { term->curs.x--; - term->wrapnext = TRUE; + term->wrapnext = true; if (term->wrap && term->vt52_mode) { cline->lattr |= LATTR_WRAPPED; if (term->curs.y == term->marg_b) - scroll(term, term->marg_t, term->marg_b, 1, TRUE); + scroll(term, term->marg_t, term->marg_b, 1, true); else if (term->curs.y < term->rows - 1) term->curs.y++; term->curs.x = 0; - term->wrapnext = FALSE; + term->wrapnext = false; } } seen_disp_event(term); @@ -3088,7 +3088,7 @@ static void term_out(Terminal *term) c = 0; else { term->termstate = SEEN_ESC; - term->esc_query = FALSE; + term->esc_query = false; c = '@' + (c & 0x1F); } } @@ -3097,7 +3097,7 @@ static void term_out(Terminal *term) if (c == '\177' && term->termstate < DO_CTRLS && has_compat(OTHER)) { if (term->curs.x && !term->wrapnext) term->curs.x--; - term->wrapnext = FALSE; + term->wrapnext = false; /* destructive backspace might be disabled */ if (!term->no_dbackspace) { check_boundary(term, term->curs.x, term->curs.y); @@ -3163,7 +3163,7 @@ static void term_out(Terminal *term) * last beep was more than s seconds ago, * leave overload mode. */ - term->beep_overloaded = FALSE; + term->beep_overloaded = false; } else if (term->bellovl && !term->beep_overloaded && term->nbeeps >= term->bellovl_n) { /* @@ -3171,7 +3171,7 @@ static void term_out(Terminal *term) * remaining in the queue, go into overload * mode. */ - term->beep_overloaded = TRUE; + term->beep_overloaded = true; } term->lastbeep = ticks; @@ -3182,7 +3182,7 @@ static void term_out(Terminal *term) win_bell(term->win, term->beep); if (term->beep == BELL_VISUAL) { - term_schedule_vbell(term, FALSE, 0); + term_schedule_vbell(term, false, 0); } } seen_disp_event(term); @@ -3195,7 +3195,7 @@ static void term_out(Terminal *term) else if (term->curs.x == 0 && term->curs.y > 0) term->curs.x = term->cols - 1, term->curs.y--; else if (term->wrapnext) - term->wrapnext = FALSE; + term->wrapnext = false; else term->curs.x--; seen_disp_event(term); @@ -3214,17 +3214,17 @@ static void term_out(Terminal *term) else { compatibility(ANSIMIN); term->termstate = SEEN_ESC; - term->esc_query = FALSE; + term->esc_query = false; } break; case '\015': /* CR: Carriage return */ term->curs.x = 0; - term->wrapnext = FALSE; + term->wrapnext = false; seen_disp_event(term); if (term->crhaslf) { if (term->curs.y == term->marg_b) - scroll(term, term->marg_t, term->marg_b, 1, TRUE); + scroll(term, term->marg_t, term->marg_b, 1, true); else if (term->curs.y < term->rows - 1) term->curs.y++; } @@ -3234,10 +3234,10 @@ static void term_out(Terminal *term) case '\014': /* FF: Form feed */ if (has_compat(SCOANSI)) { move(term, 0, 0, 0); - erase_lots(term, FALSE, FALSE, TRUE); + erase_lots(term, false, false, true); if (term->scroll_on_disp) term->disptop = 0; - term->wrapnext = FALSE; + term->wrapnext = false; seen_disp_event(term); break; } @@ -3245,12 +3245,12 @@ static void term_out(Terminal *term) compatibility(VT100); case '\012': /* LF: Line feed */ if (term->curs.y == term->marg_b) - scroll(term, term->marg_t, term->marg_b, 1, TRUE); + scroll(term, term->marg_t, term->marg_b, 1, true); else if (term->curs.y < term->rows - 1) term->curs.y++; if (term->lfhascr) term->curs.x = 0; - term->wrapnext = FALSE; + term->wrapnext = false; seen_disp_event(term); if (term->logctx) logtraffic(term->logctx, (unsigned char) c, LGTYP_ASCII); @@ -3313,7 +3313,7 @@ static void term_out(Terminal *term) term->termstate = SEEN_CSI; term->esc_nargs = 1; term->esc_args[0] = ARG_DEFAULT; - term->esc_query = FALSE; + term->esc_query = false; break; case ']': /* OSC: xterm escape sequences */ /* Compatibility is nasty here, xterm, linux, decterm yuk! */ @@ -3324,47 +3324,47 @@ static void term_out(Terminal *term) break; case '7': /* DECSC: save cursor */ compatibility(VT100); - save_cursor(term, TRUE); + save_cursor(term, true); break; case '8': /* DECRC: restore cursor */ compatibility(VT100); - save_cursor(term, FALSE); + save_cursor(term, false); seen_disp_event(term); break; case '=': /* DECKPAM: Keypad application mode */ compatibility(VT100); - term->app_keypad_keys = TRUE; + term->app_keypad_keys = true; break; case '>': /* DECKPNM: Keypad numeric mode */ compatibility(VT100); - term->app_keypad_keys = FALSE; + term->app_keypad_keys = false; break; case 'D': /* IND: exactly equivalent to LF */ compatibility(VT100); if (term->curs.y == term->marg_b) - scroll(term, term->marg_t, term->marg_b, 1, TRUE); + scroll(term, term->marg_t, term->marg_b, 1, true); else if (term->curs.y < term->rows - 1) term->curs.y++; - term->wrapnext = FALSE; + term->wrapnext = false; seen_disp_event(term); break; case 'E': /* NEL: exactly equivalent to CR-LF */ compatibility(VT100); term->curs.x = 0; if (term->curs.y == term->marg_b) - scroll(term, term->marg_t, term->marg_b, 1, TRUE); + scroll(term, term->marg_t, term->marg_b, 1, true); else if (term->curs.y < term->rows - 1) term->curs.y++; - term->wrapnext = FALSE; + term->wrapnext = false; seen_disp_event(term); break; case 'M': /* RI: reverse index - backwards LF */ compatibility(VT100); if (term->curs.y == term->marg_t) - scroll(term, term->marg_t, term->marg_b, -1, TRUE); + scroll(term, term->marg_t, term->marg_b, -1, true); else if (term->curs.y > 0) term->curs.y--; - term->wrapnext = FALSE; + term->wrapnext = false; seen_disp_event(term); break; case 'Z': /* DECID: terminal type query */ @@ -3375,7 +3375,7 @@ static void term_out(Terminal *term) break; case 'c': /* RIS: restore power-on settings */ compatibility(VT100); - power_on(term, TRUE); + power_on(term, true); if (term->ldisc) /* cause ldisc to notice changes */ ldisc_echoedit_update(term->ldisc); if (term->reset_132) { @@ -3389,7 +3389,7 @@ static void term_out(Terminal *term) break; case 'H': /* HTS: set a tab */ compatibility(VT100); - term->tabs[term->curs.x] = TRUE; + term->tabs[term->curs.x] = true; break; case ANSI('8', '#'): /* DECALN: fills screen with Es :-) */ @@ -3528,7 +3528,7 @@ static void term_out(Terminal *term) if (term->esc_query) term->esc_query = -1; else if (c == '?') - term->esc_query = TRUE; + term->esc_query = true; else term->esc_query = c; term->termstate = SEEN_CSI; @@ -3636,7 +3636,7 @@ static void term_out(Terminal *term) i++; if (i > 3) i = 0; - erase_lots(term, FALSE, !!(i & 2), !!(i & 1)); + erase_lots(term, false, !!(i & 2), !!(i & 1)); } } if (term->scroll_on_disp) @@ -3648,7 +3648,7 @@ static void term_out(Terminal *term) unsigned int i = def(term->esc_args[0], 0) + 1; if (i > 3) i = 0; - erase_lots(term, TRUE, !!(i & 2), !!(i & 1)); + erase_lots(term, true, !!(i & 2), !!(i & 1)); } seen_disp_event(term); break; @@ -3657,7 +3657,7 @@ static void term_out(Terminal *term) CLAMP(term->esc_args[0], term->rows); if (term->curs.y <= term->marg_b) scroll(term, term->curs.y, term->marg_b, - -def(term->esc_args[0], 1), FALSE); + -def(term->esc_args[0], 1), false); seen_disp_event(term); break; case 'M': /* DL: delete lines */ @@ -3666,7 +3666,7 @@ static void term_out(Terminal *term) if (term->curs.y <= term->marg_b) scroll(term, term->curs.y, term->marg_b, def(term->esc_args[0], 1), - TRUE); + true); seen_disp_event(term); break; case '@': /* ICH: insert chars */ @@ -3708,7 +3708,7 @@ static void term_out(Terminal *term) int i; for (i = 0; i < term->esc_nargs; i++) toggle_mode(term, term->esc_args[i], - term->esc_query, TRUE); + term->esc_query, true); } break; case 'i': /* MC: Media copy */ @@ -3720,7 +3720,7 @@ static void term_out(Terminal *term) if (term->esc_args[0] == 5 && (printer = conf_get_str(term->conf, CONF_printer))[0]) { - term->printing = TRUE; + term->printing = true; term->only_printing = !term->esc_query; term->print_state = 0; term_print_setup(term, printer); @@ -3737,18 +3737,18 @@ static void term_out(Terminal *term) int i; for (i = 0; i < term->esc_nargs; i++) toggle_mode(term, term->esc_args[i], - term->esc_query, FALSE); + term->esc_query, false); } break; case 'g': /* TBC: clear tabs */ compatibility(VT100); if (term->esc_nargs == 1) { if (term->esc_args[0] == 0) { - term->tabs[term->curs.x] = FALSE; + term->tabs[term->curs.x] = false; } else if (term->esc_args[0] == 3) { int i; for (i = 0; i < term->cols; i++) - term->tabs[i] = FALSE; + term->tabs[i] = false; } } break; @@ -3845,7 +3845,7 @@ static void term_out(Terminal *term) break; case 6: /* SCO light bkgrd */ compatibility(SCOANSI); - term->blink_is_real = FALSE; + term->blink_is_real = false; term->curr_attr |= ATTR_BLINK; term_schedule_tblink(term); break; @@ -3889,7 +3889,7 @@ static void term_out(Terminal *term) case 36: case 37: /* foreground */ - term->curr_truecolour.fg.enabled = FALSE; + term->curr_truecolour.fg.enabled = false; term->curr_attr &= ~ATTR_FGMASK; term->curr_attr |= (term->esc_args[i] - 30)<curr_truecolour.fg.enabled = FALSE; + term->curr_truecolour.fg.enabled = false; term->curr_attr &= ~ATTR_FGMASK; term->curr_attr |= ((term->esc_args[i] - 90 + 8) << ATTR_FGSHIFT); break; case 39: /* default-foreground */ - term->curr_truecolour.fg.enabled = FALSE; + term->curr_truecolour.fg.enabled = false; term->curr_attr &= ~ATTR_FGMASK; term->curr_attr |= ATTR_DEFFG; break; @@ -3923,7 +3923,7 @@ static void term_out(Terminal *term) case 46: case 47: /* background */ - term->curr_truecolour.bg.enabled = FALSE; + term->curr_truecolour.bg.enabled = false; term->curr_attr &= ~ATTR_BGMASK; term->curr_attr |= (term->esc_args[i] - 40)<curr_truecolour.bg.enabled = FALSE; + term->curr_truecolour.bg.enabled = false; term->curr_attr &= ~ATTR_BGMASK; term->curr_attr |= ((term->esc_args[i] - 100 + 8) << ATTR_BGSHIFT); break; case 49: /* default-background */ - term->curr_truecolour.bg.enabled = FALSE; + term->curr_truecolour.bg.enabled = false; term->curr_attr &= ~ATTR_BGMASK; term->curr_attr |= ATTR_DEFBG; break; @@ -4006,10 +4006,10 @@ static void term_out(Terminal *term) } break; case 's': /* save cursor */ - save_cursor(term, TRUE); + save_cursor(term, true); break; case 'u': /* restore cursor */ - save_cursor(term, FALSE); + save_cursor(term, false); seen_disp_event(term); break; case 't': /* DECSLPP: set page size - ie window height */ @@ -4037,10 +4037,10 @@ static void term_out(Terminal *term) char buf[80]; const char *p; case 1: - win_set_minimised(term->win, FALSE); + win_set_minimised(term->win, false); break; case 2: - win_set_minimised(term->win, TRUE); + win_set_minimised(term->win, true); break; case 3: if (term->esc_nargs >= 3) { @@ -4058,11 +4058,11 @@ static void term_out(Terminal *term) break; case 5: /* move to top */ - win_set_zorder(term->win, TRUE); + win_set_zorder(term->win, true); break; case 6: /* move to bottom */ - win_set_zorder(term->win, FALSE); + win_set_zorder(term->win, false); break; case 7: win_refresh(term->win); @@ -4082,7 +4082,7 @@ static void term_out(Terminal *term) if (term->esc_nargs >= 2) win_set_maximised( term->win, - term->esc_args[1] ? TRUE : FALSE); + term->esc_args[1] ? true : false); break; case 11: if (term->ldisc) @@ -4134,7 +4134,7 @@ static void term_out(Terminal *term) if (term->ldisc && term->remote_qtitle_action != TITLE_NONE) { if(term->remote_qtitle_action == TITLE_REAL) - p = win_get_title(term->win, TRUE); + p = win_get_title(term->win, true); else p = EMPTY_WINDOW_TITLE; len = strlen(p); @@ -4148,7 +4148,7 @@ static void term_out(Terminal *term) if (term->ldisc && term->remote_qtitle_action != TITLE_NONE) { if(term->remote_qtitle_action == TITLE_REAL) - p = win_get_title(term->win, FALSE); + p = win_get_title(term->win, false); else p = EMPTY_WINDOW_TITLE; len = strlen(p); @@ -4165,16 +4165,16 @@ static void term_out(Terminal *term) CLAMP(term->esc_args[0], term->rows); compatibility(SCOANSI); scroll(term, term->marg_t, term->marg_b, - def(term->esc_args[0], 1), TRUE); - term->wrapnext = FALSE; + def(term->esc_args[0], 1), true); + term->wrapnext = false; seen_disp_event(term); break; case 'T': /* SD: Scroll down */ CLAMP(term->esc_args[0], term->rows); compatibility(SCOANSI); scroll(term, term->marg_t, term->marg_b, - -def(term->esc_args[0], 1), TRUE); - term->wrapnext = FALSE; + -def(term->esc_args[0], 1), true); + term->wrapnext = false; seen_disp_event(term); break; case ANSI('|', '*'): /* DECSNLS */ @@ -4265,15 +4265,15 @@ static void term_out(Terminal *term) compatibility(SCOANSI); switch(term->esc_args[0]) { case 0: /* hide cursor */ - term->cursor_on = FALSE; + term->cursor_on = false; break; case 1: /* restore cursor */ - term->big_cursor = FALSE; - term->cursor_on = TRUE; + term->big_cursor = false; + term->cursor_on = true; break; case 2: /* block cursor */ - term->big_cursor = TRUE; - term->cursor_on = TRUE; + term->big_cursor = true; + term->cursor_on = true; break; } break; @@ -4287,14 +4287,14 @@ static void term_out(Terminal *term) compatibility(SCOANSI); if (term->esc_nargs >= 2) { if (term->esc_args[0] > term->esc_args[1]) - term->cursor_on = FALSE; + term->cursor_on = false; else - term->cursor_on = TRUE; + term->cursor_on = true; } break; case ANSI('D', '='): compatibility(SCOANSI); - term->blink_is_real = FALSE; + term->blink_is_real = false; term_schedule_tblink(term); if (term->esc_args[0]>=1) term->curr_attr |= ATTR_BLINK; @@ -4423,7 +4423,7 @@ static void term_out(Terminal *term) } break; case SEEN_OSC: - term->osc_w = FALSE; + term->osc_w = false; switch (c) { case 'P': /* Linux palette sequence */ term->termstate = SEEN_OSC_P; @@ -4436,7 +4436,7 @@ static void term_out(Terminal *term) break; case 'W': /* word-set */ term->termstate = SEEN_OSC_W; - term->osc_w = TRUE; + term->osc_w = true; break; case '0': case '1': @@ -4628,18 +4628,18 @@ static void term_out(Terminal *term) break; case 'I': if (term->curs.y == 0) - scroll(term, 0, term->rows - 1, -1, TRUE); + scroll(term, 0, term->rows - 1, -1, true); else if (term->curs.y > 0) term->curs.y--; - term->wrapnext = FALSE; + term->wrapnext = false; break; case 'J': - erase_lots(term, FALSE, FALSE, TRUE); + erase_lots(term, false, false, true); if (term->scroll_on_disp) term->disptop = 0; break; case 'K': - erase_lots(term, TRUE, FALSE, TRUE); + erase_lots(term, true, false, true); break; #if 0 case 'V': @@ -4660,17 +4660,17 @@ static void term_out(Terminal *term) ldisc_send(term->ldisc, "\033/Z", 3, 0); break; case '=': - term->app_keypad_keys = TRUE; + term->app_keypad_keys = true; break; case '>': - term->app_keypad_keys = FALSE; + term->app_keypad_keys = false; break; case '<': /* XXX This should switch to VT100 mode not current or default * VT mode. But this will only have effect in a VT220+ * emulation. */ - term->vt52_mode = FALSE; + term->vt52_mode = false; term->blink_is_real = term->blinktext; term_schedule_tblink(term); break; @@ -4690,19 +4690,19 @@ static void term_out(Terminal *term) case 'E': /* compatibility(ATARI) */ move(term, 0, 0, 0); - erase_lots(term, FALSE, FALSE, TRUE); + erase_lots(term, false, false, true); if (term->scroll_on_disp) term->disptop = 0; break; case 'L': /* compatibility(ATARI) */ if (term->curs.y <= term->marg_b) - scroll(term, term->curs.y, term->marg_b, -1, FALSE); + scroll(term, term->curs.y, term->marg_b, -1, false); break; case 'M': /* compatibility(ATARI) */ if (term->curs.y <= term->marg_b) - scroll(term, term->curs.y, term->marg_b, 1, TRUE); + scroll(term, term->curs.y, term->marg_b, 1, true); break; case 'b': /* compatibility(ATARI) */ @@ -4714,29 +4714,29 @@ static void term_out(Terminal *term) break; case 'd': /* compatibility(ATARI) */ - erase_lots(term, FALSE, TRUE, FALSE); + erase_lots(term, false, true, false); if (term->scroll_on_disp) term->disptop = 0; break; case 'e': /* compatibility(ATARI) */ - term->cursor_on = TRUE; + term->cursor_on = true; break; case 'f': /* compatibility(ATARI) */ - term->cursor_on = FALSE; + term->cursor_on = false; break; /* case 'j': Save cursor position - broken on ST */ /* case 'k': Restore cursor position */ case 'l': /* compatibility(ATARI) */ - erase_lots(term, TRUE, TRUE, TRUE); + erase_lots(term, true, true, true); term->curs.x = 0; - term->wrapnext = FALSE; + term->wrapnext = false; break; case 'o': /* compatibility(ATARI) */ - erase_lots(term, TRUE, TRUE, FALSE); + erase_lots(term, true, true, false); break; case 'p': /* compatibility(ATARI) */ @@ -4757,7 +4757,7 @@ static void term_out(Terminal *term) case 'R': /* compatibility(OTHER) */ - term->vt52_bold = FALSE; + term->vt52_bold = false; term->curr_attr = ATTR_DEFAULT; term->curr_truecolour.fg = optionalrgb_none; term->curr_truecolour.bg = optionalrgb_none; @@ -4773,12 +4773,12 @@ static void term_out(Terminal *term) break; case 'U': /* compatibility(VI50) */ - term->vt52_bold = TRUE; + term->vt52_bold = true; term->curr_attr |= ATTR_BOLD; break; case 'T': /* compatibility(VI50) */ - term->vt52_bold = FALSE; + term->vt52_bold = false; term->curr_attr &= ~ATTR_BOLD; break; #endif @@ -4830,7 +4830,7 @@ static void term_out(Terminal *term) */ static void parse_optionalrgb(optionalrgb *out, unsigned *values) { - out->enabled = TRUE; + out->enabled = true; out->r = values[0] < 256 ? values[0] : 0; out->g = values[1] < 256 ? values[1] : 0; out->b = values[2] < 256 ? values[2] : 0; @@ -4847,22 +4847,22 @@ static int term_bidi_cache_hit(Terminal *term, int line, int i; if (!term->pre_bidi_cache) - return FALSE; /* cache doesn't even exist yet! */ + return false; /* cache doesn't even exist yet! */ if (line >= term->bidi_cache_size) - return FALSE; /* cache doesn't have this many lines */ + return false; /* cache doesn't have this many lines */ if (!term->pre_bidi_cache[line].chars) - return FALSE; /* cache doesn't contain _this_ line */ + return false; /* cache doesn't contain _this_ line */ if (term->pre_bidi_cache[line].width != width) - return FALSE; /* line is wrong width */ + return false; /* line is wrong width */ for (i = 0; i < width; i++) if (!termchars_equal(term->pre_bidi_cache[line].chars+i, lbefore+i)) - return FALSE; /* line doesn't match cache */ + return false; /* line doesn't match cache */ - return TRUE; /* it didn't match. */ + return true; /* it didn't match. */ } static void term_bidi_cache_store(Terminal *term, int line, termchar *lbefore, @@ -5191,7 +5191,7 @@ static void do_paint(Terminal *term) selected = (posPle(term->selstart, scrpos) && posPlt(scrpos, term->selend)); } else - selected = FALSE; + selected = false; tattr = (tattr ^ rv ^ (selected ? ATTR_REVERSE : 0)); @@ -5246,11 +5246,11 @@ static void do_paint(Terminal *term) * with fonts that overflow their character cells. */ laststart = 0; - dirtyrect = FALSE; + dirtyrect = false; for (j = 0; j < term->cols; j++) { if (term->disptext[i]->chars[j].attr & DATTR_STARTRUN) { laststart = j; - dirtyrect = FALSE; + dirtyrect = false; } if (term->disptext[i]->chars[j].chr != newline[j].chr || @@ -5262,7 +5262,7 @@ static void do_paint(Terminal *term) for (k = laststart; k < j; k++) term->disptext[i]->chars[k].attr |= ATTR_INVALID; - dirtyrect = TRUE; + dirtyrect = true; } } @@ -5287,19 +5287,19 @@ static void do_paint(Terminal *term) tchar = newline[j].chr; if ((term->disptext[i]->chars[j].attr ^ tattr) & ATTR_WIDE) - dirty_line = TRUE; + dirty_line = true; break_run = ((tattr ^ attr) & term->attr_mask) != 0; if (!truecolour_equal(newline[j].truecolour, tc)) - break_run = TRUE; + break_run = true; #ifdef USES_VTLINE_HACK /* Special hack for VT100 Linedraw glyphs */ if ((tchar >= 0x23BA && tchar <= 0x23BD) || (j > 0 && (newline[j-1].chr >= 0x23BA && newline[j-1].chr <= 0x23BD))) - break_run = TRUE; + break_run = true; #endif /* @@ -5307,21 +5307,21 @@ static void do_paint(Terminal *term) * same CSET, if that CSET is a magic one. */ if (CSET_OF(tchar) != cset) - break_run = TRUE; + break_run = true; /* * Break on both sides of any combined-character cell. */ if (d->cc_next != 0 || (j > 0 && d[-1].cc_next != 0)) - break_run = TRUE; + break_run = true; if (!term->ucsdata->dbcs_screenfont && !dirty_line) { if (term->disptext[i]->chars[j].chr == tchar && (term->disptext[i]->chars[j].attr &~ DATTR_MASK) == tattr) - break_run = TRUE; + break_run = true; else if (!dirty_run && ccount == 1) - break_run = TRUE; + break_run = true; } if (break_run) { @@ -5342,11 +5342,11 @@ static void do_paint(Terminal *term) dirty_run = dirty_line; } - do_copy = FALSE; + do_copy = false; if (!termchars_equal_override(&term->disptext[i]->chars[j], d, tchar, tattr)) { - do_copy = TRUE; - dirty_run = TRUE; + do_copy = true; + dirty_run = true; } if (ccount+2 > chlen) { @@ -5420,7 +5420,7 @@ static void do_paint(Terminal *term) */ assert(!(i == our_curs_y && j == our_curs_x)); if (!termchars_equal(&term->disptext[i]->chars[j], d)) - dirty_run = TRUE; + dirty_run = true; copy_termchar(term->disptext[i], j, d); } } @@ -5575,7 +5575,7 @@ static void clipme(Terminal *term, pos top, pos bottom, int rect, int desel, old_top_x = top.x; /* needed for rect==1 */ while (poslt(top, bottom)) { - int nl = FALSE; + int nl = false; termline *ldata = lineptr(top.y); pos nlpos; @@ -5600,7 +5600,7 @@ static void clipme(Terminal *term, pos top, pos bottom, int rect, int desel, poslt(top, nlpos)) decpos(nlpos); if (poslt(nlpos, bottom)) - nl = TRUE; + nl = true; } else if (ldata->lattr & LATTR_WRAPPED2) { /* Ignore the last char on the line in a WRAPPED2 line. */ decpos(nlpos); @@ -5722,10 +5722,10 @@ static void clipme(Terminal *term, pos top, pos bottom, int rect, int desel, /* Finally, transfer all that to the clipboard(s). */ { int i; - int clip_local = FALSE; + int clip_local = false; for (i = 0; i < n_clipboards; i++) { if (clipboards[i] == CLIP_LOCAL) { - clip_local = TRUE; + clip_local = true; } else if (clipboards[i] != CLIP_NULL) { win_clip_write( term->win, clipboards[i], buf.textbuf, buf.attrbuf, @@ -5757,7 +5757,7 @@ void term_copyall(Terminal *term, const int *clipboards, int n_clipboards) top.x = 0; bottom.y = find_last_nonempty_line(term, screen); bottom.x = term->cols; - clipme(term, top, bottom, 0, TRUE, clipboards, n_clipboards); + clipme(term, top, bottom, 0, true, clipboards, n_clipboards); } static void paste_from_clip_local(void *vterm) @@ -5775,7 +5775,7 @@ void term_request_copy(Terminal *term, const int *clipboards, int n_clipboards) win_clip_write(term->win, clipboards[i], term->last_selected_text, term->last_selected_attr, term->last_selected_tc, term->last_selected_len, - FALSE); + false); } } } @@ -6229,23 +6229,23 @@ void term_mouse(Terminal *term, Mouse_Button braw, Mouse_Button bcooked, switch (braw) { case MBT_LEFT: encstate = 0x00; /* left button down */ - wheel = FALSE; + wheel = false; break; case MBT_MIDDLE: encstate = 0x01; - wheel = FALSE; + wheel = false; break; case MBT_RIGHT: encstate = 0x02; - wheel = FALSE; + wheel = false; break; case MBT_WHEEL_UP: encstate = 0x40; - wheel = TRUE; + wheel = true; break; case MBT_WHEEL_DOWN: encstate = 0x41; - wheel = TRUE; + wheel = true; break; default: return; @@ -6412,7 +6412,7 @@ void term_mouse(Terminal *term, Mouse_Button braw, Mouse_Button bcooked, * data to the clipboard. */ clipme(term, term->selstart, term->selend, - (term->seltype == RECTANGULAR), FALSE, + (term->seltype == RECTANGULAR), false, term->mouse_select_clipboards, term->n_mouse_select_clipboards); term->selstate = SELECTED; @@ -6512,13 +6512,13 @@ int term_ldisc(Terminal *term, int option) return term->term_echoing; if (option == LD_EDIT) return term->term_editing; - return FALSE; + return false; } static void term_added_data(Terminal *term) { if (!term->in_term_out) { - term->in_term_out = TRUE; + term->in_term_out = true; term_reset_cblink(term); /* * During drag-selects, we do not process terminal input, @@ -6527,7 +6527,7 @@ static void term_added_data(Terminal *term) */ if (term->selstate != DRAGGING) term_out(term); - term->in_term_out = FALSE; + term->in_term_out = false; } } diff --git a/terminal.h b/terminal.h index b63d42e9..d569f5f4 100644 --- a/terminal.h +++ b/terminal.h @@ -52,7 +52,7 @@ struct termline { int cols; /* number of real columns on the line */ int size; /* number of allocated termchars * (cc-lists may make this > cols) */ - int temporary; /* TRUE if decompressed from scrollback */ + int temporary; /* true if decompressed from scrollback */ int cc_free; /* offset to first cc in free list */ struct termchar *chars; }; @@ -166,7 +166,7 @@ struct terminal_tag { int esc_nargs; int esc_query; #define ANSI(x,y) ((x)+((y)<<8)) -#define ANSI_QUE(x) ANSI(x,TRUE) +#define ANSI_QUE(x) ANSI(x,true) #define OSC_STR_MAX 2048 int osc_strlen; diff --git a/testbn.c b/testbn.c index 0bc555ee..29f6b753 100644 --- a/testbn.c +++ b/testbn.c @@ -37,7 +37,7 @@ void queue_idempotent_callback(IdempotentCallback *ic) { assert(0); } #define fromxdigit(c) ( (c)>'9' ? ((c)&0xDF) - 'A' + 10 : (c) - '0' ) /* For Unix in particular, but harmless if this main() is reused elsewhere */ -const int buildinfo_gtk_relevant = FALSE; +const int buildinfo_gtk_relevant = false; int main(int argc, char **argv) { @@ -215,7 +215,7 @@ int main(int argc, char **argv) answer_q = bigdiv(n, d); answer_r = bigmod(n, d); - fail = FALSE; + fail = false; if (bignum_cmp(expect_q, answer_q) != 0) { char *as = bignum_decimal(n); char *bs = bignum_decimal(d); @@ -224,7 +224,7 @@ int main(int argc, char **argv) printf("%d: fail: %s / %s gave %s expected %s\n", line, as, bs, cs, ds); - fail = TRUE; + fail = true; sfree(as); sfree(bs); @@ -239,7 +239,7 @@ int main(int argc, char **argv) printf("%d: fail: %s mod %s gave %s expected %s\n", line, as, bs, cs, ds); - fail = TRUE; + fail = true; sfree(as); sfree(bs); diff --git a/timing.c b/timing.c index 696c1e1d..0aad374a 100644 --- a/timing.c +++ b/timing.c @@ -176,7 +176,7 @@ int run_timers(unsigned long anow, unsigned long *next) first = (struct timer *)index234(timers, 0); if (!first) - return FALSE; /* no timers remaining */ + return false; /* no timers remaining */ if (find234(timer_contexts, first->ctx, NULL) == NULL) { /* @@ -200,7 +200,7 @@ int run_timers(unsigned long anow, unsigned long *next) * future. Return how long it has yet to go. */ *next = first->now; - return TRUE; + return true; } } } diff --git a/unix/gtkapp.c b/unix/gtkapp.c index 2629e684..a9f6b02c 100644 --- a/unix/gtkapp.c +++ b/unix/gtkapp.c @@ -88,7 +88,7 @@ https://wiki.gnome.org/Projects/GTK%2B/OSX/Bundling has some links. char *x_get_default(const char *key) { return NULL; } -const int buildinfo_gtk_relevant = TRUE; +const int buildinfo_gtk_relevant = true; #if !GTK_CHECK_VERSION(3,0,0) /* This front end only works in GTK 3. If that's not what we've got, @@ -275,7 +275,7 @@ void window_setup_error(const char *errmsg) create_message_box(NULL, "Error creating session window", errmsg, string_width("Some sort of fiddly error message that " "might be technical"), - TRUE, &buttons_ok, window_setup_error_callback, NULL); + true, &buttons_ok, window_setup_error_callback, NULL); } static void activate(GApplication *app, @@ -319,7 +319,7 @@ int main(int argc, char **argv) /* Call the function in ux{putty,pterm}.c to do app-type * specific setup */ extern void setup(int); - setup(FALSE); /* FALSE means we are not a one-session process */ + setup(false); /* false means we are not a one-session process */ } if (argc > 1) { diff --git a/unix/gtkask.c b/unix/gtkask.c index 5b45d342..defc98f0 100644 --- a/unix/gtkask.c +++ b/unix/gtkask.c @@ -122,7 +122,7 @@ static gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) } else { #if GTK_CHECK_VERSION(2,0,0) if (gtk_im_context_filter_keypress(ctx->imc, event)) - return TRUE; + return true; #endif if (event->type == GDK_KEY_PRESS) { @@ -158,7 +158,7 @@ static gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) } } } - return TRUE; + return true; } #if GTK_CHECK_VERSION(2,0,0) @@ -177,7 +177,7 @@ static gint configure_area(GtkWidget *widget, GdkEventConfigure *event, ctx->width = event->width; ctx->height = event->height; gtk_widget_queue_draw(widget); - return TRUE; + return true; } #ifdef DRAW_DEFAULT_CAIRO @@ -193,7 +193,7 @@ static void askpass_redraw_gdk(GdkWindow *win, struct drawing_area_ctx *ctx) { GdkGC *gc = gdk_gc_new(win); gdk_gc_set_foreground(gc, &ctx->cols[ctx->state]); - gdk_draw_rectangle(win, gc, TRUE, 0, 0, ctx->width, ctx->height); + gdk_draw_rectangle(win, gc, true, 0, 0, ctx->width, ctx->height); gdk_gc_unref(gc); } #endif @@ -203,7 +203,7 @@ static gint draw_area(GtkWidget *widget, cairo_t *cr, gpointer data) { struct drawing_area_ctx *ctx = (struct drawing_area_ctx *)data; askpass_redraw_cairo(cr, ctx); - return TRUE; + return true; } #else static gint expose_area(GtkWidget *widget, GdkEventExpose *event, @@ -219,7 +219,7 @@ static gint expose_area(GtkWidget *widget, GdkEventExpose *event, askpass_redraw_gdk(gtk_widget_get_window(ctx->area), ctx); #endif - return TRUE; + return true; } #endif @@ -245,7 +245,7 @@ static gboolean try_grab_keyboard(gpointer vctx) ctx->seat = seat; ret = gdk_seat_grab(seat, gdkw, GDK_SEAT_CAPABILITY_KEYBOARD, - TRUE, NULL, NULL, NULL, NULL); + true, NULL, NULL, NULL, NULL); /* * For some reason GDK 3.22 hides the GDK window as a side effect @@ -281,7 +281,7 @@ static gboolean try_grab_keyboard(gpointer vctx) ret = gdk_device_grab(ctx->keyboard, gtk_widget_get_window(ctx->dialog), GDK_OWNERSHIP_NONE, - TRUE, + true, GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK, NULL, GDK_CURRENT_TIME); @@ -290,7 +290,7 @@ static gboolean try_grab_keyboard(gpointer vctx) * It's much simpler in GTK 1 and 2! */ ret = gdk_keyboard_grab(gtk_widget_get_window(ctx->dialog), - FALSE, GDK_CURRENT_TIME); + false, GDK_CURRENT_TIME); #endif if (ret != GDK_GRAB_SUCCESS) goto fail; @@ -323,7 +323,7 @@ static gboolean try_grab_keyboard(gpointer vctx) gtk_widget_queue_draw(ctx->drawingareas[i].area); } - return FALSE; + return false; fail: /* @@ -347,7 +347,7 @@ static gboolean try_grab_keyboard(gpointer vctx) } else { g_timeout_add(1000/8, try_grab_keyboard, ctx); } - return FALSE; + return false; } void realize(GtkWidget *widget, gpointer vctx) @@ -389,12 +389,12 @@ static const char *gtk_askpass_setup(struct askpass_ctx *ctx, ctx->promptlabel = gtk_label_new(prompt_text); align_label_left(GTK_LABEL(ctx->promptlabel)); gtk_widget_show(ctx->promptlabel); - gtk_label_set_line_wrap(GTK_LABEL(ctx->promptlabel), TRUE); + gtk_label_set_line_wrap(GTK_LABEL(ctx->promptlabel), true); #if GTK_CHECK_VERSION(3,0,0) gtk_label_set_width_chars(GTK_LABEL(ctx->promptlabel), 48); #endif our_dialog_add_to_content_area(GTK_WINDOW(ctx->dialog), - ctx->promptlabel, TRUE, TRUE, 0); + ctx->promptlabel, true, true, 0); #if GTK_CHECK_VERSION(2,0,0) ctx->imc = gtk_im_multicontext_new(); #endif @@ -406,7 +406,7 @@ static const char *gtk_askpass_setup(struct askpass_ctx *ctx, ctx->cols[1].red = ctx->cols[1].green = ctx->cols[1].blue = 0; ctx->cols[2].red = ctx->cols[2].green = ctx->cols[2].blue = 0x8000; gdk_colormap_alloc_colors(ctx->colmap, ctx->cols, 2, - FALSE, TRUE, success); + false, true, success); if (!success[0] || !success[1]) return "unable to allocate colours"; } @@ -426,7 +426,7 @@ static const char *gtk_askpass_setup(struct askpass_ctx *ctx, * piece of template text. */ gtk_widget_set_size_request(ctx->drawingareas[i].area, 32, 32); gtk_box_pack_end(action_area, ctx->drawingareas[i].area, - TRUE, TRUE, 5); + true, true, 5); g_signal_connect(G_OBJECT(ctx->drawingareas[i].area), "configure_event", G_CALLBACK(configure_area), @@ -459,10 +459,10 @@ static const char *gtk_askpass_setup(struct askpass_ctx *ctx, * the prompt label at random, and we'll use gtk_grab_add to * ensure key events go to it. */ - gtk_widget_set_sensitive(ctx->dialog, TRUE); + gtk_widget_set_sensitive(ctx->dialog, true); #if GTK_CHECK_VERSION(2,0,0) - gtk_window_set_keep_above(GTK_WINDOW(ctx->dialog), TRUE); + gtk_window_set_keep_above(GTK_WINDOW(ctx->dialog), true); #endif /* @@ -503,14 +503,14 @@ static void gtk_askpass_cleanup(struct askpass_ctx *ctx) static int setup_gtk(const char *display) { - static int gtk_initialised = FALSE; + static int gtk_initialised = false; int argc; char *real_argv[3]; char **argv = real_argv; int ret; if (gtk_initialised) - return TRUE; + return true; argc = 0; argv[argc++] = dupstr("dummy"); @@ -524,7 +524,7 @@ static int setup_gtk(const char *display) return ret; } -const int buildinfo_gtk_relevant = TRUE; +const int buildinfo_gtk_relevant = true; char *gtk_askpass_main(const char *display, const char *wintitle, const char *prompt, int *success) @@ -537,22 +537,22 @@ char *gtk_askpass_main(const char *display, const char *wintitle, /* In case gtk_init hasn't been called yet by the program */ if (!setup_gtk(display)) { - *success = FALSE; + *success = false; return dupstr("unable to initialise GTK"); } if ((err = gtk_askpass_setup(ctx, wintitle, prompt)) != NULL) { - *success = FALSE; + *success = false; return dupprintf("%s", err); } gtk_main(); gtk_askpass_cleanup(ctx); if (ctx->passphrase) { - *success = TRUE; + *success = true; return ctx->passphrase; } else { - *success = FALSE; + *success = false; return ctx->error_message; } } @@ -577,7 +577,7 @@ int main(int argc, char **argv) gtk_init(&argc, &argv); if (argc != 2) { - success = FALSE; + success = false; ret = dupprintf("usage: %s ", argv[0]); } else { srand(time(NULL)); diff --git a/unix/gtkcols.c b/unix/gtkcols.c index 60e39441..fe8005f5 100644 --- a/unix/gtkcols.c +++ b/unix/gtkcols.c @@ -3,6 +3,7 @@ */ #include +#include "defs.h" #include "gtkcompat.h" #include "gtkcols.h" @@ -157,7 +158,7 @@ static void columns_class_init(ColumnsClass *klass) static void columns_init(Columns *cols) { - gtk_widget_set_has_window(GTK_WIDGET(cols), FALSE); + gtk_widget_set_has_window(GTK_WIDGET(cols), false); cols->children = NULL; cols->spacing = 0; @@ -222,7 +223,7 @@ static void columns_map(GtkWidget *widget) g_return_if_fail(IS_COLUMNS(widget)); cols = COLUMNS(widget); - gtk_widget_set_mapped(GTK_WIDGET(cols), TRUE); + gtk_widget_set_mapped(GTK_WIDGET(cols), true); for (children = cols->children; children && (child = children->data); @@ -243,7 +244,7 @@ static void columns_unmap(GtkWidget *widget) g_return_if_fail(IS_COLUMNS(widget)); cols = COLUMNS(widget); - gtk_widget_set_mapped(GTK_WIDGET(cols), FALSE); + gtk_widget_set_mapped(GTK_WIDGET(cols), false); for (children = cols->children; children && (child = children->data); @@ -285,9 +286,9 @@ static gint columns_expose(GtkWidget *widget, GdkEventExpose *event) GList *children; GdkEventExpose child_event; - g_return_val_if_fail(widget != NULL, FALSE); - g_return_val_if_fail(IS_COLUMNS(widget), FALSE); - g_return_val_if_fail(event != NULL, FALSE); + g_return_val_if_fail(widget != NULL, false); + g_return_val_if_fail(IS_COLUMNS(widget), false); + g_return_val_if_fail(event != NULL, false); if (GTK_WIDGET_DRAWABLE(widget)) { cols = COLUMNS(widget); @@ -304,7 +305,7 @@ static gint columns_expose(GtkWidget *widget, GdkEventExpose *event) gtk_widget_event(child->widget, (GdkEvent *)&child_event); } } - return FALSE; + return false; } #endif @@ -438,7 +439,7 @@ void columns_set_cols(Columns *cols, gint ncols, const gint *percentages) childdata->widget = NULL; childdata->ncols = ncols; childdata->percentages = g_new(gint, ncols); - childdata->force_left = FALSE; + childdata->force_left = false; for (i = 0; i < ncols; i++) childdata->percentages[i] = percentages[i]; @@ -459,7 +460,7 @@ void columns_add(Columns *cols, GtkWidget *child, childdata->widget = child; childdata->colstart = colstart; childdata->colspan = colspan; - childdata->force_left = FALSE; + childdata->force_left = false; childdata->same_height_as = NULL; childdata->percentages = NULL; @@ -506,7 +507,7 @@ void columns_force_left_align(Columns *cols, GtkWidget *widget) child = columns_find_child(cols, widget); g_return_if_fail(child != NULL); - child->force_left = TRUE; + child->force_left = true; if (gtk_widget_get_visible(widget)) gtk_widget_queue_resize(GTK_WIDGET(cols)); } @@ -563,14 +564,14 @@ static gint columns_focus(FOCUS_METHOD_SUPERCLASS *super, GtkDirectionType dir) GList *pos; GtkWidget *focuschild; - g_return_val_if_fail(super != NULL, FALSE); - g_return_val_if_fail(IS_COLUMNS(super), FALSE); + g_return_val_if_fail(super != NULL, false); + g_return_val_if_fail(IS_COLUMNS(super), false); cols = COLUMNS(super); if (!gtk_widget_is_drawable(GTK_WIDGET(cols)) || !gtk_widget_is_sensitive(GTK_WIDGET(cols))) - return FALSE; + return false; if (!gtk_widget_get_can_focus(GTK_WIDGET(cols)) && (dir == GTK_DIR_TAB_FORWARD || dir == GTK_DIR_TAB_BACKWARD)) { @@ -593,16 +594,16 @@ static gint columns_focus(FOCUS_METHOD_SUPERCLASS *super, GtkDirectionType dir) GTK_IS_CONTAINER(child) && !gtk_widget_has_focus(child)) { if (CHILD_FOCUS(child, dir)) - return TRUE; + return true; } } } else if (gtk_widget_is_drawable(child)) { if (GTK_IS_CONTAINER(child)) { if (CHILD_FOCUS(child, dir)) - return TRUE; + return true; } else if (gtk_widget_get_can_focus(child)) { gtk_widget_grab_focus(child); - return TRUE; + return true; } } @@ -612,7 +613,7 @@ static gint columns_focus(FOCUS_METHOD_SUPERCLASS *super, GtkDirectionType dir) pos = pos->prev; } - return FALSE; + return false; } else return columns_inherited_focus(super, dir); } @@ -668,7 +669,7 @@ static gint columns_compute_width(Columns *cols, widget_dim_fn_t get_width) printf("label %p '%s' wrap=%s: ", child->widget, gtk_label_get_text(GTK_LABEL(child->widget)), (gtk_label_get_line_wrap(GTK_LABEL(child->widget)) - ? "TRUE" : "FALSE")); + ? "true" : "false")); else printf("widget %p: ", child->widget); { diff --git a/unix/gtkcomm.c b/unix/gtkcomm.c index b29bd7ed..15da36d5 100644 --- a/unix/gtkcomm.c +++ b/unix/gtkcomm.c @@ -88,7 +88,7 @@ gboolean fd_input_func(GIOChannel *source, GIOCondition condition, if (condition & G_IO_OUT) select_result(sourcefd, 2); - return TRUE; + return true; } #else void fd_input_func(gpointer data, gint sourcefd, GdkInputCondition condition) @@ -173,11 +173,11 @@ static gint timer_trigger(gpointer data) } /* - * Returning FALSE means 'don't call this timer again', which + * Returning false means 'don't call this timer again', which * _should_ be redundant given that we removed it above, but just - * in case, return FALSE anyway. + * in case, return false anyway. */ - return FALSE; + return false; } void timer_change_notify(unsigned long next) @@ -215,10 +215,10 @@ static gint idle_toplevel_callback_func(gpointer data) */ if (!toplevel_callback_pending() && idle_fn_scheduled) { g_source_remove(toplevel_callback_idle_id); - idle_fn_scheduled = FALSE; + idle_fn_scheduled = false; } - return TRUE; + return true; } static void notify_toplevel_callback(void *vctx) @@ -226,7 +226,7 @@ static void notify_toplevel_callback(void *vctx) if (!idle_fn_scheduled) { toplevel_callback_idle_id = g_idle_add(idle_toplevel_callback_func, NULL); - idle_fn_scheduled = TRUE; + idle_fn_scheduled = true; } } diff --git a/unix/gtkcompat.h b/unix/gtkcompat.h index fe070720..b34eda10 100644 --- a/unix/gtkcompat.h +++ b/unix/gtkcompat.h @@ -200,7 +200,7 @@ #if GTK_CHECK_VERSION(3,0,0) #define gtk_hseparator_new() gtk_separator_new(GTK_ORIENTATION_HORIZONTAL) /* Fortunately, my hboxes and vboxes never actually set homogeneous to - * TRUE, so I can just wrap these deprecated constructors with a macro + * true, so I can just wrap these deprecated constructors with a macro * without also having to arrange a call to gtk_box_set_homogeneous. */ #define gtk_hbox_new(homogeneous, spacing) \ gtk_box_new(GTK_ORIENTATION_HORIZONTAL, spacing) diff --git a/unix/gtkdlg.c b/unix/gtkdlg.c index 39c91c61..d988f9fb 100644 --- a/unix/gtkdlg.c +++ b/unix/gtkdlg.c @@ -197,7 +197,7 @@ static void dlg_init(struct dlgparam *dp) { dp->byctrl = newtree234(uctrl_cmp_byctrl); dp->bywidget = newtree234(uctrl_cmp_bywidget); - dp->coloursel_result.ok = FALSE; + dp->coloursel_result.ok = false; dp->window = dp->cancelbutton = NULL; #if !GTK_CHECK_VERSION(2,0,0) dp->treeitems = NULL; @@ -265,7 +265,7 @@ void dlg_radiobutton_set(union control *ctrl, dlgparam *dp, int which) struct uctrl *uc = dlg_find_byctrl(dp, ctrl); assert(uc->ctrl->generic.type == CTRL_RADIO); assert(uc->buttons != NULL); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(uc->buttons[which]), TRUE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(uc->buttons[which]), true); } int dlg_radiobutton_get(union control *ctrl, dlgparam *dp) @@ -790,17 +790,17 @@ void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index) items = gtk_container_children(GTK_CONTAINER(uc->list)); nitems = g_list_length(items); if (nitems > 0) { - int modified = FALSE; + int modified = false; g_list_free(items); newtop = uc->adj->lower + (uc->adj->upper - uc->adj->lower) * index / nitems; newbot = uc->adj->lower + (uc->adj->upper - uc->adj->lower) * (index+1) / nitems; if (uc->adj->value > newtop) { - modified = TRUE; + modified = true; uc->adj->value = newtop; } else if (uc->adj->value < newbot - uc->adj->page_size) { - modified = TRUE; + modified = true; uc->adj->value = newbot - uc->adj->page_size; } if (modified) @@ -824,7 +824,7 @@ void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index) path = gtk_tree_path_new_from_indices(index, -1); gtk_tree_selection_select_path(treesel, path); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(uc->treeview), - path, NULL, FALSE, 0.0, 0.0); + path, NULL, false, 0.0, 0.0); gtk_tree_path_free(path); return; } @@ -1063,7 +1063,7 @@ void dlg_error_msg(dlgparam *dp, const char *msg) create_message_box( dp->window, "Error", msg, string_width("Some sort of text about a config-box error message"), - FALSE, &buttons_ok, trivial_post_dialog_fn, NULL); + false, &buttons_ok, trivial_post_dialog_fn, NULL); } /* @@ -1104,7 +1104,7 @@ void dlg_coloursel_start(union control *ctrl, dlgparam *dp, int r, int g, int b) GtkWidget *coloursel = gtk_color_chooser_dialog_new("Select a colour", GTK_WINDOW(dp->window)); - gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(coloursel), FALSE); + gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(coloursel), false); #else GtkWidget *okbutton, *cancelbutton; GtkWidget *coloursel = @@ -1112,12 +1112,12 @@ void dlg_coloursel_start(union control *ctrl, dlgparam *dp, int r, int g, int b) GtkColorSelectionDialog *ccs = GTK_COLOR_SELECTION_DIALOG(coloursel); GtkColorSelection *cs = GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection(ccs)); - gtk_color_selection_set_has_opacity_control(cs, FALSE); + gtk_color_selection_set_has_opacity_control(cs, false); #endif - dp->coloursel_result.ok = FALSE; + dp->coloursel_result.ok = false; - gtk_window_set_modal(GTK_WINDOW(coloursel), TRUE); + gtk_window_set_modal(GTK_WINDOW(coloursel), true); #if GTK_CHECK_VERSION(3,0,0) { @@ -1214,7 +1214,7 @@ static gboolean widget_focus(GtkWidget *widget, GdkEventFocus *event, dp->currfocus = focus; } - return FALSE; + return false; } static void button_clicked(GtkButton *button, gpointer data) @@ -1251,7 +1251,7 @@ static gboolean editbox_key(GtkWidget *widget, GdkEventKey *event, event, &return_val); return return_val; } - return FALSE; + return false; } static void editbox_changed(GtkEditable *ed, gpointer data) @@ -1269,7 +1269,7 @@ static gboolean editbox_lostfocus(GtkWidget *ed, GdkEventFocus *event, struct dlgparam *dp = (struct dlgparam *)data; struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(ed)); uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_REFRESH); - return FALSE; + return false; } #if !GTK_CHECK_VERSION(2,0,0) @@ -1366,22 +1366,22 @@ static gboolean listitem_key(GtkWidget *item, GdkEventKey *event, g_list_free(chead); } - return TRUE; + return true; } - return FALSE; + return false; } static gboolean listitem_single_key(GtkWidget *item, GdkEventKey *event, gpointer data) { - return listitem_key(item, event, data, FALSE); + return listitem_key(item, event, data, false); } static gboolean listitem_multi_key(GtkWidget *item, GdkEventKey *event, gpointer data) { - return listitem_key(item, event, data, TRUE); + return listitem_key(item, event, data, true); } static gboolean listitem_button_press(GtkWidget *item, GdkEventButton *event, @@ -1395,7 +1395,7 @@ static gboolean listitem_button_press(GtkWidget *item, GdkEventButton *event, case GDK_2BUTTON_PRESS: uc->nclicks = 2; break; case GDK_3BUTTON_PRESS: uc->nclicks = 3; break; } - return FALSE; + return false; } static gboolean listitem_button_release(GtkWidget *item, GdkEventButton *event, @@ -1405,9 +1405,9 @@ static gboolean listitem_button_release(GtkWidget *item, GdkEventButton *event, struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(item)); if (uc->nclicks>1) { uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_ACTION); - return TRUE; + return true; } - return FALSE; + return false; } static void list_selchange(GtkList *list, gpointer data) @@ -1497,7 +1497,7 @@ static gboolean draglist_valchange(gpointer data) sfree(ctx); - return FALSE; + return false; } static void listbox_reorder(GtkTreeModel *treemodel, GtkTreePath *path, @@ -1626,9 +1626,9 @@ static void colourchoose_response(GtkDialog *dialog, dp->coloursel_result.r = (int) (255 * rgba.red); dp->coloursel_result.g = (int) (255 * rgba.green); dp->coloursel_result.b = (int) (255 * rgba.blue); - dp->coloursel_result.ok = TRUE; + dp->coloursel_result.ok = true; } else { - dp->coloursel_result.ok = FALSE; + dp->coloursel_result.ok = false; } uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_CALLBACK); @@ -1667,7 +1667,7 @@ static void coloursel_ok(GtkButton *button, gpointer data) dp->coloursel_result.b = (int) (255 * cvals[2]); } #endif - dp->coloursel_result.ok = TRUE; + dp->coloursel_result.ok = true; uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_CALLBACK); } @@ -1676,7 +1676,7 @@ static void coloursel_cancel(GtkButton *button, gpointer data) struct dlgparam *dp = (struct dlgparam *)data; gpointer coloursel = g_object_get_data(G_OBJECT(button), "user-data"); struct uctrl *uc = g_object_get_data(G_OBJECT(coloursel), "user-data"); - dp->coloursel_result.ok = FALSE; + dp->coloursel_result.ok = false; uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_CALLBACK); } @@ -1697,7 +1697,7 @@ static void filefont_clicked(GtkButton *button, gpointer data) STANDARD_CANCEL_LABEL, GTK_RESPONSE_CANCEL, STANDARD_OPEN_LABEL, GTK_RESPONSE_ACCEPT, (const gchar *)NULL); - gtk_window_set_modal(GTK_WINDOW(filechoose), TRUE); + gtk_window_set_modal(GTK_WINDOW(filechoose), true); g_object_set_data(G_OBJECT(filechoose), "user-data", (gpointer)uc); g_signal_connect(G_OBJECT(filechoose), "response", G_CALLBACK(filechoose_response), (gpointer)dp); @@ -1705,7 +1705,7 @@ static void filefont_clicked(GtkButton *button, gpointer data) #else GtkWidget *filesel = gtk_file_selection_new(uc->ctrl->fileselect.title); - gtk_window_set_modal(GTK_WINDOW(filesel), TRUE); + gtk_window_set_modal(GTK_WINDOW(filesel), true); g_object_set_data (G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "user-data", (gpointer)filesel); @@ -1735,7 +1735,7 @@ static void filefont_clicked(GtkButton *button, gpointer data) gchar *spacings[] = { "c", "m", NULL }; GtkWidget *fontsel = gtk_font_selection_dialog_new("Select a font"); - gtk_window_set_modal(GTK_WINDOW(fontsel), TRUE); + gtk_window_set_modal(GTK_WINDOW(fontsel), true); gtk_font_selection_dialog_set_filter (GTK_FONT_SELECTION_DIALOG(fontsel), GTK_FONT_FILTER_BASE, GTK_FONT_ALL, @@ -1792,7 +1792,7 @@ static void filefont_clicked(GtkButton *button, gpointer data) unifontsel *fontsel = unifontsel_new("Select a font"); - gtk_window_set_modal(fontsel->window, TRUE); + gtk_window_set_modal(fontsel->window, true); unifontsel_set_name(fontsel, fontname); g_object_set_data(G_OBJECT(fontsel->ok_button), @@ -1877,7 +1877,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs, for (i = 0; i < s->ncontrols; i++) { union control *ctrl = s->ctrls[i]; struct uctrl *uc; - int left = FALSE; + int left = false; GtkWidget *w = NULL; switch (ctrl->generic.type) { @@ -1919,7 +1919,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs, case CTRL_BUTTON: w = gtk_button_new_with_label(ctrl->generic.label); if (win) { - gtk_widget_set_can_default(w, TRUE); + gtk_widget_set_can_default(w, true); if (ctrl->button.isdefault) gtk_window_set_default(win, w); if (ctrl->button.iscancel) @@ -1940,7 +1940,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs, G_CALLBACK(widget_focus), dp); shortcut_add(scs, gtk_bin_get_child(GTK_BIN(w)), ctrl->checkbox.shortcut, SHORTCUT_UCTRL, uc); - left = TRUE; + left = true; break; case CTRL_RADIO: /* @@ -2011,7 +2011,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs, * GTK 1 combo box. */ w = gtk_combo_new(); - gtk_combo_set_value_in_list(GTK_COMBO(w), FALSE, TRUE); + gtk_combo_set_value_in_list(GTK_COMBO(w), false, true); uc->entry = GTK_COMBO(w)->entry; uc->list = GTK_COMBO(w)->list; signalobject = uc->entry; @@ -2033,7 +2033,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs, } else { w = gtk_entry_new(); if (ctrl->editbox.password) - gtk_entry_set_visibility(GTK_ENTRY(w), FALSE); + gtk_entry_set_visibility(GTK_ENTRY(w), false); uc->entry = w; signalobject = w; } @@ -2226,7 +2226,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs, * column to look at in the list model). */ cr = gtk_cell_renderer_text_new(); - gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(w), cr, TRUE); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(w), cr, true); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(w), cr, "text", 1, NULL); @@ -2337,7 +2337,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs, (GTK_TREE_MODEL(uc->listmodel)); g_object_set_data(G_OBJECT(uc->listmodel), "user-data", (gpointer)w); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), FALSE); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false); sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(w)); gtk_tree_selection_set_mode (sel, ctrl->listbox.multisel ? GTK_SELECTION_MULTIPLE : @@ -2351,7 +2351,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs, G_CALLBACK(listbox_selchange), dp); if (ctrl->listbox.draglist) { - gtk_tree_view_set_reorderable(GTK_TREE_VIEW(w), TRUE); + gtk_tree_view_set_reorderable(GTK_TREE_VIEW(w), true); g_signal_connect(G_OBJECT(uc->listmodel), "row-inserted", G_CALLBACK(listbox_reorder), dp); } @@ -2375,7 +2375,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs, if (!ctrl->listbox.hscroll) { g_object_set(G_OBJECT(cellrend), "ellipsize", PANGO_ELLIPSIZE_END, - "ellipsize-set", TRUE, + "ellipsize-set", true, (const char *)NULL); } column = gtk_tree_view_column_new_with_attributes @@ -2482,7 +2482,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs, uc->text = w = gtk_label_new(uc->ctrl->generic.label); #endif align_label_left(GTK_LABEL(w)); - gtk_label_set_line_wrap(GTK_LABEL(w), TRUE); + gtk_label_set_line_wrap(GTK_LABEL(w), true); break; } @@ -2570,10 +2570,10 @@ static int tree_grab_focus(struct dlgparam *dp) } if (f >= 0) - return FALSE; + return false; else { gtk_widget_grab_focus(dp->currtreeitem); - return TRUE; + return true; } } @@ -2584,7 +2584,7 @@ gint tree_focus(GtkContainer *container, GtkDirectionType direction, g_signal_stop_emission_by_name(G_OBJECT(container), "focus"); /* - * If there's a focused treeitem, we return FALSE to cause the + * If there's a focused treeitem, we return false to cause the * focus to move on to some totally other control. If not, we * focus the selected one. */ @@ -2598,7 +2598,7 @@ int win_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data) if (event->keyval == GDK_KEY_Escape && dp->cancelbutton) { g_signal_emit_by_name(G_OBJECT(dp->cancelbutton), "clicked"); - return TRUE; + return true; } if ((event->state & GDK_MOD1_MASK) && @@ -2713,7 +2713,7 @@ int win_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data) } } - return FALSE; + return false; } #if !GTK_CHECK_VERSION(2,0,0) @@ -2742,10 +2742,10 @@ int tree_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data) */ { GtkWidget *w = dp->treeitems[i]; - int vis = TRUE; + int vis = true; while (w && (GTK_IS_TREE_ITEM(w) || GTK_IS_TREE(w))) { if (!GTK_WIDGET_VISIBLE(w)) { - vis = FALSE; + vis = false; break; } w = w->parent; @@ -2762,7 +2762,7 @@ int tree_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data) g_signal_emit_by_name(G_OBJECT(dp->treeitems[j]), "toggle"); gtk_widget_grab_focus(dp->treeitems[j]); } - return TRUE; + return true; } /* @@ -2772,15 +2772,15 @@ int tree_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data) if (event->keyval == GDK_Left || event->keyval == GDK_KP_Left) { g_signal_stop_emission_by_name(G_OBJECT(widget), "key_press_event"); gtk_tree_item_collapse(GTK_TREE_ITEM(widget)); - return TRUE; + return true; } if (event->keyval == GDK_Right || event->keyval == GDK_KP_Right) { g_signal_stop_emission_by_name(G_OBJECT(widget), "key_press_event"); gtk_tree_item_expand(GTK_TREE_ITEM(widget)); - return TRUE; + return true; } - return FALSE; + return false; } #endif @@ -2935,15 +2935,15 @@ GtkWidget *create_config_box(const char *title, Conf *conf, gtk_setup_config_box(dp->ctrlbox, midsession, window); gtk_window_set_title(GTK_WINDOW(window), title); - hbox = gtk_hbox_new(FALSE, 4); - our_dialog_add_to_content_area(GTK_WINDOW(window), hbox, TRUE, TRUE, 0); + hbox = gtk_hbox_new(false, 4); + our_dialog_add_to_content_area(GTK_WINDOW(window), hbox, true, true, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox), 10); gtk_widget_show(hbox); - vbox = gtk_vbox_new(FALSE, 4); - gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); + vbox = gtk_vbox_new(false, 4); + gtk_box_pack_start(GTK_BOX(hbox), vbox, false, false, 0); gtk_widget_show(vbox); cols = columns_new(4); - gtk_box_pack_start(GTK_BOX(vbox), cols, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), cols, false, false, 0); gtk_widget_show(cols); label = gtk_label_new("Category:"); columns_add(COLUMNS(cols), label, 0, 1); @@ -2954,7 +2954,7 @@ GtkWidget *create_config_box(const char *title, Conf *conf, treestore = gtk_tree_store_new (TREESTORE_NUM, G_TYPE_STRING, G_TYPE_INT); tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(treestore)); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), false); treerenderer = gtk_cell_renderer_text_new(); treecolumn = gtk_tree_view_column_new_with_attributes ("Label", treerenderer, "text", 0, NULL); @@ -2972,11 +2972,11 @@ GtkWidget *create_config_box(const char *title, Conf *conf, G_CALLBACK(widget_focus), dp); shortcut_add(&scs, label, 'g', SHORTCUT_TREE, tree); gtk_widget_show(treescroll); - gtk_box_pack_start(GTK_BOX(vbox), treescroll, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), treescroll, true, true, 0); panels = gtk_notebook_new(); - gtk_notebook_set_show_tabs(GTK_NOTEBOOK(panels), FALSE); - gtk_notebook_set_show_border(GTK_NOTEBOOK(panels), FALSE); - gtk_box_pack_start(GTK_BOX(hbox), panels, TRUE, TRUE, 0); + gtk_notebook_set_show_tabs(GTK_NOTEBOOK(panels), false); + gtk_notebook_set_show_border(GTK_NOTEBOOK(panels), false); + gtk_box_pack_start(GTK_BOX(hbox), panels, true, true, 0); gtk_widget_show(panels); panelvbox = NULL; @@ -3023,7 +3023,7 @@ GtkWidget *create_config_box(const char *title, Conf *conf, first = (panelvbox == NULL); - panelvbox = gtk_vbox_new(FALSE, 4); + panelvbox = gtk_vbox_new(false, 4); gtk_widget_show(panelvbox); gtk_notebook_append_page(GTK_NOTEBOOK(panels), panelvbox, NULL); @@ -3076,7 +3076,7 @@ GtkWidget *create_config_box(const char *title, Conf *conf, */ gtk_tree_view_expand_row(GTK_TREE_VIEW(tree), selparams[nselparams].treepath, - FALSE); + false); } else { selparams[nselparams].treepath = NULL; } @@ -3117,7 +3117,7 @@ GtkWidget *create_config_box(const char *title, Conf *conf, } w = layout_ctrls(dp, &selparams[nselparams-1].shortcuts, s, NULL); - gtk_box_pack_start(GTK_BOX(panelvbox), w, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(panelvbox), w, false, false, 0); gtk_widget_show(w); } } @@ -3330,7 +3330,7 @@ GtkWidget *create_message_box( I(button->value)); c->generic.column = index++; if (button->type > 0) - c->button.isdefault = TRUE; + c->button.isdefault = true; /* We always arrange that _some_ button is labelled as * 'iscancel', so that pressing Escape will always cause @@ -3342,7 +3342,7 @@ GtkWidget *create_message_box( * that really is just showing a _message_ and not even asking * a question) then that will be picked. */ if (button->type == min_type) - c->button.iscancel = TRUE; + c->button.iscancel = true; } s1 = ctrl_getset(dp->ctrlbox, "x", "", ""); @@ -3356,7 +3356,7 @@ GtkWidget *create_message_box( w1 = layout_ctrls(dp, &scs, s1, GTK_WINDOW(window)); gtk_container_set_border_width(GTK_CONTAINER(w1), 10); gtk_widget_set_size_request(w1, minwid+20, -1); - our_dialog_add_to_content_area(GTK_WINDOW(window), w1, TRUE, TRUE, 0); + our_dialog_add_to_content_area(GTK_WINDOW(window), w1, true, true, 0); gtk_widget_show(w1); dp->shortcuts = &scs; @@ -3367,7 +3367,7 @@ GtkWidget *create_message_box( if (selectable) { #if GTK_CHECK_VERSION(2,0,0) struct uctrl *uc = dlg_find_byctrl(dp, textctrl); - gtk_label_set_selectable(GTK_LABEL(uc->text), TRUE); + gtk_label_set_selectable(GTK_LABEL(uc->text), true); /* * GTK selectable labels have a habit of selecting their @@ -3523,7 +3523,7 @@ int gtk_seat_verify_ssh_host_key( mainwin = GTK_WIDGET(gtk_seat_get_window(seat)); msgbox = create_message_box( - mainwin, "PuTTY Security Alert", text, string_width(fingerprint), TRUE, + mainwin, "PuTTY Security Alert", text, string_width(fingerprint), true, &buttons_hostkey, verify_ssh_host_key_result_callback, result_ctx); register_dialog(seat, DIALOG_SLOT_NETWORK_PROMPT, msgbox); @@ -3584,7 +3584,7 @@ int gtk_seat_confirm_weak_crypto_primitive( msgbox = create_message_box( mainwin, "PuTTY Security Alert", text, string_width("Reasonably long line of text as a width template"), - FALSE, &buttons_yn, simple_prompt_result_callback, result_ctx); + false, &buttons_yn, simple_prompt_result_callback, result_ctx); register_dialog(seat, result_ctx->dialog_slot, msgbox); sfree(text); @@ -3621,7 +3621,7 @@ int gtk_seat_confirm_weak_cached_hostkey( mainwin, "PuTTY Security Alert", text, string_width("is ecdsa-nistp521, which is below the configured" " warning threshold."), - FALSE, &buttons_yn, simple_prompt_result_callback, result_ctx); + false, &buttons_yn, simple_prompt_result_callback, result_ctx); register_dialog(seat, result_ctx->dialog_slot, msgbox); sfree(text); @@ -3642,7 +3642,7 @@ void nonfatal_message_box(void *window, const char *msg) create_message_box( window, title, msg, string_width("REASONABLY LONG LINE OF TEXT FOR BASIC SANITY"), - FALSE, &buttons_ok, trivial_post_dialog_fn, NULL); + false, &buttons_ok, trivial_post_dialog_fn, NULL); sfree(title); } @@ -3683,7 +3683,7 @@ static void licence_clicked(GtkButton *button, gpointer data) create_message_box(aboutbox, title, LICENCE_TEXT("\n\n"), string_width("LONGISH LINE OF TEXT SO THE LICENCE" " BOX ISN'T EXCESSIVELY TALL AND THIN"), - TRUE, &buttons_ok, trivial_post_dialog_fn, NULL); + true, &buttons_ok, trivial_post_dialog_fn, NULL); sfree(title); } @@ -3705,17 +3705,17 @@ void about_box(void *window) sfree(title); w = gtk_button_new_with_label("Close"); - gtk_widget_set_can_default(w, TRUE); + gtk_widget_set_can_default(w, true); gtk_window_set_default(GTK_WINDOW(aboutbox), w); action_area = our_dialog_make_action_hbox(GTK_WINDOW(aboutbox)); - gtk_box_pack_end(action_area, w, FALSE, FALSE, 0); + gtk_box_pack_end(action_area, w, false, false, 0); g_signal_connect(G_OBJECT(w), "clicked", G_CALLBACK(about_close_clicked), NULL); gtk_widget_show(w); w = gtk_button_new_with_label("View Licence"); - gtk_widget_set_can_default(w, TRUE); - gtk_box_pack_end(action_area, w, FALSE, FALSE, 0); + gtk_widget_set_can_default(w, true); + gtk_box_pack_end(action_area, w, false, false, 0); g_signal_connect(G_OBJECT(w), "clicked", G_CALLBACK(licence_clicked), NULL); gtk_widget_show(w); @@ -3729,11 +3729,11 @@ void about_box(void *window) w = gtk_label_new(label_text); gtk_label_set_justify(GTK_LABEL(w), GTK_JUSTIFY_CENTER); #if GTK_CHECK_VERSION(2,0,0) - gtk_label_set_selectable(GTK_LABEL(w), TRUE); + gtk_label_set_selectable(GTK_LABEL(w), true); #endif sfree(label_text); } - our_dialog_add_to_content_area(GTK_WINDOW(aboutbox), w, FALSE, FALSE, 0); + our_dialog_add_to_content_area(GTK_WINDOW(aboutbox), w, false, false, 0); #if GTK_CHECK_VERSION(2,0,0) /* * Same precautions against initial select-all as in @@ -3901,7 +3901,7 @@ gint eventlog_selection_clear(GtkWidget *widget, GdkEventSelection *seldata, sfree(es->seldata); es->sellen = 0; es->seldata = NULL; - return TRUE; + return true; } void showeventlog(eventlog_stuff *es, void *parentwin) @@ -3931,7 +3931,7 @@ void showeventlog(eventlog_stuff *es, void *parentwin) c = ctrl_pushbutton(s0, "Close", 'c', HELPCTX(no_help), eventlog_ok_handler, P(NULL)); c->button.column = 1; - c->button.isdefault = TRUE; + c->button.isdefault = true; s1 = ctrl_getset(es->eventbox, "x", "", ""); es->listctrl = c = ctrl_listbox(s1, NULL, NO_SHORTCUT, HELPCTX(no_help), @@ -3957,7 +3957,7 @@ void showeventlog(eventlog_stuff *es, void *parentwin) ("LINE OF TEXT GIVING WIDTH OF EVENT LOG IS " "QUITE LONG 'COS SSH LOG ENTRIES ARE WIDE"), -1); - our_dialog_add_to_content_area(GTK_WINDOW(window), w1, TRUE, TRUE, 0); + our_dialog_add_to_content_area(GTK_WINDOW(window), w1, true, true, 0); gtk_widget_show(w1); es->dp.data = es; @@ -4086,7 +4086,7 @@ int gtkdlg_askappend(Seat *seat, Filename *filename, msgbox = create_message_box( mainwin, mbtitle, message, string_width("LINE OF TEXT SUITABLE FOR THE ASKAPPEND WIDTH"), - FALSE, &buttons_append, simple_prompt_result_callback, result_ctx); + false, &buttons_append, simple_prompt_result_callback, result_ctx); register_dialog(seat, result_ctx->dialog_slot, msgbox); sfree(message); diff --git a/unix/gtkfont.c b/unix/gtkfont.c index 3dbf16f0..074b61f9 100644 --- a/unix/gtkfont.c +++ b/unix/gtkfont.c @@ -448,8 +448,8 @@ static unifont *x11font_create(GtkWidget *widget, const char *name, charset_encoding = XInternAtom(disp, "CHARSET_ENCODING", False); pubcs = realcs = CS_NONE; - sixteen_bit = FALSE; - variable = TRUE; + sixteen_bit = false; + variable = true; if (XGetFontProperty(xfs, charset_registry, ®istry_ret) && XGetFontProperty(xfs, charset_encoding, &encoding_ret)) { @@ -467,7 +467,7 @@ static unifont *x11font_create(GtkWidget *widget, const char *name, * into 16-bit Unicode. */ if (!strcasecmp(encoding, "iso10646-1")) { - sixteen_bit = TRUE; + sixteen_bit = true; pubcs = realcs = CS_UTF8; } @@ -496,7 +496,7 @@ static unifont *x11font_create(GtkWidget *widget, const char *name, spc = XGetAtomName(disp, (Atom)spacing_ret); if (spc && strchr("CcMm", spc[0])) - variable = FALSE; + variable = false; } xfont = snew(struct x11font); @@ -506,7 +506,7 @@ static unifont *x11font_create(GtkWidget *widget, const char *name, xfont->u.descent = xfs->descent; xfont->u.height = xfont->u.ascent + xfont->u.descent; xfont->u.public_charset = pubcs; - xfont->u.want_fallback = TRUE; + xfont->u.want_fallback = true; #ifdef DRAW_TEXT_GDK xfont->u.preferred_drawtype = DRAWTYPE_GDK; #elif defined DRAW_TEXT_CAIRO @@ -525,7 +525,7 @@ static unifont *x11font_create(GtkWidget *widget, const char *name, for (i = 0; i < lenof(xfont->fonts); i++) { xfont->fonts[i].xfs = NULL; - xfont->fonts[i].allocated = FALSE; + xfont->fonts[i].allocated = false; #ifdef DRAW_TEXT_CAIRO xfont->fonts[i].glyphcache = NULL; xfont->fonts[i].nglyphs = 0; @@ -534,7 +534,7 @@ static unifont *x11font_create(GtkWidget *widget, const char *name, #endif } xfont->fonts[0].xfs = xfs; - xfont->fonts[0].allocated = TRUE; + xfont->fonts[0].allocated = true; return &xfont->u; } @@ -572,7 +572,7 @@ static void x11_alloc_subfont(struct x11font *xfont, int sfid) char *derived_name = x11_guess_derived_font_name (disp, xfont->fonts[0].xfs, sfid & 1, !!(sfid & 2)); xfont->fonts[sfid].xfs = XLoadQueryFont(disp, derived_name); - xfont->fonts[sfid].allocated = TRUE; + xfont->fonts[sfid].allocated = true; sfree(derived_name); /* Note that xfont->fonts[sfid].xfs may still be NULL, if XLQF failed. */ } @@ -597,7 +597,7 @@ static int x11font_has_glyph(unifont *font, wchar_t glyph) int sblen = wc_to_mb(xfont->real_charset, 0, &glyph, 1, sbstring, 2, "", NULL); if (sblen == 0 || !sbstring[0]) - return FALSE; /* not even in the charset */ + return false; /* not even in the charset */ return x11_font_has_glyph(xfont->fonts[0].xfs, 0, (unsigned char)sbstring[0]); @@ -862,14 +862,14 @@ static void x11font_really_draw_text( */ step = 1; nsteps = nchars; - centre = TRUE; + centre = true; } else { /* * In a fixed-pitch font, we can draw the whole lot in one go. */ step = nchars; nsteps = 1; - centre = FALSE; + centre = false; } dfns->setup(ctx, xfi, disp); @@ -1391,17 +1391,17 @@ static int pangofont_check_desc_makes_sense(PangoContext *ctx, #ifndef PANGO_PRE_1POINT6 map = pango_context_get_font_map(ctx); if (!map) - return FALSE; + return false; pango_font_map_list_families(map, &families, &nfamilies); #else pango_context_list_families(ctx, &families, &nfamilies); #endif - matched = FALSE; + matched = false; for (i = 0; i < nfamilies; i++) { if (!g_ascii_strcasecmp(pango_font_family_get_name(families[i]), pango_font_description_get_family(desc))) { - matched = TRUE; + matched = true; break; } } @@ -1454,7 +1454,7 @@ static unifont *pangofont_create_internal(GtkWidget *widget, pfont->u.ascent = PANGO_PIXELS(pango_font_metrics_get_ascent(metrics)); pfont->u.descent = PANGO_PIXELS(pango_font_metrics_get_descent(metrics)); pfont->u.height = pfont->u.ascent + pfont->u.descent; - pfont->u.want_fallback = FALSE; + pfont->u.want_fallback = false; #ifdef DRAW_TEXT_CAIRO pfont->u.preferred_drawtype = DRAWTYPE_CAIRO; #elif defined DRAW_TEXT_GDK @@ -1562,7 +1562,7 @@ static int pangofont_char_width(PangoLayout *layout, struct pangofont *pfont, static int pangofont_has_glyph(unifont *font, wchar_t glyph) { /* Pango implements font fallback, so assume it has everything */ - return TRUE; + return true; } #ifdef DRAW_TEXT_GDK @@ -1592,7 +1592,7 @@ static void pangofont_draw_internal(unifont_drawctx *ctx, unifont *font, PangoRectangle rect; char *utfstring, *utfptr; int utflen; - int shadowbold = FALSE; + int shadowbold = false; void (*draw_layout)(unifont_drawctx *ctx, gint x, gint y, PangoLayout *layout) = NULL; @@ -1616,7 +1616,7 @@ static void pangofont_draw_internal(unifont_drawctx *ctx, unifont *font, pango_layout_set_font_description(layout, pfont->desc); if (bold > pfont->bold) { if (pfont->shadowalways) - shadowbold = TRUE; + shadowbold = true; else { PangoFontDescription *desc2 = pango_font_description_copy_static(pfont->desc); @@ -1743,7 +1743,7 @@ static void pangofont_draw_text(unifont_drawctx *ctx, unifont *font, int wide, int bold, int cellwidth) { pangofont_draw_internal(ctx, font, x, y, string, len, wide, bold, - cellwidth, FALSE); + cellwidth, false); } static void pangofont_draw_combining(unifont_drawctx *ctx, unifont *font, @@ -1765,7 +1765,7 @@ static void pangofont_draw_combining(unifont_drawctx *ctx, unifont *font, len++; } pangofont_draw_internal(ctx, font, x, y, string, len, wide, bold, - cellwidth, TRUE); + cellwidth, true); sfree(tmpstring); } @@ -2234,7 +2234,7 @@ unifont *multifont_create(GtkWidget *widget, const char *name, mfont->u.descent = font->descent; mfont->u.height = font->height; mfont->u.public_charset = font->public_charset; - mfont->u.want_fallback = FALSE; /* shouldn't be needed, but just in case */ + mfont->u.want_fallback = false; /* shouldn't be needed, but just in case */ mfont->u.preferred_drawtype = font->preferred_drawtype; mfont->main = font; mfont->fallback = fallback; @@ -2456,8 +2456,8 @@ static void unifontsel_deselect(unifontsel_internal *fs) fs->selected = NULL; gtk_list_store_clear(fs->style_model); gtk_list_store_clear(fs->size_model); - gtk_widget_set_sensitive(fs->u.ok_button, FALSE); - gtk_widget_set_sensitive(fs->size_entry, FALSE); + gtk_widget_set_sensitive(fs->u.ok_button, false); + gtk_widget_set_sensitive(fs->size_entry, false); unifontsel_draw_preview_text(fs); } @@ -2469,7 +2469,7 @@ static void unifontsel_setup_familylist(unifontsel_internal *fs) int currflags = -1; fontinfo *info; - fs->inhibit_response = TRUE; + fs->inhibit_response = true; gtk_list_store_clear(fs->family_model); listindex = 0; @@ -2522,20 +2522,20 @@ static void unifontsel_setup_familylist(unifontsel_internal *fs) if (fs->selected && fs->selected->familyindex < 0) unifontsel_deselect(fs); - fs->inhibit_response = FALSE; + fs->inhibit_response = false; } static void unifontsel_setup_stylelist(unifontsel_internal *fs, int start, int end) { GtkTreeIter iter; - int i, listindex, minpos = -1, maxpos = -1, started = FALSE; + int i, listindex, minpos = -1, maxpos = -1, started = false; char *currcs = NULL, *currstyle = NULL; fontinfo *info; gtk_list_store_clear(fs->style_model); listindex = 0; - started = FALSE; + started = false; /* * Search through the font tree for anything matching our @@ -2563,12 +2563,12 @@ static void unifontsel_setup_stylelist(unifontsel_internal *fs, * We've either finished a style/charset, or started a * new one, or both. */ - started = TRUE; + started = true; if (currstyle) { gtk_list_store_append(fs->style_model, &iter); gtk_list_store_set(fs->style_model, &iter, 0, currstyle, 1, minpos, 2, maxpos+1, - 3, TRUE, 4, PANGO_WEIGHT_NORMAL, -1); + 3, true, 4, PANGO_WEIGHT_NORMAL, -1); listindex++; } if (info) { @@ -2577,7 +2577,7 @@ static void unifontsel_setup_stylelist(unifontsel_internal *fs, gtk_list_store_append(fs->style_model, &iter); gtk_list_store_set(fs->style_model, &iter, 0, info->charset, 1, -1, 2, -1, - 3, FALSE, 4, PANGO_WEIGHT_BOLD, -1); + 3, false, 4, PANGO_WEIGHT_BOLD, -1); listindex++; } currcs = info->charset; @@ -2664,7 +2664,7 @@ static void unifontsel_draw_preview_text_inner(unifont_drawctx *dctx, (GTK_WIDGET(fs->u.window), info->realname, fs->selsize); font = info->fontclass->create(GTK_WIDGET(fs->u.window), sizename ? sizename : info->realname, - FALSE, FALSE, 0, 0); + false, false, 0, 0); } else font = NULL; @@ -2715,11 +2715,11 @@ static void unifontsel_draw_preview_text_inner(unifont_drawctx *dctx, info->fontclass->draw_text(dctx, font, 0, font->ascent, L"bankrupt jilted showmen quiz convex fogey", - 41, FALSE, FALSE, font->width); + 41, false, false, font->width); info->fontclass->draw_text(dctx, font, 0, font->ascent + font->height, L"BANKRUPT JILTED SHOWMEN QUIZ CONVEX FOGEY", - 41, FALSE, FALSE, font->width); + 41, false, false, font->width); /* * The ordering of punctuation here is also selected * with some specific aims in mind. I put ` and ' @@ -2735,7 +2735,7 @@ static void unifontsel_draw_preview_text_inner(unifont_drawctx *dctx, info->fontclass->draw_text(dctx, font, 0, font->ascent + font->height * 2, L"0123456789!?,.:;<>()[]{}\\/`'\"+*-=~#_@|%&^$", - 42, FALSE, FALSE, font->width); + 42, false, false, font->width); info->fontclass->destroy(font); } @@ -2803,7 +2803,7 @@ static void unifontsel_draw_preview_text(unifontsel_internal *fs) #endif gdk_window_invalidate_rect(gtk_widget_get_window(fs->preview_area), - NULL, FALSE); + NULL, false); } static void unifontsel_select_font(unifontsel_internal *fs, @@ -2816,14 +2816,14 @@ static void unifontsel_select_font(unifontsel_internal *fs, GtkTreePath *treepath; GtkTreeIter iter; - fs->inhibit_response = TRUE; + fs->inhibit_response = true; fs->selected = info; fs->selsize = size; if (size_is_explicit) fs->intendedsize = size; - gtk_widget_set_sensitive(fs->u.ok_button, TRUE); + gtk_widget_set_sensitive(fs->u.ok_button, true); /* * Find the index of this fontinfo in the selorder list. @@ -2852,7 +2852,7 @@ static void unifontsel_select_font(unifontsel_internal *fs, (gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->family_list)), treepath); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->family_list), - treepath, NULL, FALSE, 0.0, 0.0); + treepath, NULL, false, 0.0, 0.0); success = gtk_tree_model_get_iter(GTK_TREE_MODEL(fs->family_model), &iter, treepath); assert(success); @@ -2876,7 +2876,7 @@ static void unifontsel_select_font(unifontsel_internal *fs, (gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->style_list)), treepath); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->style_list), - treepath, NULL, FALSE, 0.0, 0.0); + treepath, NULL, false, 0.0, 0.0); gtk_tree_model_get_iter(GTK_TREE_MODEL(fs->style_model), &iter, treepath); gtk_tree_path_free(treepath); @@ -2899,7 +2899,7 @@ static void unifontsel_select_font(unifontsel_internal *fs, (gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->size_list)), treepath); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->size_list), - treepath, NULL, FALSE, 0.0, 0.0); + treepath, NULL, false, 0.0, 0.0); gtk_tree_path_free(treepath); size = info->size; } else { @@ -2908,9 +2908,9 @@ static void unifontsel_select_font(unifontsel_internal *fs, if (unifontsel_default_sizes[j] == size) { treepath = gtk_tree_path_new_from_indices(j, -1); gtk_tree_view_set_cursor(GTK_TREE_VIEW(fs->size_list), - treepath, NULL, FALSE); + treepath, NULL, false); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->size_list), - treepath, NULL, FALSE, 0.0, + treepath, NULL, false, 0.0, 0.0); gtk_tree_path_free(treepath); } @@ -2940,7 +2940,7 @@ static void unifontsel_select_font(unifontsel_internal *fs, unifontsel_draw_preview_text(fs); - fs->inhibit_response = FALSE; + fs->inhibit_response = false; } static void unifontsel_button_toggled(GtkToggleButton *tb, gpointer data) @@ -3125,7 +3125,7 @@ static void family_changed(GtkTreeSelection *treeselection, gpointer data) if (!info->size) fs->selsize = fs->intendedsize; /* font is scalable */ unifontsel_select_font(fs, info, info->size ? info->size : fs->selsize, - 1, FALSE); + 1, false); } static void style_changed(GtkTreeSelection *treeselection, gpointer data) @@ -3152,7 +3152,7 @@ static void style_changed(GtkTreeSelection *treeselection, gpointer data) if (!info->size) fs->selsize = fs->intendedsize; /* font is scalable */ unifontsel_select_font(fs, info, info->size ? info->size : fs->selsize, - 2, FALSE); + 2, false); } static void size_changed(GtkTreeSelection *treeselection, gpointer data) @@ -3171,7 +3171,7 @@ static void size_changed(GtkTreeSelection *treeselection, gpointer data) gtk_tree_model_get(treemodel, &treeiter, 1, &minval, 2, &size, -1); info = (fontinfo *)index234(fs->fonts_by_selorder, minval); - unifontsel_select_font(fs, info, info->size ? info->size : size, 3, TRUE); + unifontsel_select_font(fs, info, info->size ? info->size : size, 3, true); } static void size_entry_changed(GtkEditable *ed, gpointer data) @@ -3188,7 +3188,7 @@ static void size_entry_changed(GtkEditable *ed, gpointer data) if (size > 0) { assert(fs->selected->size == 0); - unifontsel_select_font(fs, fs->selected, size, 3, TRUE); + unifontsel_select_font(fs, fs->selected, size, 3, true); } } @@ -3212,7 +3212,7 @@ static void alias_resolve(GtkTreeView *treeview, GtkTreePath *path, struct fontinfo_realname_find f; newname = info->fontclass->canonify_fontname - (GTK_WIDGET(fs->u.window), info->realname, &newsize, &flags, TRUE); + (GTK_WIDGET(fs->u.window), info->realname, &newsize, &flags, true); f.realname = newname; f.flags = flags; @@ -3225,7 +3225,7 @@ static void alias_resolve(GtkTreeView *treeview, GtkTreePath *path, return; /* didn't change under canonification => not an alias */ unifontsel_select_font(fs, newinfo, newinfo->size ? newinfo->size : newsize, - 1, TRUE); + 1, true); } } @@ -3240,7 +3240,7 @@ static gint unifontsel_draw_area(GtkWidget *widget, cairo_t *cr, gpointer data) dctx.u.cairo.cr = cr; unifontsel_draw_preview_text_inner(&dctx, fs); - return TRUE; + return true; } #else static gint unifontsel_expose_area(GtkWidget *widget, GdkEventExpose *event, @@ -3262,7 +3262,7 @@ static gint unifontsel_expose_area(GtkWidget *widget, GdkEventExpose *event, unifontsel_draw_preview_text(fs); #endif - return TRUE; + return true; } #endif @@ -3295,9 +3295,9 @@ static gint unifontsel_configure_area(GtkWidget *widget, } #endif - gdk_window_invalidate_rect(gtk_widget_get_window(widget), NULL, FALSE); + gdk_window_invalidate_rect(gtk_widget_get_window(widget), NULL, false); - return TRUE; + return true; } unifontsel *unifontsel_new(const char *wintitle) @@ -3309,7 +3309,7 @@ unifontsel *unifontsel_new(const char *wintitle) int lists_height, preview_height, font_width, style_width, size_width; int i; - fs->inhibit_response = FALSE; + fs->inhibit_response = false; fs->selected = NULL; { @@ -3352,7 +3352,7 @@ unifontsel *unifontsel_new(const char *wintitle) table = gtk_grid_new(); gtk_grid_set_column_spacing(GTK_GRID(table), 8); #else - table = gtk_table_new(8, 3, FALSE); + table = gtk_table_new(8, 3, false); gtk_table_set_col_spacings(GTK_TABLE(table), 8); #endif gtk_widget_show(table); @@ -3375,14 +3375,14 @@ unifontsel *unifontsel_new(const char *wintitle) gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area (GTK_DIALOG(fs->u.window))), - w, TRUE, TRUE, 0); + w, true, true, 0); label = gtk_label_new_with_mnemonic("_Font:"); gtk_widget_show(label); align_label_left(GTK_LABEL(label)); #if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1); - g_object_set(G_OBJECT(label), "hexpand", TRUE, (const char *)NULL); + g_object_set(G_OBJECT(label), "hexpand", true, (const char *)NULL); #else gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); #endif @@ -3394,7 +3394,7 @@ unifontsel *unifontsel_new(const char *wintitle) */ model = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT); w = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), FALSE); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false); gtk_label_set_mnemonic_widget(GTK_LABEL(label), w); gtk_widget_show(w); column = gtk_tree_view_column_new_with_attributes @@ -3417,7 +3417,7 @@ unifontsel *unifontsel_new(const char *wintitle) gtk_widget_set_size_request(scroll, font_width, lists_height); #if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(table), scroll, 0, 1, 1, 2); - g_object_set(G_OBJECT(scroll), "expand", TRUE, (const char *)NULL); + g_object_set(G_OBJECT(scroll), "expand", true, (const char *)NULL); #else gtk_table_attach(GTK_TABLE(table), scroll, 0, 1, 1, 3, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); @@ -3430,7 +3430,7 @@ unifontsel *unifontsel_new(const char *wintitle) align_label_left(GTK_LABEL(label)); #if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(table), label, 1, 0, 1, 1); - g_object_set(G_OBJECT(label), "hexpand", TRUE, (const char *)NULL); + g_object_set(G_OBJECT(label), "hexpand", true, (const char *)NULL); #else gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); #endif @@ -3445,7 +3445,7 @@ unifontsel *unifontsel_new(const char *wintitle) model = gtk_list_store_new(5, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_INT); w = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), FALSE); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false); gtk_label_set_mnemonic_widget(GTK_LABEL(label), w); gtk_widget_show(w); column = gtk_tree_view_column_new_with_attributes @@ -3466,7 +3466,7 @@ unifontsel *unifontsel_new(const char *wintitle) gtk_widget_set_size_request(scroll, style_width, lists_height); #if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(table), scroll, 1, 1, 1, 2); - g_object_set(G_OBJECT(scroll), "expand", TRUE, (const char *)NULL); + g_object_set(G_OBJECT(scroll), "expand", true, (const char *)NULL); #else gtk_table_attach(GTK_TABLE(table), scroll, 1, 2, 1, 3, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); @@ -3479,7 +3479,7 @@ unifontsel *unifontsel_new(const char *wintitle) align_label_left(GTK_LABEL(label)); #if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(table), label, 2, 0, 1, 1); - g_object_set(G_OBJECT(label), "hexpand", TRUE, (const char *)NULL); + g_object_set(G_OBJECT(label), "hexpand", true, (const char *)NULL); #else gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); #endif @@ -3495,7 +3495,7 @@ unifontsel *unifontsel_new(const char *wintitle) gtk_widget_show(w); #if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(table), w, 2, 1, 1, 1); - g_object_set(G_OBJECT(w), "hexpand", TRUE, (const char *)NULL); + g_object_set(G_OBJECT(w), "hexpand", true, (const char *)NULL); #else gtk_table_attach(GTK_TABLE(table), w, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); #endif @@ -3504,7 +3504,7 @@ unifontsel *unifontsel_new(const char *wintitle) model = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT); w = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), FALSE); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false); gtk_widget_show(w); column = gtk_tree_view_column_new_with_attributes ("Size", gtk_cell_renderer_text_new(), @@ -3523,7 +3523,7 @@ unifontsel *unifontsel_new(const char *wintitle) GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); #if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(table), scroll, 2, 2, 1, 1); - g_object_set(G_OBJECT(scroll), "expand", TRUE, (const char *)NULL); + g_object_set(G_OBJECT(scroll), "expand", true, (const char *)NULL); #else gtk_table_attach(GTK_TABLE(table), scroll, 2, 3, 2, 3, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); @@ -3545,9 +3545,9 @@ unifontsel *unifontsel_new(const char *wintitle) fs->preview_bg.red = fs->preview_bg.green = fs->preview_bg.blue = 0xFFFF; #if !GTK_CHECK_VERSION(3,0,0) gdk_colormap_alloc_color(gdk_colormap_get_system(), &fs->preview_fg, - FALSE, FALSE); + false, false); gdk_colormap_alloc_color(gdk_colormap_get_system(), &fs->preview_bg, - FALSE, FALSE); + false, false); #endif #if GTK_CHECK_VERSION(3,0,0) g_signal_connect(G_OBJECT(fs->preview_area), "draw", @@ -3584,7 +3584,7 @@ unifontsel *unifontsel_new(const char *wintitle) gtk_widget_show(w); #if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(table), w, 0, 3, 3, 1); - g_object_set(G_OBJECT(w), "expand", TRUE, (const char *)NULL); + g_object_set(G_OBJECT(w), "expand", true, (const char *)NULL); #else gtk_table_attach(GTK_TABLE(table), w, 0, 3, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 8); @@ -3607,7 +3607,7 @@ unifontsel *unifontsel_new(const char *wintitle) fs->filter_buttons[fs->n_filter_buttons++] = w; #if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(table), w, 0, 4, 3, 1); - g_object_set(G_OBJECT(w), "hexpand", TRUE, (const char *)NULL); + g_object_set(G_OBJECT(w), "hexpand", true, (const char *)NULL); #else gtk_table_attach(GTK_TABLE(table), w, 0, 3, 4, 5, GTK_FILL, 0, 0, 0); #endif @@ -3620,7 +3620,7 @@ unifontsel *unifontsel_new(const char *wintitle) fs->filter_buttons[fs->n_filter_buttons++] = w; #if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(table), w, 0, 5, 3, 1); - g_object_set(G_OBJECT(w), "hexpand", TRUE, (const char *)NULL); + g_object_set(G_OBJECT(w), "hexpand", true, (const char *)NULL); #else gtk_table_attach(GTK_TABLE(table), w, 0, 3, 5, 6, GTK_FILL, 0, 0, 0); #endif @@ -3633,7 +3633,7 @@ unifontsel *unifontsel_new(const char *wintitle) fs->filter_buttons[fs->n_filter_buttons++] = w; #if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(table), w, 0, 6, 3, 1); - g_object_set(G_OBJECT(w), "hexpand", TRUE, (const char *)NULL); + g_object_set(G_OBJECT(w), "hexpand", true, (const char *)NULL); #else gtk_table_attach(GTK_TABLE(table), w, 0, 3, 6, 7, GTK_FILL, 0, 0, 0); #endif @@ -3647,7 +3647,7 @@ unifontsel *unifontsel_new(const char *wintitle) fs->filter_buttons[fs->n_filter_buttons++] = w; #if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(table), w, 0, 7, 3, 1); - g_object_set(G_OBJECT(w), "hexpand", TRUE, (const char *)NULL); + g_object_set(G_OBJECT(w), "hexpand", true, (const char *)NULL); #else gtk_table_attach(GTK_TABLE(table), w, 0, 3, 7, 8, GTK_FILL, 0, 0, 0); #endif @@ -3673,7 +3673,7 @@ unifontsel *unifontsel_new(const char *wintitle) unifontsel_setup_familylist(fs); fs->selsize = fs->intendedsize = 13; /* random default */ - gtk_widget_set_sensitive(fs->u.ok_button, FALSE); + gtk_widget_set_sensitive(fs->u.ok_button, false); return &fs->u; } @@ -3716,7 +3716,7 @@ void unifontsel_set_name(unifontsel *fontsel, const char *fontname) fontname = unifont_do_prefix(fontname, &start, &end); for (i = start; i < end; i++) { fontname2 = unifont_types[i]->canonify_fontname - (GTK_WIDGET(fs->u.window), fontname, &size, &flags, FALSE); + (GTK_WIDGET(fs->u.window), fontname, &size, &flags, false); if (fontname2) break; } @@ -3754,7 +3754,7 @@ void unifontsel_set_name(unifontsel *fontsel, const char *fontname) * know everything we need to fill in all the fields in the * dialog. */ - unifontsel_select_font(fs, info, size, 0, TRUE); + unifontsel_select_font(fs, info, size, 0, true); } char *unifontsel_get_name(unifontsel *fontsel) diff --git a/unix/gtkmain.c b/unix/gtkmain.c index 8829dbfa..8e357525 100644 --- a/unix/gtkmain.c +++ b/unix/gtkmain.c @@ -554,7 +554,7 @@ GtkWidget *make_gtk_toplevel_window(GtkFrontend *frontend) return gtk_window_new(GTK_WINDOW_TOPLEVEL); } -const int buildinfo_gtk_relevant = TRUE; +const int buildinfo_gtk_relevant = true; struct post_initial_config_box_ctx { Conf *conf; @@ -594,7 +594,7 @@ int main(int argc, char **argv) /* Call the function in ux{putty,pterm}.c to do app-type * specific setup */ extern void setup(int); - setup(TRUE); /* TRUE means we are a one-session process */ + setup(true); /* true means we are a one-session process */ } progname = argv[0]; @@ -633,7 +633,7 @@ int main(int argc, char **argv) smemclr(argv[1], strlen(argv[1])); assert(!dup_check_launchable || conf_launchable(conf)); - need_config_box = FALSE; + need_config_box = false; } else { if (do_cmdline(argc, argv, 0, conf)) exit(1); /* pre-defaults pass to get -class */ @@ -646,7 +646,7 @@ int main(int argc, char **argv) if (cmdline_tooltype & TOOLTYPE_HOST_ARG) need_config_box = !cmdline_host_ok(conf); else - need_config_box = FALSE; + need_config_box = false; } if (need_config_box) { diff --git a/unix/gtkmisc.c b/unix/gtkmisc.c index e9fcaa75..05379415 100644 --- a/unix/gtkmisc.c +++ b/unix/gtkmisc.c @@ -130,7 +130,7 @@ void our_dialog_set_action_area(GtkWindow *dlg, GtkWidget *w) #if !GTK_CHECK_VERSION(2,0,0) gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->action_area), - w, TRUE, TRUE, 0); + w, true, true, 0); #elif !GTK_CHECK_VERSION(3,0,0) @@ -149,14 +149,14 @@ void our_dialog_set_action_area(GtkWindow *dlg, GtkWidget *w) #endif gtk_widget_show(align); gtk_box_pack_end(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg))), - align, FALSE, TRUE, 0); + align, false, true, 0); w = gtk_hseparator_new(); gtk_box_pack_end(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg))), - w, FALSE, TRUE, 0); + w, false, true, 0); gtk_widget_show(w); gtk_widget_hide(gtk_dialog_get_action_area(GTK_DIALOG(dlg))); - g_object_set(G_OBJECT(dlg), "has-separator", TRUE, (const char *)NULL); + g_object_set(G_OBJECT(dlg), "has-separator", true, (const char *)NULL); #else /* GTK 3 */ @@ -166,10 +166,10 @@ void our_dialog_set_action_area(GtkWindow *dlg, GtkWidget *w) GtkWidget *sep; g_object_set(G_OBJECT(w), "margin", 8, (const char *)NULL); - gtk_box_pack_end(vbox, w, FALSE, TRUE, 0); + gtk_box_pack_end(vbox, w, false, true, 0); sep = gtk_hseparator_new(); - gtk_box_pack_end(vbox, sep, FALSE, TRUE, 0); + gtk_box_pack_end(vbox, sep, false, true, 0); gtk_widget_show(sep); #endif diff --git a/unix/gtkwin.c b/unix/gtkwin.c index d56c1ee5..2887d071 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -231,7 +231,7 @@ static void common_connfatal_message_box( GtkWidget *dialog = create_message_box( inst->window, title, msg, string_width("REASONABLY LONG LINE OF TEXT FOR BASIC SANITY"), - FALSE, &buttons_ok, postfn, inst); + false, &buttons_ok, postfn, inst); register_dialog(&inst->seat, DIALOG_SLOT_CONNECTION_FATAL, dialog); sfree(title); } @@ -262,7 +262,7 @@ static void gtk_seat_connection_fatal(Seat *seat, const char *msg) common_connfatal_message_box(inst, msg, post_nonfatal_message_box); } - inst->exited = TRUE; /* suppress normal exit handling */ + inst->exited = true; /* suppress normal exit handling */ queue_toplevel_callback(connection_fatal_callback, inst); } @@ -317,7 +317,7 @@ static int gtk_seat_output(Seat *seat, int is_stderr, static int gtk_seat_eof(Seat *seat) { /* GtkFrontend *inst = container_of(seat, GtkFrontend, seat); */ - return TRUE; /* do respond to incoming EOF with outgoing */ + return true; /* do respond to incoming EOF with outgoing */ } static int gtk_seat_get_userpass_input(Seat *seat, prompts_t *p, @@ -341,7 +341,7 @@ static int gtk_seat_get_window_pixel_size(Seat *seat, int *w, int *h) { GtkFrontend *inst = container_of(seat, GtkFrontend, seat); win_get_pixels(&inst->termwin, w, h); - return TRUE; + return true; } static void gtk_seat_notify_remote_exit(Seat *seat); @@ -591,13 +591,13 @@ static int find_and_raise_dialog(GtkFrontend *inst, enum DialogSlot slot) { GtkWidget *dialog = inst->dialogs[slot]; if (!dialog) - return FALSE; + return false; #if GTK_CHECK_VERSION(2,0,0) gtk_window_deiconify(GTK_WINDOW(dialog)); #endif gdk_window_raise(gtk_widget_get_window(dialog)); - return TRUE; + return true; } /* @@ -619,10 +619,10 @@ static void warn_on_close_callback(void *vctx, int result) /* * Handle the 'delete window' event (e.g. user clicking the WM close - * button). The return value FALSE means the window should close, and - * TRUE means it shouldn't. + * button). The return value false means the window should close, and + * true means it shouldn't. * - * (That's counterintuitive, but really, in GTK terms, TRUE means 'I + * (That's counterintuitive, but really, in GTK terms, true means 'I * have done everything necessary to handle this event, so the default * handler need not do anything', i.e. 'suppress default handler', * i.e. 'do not close the window'.) @@ -641,13 +641,13 @@ gint delete_window(GtkWidget *widget, GdkEvent *event, GtkFrontend *inst) inst->window, title, "Are you sure you want to close this session?", string_width("Most of the width of the above text"), - FALSE, &buttons_yn, warn_on_close_callback, inst); + false, &buttons_yn, warn_on_close_callback, inst); register_dialog(&inst->seat, DIALOG_SLOT_WARN_ON_CLOSE, dialog); sfree(title); } - return TRUE; + return true; } - return FALSE; + return false; } static void update_mouseptr(GtkFrontend *inst) @@ -706,17 +706,17 @@ static void drawing_area_setup(GtkFrontend *inst, int width, int height) /* * We'll need to tell terminal.c about the resize below. */ - need_size = TRUE; + need_size = true; /* * And we must refresh the window's backing image. */ - inst->drawing_area_setup_needed = TRUE; + inst->drawing_area_setup_needed = true; } #if GTK_CHECK_VERSION(3,10,0) new_scale = gtk_widget_get_scale_factor(inst->area); if (new_scale != inst->scale) - inst->drawing_area_setup_needed = TRUE; + inst->drawing_area_setup_needed = true; #else new_scale = 1; #endif @@ -729,7 +729,7 @@ static void drawing_area_setup(GtkFrontend *inst, int width, int height) if (!inst->drawing_area_setup_needed) return; - inst->drawing_area_setup_needed = FALSE; + inst->drawing_area_setup_needed = false; inst->scale = new_scale; { @@ -794,7 +794,7 @@ static void drawing_area_setup_simple(GtkFrontend *inst) static void area_realised(GtkWidget *widget, GtkFrontend *inst) { - inst->drawing_area_realised = TRUE; + inst->drawing_area_realised = true; if (inst->drawing_area_realised && inst->drawing_area_got_size && inst->drawing_area_setup_needed) drawing_area_setup_simple(inst); @@ -803,7 +803,7 @@ static void area_realised(GtkWidget *widget, GtkFrontend *inst) static void area_size_allocate( GtkWidget *widget, GdkRectangle *alloc, GtkFrontend *inst) { - inst->drawing_area_got_size = TRUE; + inst->drawing_area_got_size = true; if (inst->drawing_area_realised && inst->drawing_area_got_size) drawing_area_setup(inst, alloc->width, alloc->height); } @@ -828,7 +828,7 @@ static gboolean area_configured( { GtkFrontend *inst = (GtkFrontend *)data; area_check_scale(inst); - return FALSE; + return false; } #endif @@ -909,7 +909,7 @@ static gint draw_area(GtkWidget *widget, cairo_t *cr, gpointer data) cairo_surface_set_device_scale(target_surface, orig_sx, orig_sy); } - return TRUE; + return true; } #else gint expose_area(GtkWidget *widget, GdkEventExpose *event, gpointer data) @@ -946,7 +946,7 @@ gint expose_area(GtkWidget *widget, GdkEventExpose *event, gpointer data) } #endif - return TRUE; + return true; } #endif @@ -974,11 +974,11 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) wchar_t ucsoutput[2]; int ucsval, start, end, special, output_charset, use_ucsoutput; int nethack_mode, app_keypad_mode; - int generated_something = FALSE; + int generated_something = false; #ifdef OSX_META_KEY_CONFIG if (event->state & inst->system_mod_mask) - return FALSE; /* let GTK process OS X Command key */ + return false; /* let GTK process OS X Command key */ #endif /* Remember the timestamp. */ @@ -986,7 +986,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) /* By default, nothing is generated. */ end = start = 0; - special = use_ucsoutput = FALSE; + special = use_ucsoutput = false; output_charset = CS_ISO8859_1; #ifdef KEY_EVENT_DIAGNOSTICS @@ -1058,7 +1058,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) "hardware_keycode=%d is_modifier=%s string=[%s]\n", type_string, keyval_string, state_string, (int)event->hardware_keycode, - event->is_modifier ? "TRUE" : "FALSE", + event->is_modifier ? "true" : "false", string_string)); sfree(type_string); @@ -1105,7 +1105,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) #ifdef KEY_EVENT_DIAGNOSTICS debug((" - key release accepted by IM\n")); #endif - return TRUE; + return true; } else { #ifdef KEY_EVENT_DIAGNOSTICS debug((" - key release not accepted by IM\n")); @@ -1179,7 +1179,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Ctrl->: increase font size\n")); #endif change_font_size(inst, +1); - return TRUE; + return true; } if (event->keyval == GDK_KEY_less && (event->state & GDK_CONTROL_MASK)) { @@ -1187,7 +1187,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Ctrl-<: increase font size\n")); #endif change_font_size(inst, -1); - return TRUE; + return true; } /* @@ -1201,7 +1201,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Ctrl-Shift-PgUp scroll\n")); #endif term_scroll(inst->term, 1, 0); - return TRUE; + return true; } if (event->keyval == GDK_KEY_Page_Up && (event->state & GDK_SHIFT_MASK)) { @@ -1209,7 +1209,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Shift-PgUp scroll\n")); #endif term_scroll(inst->term, 0, -inst->height/2); - return TRUE; + return true; } if (event->keyval == GDK_KEY_Page_Up && (event->state & GDK_CONTROL_MASK)) { @@ -1217,7 +1217,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Ctrl-PgUp scroll\n")); #endif term_scroll(inst->term, 0, -1); - return TRUE; + return true; } if (event->keyval == GDK_KEY_Page_Down && ((event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) == @@ -1226,7 +1226,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Ctrl-shift-PgDn scroll\n")); #endif term_scroll(inst->term, -1, 0); - return TRUE; + return true; } if (event->keyval == GDK_KEY_Page_Down && (event->state & GDK_SHIFT_MASK)) { @@ -1234,7 +1234,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Shift-PgDn scroll\n")); #endif term_scroll(inst->term, 0, +inst->height/2); - return TRUE; + return true; } if (event->keyval == GDK_KEY_Page_Down && (event->state & GDK_CONTROL_MASK)) { @@ -1242,7 +1242,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Ctrl-PgDn scroll\n")); #endif term_scroll(inst->term, 0, +1); - return TRUE; + return true; } /* @@ -1258,19 +1258,19 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Shift-Insert: paste from PRIMARY\n")); #endif term_request_paste(inst->term, CLIP_PRIMARY); - return TRUE; + return true; case CLIPUI_EXPLICIT: #ifdef KEY_EVENT_DIAGNOSTICS debug((" - Shift-Insert: paste from CLIPBOARD\n")); #endif term_request_paste(inst->term, CLIP_CLIPBOARD); - return TRUE; + return true; case CLIPUI_CUSTOM: #ifdef KEY_EVENT_DIAGNOSTICS debug((" - Shift-Insert: paste from custom clipboard\n")); #endif term_request_paste(inst->term, inst->clipboard_ctrlshiftins); - return TRUE; + return true; default: #ifdef KEY_EVENT_DIAGNOSTICS debug((" - Shift-Insert: no paste action\n")); @@ -1289,21 +1289,21 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) #ifdef KEY_EVENT_DIAGNOSTICS debug((" - Ctrl-Insert: non-copy to PRIMARY\n")); #endif - return TRUE; + return true; case CLIPUI_EXPLICIT: #ifdef KEY_EVENT_DIAGNOSTICS debug((" - Ctrl-Insert: copy to CLIPBOARD\n")); #endif term_request_copy(inst->term, clips_clipboard, lenof(clips_clipboard)); - return TRUE; + return true; case CLIPUI_CUSTOM: #ifdef KEY_EVENT_DIAGNOSTICS debug((" - Ctrl-Insert: copy to custom clipboard\n")); #endif term_request_copy(inst->term, &inst->clipboard_ctrlshiftins, 1); - return TRUE; + return true; default: #ifdef KEY_EVENT_DIAGNOSTICS debug((" - Ctrl-Insert: no copy action\n")); @@ -1335,7 +1335,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Ctrl-Shift-C: non-copy to PRIMARY\n")); #endif } - return TRUE; + return true; case CLIPUI_EXPLICIT: if (paste) { #ifdef KEY_EVENT_DIAGNOSTICS @@ -1349,7 +1349,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) #endif term_request_copy(inst->term, clips, lenof(clips)); } - return TRUE; + return true; case CLIPUI_CUSTOM: if (paste) { #ifdef KEY_EVENT_DIAGNOSTICS @@ -1364,12 +1364,12 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) term_request_copy(inst->term, &inst->clipboard_ctrlshiftcv, 1); } - return TRUE; + return true; } } - special = FALSE; - use_ucsoutput = FALSE; + special = false; + use_ucsoutput = false; nethack_mode = conf_get_int(inst->conf, CONF_nethack_keypad); app_keypad_mode = (inst->term->app_keypad_keys && @@ -1447,7 +1447,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) event->keyval == GDK_KEY_KP_Page_Up)) { /* nethack mode; do nothing */ } else { - int try_filter = TRUE; + int try_filter = true; #ifdef META_MANUAL_MASK if (event->state & META_MANUAL_MASK & inst->meta_mod_mask) { @@ -1462,7 +1462,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Meta modifier requiring manual intervention, " "suppressing IM filtering\n")); #endif - try_filter = FALSE; + try_filter = false; } #endif @@ -1474,7 +1474,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) #ifdef KEY_EVENT_DIAGNOSTICS debug((" - key press accepted by IM\n")); #endif - return TRUE; + return true; } else { #ifdef KEY_EVENT_DIAGNOSTICS debug((" - key press not accepted by IM\n")); @@ -1558,7 +1558,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - keysym_to_unicode gave %04x\n", (unsigned)ucsoutput[1])); #endif - use_ucsoutput = TRUE; + use_ucsoutput = true; end = 2; } else { output[lenof(output)-1] = '\0'; @@ -1598,7 +1598,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) sfree(keyval_name); } #endif - use_ucsoutput = TRUE; + use_ucsoutput = true; end = 2; } } @@ -1613,7 +1613,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Ctrl-` special case, translating as 1c\n")); #endif output[1] = '\x1C'; - use_ucsoutput = FALSE; + use_ucsoutput = false; end = 2; } @@ -1664,7 +1664,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) #endif if (inst->backend) backend_special(inst->backend, SS_BRK, 0); - return TRUE; + return true; } /* We handle Return ourselves, because it needs to be flagged as @@ -1674,9 +1674,9 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Return special case, translating as 0d + special\n")); #endif output[1] = '\015'; - use_ucsoutput = FALSE; + use_ucsoutput = false; end = 2; - special = TRUE; + special = true; } /* Control-2, Control-Space and Control-@ are NUL */ @@ -1689,7 +1689,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Ctrl-{space,2,@} special case, translating as 00\n")); #endif output[1] = '\0'; - use_ucsoutput = FALSE; + use_ucsoutput = false; end = 2; } @@ -1702,7 +1702,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) #endif output[1] = '\240'; output_charset = CS_ISO8859_1; - use_ucsoutput = FALSE; + use_ucsoutput = false; end = 2; } @@ -1715,9 +1715,9 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Backspace, translating as %02x\n", (unsigned)output[1])); #endif - use_ucsoutput = FALSE; + use_ucsoutput = false; end = 2; - special = TRUE; + special = true; } /* For Shift Backspace, do opposite of what is configured. */ if (event->keyval == GDK_KEY_BackSpace && @@ -1728,9 +1728,9 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Shift-Backspace, translating as %02x\n", (unsigned)output[1])); #endif - use_ucsoutput = FALSE; + use_ucsoutput = false; end = 2; - special = TRUE; + special = true; } /* Shift-Tab is ESC [ Z */ @@ -1741,7 +1741,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - Shift-Tab, translating as ESC [ Z\n")); #endif end = 1 + sprintf(output+1, "\033[Z"); - use_ucsoutput = FALSE; + use_ucsoutput = false; } /* And normal Tab is Tab, if the keymap hasn't already told us. * (Curiously, at least one version of the MacOS 10.5 X server @@ -1790,7 +1790,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) #ifdef KEY_EVENT_DIAGNOSTICS debug((" - Nethack-mode key")); #endif - use_ucsoutput = FALSE; + use_ucsoutput = false; goto done; } } @@ -1844,7 +1844,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) end = 1 + sprintf(output+1, "\033?%c", xkey); } else end = 1 + sprintf(output+1, "\033O%c", xkey); - use_ucsoutput = FALSE; + use_ucsoutput = false; #ifdef KEY_EVENT_DIAGNOSTICS debug((" - Application keypad mode key")); #endif @@ -1955,7 +1955,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) #ifdef KEY_EVENT_DIAGNOSTICS debug((" - VT52 mode small keypad key")); #endif - use_ucsoutput = FALSE; + use_ucsoutput = false; goto done; } @@ -1983,7 +1983,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) #ifdef KEY_EVENT_DIAGNOSTICS debug((" - SCO mode function key")); #endif - use_ucsoutput = FALSE; + use_ucsoutput = false; goto done; } if (funky_type == FUNKY_SCO && /* SCO small keypad */ @@ -1998,7 +1998,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) #ifdef KEY_EVENT_DIAGNOSTICS debug((" - SCO mode small keypad key")); #endif - use_ucsoutput = FALSE; + use_ucsoutput = false; goto done; } if ((inst->term->vt52_mode || funky_type == FUNKY_VT100P) && @@ -2021,7 +2021,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) end = 1 + sprintf(output+1, "\x1BO%c", code + 'P' - 11 - offt); } - use_ucsoutput = FALSE; + use_ucsoutput = false; goto done; } if (funky_type == FUNKY_LINUX && code >= 11 && code <= 15) { @@ -2029,7 +2029,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) #ifdef KEY_EVENT_DIAGNOSTICS debug((" - Linux mode F1-F5 function key")); #endif - use_ucsoutput = FALSE; + use_ucsoutput = false; goto done; } if (funky_type == FUNKY_XTERM && code >= 11 && code <= 14) { @@ -2045,7 +2045,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) #endif end = 1 + sprintf(output+1, "\x1BO%c", code + 'P' - 11); } - use_ucsoutput = FALSE; + use_ucsoutput = false; goto done; } if ((code == 1 || code == 4) && @@ -2054,7 +2054,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - rxvt style Home/End")); #endif end = 1 + sprintf(output+1, code == 1 ? "\x1B[H" : "\x1BOw"); - use_ucsoutput = FALSE; + use_ucsoutput = false; goto done; } if (code) { @@ -2062,7 +2062,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) debug((" - ordinary function key encoding")); #endif end = 1 + sprintf(output+1, "\x1B[%d~", code); - use_ucsoutput = FALSE; + use_ucsoutput = false; goto done; } } @@ -2089,7 +2089,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) #ifdef KEY_EVENT_DIAGNOSTICS debug((" - arrow key")); #endif - use_ucsoutput = FALSE; + use_ucsoutput = false; goto done; } } @@ -2120,7 +2120,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) * should never matter. */ output[end] = '\0'; /* NUL-terminate */ - generated_something = TRUE; + generated_something = true; if (inst->ldisc) ldisc_send(inst->ldisc, output+start, -2, 1); } else if (!inst->direct_to_font) { @@ -2140,7 +2140,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) charset_to_localenc(output_charset), string_string)); sfree(string_string); #endif - generated_something = TRUE; + generated_something = true; if (inst->ldisc) lpage_send(inst->ldisc, output_charset, output+start, end-start, 1); @@ -2165,7 +2165,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) * We generated our own Unicode key data from the * keysym, so use that instead. */ - generated_something = TRUE; + generated_something = true; if (inst->ldisc) luni_send(inst->ldisc, ucsoutput+start, end-start, 1); } @@ -2189,7 +2189,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) string_string)); sfree(string_string); #endif - generated_something = TRUE; + generated_something = true; if (inst->ldisc) ldisc_send(inst->ldisc, output+start, end-start, 1); } @@ -2200,7 +2200,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) if (generated_something) key_pressed(inst); - return TRUE; + return true; } #if GTK_CHECK_VERSION(2,0,0) @@ -2260,7 +2260,7 @@ gboolean scroll_internal(GtkFrontend *inst, gdouble delta, guint state, term_scroll(inst->term, 0, scroll_lines); inst->cumulative_scroll -= scroll_lines; } - return TRUE; + return true; } else { int scroll_events = (int)(inst->cumulative_scroll / SCROLL_INCREMENT_LINES); @@ -2281,7 +2281,7 @@ gboolean scroll_internal(GtkFrontend *inst, gdouble delta, guint state, MA_CLICK, x, y, shift, ctrl, alt); } } - return TRUE; + return true; } } #endif @@ -2306,11 +2306,11 @@ static gboolean button_internal(GtkFrontend *inst, GdkEventButton *event) if (!raw_mouse_mode) { if (event->button == 4 && event->type == GDK_BUTTON_PRESS) { term_scroll(inst->term, 0, -SCROLL_INCREMENT_LINES); - return TRUE; + return true; } if (event->button == 5 && event->type == GDK_BUTTON_PRESS) { term_scroll(inst->term, 0, +SCROLL_INCREMENT_LINES); - return TRUE; + return true; } } @@ -2321,7 +2321,7 @@ static gboolean button_internal(GtkFrontend *inst, GdkEventButton *event) gtk_menu_popup(GTK_MENU(inst->menu), NULL, NULL, NULL, NULL, event->button, event->time); #endif - return TRUE; + return true; } if (event->button == 1) @@ -2335,18 +2335,18 @@ static gboolean button_internal(GtkFrontend *inst, GdkEventButton *event) else if (event->button == 5) button = MBT_WHEEL_DOWN; else - return FALSE; /* don't even know what button! */ + return false; /* don't even know what button! */ switch (event->type) { case GDK_BUTTON_PRESS: act = MA_CLICK; break; case GDK_BUTTON_RELEASE: act = MA_RELEASE; break; case GDK_2BUTTON_PRESS: act = MA_2CLK; break; case GDK_3BUTTON_PRESS: act = MA_3CLK; break; - default: return FALSE; /* don't know this event type */ + default: return false; /* don't know this event type */ } if (raw_mouse_mode && act != MA_CLICK && act != MA_RELEASE) - return TRUE; /* we ignore these in raw mouse mode */ + return true; /* we ignore these in raw mouse mode */ x = (event->x - inst->window_border) / inst->font_width; y = (event->y - inst->window_border) / inst->font_height; @@ -2354,7 +2354,7 @@ static gboolean button_internal(GtkFrontend *inst, GdkEventButton *event) term_mouse(inst->term, button, translate_button(button), act, x, y, shift, ctrl, alt); - return TRUE; + return true; } gboolean button_event(GtkWidget *widget, GdkEventButton *event, gpointer data) @@ -2378,7 +2378,7 @@ gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer data) if (gdk_event_get_scroll_deltas((GdkEvent *)event, &dx, &dy)) { return scroll_internal(inst, dy, event->state, event->x, event->y); } else - return FALSE; + return false; #else guint button; GdkEventButton *event_button; @@ -2389,7 +2389,7 @@ gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer data) else if (event->direction == GDK_SCROLL_DOWN) button = 5; else - return FALSE; + return false; event_button = (GdkEventButton *)gdk_event_new(GDK_BUTTON_PRESS); event_button->window = g_object_ref(event->window); @@ -2430,7 +2430,7 @@ gint motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) else if (event->state & GDK_BUTTON3_MASK) button = MBT_RIGHT; else - return FALSE; /* don't even know what button! */ + return false; /* don't even know what button! */ x = (event->x - inst->window_border) / inst->font_width; y = (event->y - inst->window_border) / inst->font_height; @@ -2438,7 +2438,7 @@ gint motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) term_mouse(inst->term, button, translate_button(button), MA_DRAG, x, y, shift, ctrl, alt); - return TRUE; + return true; } static void key_pressed(GtkFrontend *inst) @@ -2485,7 +2485,7 @@ static void gtk_seat_notify_remote_exit(Seat *seat) static void destroy_inst_connection(GtkFrontend *inst) { - inst->exited = TRUE; + inst->exited = true; if (inst->ldisc) { ldisc_free(inst->ldisc); inst->ldisc = NULL; @@ -2498,7 +2498,7 @@ static void destroy_inst_connection(GtkFrontend *inst) term_provide_backend(inst->term, NULL); if (inst->menu) { seat_update_specials_menu(&inst->seat); - gtk_widget_set_sensitive(inst->restartitem, TRUE); + gtk_widget_set_sensitive(inst->restartitem, true); } } @@ -2577,7 +2577,7 @@ gint focus_event(GtkWidget *widget, GdkEventFocus *event, gpointer data) term_set_focus(inst->term, event->in); term_update(inst->term); show_mouseptr(inst, 1); - return FALSE; + return false; } static void gtk_seat_set_busy_status(Seat *seat, BusyStatus status) @@ -2704,7 +2704,7 @@ static void real_palette_set(GtkFrontend *inst, int n, int r, int g, int b) gboolean success[1]; gdk_colormap_free_colors(inst->colmap, inst->cols + n, 1); gdk_colormap_alloc_colors(inst->colmap, inst->cols + n, 1, - FALSE, TRUE, success); + false, true, success); if (!success[0]) g_error("%s: couldn't allocate colour %d (#%02x%02x%02x)\n", appname, n, r, g, b); @@ -2776,11 +2776,11 @@ static int gtkwin_palette_get(TermWin *tw, int n, int *r, int *g, int *b) { GtkFrontend *inst = container_of(tw, GtkFrontend, termwin); if (n < 0 || n >= NALLCOLOURS) - return FALSE; + return false; *r = inst->cols[n].red >> 8; *g = inst->cols[n].green >> 8; *b = inst->cols[n].blue >> 8; - return TRUE; + return true; } static void gtkwin_palette_reset(TermWin *tw) @@ -2831,7 +2831,7 @@ static void gtkwin_palette_reset(TermWin *tw) { gboolean success[NALLCOLOURS]; gdk_colormap_alloc_colors(inst->colmap, inst->cols, NALLCOLOURS, - FALSE, TRUE, success); + false, true, success); for (i = 0; i < NALLCOLOURS; i++) { if (!success[i]) g_error("%s: couldn't allocate colour %d (#%02x%02x%02x)\n", @@ -2896,7 +2896,7 @@ int init_clipboard(GtkFrontend *inst) { set_clipboard_atom(inst, CLIP_PRIMARY, GDK_SELECTION_PRIMARY); set_clipboard_atom(inst, CLIP_CLIPBOARD, clipboard_atom); - return TRUE; + return true; } static void clipboard_provide_data(GtkClipboard *clipboard, @@ -3214,7 +3214,7 @@ static gint selection_clear(GtkWidget *widget, GdkEventSelection *seldata, inst, seldata->selection); if (!state) - return TRUE; + return true; term_lost_clipboard_ownership(inst->term, state->clipboard); if (state->pasteout_data) @@ -3229,7 +3229,7 @@ static gint selection_clear(GtkWidget *widget, GdkEventSelection *seldata, state->pasteout_data_ctext_len = 0; state->pasteout_data_utf8 = NULL; state->pasteout_data_utf8_len = 0; - return TRUE; + return true; } static void gtkwin_clip_request_paste(TermWin *tw, int clipboard) @@ -3506,7 +3506,7 @@ 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)) return; - inst->ignore_sbar = TRUE; + inst->ignore_sbar = true; gtk_adjustment_set_lower(inst->sbar_adjust, 0); gtk_adjustment_set_upper(inst->sbar_adjust, total); gtk_adjustment_set_value(inst->sbar_adjust, start); @@ -3516,7 +3516,7 @@ static void gtkwin_set_scrollbar(TermWin *tw, int total, int start, int page) #if !GTK_CHECK_VERSION(3,18,0) gtk_adjustment_changed(inst->sbar_adjust); #endif - inst->ignore_sbar = FALSE; + inst->ignore_sbar = false; } void scrollbar_moved(GtkAdjustment *adj, GtkFrontend *inst) @@ -3570,7 +3570,7 @@ static int gtkwin_setup_draw_ctx(TermWin *tw) GtkFrontend *inst = container_of(tw, GtkFrontend, termwin); if (!gtk_widget_get_window(inst->area)) - return FALSE; + return false; inst->uctx.type = inst->drawtype; #ifdef DRAW_TEXT_GDK @@ -3592,7 +3592,7 @@ static int gtkwin_setup_draw_ctx(TermWin *tw) cairo_setup_draw_ctx(inst); } #endif - return TRUE; + return true; } static void gtkwin_free_draw_ctx(TermWin *tw) @@ -3894,7 +3894,7 @@ static void draw_backing_rect(GtkFrontend *inst) w = inst->width * inst->font_width + 2*inst->window_border; h = inst->height * inst->font_height + 2*inst->window_border; - draw_set_colour(inst, 258, FALSE); + draw_set_colour(inst, 258, false); draw_rectangle(inst, 1, 0, 0, w, h); draw_update(inst, 0, 0, w, h); win_free_draw_ctx(&inst->termwin); @@ -4005,7 +4005,7 @@ static void do_text_internal( draw_stretch_before(inst, x*inst->font_width+inst->window_border, y*inst->font_height+inst->window_border, - rlen*widefactor*inst->font_width, TRUE, + rlen*widefactor*inst->font_width, true, inst->font_height, ((lattr & LATTR_MODE) != LATTR_WIDE), ((lattr & LATTR_MODE) == LATTR_BOT)); @@ -4015,7 +4015,7 @@ static void do_text_internal( draw_set_colour_rgb(inst, truecolour.bg, attr & ATTR_DIM); else draw_set_colour(inst, nbg, attr & ATTR_DIM); - draw_rectangle(inst, TRUE, + draw_rectangle(inst, true, x*inst->font_width+inst->window_border, y*inst->font_height+inst->window_border, rlen*widefactor*inst->font_width, inst->font_height); @@ -4055,7 +4055,7 @@ static void do_text_internal( draw_stretch_after(inst, x*inst->font_width+inst->window_border, y*inst->font_height+inst->window_border, - rlen*widefactor*inst->font_width, TRUE, + rlen*widefactor*inst->font_width, true, inst->font_height, ((lattr & LATTR_MODE) != LATTR_WIDE), ((lattr & LATTR_MODE) == LATTR_BOT)); @@ -4136,8 +4136,8 @@ static void gtkwin_draw_cursor( * if it's passive. */ if (passive) { - draw_set_colour(inst, 261, FALSE); - draw_rectangle(inst, FALSE, + draw_set_colour(inst, 261, false); + draw_rectangle(inst, false, x*inst->font_width+inst->window_border, y*inst->font_height+inst->window_border, len*widefactor*inst->font_width-1, @@ -4175,7 +4175,7 @@ static void gtkwin_draw_cursor( length = inst->font_height; } - draw_set_colour(inst, 261, FALSE); + draw_set_colour(inst, 261, false); if (passive) { for (i = 0; i < length; i++) { if (i % 2 == 0) { @@ -4255,9 +4255,9 @@ static int gtk_seat_get_windowid(Seat *seat, long *id) GtkFrontend *inst = container_of(seat, GtkFrontend, seat); GdkWindow *window = gtk_widget_get_window(inst->area); if (!GDK_IS_X11_WINDOW(window)) - return FALSE; + return false; *id = GDK_WINDOW_XID(window); - return TRUE; + return true; } #endif @@ -4276,7 +4276,7 @@ char *setup_fonts_ucs(GtkFrontend *inst) int i; fs = conf_get_fontspec(inst->conf, CONF_font); - fonts[0] = multifont_create(inst->area, fs->name, FALSE, FALSE, + fonts[0] = multifont_create(inst->area, fs->name, false, false, shadowboldoffset, shadowbold); if (!fonts[0]) { return dupprintf("unable to load font \"%s\"", fs->name); @@ -4286,7 +4286,7 @@ char *setup_fonts_ucs(GtkFrontend *inst) if (shadowbold || !fs->name[0]) { fonts[1] = NULL; } else { - fonts[1] = multifont_create(inst->area, fs->name, FALSE, TRUE, + fonts[1] = multifont_create(inst->area, fs->name, false, true, shadowboldoffset, shadowbold); if (!fonts[1]) { if (fonts[0]) @@ -4297,7 +4297,7 @@ char *setup_fonts_ucs(GtkFrontend *inst) fs = conf_get_fontspec(inst->conf, CONF_widefont); if (fs->name[0]) { - fonts[2] = multifont_create(inst->area, fs->name, TRUE, FALSE, + fonts[2] = multifont_create(inst->area, fs->name, true, false, shadowboldoffset, shadowbold); if (!fonts[2]) { for (i = 0; i < 2; i++) @@ -4313,7 +4313,7 @@ char *setup_fonts_ucs(GtkFrontend *inst) if (shadowbold || !fs->name[0]) { fonts[3] = NULL; } else { - fonts[3] = multifont_create(inst->area, fs->name, TRUE, TRUE, + fonts[3] = multifont_create(inst->area, fs->name, true, true, shadowboldoffset, shadowbold); if (!fonts[3]) { for (i = 0; i < 3; i++) @@ -4344,7 +4344,7 @@ char *setup_fonts_ucs(GtkFrontend *inst) * The font size has changed, so force the next call to * drawing_area_setup to regenerate the backing surface. */ - inst->drawing_area_setup_needed = TRUE; + inst->drawing_area_setup_needed = true; } inst->direct_to_font = init_ucs(&inst->ucsdata, @@ -4505,7 +4505,7 @@ void clear_scrollback_menuitem(GtkMenuItem *item, gpointer data) void reset_terminal_menuitem(GtkMenuItem *item, gpointer data) { GtkFrontend *inst = (GtkFrontend *)data; - term_pwron(inst->term, TRUE); + term_pwron(inst->term, true); if (inst->ldisc) ldisc_echoedit_update(inst->ldisc); } @@ -4580,7 +4580,7 @@ void setup_clipboards(GtkFrontend *inst, Terminal *term, Conf *conf) set_clipboard_atom(inst, CLIP_CUSTOM_1, gdk_atom_intern( conf_get_str(conf, CONF_mousepaste_custom), - FALSE)); + false)); break; default: term->mouse_paste_clipboard = CLIP_NULL; @@ -4589,7 +4589,7 @@ void setup_clipboards(GtkFrontend *inst, Terminal *term, Conf *conf) if (conf_get_int(conf, CONF_ctrlshiftins) == CLIPUI_CUSTOM) { GdkAtom atom = gdk_atom_intern( - conf_get_str(conf, CONF_ctrlshiftins_custom), FALSE); + conf_get_str(conf, CONF_ctrlshiftins_custom), false); struct clipboard_state *state = clipboard_from_atom(inst, atom); if (state) { inst->clipboard_ctrlshiftins = state->clipboard; @@ -4601,7 +4601,7 @@ void setup_clipboards(GtkFrontend *inst, Terminal *term, Conf *conf) if (conf_get_int(conf, CONF_ctrlshiftcv) == CLIPUI_CUSTOM) { GdkAtom atom = gdk_atom_intern( - conf_get_str(conf, CONF_ctrlshiftcv_custom), FALSE); + conf_get_str(conf, CONF_ctrlshiftcv_custom), false); struct clipboard_state *state = clipboard_from_atom(inst, atom); if (state) { inst->clipboard_ctrlshiftins = state->clipboard; @@ -4724,7 +4724,7 @@ static void after_change_settings_dialog(void *vctx, int retval) } } - need_size = FALSE; + need_size = false; /* * If the scrollbar needs to be shown, hidden, or moved @@ -4733,7 +4733,7 @@ static void after_change_settings_dialog(void *vctx, int retval) if (conf_get_int(oldconf, CONF_scrollbar) != conf_get_int(newconf, CONF_scrollbar)) { show_scrollbar(inst, conf_get_int(newconf, CONF_scrollbar)); - need_size = TRUE; + need_size = true; } if (conf_get_int(oldconf, CONF_scrollbar_on_left) != conf_get_int(newconf, CONF_scrollbar_on_left)) { @@ -4781,11 +4781,11 @@ static void after_change_settings_dialog(void *vctx, int retval) create_message_box( inst->window, "Font setup error", msgboxtext, string_width("Could not change fonts in terminal window:"), - FALSE, &buttons_ok, trivial_post_dialog_fn, NULL); + false, &buttons_ok, trivial_post_dialog_fn, NULL); sfree(msgboxtext); sfree(errmsg); } else { - need_size = TRUE; + need_size = true; } } @@ -4910,9 +4910,9 @@ void restart_session_menuitem(GtkMenuItem *item, gpointer data) if (!inst->backend) { logevent(inst->logctx, "----- Session restarted -----"); - term_pwron(inst->term, FALSE); + term_pwron(inst->term, false); start_backend(inst); - inst->exited = FALSE; + inst->exited = false; } } @@ -4973,7 +4973,7 @@ static void update_savedsess_menu(GtkMenuItem *menuitem, gpointer data) gtk_container_foreach(GTK_CONTAINER(inst->sessionsmenu), (GtkCallback)gtk_widget_destroy, NULL); - get_sesslist(&sesslist, TRUE); + get_sesslist(&sesslist, true); /* skip sesslist.sessions[0] == Default Settings */ for (i = 1; i < sesslist.nsessions; i++) { GtkWidget *menuitem = @@ -4992,11 +4992,11 @@ static void update_savedsess_menu(GtkMenuItem *menuitem, gpointer data) if (sesslist.nsessions <= 1) { GtkWidget *menuitem = gtk_menu_item_new_with_label("(No sessions)"); - gtk_widget_set_sensitive(menuitem, FALSE); + gtk_widget_set_sensitive(menuitem, false); gtk_container_add(GTK_CONTAINER(inst->sessionsmenu), menuitem); gtk_widget_show(menuitem); } - get_sesslist(&sesslist, FALSE); /* free up */ + get_sesslist(&sesslist, false); /* free up */ } void set_window_icon(GtkWidget *window, const char *const *const *icon, @@ -5125,7 +5125,7 @@ static void start_backend(GtkFrontend *inst) if (error) { char *msg = dupprintf("Unable to open connection to %s:\n%s", conf_dest(inst->conf), error); - inst->exited = TRUE; + inst->exited = true; seat_connection_fatal(&inst->seat, msg); sfree(msg); return; @@ -5146,7 +5146,7 @@ static void start_backend(GtkFrontend *inst) inst->ldisc = ldisc_create(inst->conf, inst->term, inst->backend, &inst->seat); - gtk_widget_set_sensitive(inst->restartitem, FALSE); + gtk_widget_set_sensitive(inst->restartitem, false); } #if GTK_CHECK_VERSION(2,0,0) @@ -5227,7 +5227,7 @@ void new_session_window(Conf *conf, const char *geometry_string) #if GTK_CHECK_VERSION(3,4,0) inst->cumulative_scroll = 0.0; #endif - inst->drawing_area_setup_needed = TRUE; + inst->drawing_area_setup_needed = true; inst->termwin.vt = >k_termwin_vt; inst->seat.vt = >k_seat_vt; @@ -5247,7 +5247,7 @@ void new_session_window(Conf *conf, const char *geometry_string) if (flags & (XValue | YValue)) { inst->xpos = x; inst->ypos = y; - inst->gotpos = TRUE; + inst->gotpos = true; inst->gravity = ((flags & XNegative ? 1 : 0) | (flags & YNegative ? 2 : 0)); } @@ -5255,11 +5255,11 @@ void new_session_window(Conf *conf, const char *geometry_string) #endif if (!compound_text_atom) - compound_text_atom = gdk_atom_intern("COMPOUND_TEXT", FALSE); + compound_text_atom = gdk_atom_intern("COMPOUND_TEXT", false); if (!utf8_string_atom) - utf8_string_atom = gdk_atom_intern("UTF8_STRING", FALSE); + utf8_string_atom = gdk_atom_intern("UTF8_STRING", false); if (!clipboard_atom) - clipboard_atom = gdk_atom_intern("CLIPBOARD", FALSE); + clipboard_atom = gdk_atom_intern("CLIPBOARD", false); inst->area = gtk_drawing_area_new(); gtk_widget_set_name(GTK_WIDGET(inst->area), "drawing-area"); @@ -5324,17 +5324,17 @@ void new_session_window(Conf *conf, const char *geometry_string) inst->sbar_adjust = GTK_ADJUSTMENT(gtk_adjustment_new(0,0,0,0,0,0)); inst->sbar = gtk_vscrollbar_new(inst->sbar_adjust); - inst->hbox = GTK_BOX(gtk_hbox_new(FALSE, 0)); + inst->hbox = GTK_BOX(gtk_hbox_new(false, 0)); /* * We always create the scrollbar; it remains invisible if * unwanted, so we can pop it up quickly if it suddenly becomes * desirable. */ if (conf_get_int(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); + 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)) - gtk_box_pack_start(inst->hbox, inst->sbar, FALSE, FALSE, 0); + gtk_box_pack_start(inst->hbox, inst->sbar, false, false, 0); gtk_container_add(GTK_CONTAINER(inst->window), GTK_WIDGET(inst->hbox)); @@ -5500,7 +5500,7 @@ void new_session_window(Conf *conf, const char *geometry_string) MKMENUITEM("New Session...", new_session_menuitem); MKMENUITEM("Restart Session", restart_session_menuitem); inst->restartitem = menuitem; - gtk_widget_set_sensitive(inst->restartitem, FALSE); + gtk_widget_set_sensitive(inst->restartitem, false); MKMENUITEM("Duplicate Session", dup_session_menuitem); if (saved_sessions) { inst->sessionsmenu = gtk_menu_new(); @@ -5557,7 +5557,7 @@ void new_session_window(Conf *conf, const char *geometry_string) term_size(inst->term, inst->height, inst->width, conf_get_int(inst->conf, CONF_savelines)); - inst->exited = FALSE; + inst->exited = false; start_backend(inst); diff --git a/unix/unix.h b/unix/unix.h index 11f9b51d..48e727b6 100644 --- a/unix/unix.h +++ b/unix/unix.h @@ -133,7 +133,7 @@ unsigned long getticks(void); * is _not_ implicit but requires a specific UI action. This is at * odds with all other PuTTY front ends' defaults, but on OS X there * is no multi-decade precedent for PuTTY working the other way. */ -#define CLIPUI_DEFAULT_AUTOCOPY FALSE +#define CLIPUI_DEFAULT_AUTOCOPY false #define CLIPUI_DEFAULT_MOUSE CLIPUI_IMPLICIT #define CLIPUI_DEFAULT_INS CLIPUI_EXPLICIT #define MENU_CLIPBOARD CLIP_CLIPBOARD @@ -146,7 +146,7 @@ unsigned long getticks(void); #define CLIPNAME_EXPLICIT_OBJECT "CLIPBOARD" /* These defaults are the ones Unix PuTTY has historically had since * it was first thought of in 2002 */ -#define CLIPUI_DEFAULT_AUTOCOPY FALSE +#define CLIPUI_DEFAULT_AUTOCOPY false #define CLIPUI_DEFAULT_MOUSE CLIPUI_IMPLICIT #define CLIPUI_DEFAULT_INS CLIPUI_IMPLICIT #define MENU_CLIPBOARD CLIP_CLIPBOARD diff --git a/unix/ux_x11.c b/unix/ux_x11.c index 4df66d15..fb5c4949 100644 --- a/unix/ux_x11.c +++ b/unix/ux_x11.c @@ -22,13 +22,13 @@ void platform_get_x11_auth(struct X11Display *disp, Conf *conf) /* * Find the .Xauthority file. */ - needs_free = FALSE; + needs_free = false; xauthfile = getenv("XAUTHORITY"); if (!xauthfile) { xauthfile = getenv("HOME"); if (xauthfile) { xauthfile = dupcat(xauthfile, "/.Xauthority", NULL); - needs_free = TRUE; + needs_free = true; } } @@ -39,7 +39,7 @@ void platform_get_x11_auth(struct X11Display *disp, Conf *conf) } } -const int platform_uses_x11_unix_by_default = TRUE; +const int platform_uses_x11_unix_by_default = true; int platform_make_x11_server(Plug *plug, const char *progname, int mindisp, const char *screen_number_suffix, @@ -71,7 +71,7 @@ int platform_make_x11_server(Plug *plug, const char *progname, int mindisp, int addrtype = ADDRTYPE_IPV4; sockets[nsockets] = new_listener( - NULL, tcp_port, plug, FALSE, conf, addrtype); + NULL, tcp_port, plug, false, conf, addrtype); err = sk_socket_error(sockets[nsockets]); if (!err) { diff --git a/unix/uxagentc.c b/unix/uxagentc.c index 1e804a73..31829eb7 100644 --- a/unix/uxagentc.c +++ b/unix/uxagentc.c @@ -19,8 +19,8 @@ int agent_exists(void) { const char *p = getenv("SSH_AUTH_SOCK"); if (p && *p) - return TRUE; - return FALSE; + return true; + return false; } static tree234 *agent_pending_queries; diff --git a/unix/uxcons.c b/unix/uxcons.c index b44d34b8..e47a8003 100644 --- a/unix/uxcons.c +++ b/unix/uxcons.c @@ -21,7 +21,7 @@ #include "storage.h" #include "ssh.h" -int console_batch_mode = FALSE; +int console_batch_mode = false; static struct termios orig_termios_stderr; static int stderr_is_a_tty; @@ -30,7 +30,7 @@ void stderr_tty_init() { /* Ensure that if stderr is a tty, we can get it back to a sane state. */ if ((flags & FLAG_STDERR_TTY) && isatty(STDERR_FILENO)) { - stderr_is_a_tty = TRUE; + stderr_is_a_tty = true; tcgetattr(STDERR_FILENO, &orig_termios_stderr); } } diff --git a/unix/uxmisc.c b/unix/uxmisc.c index 320a6c9e..cfdc5598 100644 --- a/unix/uxmisc.c +++ b/unix/uxmisc.c @@ -343,7 +343,7 @@ int open_for_write_would_lose_data(const Filename *fn) * open the file for writing and report _that_ error, which is * likely to be more to the point. */ - return FALSE; + return false; } /* @@ -360,8 +360,8 @@ int open_for_write_would_lose_data(const Filename *fn) * information.) */ if (S_ISREG(st.st_mode) && st.st_size > 0) { - return TRUE; + return true; } - return FALSE; + return false; } diff --git a/unix/uxnet.c b/unix/uxnet.c index 92311fc9..9ca98faf 100644 --- a/unix/uxnet.c +++ b/unix/uxnet.c @@ -297,15 +297,15 @@ static int sk_nextaddr(SockAddr *addr, SockAddrStep *step) #ifndef NO_IPV6 if (step->ai && step->ai->ai_next) { step->ai = step->ai->ai_next; - return TRUE; + return true; } else - return FALSE; + return false; #else if (step->curraddr+1 < addr->naddresses) { step->curraddr++; - return TRUE; + return true; } else { - return FALSE; + return false; } #endif } @@ -365,9 +365,9 @@ static SockAddr sk_extractaddr_tmp( int sk_addr_needs_port(SockAddr *addr) { if (addr->superfamily == UNRESOLVED || addr->superfamily == UNIX) { - return FALSE; + return false; } else { - return TRUE; + return true; } } @@ -392,9 +392,9 @@ static int sockaddr_is_loopback(struct sockaddr *sa) return IN6_IS_ADDR_LOOPBACK(&u->sin6.sin6_addr); #endif case AF_UNIX: - return TRUE; + return true; default: - return FALSE; + return false; } } @@ -452,7 +452,7 @@ void sk_addrcopy(SockAddr *addr, char *buf) memcpy(buf, &((struct sockaddr_in6 *)step.ai->ai_addr)->sin6_addr, sizeof(struct in6_addr)); else - assert(FALSE); + assert(false); #else struct in_addr a; @@ -536,9 +536,9 @@ static Socket *sk_net_accept(accept_ctx_t ctx, Plug *plug) ret->frozen = 1; ret->localhost_only = 0; /* unused, but best init anyway */ ret->pending_error = 0; - ret->oobpending = FALSE; + ret->oobpending = false; ret->outgoingeof = EOF_NO; - ret->incomingeof = FALSE; + ret->incomingeof = false; ret->listener = 0; ret->parent = ret->child = NULL; ret->addr = NULL; @@ -601,7 +601,7 @@ static int try_connect(NetSocket *sock) cloexec(s); if (sock->oobinline) { - int b = TRUE; + int b = true; if (setsockopt(s, SOL_SOCKET, SO_OOBINLINE, (void *) &b, sizeof(b)) < 0) { err = errno; @@ -611,7 +611,7 @@ static int try_connect(NetSocket *sock) } if (sock->nodelay) { - int b = TRUE; + int b = true; if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (void *) &b, sizeof(b)) < 0) { err = errno; @@ -621,7 +621,7 @@ static int try_connect(NetSocket *sock) } if (sock->keepalive) { - int b = TRUE; + int b = true; if (setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (void *) &b, sizeof(b)) < 0) { err = errno; @@ -779,9 +779,9 @@ Socket *sk_new(SockAddr *addr, int port, int privport, int oobinline, ret->localhost_only = 0; /* unused, but best init anyway */ ret->pending_error = 0; ret->parent = ret->child = NULL; - ret->oobpending = FALSE; + ret->oobpending = false; ret->outgoingeof = EOF_NO; - ret->incomingeof = FALSE; + ret->incomingeof = false; ret->listener = 0; ret->addr = addr; START_STEP(ret->addr, ret->step); @@ -833,9 +833,9 @@ Socket *sk_newlistener(const char *srcaddr, int port, Plug *plug, ret->localhost_only = local_host_only; ret->pending_error = 0; ret->parent = ret->child = NULL; - ret->oobpending = FALSE; + ret->oobpending = false; ret->outgoingeof = EOF_NO; - ret->incomingeof = FALSE; + ret->incomingeof = false; ret->listener = 1; ret->addr = NULL; ret->s = -1; @@ -1127,7 +1127,7 @@ void try_send(NetSocket *s) /* * Perfectly normal: we've sent all we can for the moment. */ - s->writable = FALSE; + s->writable = false; return; } else { /* @@ -1312,7 +1312,7 @@ static void net_select_result(int fd, int event) * when we get called for the readability event (which * should also occur). */ - s->oobpending = TRUE; + s->oobpending = true; break; case 1: /* readable; also acceptance */ if (s->listener) { @@ -1361,7 +1361,7 @@ static void net_select_result(int fd, int event) if (s->oobinline && s->oobpending) { atmark = 1; if (ioctl(s->s, SIOCATMARK, &atmark) == 0 && atmark) - s->oobpending = FALSE; /* clear this indicator */ + s->oobpending = false; /* clear this indicator */ } else atmark = 1; @@ -1375,7 +1375,7 @@ static void net_select_result(int fd, int event) if (ret < 0) { plug_closing(s->plug, strerror(errno), errno, 0); } else if (0 == ret) { - s->incomingeof = TRUE; /* stop trying to read now */ + s->incomingeof = true; /* stop trying to read now */ uxsel_tell(s); plug_closing(s->plug, NULL, 0, 0); } else { @@ -1668,12 +1668,12 @@ Socket *new_unix_listener(SockAddr *listenaddr, Plug *plug) ret->writable = 0; /* to start with */ ret->sending_oob = 0; ret->frozen = 0; - ret->localhost_only = TRUE; + ret->localhost_only = true; ret->pending_error = 0; ret->parent = ret->child = NULL; - ret->oobpending = FALSE; + ret->oobpending = false; ret->outgoingeof = EOF_NO; - ret->incomingeof = FALSE; + ret->incomingeof = false; ret->listener = 1; ret->addr = listenaddr; ret->s = -1; diff --git a/unix/uxpeer.c b/unix/uxpeer.c index 57bcfb88..8aaa3579 100644 --- a/unix/uxpeer.c +++ b/unix/uxpeer.c @@ -25,8 +25,8 @@ int so_peercred(int fd, int *pid, int *uid, int *gid) *pid = cr.pid; *uid = cr.uid; *gid = cr.gid; - return TRUE; + return true; } #endif - return FALSE; + return false; } diff --git a/unix/uxpgnt.c b/unix/uxpgnt.c index ca1be2fe..ac536843 100644 --- a/unix/uxpgnt.c +++ b/unix/uxpgnt.c @@ -113,7 +113,7 @@ void keylist_update(void) const char *const appname = "Pageant"; -static int time_to_die = FALSE; +static int time_to_die = false; /* Stub functions to permit linking against x11fwd.c. These never get * used, because in LIFE_X11 mode we connect to the X server using a @@ -121,29 +121,29 @@ static int time_to_die = FALSE; * forwarding too. */ void chan_remotely_opened_confirmation(Channel *chan) { } void chan_remotely_opened_failure(Channel *chan, const char *err) { } -int chan_default_want_close(Channel *chan, int s, int r) { return FALSE; } -int chan_no_exit_status(Channel *ch, int s) { return FALSE; } +int chan_default_want_close(Channel *chan, int s, int r) { return false; } +int chan_no_exit_status(Channel *ch, int s) { return false; } int chan_no_exit_signal(Channel *ch, ptrlen s, int c, ptrlen m) -{ return FALSE; } +{ return false; } int chan_no_exit_signal_numeric(Channel *ch, int s, int c, ptrlen m) -{ return FALSE; } -int chan_no_run_shell(Channel *chan) { return FALSE; } -int chan_no_run_command(Channel *chan, ptrlen command) { return FALSE; } -int chan_no_run_subsystem(Channel *chan, ptrlen subsys) { return FALSE; } +{ return false; } +int chan_no_run_shell(Channel *chan) { return false; } +int chan_no_run_command(Channel *chan, ptrlen command) { return false; } +int chan_no_run_subsystem(Channel *chan, ptrlen subsys) { return false; } int chan_no_enable_x11_forwarding( Channel *chan, int oneshot, ptrlen authproto, ptrlen authdata, - unsigned screen_number) { return FALSE; } -int chan_no_enable_agent_forwarding(Channel *chan) { return FALSE; } + unsigned screen_number) { return false; } +int chan_no_enable_agent_forwarding(Channel *chan) { return false; } int chan_no_allocate_pty( Channel *chan, ptrlen termtype, unsigned width, unsigned height, unsigned pixwidth, unsigned pixheight, struct ssh_ttymodes modes) -{ return FALSE; } -int chan_no_set_env(Channel *chan, ptrlen var, ptrlen value) { return FALSE; } -int chan_no_send_break(Channel *chan, unsigned length) { return FALSE; } -int chan_no_send_signal(Channel *chan, ptrlen signame) { return FALSE; } +{ return false; } +int chan_no_set_env(Channel *chan, ptrlen var, ptrlen value) { return false; } +int chan_no_send_break(Channel *chan, unsigned length) { return false; } +int chan_no_send_signal(Channel *chan, ptrlen signame) { return false; } int chan_no_change_window_size( Channel *chan, unsigned width, unsigned height, - unsigned pixwidth, unsigned pixheight) { return FALSE; } + unsigned pixwidth, unsigned pixheight) { return false; } void chan_no_request_response(Channel *chan, int success) {} /* @@ -159,7 +159,7 @@ static void x11_sent(Plug *plug, int bufsize) {} static void x11_closing(Plug *plug, const char *error_msg, int error_code, int calling_back) { - time_to_die = TRUE; + time_to_die = true; } struct X11Connection { Plug plug; @@ -306,10 +306,10 @@ int have_controlling_tty(void) perror("/dev/tty: open"); exit(1); } - return FALSE; + return false; } else { close(fd); - return TRUE; + return true; } } @@ -326,9 +326,9 @@ static char *askpass_tty(const char *prompt) { int ret; prompts_t *p = new_prompts(); - p->to_server = FALSE; + p->to_server = false; p->name = dupstr("Pageant passphrase prompt"); - add_prompt(p, dupcat(prompt, ": ", (const char *)NULL), FALSE); + add_prompt(p, dupcat(prompt, ": ", (const char *)NULL), false); ret = console_get_userpass_input(p); assert(ret >= 0); @@ -400,7 +400,7 @@ static int unix_add_keyfile(const char *filename_str) int status, ret; char *err; - ret = TRUE; + ret = true; /* * Try without a passphrase. @@ -410,7 +410,7 @@ static int unix_add_keyfile(const char *filename_str) goto cleanup; } else if (status == PAGEANT_ACTION_FAILURE) { fprintf(stderr, "pageant: %s: %s\n", filename_str, err); - ret = FALSE; + ret = false; goto cleanup; } @@ -437,7 +437,7 @@ static int unix_add_keyfile(const char *filename_str) goto cleanup; } else if (status == PAGEANT_ACTION_FAILURE) { fprintf(stderr, "pageant: %s: %s\n", filename_str, err); - ret = FALSE; + ret = false; goto cleanup; } } @@ -476,9 +476,9 @@ int match_fingerprint_string(const char *string, const char *fingerprint) while (*string == ':') string++; while (*hash == ':') hash++; if (!*string) - return TRUE; + return true; if (tolower((unsigned char)*string) != tolower((unsigned char)*hash)) - return FALSE; + return false; string++; hash++; } @@ -502,8 +502,8 @@ struct pageant_pubkey *find_key(const char *string, char **retstr) { struct key_find_ctx actx, *ctx = &actx; struct pageant_pubkey key_in, *key_ret; - int try_file = TRUE, try_fp = TRUE, try_comment = TRUE; - int file_errors = FALSE; + int try_file = true, try_fp = true, try_comment = true; + int file_errors = false; /* * Trim off disambiguating prefixes telling us how to interpret @@ -511,17 +511,17 @@ struct pageant_pubkey *find_key(const char *string, char **retstr) */ if (!strncmp(string, "file:", 5)) { string += 5; - try_fp = try_comment = FALSE; - file_errors = TRUE; /* also report failure to load the file */ + try_fp = try_comment = false; + file_errors = true; /* also report failure to load the file */ } else if (!strncmp(string, "comment:", 8)) { string += 8; - try_file = try_fp = FALSE; + try_file = try_fp = false; } else if (!strncmp(string, "fp:", 3)) { string += 3; - try_file = try_comment = FALSE; + try_file = try_comment = false; } else if (!strncmp(string, "fingerprint:", 12)) { string += 12; - try_file = try_comment = FALSE; + try_file = try_comment = false; } /* @@ -632,7 +632,7 @@ void run_client(void) { const struct cmdline_key_action *act; struct pageant_pubkey *key; - int errors = FALSE; + int errors = false; char *retstr; if (!agent_exists()) { @@ -644,14 +644,14 @@ void run_client(void) switch (act->action) { case KEYACT_CLIENT_ADD: if (!unix_add_keyfile(act->filename)) - errors = TRUE; + errors = true; break; case KEYACT_CLIENT_LIST: if (pageant_enum_keys(key_list_callback, NULL, &retstr) == PAGEANT_ACTION_FAILURE) { fprintf(stderr, "pageant: listing keys: %s\n", retstr); sfree(retstr); - errors = TRUE; + errors = true; } break; case KEYACT_CLIENT_DEL: @@ -661,7 +661,7 @@ void run_client(void) fprintf(stderr, "pageant: deleting key '%s': %s\n", act->filename, retstr); sfree(retstr); - errors = TRUE; + errors = true; } if (key) pageant_pubkey_free(key); @@ -673,7 +673,7 @@ void run_client(void) fprintf(stderr, "pageant: finding key '%s': %s\n", act->filename, retstr); sfree(retstr); - errors = TRUE; + errors = true; } else { FILE *fp = stdout; /* FIXME: add a -o option? */ @@ -702,7 +702,7 @@ void run_client(void) if (pageant_delete_all_keys(&retstr) == PAGEANT_ACTION_FAILURE) { fprintf(stderr, "pageant: deleting all keys: %s\n", retstr); sfree(retstr); - errors = TRUE; + errors = true; } break; default: @@ -734,7 +734,7 @@ void run_agent(void) int fd; int i, fdcount, fdsize, fdstate; int termination_pid = -1; - int errors = FALSE; + int errors = false; Conf *conf; const struct cmdline_key_action *act; @@ -749,7 +749,7 @@ void run_agent(void) for (act = keyact_head; act; act = act->next) { assert(act->action == KEYACT_AGENT_LOAD); if (!unix_add_keyfile(act->filename)) - errors = TRUE; + errors = true; } if (errors) exit(1); @@ -811,13 +811,13 @@ void run_agent(void) smemclr(greeting, greetinglen); sfree(greeting); - pageant_fork_and_print_env(FALSE); + pageant_fork_and_print_env(false); } else if (life == LIFE_TTY) { schedule_timer(TTY_LIFE_POLL_INTERVAL, tty_life_timer, &dummy_timer_ctx); - pageant_fork_and_print_env(TRUE); + pageant_fork_and_print_env(true); } else if (life == LIFE_PERM) { - pageant_fork_and_print_env(FALSE); + pageant_fork_and_print_env(false); } else if (life == LIFE_DEBUG) { pageant_print_env(getpid()); pageant_logfp = stdout; @@ -840,8 +840,8 @@ void run_agent(void) perror("fork"); exit(1); } else if (pid == 0) { - setenv("SSH_AUTH_SOCK", socketname, TRUE); - setenv("SSH_AGENT_PID", dupprintf("%d", (int)agentpid), TRUE); + setenv("SSH_AUTH_SOCK", socketname, true); + setenv("SSH_AGENT_PID", dupprintf("%d", (int)agentpid), true); execvp(exec_args[0], exec_args); perror("exec"); _exit(127); @@ -945,7 +945,7 @@ void run_agent(void) * clean up and leave. */ if (!have_controlling_tty()) { - time_to_die = TRUE; + time_to_die = true; break; } } @@ -977,7 +977,7 @@ void run_agent(void) if (pid <= 0) break; if (pid == termination_pid) - time_to_die = TRUE; + time_to_die = true; } } @@ -998,7 +998,7 @@ void run_agent(void) int main(int argc, char **argv) { - int doing_opts = TRUE; + int doing_opts = true; keyact curr_keyact = KEYACT_AGENT_LOAD; const char *standalone_askpass_prompt = NULL; @@ -1063,7 +1063,7 @@ int main(int argc, char **argv) exit(1); } } else if (!strcmp(p, "--")) { - doing_opts = FALSE; + doing_opts = false; } } else { /* @@ -1120,19 +1120,19 @@ int main(int argc, char **argv) * actions of KEYACT_AGENT_* type. */ { - int has_agent_actions = FALSE; - int has_client_actions = FALSE; - int has_lifetime = FALSE; + int has_agent_actions = false; + int has_client_actions = false; + int has_lifetime = false; const struct cmdline_key_action *act; for (act = keyact_head; act; act = act->next) { if (is_agent_action(act->action)) - has_agent_actions = TRUE; + has_agent_actions = true; else - has_client_actions = TRUE; + has_client_actions = true; } if (life != LIFE_UNSPEC) - has_lifetime = TRUE; + has_lifetime = true; if (has_lifetime && has_client_actions) { fprintf(stderr, "pageant: client key actions (-a, -d, -D, -l, -L)" diff --git a/unix/uxplink.c b/unix/uxplink.c index 6b7da66c..dad746d9 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -38,7 +38,7 @@ void cmdline_error(const char *fmt, ...) exit(1); } -static int local_tty = FALSE; /* do we have a local tty? */ +static int local_tty = false; /* do we have a local tty? */ static Backend *backend; static Conf *conf; @@ -79,7 +79,7 @@ char *x_get_default(const char *key) } int term_ldisc(Terminal *term, int mode) { - return FALSE; + return false; } static void plink_echoedit_update(Seat *seat, int echo, int edit) { @@ -353,11 +353,11 @@ static int plink_output(Seat *seat, int is_stderr, const void *data, int len) { if (is_stderr) { bufchain_add(&stderr_data, data, len); - return try_output(TRUE); + return try_output(true); } else { assert(outgoingeof == EOF_NO); bufchain_add(&stdout_data, data, len); - return try_output(FALSE); + return try_output(false); } } @@ -365,8 +365,8 @@ static int plink_eof(Seat *seat) { assert(outgoingeof == EOF_NO); outgoingeof = EOF_PENDING; - try_output(FALSE); - return FALSE; /* do not respond to incoming EOF with outgoing */ + try_output(false); + return false; /* do not respond to incoming EOF with outgoing */ } static int plink_get_userpass_input(Seat *seat, prompts_t *p, bufchain *input) @@ -546,10 +546,10 @@ static void version(void) void frontend_net_error_pending(void) {} -const int share_can_be_downstream = TRUE; -const int share_can_be_upstream = TRUE; +const int share_can_be_downstream = true; +const int share_can_be_upstream = true; -const int buildinfo_gtk_relevant = FALSE; +const int buildinfo_gtk_relevant = false; int main(int argc, char **argv) { @@ -560,7 +560,7 @@ int main(int argc, char **argv) int exitcode; int errors; int use_subsystem = 0; - int just_test_share_exists = FALSE; + int just_test_share_exists = false; unsigned long now; struct winsize size; const struct BackendVtable *backvt; @@ -591,7 +591,7 @@ int main(int argc, char **argv) */ conf = conf_new(); do_defaults(NULL, conf); - loaded_session = FALSE; + loaded_session = false; default_protocol = conf_get_int(conf, CONF_protocol); default_port = conf_get_int(conf, CONF_port); errors = 0; @@ -645,7 +645,7 @@ int main(int argc, char **argv) provide_xrm_string(*++argv); } } else if (!strcmp(p, "-shareexists")) { - just_test_share_exists = TRUE; + just_test_share_exists = true; } else if (!strcmp(p, "-fuzznet")) { conf_set_int(conf, CONF_proxy_type, PROXY_FUZZ); conf_set_str(conf, CONF_proxy_telnet_command, "%host"); @@ -674,7 +674,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_int(conf, CONF_nopty, true); /* command => no tty */ break; /* done with cmdline */ } else { @@ -713,7 +713,7 @@ int main(int argc, char **argv) * Apply subsystem status. */ if (use_subsystem) - conf_set_int(conf, CONF_ssh_subsys, TRUE); + conf_set_int(conf, CONF_ssh_subsys, true); if (!*conf_get_str(conf, CONF_remote_cmd) && !*conf_get_str(conf, CONF_remote_cmd2) && @@ -772,7 +772,7 @@ int main(int argc, char **argv) !conf_get_int(conf, CONF_x11_forward) && !conf_get_int(conf, CONF_agentfwd) && !conf_get_str_nthstrkey(conf, CONF_portfwd, 0)) - conf_set_int(conf, CONF_ssh_simple, TRUE); + conf_set_int(conf, CONF_ssh_simple, true); if (just_test_share_exists) { if (!backvt->test_for_upstream) { @@ -823,7 +823,7 @@ int main(int argc, char **argv) local_tty = (tcgetattr(STDIN_FILENO, &orig_termios) == 0); atexit(cleanup_termios); seat_echoedit_update(plink_seat, 1, 1); - sending = FALSE; + sending = false; now = GETTICKCOUNT(); while (1) { @@ -958,7 +958,7 @@ int main(int argc, char **argv) exit(1); } else if (ret == 0) { backend_special(backend, SS_EOF, 0); - sending = FALSE; /* send nothing further after this */ + sending = false; /* send nothing further after this */ } else { if (local_tty) from_tty(buf, ret); @@ -969,11 +969,11 @@ int main(int argc, char **argv) } if (FD_ISSET(STDOUT_FILENO, &wset)) { - backend_unthrottle(backend, try_output(FALSE)); + backend_unthrottle(backend, try_output(false)); } if (FD_ISSET(STDERR_FILENO, &wset)) { - backend_unthrottle(backend, try_output(TRUE)); + backend_unthrottle(backend, try_output(true)); } run_toplevel_callbacks(); diff --git a/unix/uxpterm.c b/unix/uxpterm.c index c7325722..b4d66924 100644 --- a/unix/uxpterm.c +++ b/unix/uxpterm.c @@ -11,7 +11,7 @@ const char *const appname = "pterm"; const int use_event_log = 0; /* pterm doesn't need it */ const int new_session = 0, saved_sessions = 0; /* or these */ const int dup_check_launchable = 0; /* no need to check host name in conf */ -const int use_pty_argv = TRUE; +const int use_pty_argv = true; const struct BackendVtable *select_backend(Conf *conf) { diff --git a/unix/uxpty.c b/unix/uxpty.c index b3fe0f83..6b9f3555 100644 --- a/unix/uxpty.c +++ b/unix/uxpty.c @@ -285,10 +285,10 @@ static void sigchld_handler(int signum) static void pty_setup_sigchld_handler(void) { - static int setup = FALSE; + static int setup = false; if (!setup) { putty_signal(SIGCHLD, sigchld_handler); - setup = TRUE; + setup = true; } } @@ -455,7 +455,7 @@ void pty_pre_init(void) pty_setup_sigchld_handler(); pty->master_fd = pty->slave_fd = -1; #ifndef OMIT_UTMP - pty_stamped_utmp = FALSE; + pty_stamped_utmp = false; #endif if (geteuid() != getuid() || getegid() != getgid()) { @@ -597,7 +597,7 @@ static void pty_real_select_result(Pty *pty, int fd, int event, int status) { char buf[4096]; int ret; - int finished = FALSE; + int finished = false; if (event < 0) { /* @@ -608,7 +608,7 @@ static void pty_real_select_result(Pty *pty, int fd, int event, int status) /* * The primary child process died. */ - pty->child_dead = TRUE; + pty->child_dead = true; del234(ptys_by_pid, pty); pty->exit_code = status; @@ -625,7 +625,7 @@ static void pty_real_select_result(Pty *pty, int fd, int event, int status) * or make configurable if necessary. */ if (pty->master_fd >= 0) - finished = TRUE; + finished = true; } } else { if (event == 1) { @@ -667,7 +667,7 @@ static void pty_real_select_result(Pty *pty, int fd, int event, int status) * usage model would precisely _not_ be for the * pterm window to hang around! */ - finished = TRUE; + finished = true; pty_try_wait(); /* one last effort to collect exit code */ if (!pty->child_dead) pty->exit_code = 0; @@ -696,7 +696,7 @@ static void pty_real_select_result(Pty *pty, int fd, int event, int status) pty_close(pty); - pty->finished = TRUE; + pty->finished = true; /* * This is a slight layering-violation sort of hack: only @@ -862,7 +862,7 @@ Backend *pty_backend_create( pty = new_pty_struct(); pty->master_fd = pty->slave_fd = -1; #ifndef OMIT_UTMP - pty_stamped_utmp = FALSE; + pty_stamped_utmp = false; #endif } for (i = 0; i < 6; i++) @@ -1193,8 +1193,8 @@ Backend *pty_backend_create( _exit(127); } else { pty->child_pid = pid; - pty->child_dead = FALSE; - pty->finished = FALSE; + pty->child_dead = false; + pty->finished = false; if (pty->slave_fd > 0) close(pty->slave_fd); if (!ptys_by_pid) @@ -1248,7 +1248,7 @@ static const char *pty_init(Seat *seat, Backend **backend_handle, cmd = pty_argv[0]; *backend_handle= pty_backend_create( - seat, logctx, conf, pty_argv, cmd, modes, FALSE); + seat, logctx, conf, pty_argv, cmd, modes, false); *realhost = dupstr(""); return NULL; } @@ -1327,7 +1327,7 @@ static void pty_try_write(Pty *pty) uxsel_del(pty->master_i); close(pty->master_i); pty->master_i = -1; - pty->pending_eof = FALSE; + pty->pending_eof = false; } pty_uxsel_setup(pty); @@ -1427,7 +1427,7 @@ static void pty_special(Backend *be, SessionSpecialCode code, int arg) if (code == SS_EOF) { if (pty->master_i >= 0 && pty->master_i != pty->master_fd) { - pty->pending_eof = TRUE; + pty->pending_eof = true; pty_try_write(pty); } return; @@ -1473,7 +1473,7 @@ static const SessionSpecial *pty_get_specials(Backend *be) static int pty_connected(Backend *be) { /* Pty *pty = container_of(be, Pty, backend); */ - return TRUE; + return true; } static int pty_sendok(Backend *be) diff --git a/unix/uxputty.c b/unix/uxputty.c index fdfa6c21..a583f878 100644 --- a/unix/uxputty.c +++ b/unix/uxputty.c @@ -20,7 +20,7 @@ /* * Stubs to avoid uxpty.c needing to be linked in. */ -const int use_pty_argv = FALSE; +const int use_pty_argv = false; char **pty_argv; /* never used */ char *pty_osx_envrestore_prefix; @@ -48,7 +48,7 @@ const struct BackendVtable *select_backend(Conf *conf) void initial_config_box(Conf *conf, post_dialog_fn_t after, void *afterctx) { char *title = dupcat(appname, " Configuration", NULL); - create_config_box(title, conf, FALSE, 0, after, afterctx); + create_config_box(title, conf, false, 0, after, afterctx); sfree(title); } @@ -73,8 +73,8 @@ char *platform_get_x_display(void) { return dupstr(display); } -const int share_can_be_downstream = TRUE; -const int share_can_be_upstream = TRUE; +const int share_can_be_downstream = true; +const int share_can_be_upstream = true; void setup(int single) { diff --git a/unix/uxser.c b/unix/uxser.c index 2f9251b7..5be7cdf8 100644 --- a/unix/uxser.c +++ b/unix/uxser.c @@ -294,7 +294,7 @@ static const char *serial_init(Seat *seat, Backend **backend_handle, serial->seat = seat; serial->logctx = logctx; - serial->finished = FALSE; + serial->finished = false; serial->inbufsize = 0; bufchain_init(&serial->output_data); @@ -361,7 +361,7 @@ static void serial_select_result(int fd, int event) Serial *serial; char buf[4096]; int ret; - int finished = FALSE; + int finished = false; serial = find234(serial_by_fd, &fd, serial_find_by_fd); @@ -377,7 +377,7 @@ static void serial_select_result(int fd, int event) * to the idea that there might be two-way devices we * can treat _like_ serial ports which can return EOF. */ - finished = TRUE; + finished = true; } else if (ret < 0) { #ifdef EAGAIN if (errno == EAGAIN) @@ -403,7 +403,7 @@ static void serial_select_result(int fd, int event) if (finished) { serial_close(serial); - serial->finished = TRUE; + serial->finished = true; seat_notify_remote_exit(serial->seat); } diff --git a/unix/uxserver.c b/unix/uxserver.c index dbf5815a..c42afc1e 100644 --- a/unix/uxserver.c +++ b/unix/uxserver.c @@ -173,7 +173,7 @@ unsigned auth_methods(AuthPolicy *ap) } int auth_none(AuthPolicy *ap, ptrlen username) { - return FALSE; + return false; } int auth_password(AuthPolicy *ap, ptrlen username, ptrlen password, ptrlen *new_password_opt) @@ -211,9 +211,9 @@ int auth_publickey(AuthPolicy *ap, ptrlen username, ptrlen public_blob) struct AuthPolicy_ssh2_pubkey *iter; for (iter = ap->ssh2keys; iter; iter = iter->next) { if (ptrlen_eq_ptrlen(public_blob, iter->public_blob)) - return TRUE; + return true; } - return FALSE; + return false; } struct RSAKey *auth_publickey_ssh1( AuthPolicy *ap, ptrlen username, Bignum rsa_modulus) @@ -237,9 +237,9 @@ AuthKbdInt *auth_kbdint_prompts(AuthPolicy *ap, ptrlen username) aki->nprompts = 2; aki->prompts = snewn(aki->nprompts, AuthKbdIntPrompt); aki->prompts[0].prompt = dupstr("Echoey prompt: "); - aki->prompts[0].echo = TRUE; + aki->prompts[0].echo = true; aki->prompts[1].prompt = dupstr("Silent prompt: "); - aki->prompts[1].echo = FALSE; + aki->prompts[1].echo = false; return aki; case 1: aki->title = dupstr("Zero-prompt step"); @@ -286,7 +286,7 @@ int auth_ssh1int_response(AuthPolicy *ap, ptrlen response) } int auth_successful(AuthPolicy *ap, ptrlen username, unsigned method) { - return TRUE; + return true; } static void safety_warning(FILE *fp) @@ -319,13 +319,13 @@ static void show_version_and_exit(void) exit(0); } -const int buildinfo_gtk_relevant = FALSE; +const int buildinfo_gtk_relevant = false; -static int finished = FALSE; +static int finished = false; void server_instance_terminated(void) { /* FIXME: change policy here if we're running in a listening loop */ - finished = TRUE; + finished = true; } static int longoptarg(const char *arg, const char *expected, @@ -333,21 +333,21 @@ static int longoptarg(const char *arg, const char *expected, { int len = strlen(expected); if (memcmp(arg, expected, len)) - return FALSE; + return false; if (arg[len] == '=') { *val = arg + len + 1; - return TRUE; + return true; } else if (arg[len] == '\0') { if (--*argcp > 0) { *val = *++*argvp; - return TRUE; + return true; } else { fprintf(stderr, "%s: option %s expects an argument\n", appname, expected); exit(1); } } - return FALSE; + return false; } extern const SftpServerVtable unix_live_sftpserver_vt; @@ -393,7 +393,7 @@ int main(int argc, char **argv) } else if (!strcmp(arg, "--version")) { show_version_and_exit(); } else if (!strcmp(arg, "--verbose") || !strcmp(arg, "-v")) { - verbose = TRUE; + verbose = true; } else if (longoptarg(arg, "--hostkey", &val, &argc, &argv)) { Filename *keyfile; int keytype; diff --git a/unix/uxsftp.c b/unix/uxsftp.c index 275c38b1..328b335a 100644 --- a/unix/uxsftp.c +++ b/unix/uxsftp.c @@ -37,7 +37,7 @@ void platform_get_x11_auth(struct X11Display *display, Conf *conf) { /* Do nothing, therefore no auth. */ } -const int platform_uses_x11_unix_by_default = TRUE; +const int platform_uses_x11_unix_by_default = true; /* * Default settings that are specific to PSFTP. @@ -415,12 +415,12 @@ char *stripslashes(const char *str, int local) int vet_filename(const char *name) { if (strchr(name, '/')) - return FALSE; + return false; if (name[0] == '.' && (!name[1] || (name[1] == '.' && !name[2]))) - return FALSE; + return false; - return TRUE; + return true; } int create_directory(const char *name) @@ -444,7 +444,7 @@ static int ssh_sftp_do_select(int include_stdin, int no_fds_ok) int fd, fdstate, rwx, ret, maxfd; unsigned long now = GETTICKCOUNT(); unsigned long next; - int done_something = FALSE; + int done_something = false; fdlist = NULL; fdcount = fdsize = 0; @@ -555,7 +555,7 @@ static int ssh_sftp_do_select(int include_stdin, int no_fds_ok) */ int ssh_sftp_loop_iteration(void) { - return ssh_sftp_do_select(FALSE, FALSE); + return ssh_sftp_do_select(false, false); } /* @@ -573,7 +573,7 @@ char *ssh_sftp_get_cmdline(const char *prompt, int no_fds_ok) buflen = bufsize = 0; while (1) { - ret = ssh_sftp_do_select(TRUE, no_fds_ok); + ret = ssh_sftp_do_select(true, no_fds_ok); if (ret < 0) { printf("connection died\n"); sfree(buf); @@ -608,7 +608,7 @@ void frontend_net_error_pending(void) {} void platform_psftp_pre_conn_setup(void) {} -const int buildinfo_gtk_relevant = FALSE; +const int buildinfo_gtk_relevant = false; /* * Main program: do platform-specific initialisation and then call diff --git a/unix/uxsftpserver.c b/unix/uxsftpserver.c index 8b59b3ab..7cfee950 100644 --- a/unix/uxsftpserver.c +++ b/unix/uxsftpserver.c @@ -107,12 +107,12 @@ static int uss_decode_handle( unsigned char handlebuf[8]; if (handle.len != 8) - return FALSE; + return false; memcpy(handlebuf, handle.ptr, 8); des_decrypt_xdmauth(uss->handlekey, handlebuf, 8); *index = toint(GET_32BIT(handlebuf)); *seq = GET_32BIT(handlebuf + 4); - return TRUE; + return true; } static void uss_return_new_handle( @@ -126,12 +126,12 @@ static void uss_return_new_handle( uss->fdsopen = sresize(uss->fdsopen, uss->fdsize, int); while (old_size < uss->fdsize) { uss->fdseqs[old_size] = 0; - uss->fdsopen[old_size] = FALSE; + uss->fdsopen[old_size] = false; old_size++; } } assert(!uss->fdsopen[fd]); - uss->fdsopen[fd] = TRUE; + uss->fdsopen[fd] = true; if (++uss->fdseqs[fd] == USS_DIRHANDLE_SEQ) uss->fdseqs[fd] = 0; uss_return_handle_raw(uss, reply, fd, uss->fdseqs[fd]); @@ -286,7 +286,7 @@ static void uss_close(SftpServer *srv, SftpReplyBuilder *reply, } else if ((fd = uss_lookup_fd(uss, reply, handle)) >= 0) { close(fd); assert(0 <= fd && fd <= uss->fdsize); - uss->fdsopen[fd] = FALSE; + uss->fdsopen[fd] = false; fxp_reply_ok(reply); } /* if both failed, uss_lookup_fd will have filled in an error response */ @@ -424,20 +424,20 @@ static void uss_fstat(SftpServer *srv, SftpReplyBuilder *reply, { \ if (attrs.flags & SSH_FILEXFER_ATTR_SIZE) \ if (api_prefix(truncate)(api_arg, attrs.size) < 0) \ - success = FALSE; \ + success = false; \ if (attrs.flags & SSH_FILEXFER_ATTR_UIDGID) \ if (api_prefix(chown)(api_arg, attrs.uid, attrs.gid) < 0) \ - success = FALSE; \ + success = false; \ if (attrs.flags & SSH_FILEXFER_ATTR_PERMISSIONS) \ if (api_prefix(chmod)(api_arg, attrs.permissions) < 0) \ - success = FALSE; \ + success = false; \ if (attrs.flags & SSH_FILEXFER_ATTR_ACMODTIME) { \ struct timeval tv[2]; \ tv[0].tv_sec = attrs.atime; \ tv[1].tv_sec = attrs.mtime; \ tv[0].tv_usec = tv[1].tv_usec = 0; \ if (api_prefix(utimes)(api_arg, tv) < 0) \ - success = FALSE; \ + success = false; \ } \ } while (0) @@ -450,7 +450,7 @@ static void uss_setstat(SftpServer *srv, SftpReplyBuilder *reply, UnixSftpServer *uss = container_of(srv, UnixSftpServer, srv); char *pathstr = mkstr(path); - int success = TRUE; + int success = true; SETSTAT_GUTS(PATH_PREFIX, pathstr, attrs, success); free(pathstr); @@ -470,7 +470,7 @@ static void uss_fsetstat(SftpServer *srv, SftpReplyBuilder *reply, if ((fd = uss_lookup_fd(uss, reply, handle)) < 0) return; - int success = TRUE; + int success = true; SETSTAT_GUTS(FD_PREFIX, fd, attrs, success); if (!success) { diff --git a/unix/uxucs.c b/unix/uxucs.c index edaca92c..92961eaa 100644 --- a/unix/uxucs.c +++ b/unix/uxucs.c @@ -96,7 +96,7 @@ int wc_to_mb(int codepage, int flags, const wchar_t *wcstr, int wclen, } /* - * Return value is TRUE if pterm is to run in direct-to-font mode. + * Return value is true if pterm is to run in direct-to-font mode. */ int init_ucs(struct unicode_data *ucsdata, char *linecharset, int utf8_override, int font_charset, int vtmode) diff --git a/windows/sizetip.c b/windows/sizetip.c index 4f0a195f..a0fd415f 100644 --- a/windows/sizetip.c +++ b/windows/sizetip.c @@ -20,7 +20,7 @@ static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, switch (nMsg) { case WM_ERASEBKGND: - return TRUE; + return true; case WM_PAINT: { @@ -80,7 +80,7 @@ static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, SetWindowPos(hWnd, NULL, 0, 0, sz.cx + 6, sz.cy + 6, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); - InvalidateRect(hWnd, NULL, FALSE); + InvalidateRect(hWnd, NULL, false); DeleteDC(hdc); } diff --git a/windows/wincapi.c b/windows/wincapi.c index 2bd03470..fbaf58e2 100644 --- a/windows/wincapi.c +++ b/windows/wincapi.c @@ -11,12 +11,12 @@ int got_crypt(void) { - static int attempted = FALSE; + static int attempted = false; static int successful; static HMODULE crypt; if (!attempted) { - attempted = TRUE; + attempted = true; crypt = load_system32_dll("crypt32.dll"); successful = crypt && #ifdef COVERITY diff --git a/windows/wincfg.c b/windows/wincfg.c index 8131883c..ec9b7e3d 100644 --- a/windows/wincfg.c +++ b/windows/wincfg.c @@ -157,7 +157,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, } } ctrl_filesel(s, "Custom sound file to play as a bell:", NO_SHORTCUT, - FILTER_WAVE_FILES, FALSE, "Select bell sound file", + FILTER_WAVE_FILES, false, "Select bell sound file", HELPCTX(bell_style), conf_filesel_handler, I(CONF_bell_wavefile)); @@ -396,7 +396,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, if (!midsession && backend_vt_from_proto(PROT_SSH)) { s = ctrl_getset(b, "Connection/SSH/X11", "x11", "X11 forwarding"); ctrl_filesel(s, "X authority file for local display", 't', - NULL, FALSE, "Select X authority file", + NULL, false, "Select X authority file", HELPCTX(ssh_tunnels_xauthority), conf_filesel_handler, I(CONF_xauthfile)); } diff --git a/windows/wincons.c b/windows/wincons.c index 9a542571..b01b1637 100644 --- a/windows/wincons.c +++ b/windows/wincons.c @@ -11,7 +11,7 @@ #include "storage.h" #include "ssh.h" -int console_batch_mode = FALSE; +int console_batch_mode = false; /* * Clean up and exit. diff --git a/windows/winctrls.c b/windows/winctrls.c index 1b51598f..2a3a093f 100644 --- a/windows/winctrls.c +++ b/windows/winctrls.c @@ -92,7 +92,7 @@ HWND doctl(struct ctlpos *cp, RECT r, ctl = CreateWindowEx(exstyle, wclass, wtext, wstyle, r.left, r.top, r.right, r.bottom, cp->hwnd, (HMENU)(ULONG_PTR)wid, hinst, NULL); - SendMessage(ctl, WM_SETFONT, cp->font, MAKELPARAM(TRUE, 0)); + SendMessage(ctl, WM_SETFONT, cp->font, MAKELPARAM(true, 0)); if (!strcmp(wclass, "LISTBOX")) { /* @@ -981,7 +981,7 @@ static void pl_moveitem(HWND hwnd, int listid, int src, int dst) SendDlgItemMessage (hwnd, listid, LB_GETTEXT, src, (LPARAM) txt); val = SendDlgItemMessage (hwnd, listid, LB_GETITEMDATA, src, 0); /* Deselect old location. */ - SendDlgItemMessage (hwnd, listid, LB_SETSEL, FALSE, src); + SendDlgItemMessage (hwnd, listid, LB_SETSEL, false, src); /* Delete it at the old location. */ SendDlgItemMessage (hwnd, listid, LB_DELETESTRING, src, 0); /* Insert it at new location. */ @@ -1014,14 +1014,14 @@ int pl_itemfrompt(HWND hwnd, POINT cursor, BOOL scroll) ret = p_LBItemFromPt(hwnd, cursor, scroll); if (ret == -1) return ret; - ret = p_LBItemFromPt(hwnd, cursor, FALSE); + ret = p_LBItemFromPt(hwnd, cursor, false); updist = downdist = 0; for (i = 1; i < 4096 && (!updist || !downdist); i++) { uppoint = downpoint = cursor; uppoint.y -= i; downpoint.y += i; - upitem = p_LBItemFromPt(hwnd, uppoint, FALSE); - downitem = p_LBItemFromPt(hwnd, downpoint, FALSE); + upitem = p_LBItemFromPt(hwnd, uppoint, false); + downitem = p_LBItemFromPt(hwnd, downpoint, false); if (!updist && upitem != ret) updist = i; if (!downdist && downitem != ret) @@ -1036,7 +1036,7 @@ int pl_itemfrompt(HWND hwnd, POINT cursor, BOOL scroll) * Handler for prefslist above. * * Return value has bit 0 set if the dialog box procedure needs to - * return TRUE from handling this message; it has bit 1 set if a + * return true from handling this message; it has bit 1 set if a * change may have been made in the contents of the list. */ int handle_prefslist(struct prefslist *hdl, @@ -1062,10 +1062,10 @@ int handle_prefslist(struct prefslist *hdl, SendDlgItemMessage(hwnd, hdl->listid, LB_ADDSTRING, 0, (LPARAM) ""); - hdl->srcitem = p_LBItemFromPt(dlm->hWnd, dlm->ptCursor, TRUE); + hdl->srcitem = p_LBItemFromPt(dlm->hWnd, dlm->ptCursor, true); hdl->dragging = 0; /* XXX hack Q183115 */ - SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE); + SetWindowLongPtr(hwnd, DWLP_MSGRESULT, true); ret |= 1; break; case DL_CANCELDRAG: p_DrawInsert(hwnd, dlm->hWnd, -1); /* Clear arrow */ @@ -1075,7 +1075,7 @@ int handle_prefslist(struct prefslist *hdl, ret |= 1; break; case DL_DRAGGING: hdl->dragging = 1; - dest = pl_itemfrompt(dlm->hWnd, dlm->ptCursor, TRUE); + dest = pl_itemfrompt(dlm->hWnd, dlm->ptCursor, true); if (dest > hdl->dummyitem) dest = hdl->dummyitem; p_DrawInsert (hwnd, dlm->hWnd, dest); if (dest >= 0) @@ -1085,7 +1085,7 @@ int handle_prefslist(struct prefslist *hdl, ret |= 1; break; case DL_DROPPED: if (hdl->dragging) { - dest = pl_itemfrompt(dlm->hWnd, dlm->ptCursor, TRUE); + dest = pl_itemfrompt(dlm->hWnd, dlm->ptCursor, true); if (dest > hdl->dummyitem) dest = hdl->dummyitem; p_DrawInsert (hwnd, dlm->hWnd, -1); } @@ -1211,7 +1211,7 @@ void winctrl_add_shortcuts(struct dlgparam *dp, struct winctrl *c) if (c->shortcuts[i] != NO_SHORTCUT) { unsigned char s = tolower((unsigned char)c->shortcuts[i]); assert(!dp->shortcuts[s]); - dp->shortcuts[s] = TRUE; + dp->shortcuts[s] = true; } } @@ -1222,7 +1222,7 @@ void winctrl_rem_shortcuts(struct dlgparam *dp, struct winctrl *c) if (c->shortcuts[i] != NO_SHORTCUT) { unsigned char s = tolower((unsigned char)c->shortcuts[i]); assert(dp->shortcuts[s]); - dp->shortcuts[s] = FALSE; + dp->shortcuts[s] = false; } } @@ -1780,7 +1780,7 @@ int winctrl_handle_command(struct dlgparam *dp, UINT msg, r.top + (r.bottom-r.top-s.cy)/2, (char *)c->data, strlen((char *)c->data)); - return TRUE; + return true; } ctrl = c->ctrl; @@ -1797,7 +1797,7 @@ int winctrl_handle_command(struct dlgparam *dp, UINT msg, * subsequent code can test dp->coloursel_wanted(). */ ret = 0; - dp->coloursel_wanted = FALSE; + dp->coloursel_wanted = false; /* * Now switch on the control type and the message. @@ -1933,7 +1933,7 @@ int winctrl_handle_command(struct dlgparam *dp, UINT msg, of.lpstrFileTitle = NULL; of.lpstrTitle = ctrl->fileselect.title; of.Flags = 0; - if (request_file(NULL, &of, FALSE, ctrl->fileselect.for_writing)) { + if (request_file(NULL, &of, false, ctrl->fileselect.for_writing)) { SetDlgItemText(dp->hwnd, c->base_id + 1, filename); ctrl->generic.handler(ctrl, dp, dp->data, EVENT_VALCHANGE); } @@ -2008,9 +2008,9 @@ int winctrl_handle_command(struct dlgparam *dp, UINT msg, (unsigned char) (cc.rgbResult >> 8) & 0xFF; dp->coloursel_result.b = (unsigned char) (cc.rgbResult >> 16) & 0xFF; - dp->coloursel_result.ok = TRUE; + dp->coloursel_result.ok = true; } else - dp->coloursel_result.ok = FALSE; + dp->coloursel_result.ok = false; ctrl->generic.handler(ctrl, dp, dp->data, EVENT_CALLBACK); } @@ -2019,7 +2019,7 @@ int winctrl_handle_command(struct dlgparam *dp, UINT msg, /* * This function can be called to produce context help on a - * control. Returns TRUE if it has actually launched some help. + * control. Returns true if it has actually launched some help. */ int winctrl_context_help(struct dlgparam *dp, HWND hwnd, int id) { @@ -2340,7 +2340,7 @@ void dlg_update_start(union control *ctrl, dlgparam *dp) { struct winctrl *c = dlg_findbyctrl(dp, ctrl); if (c && c->ctrl->generic.type == CTRL_LISTBOX) { - SendDlgItemMessage(dp->hwnd, c->base_id+1, WM_SETREDRAW, FALSE, 0); + SendDlgItemMessage(dp->hwnd, c->base_id+1, WM_SETREDRAW, false, 0); } } @@ -2349,8 +2349,8 @@ void dlg_update_done(union control *ctrl, dlgparam *dp) struct winctrl *c = dlg_findbyctrl(dp, ctrl); if (c && c->ctrl->generic.type == CTRL_LISTBOX) { HWND hw = GetDlgItem(dp->hwnd, c->base_id+1); - SendMessage(hw, WM_SETREDRAW, TRUE, 0); - InvalidateRect(hw, NULL, TRUE); + SendMessage(hw, WM_SETREDRAW, true, 0); + InvalidateRect(hw, NULL, true); } } @@ -2408,7 +2408,7 @@ void dlg_error_msg(dlgparam *dp, const char *msg) */ void dlg_end(dlgparam *dp, int value) { - dp->ended = TRUE; + dp->ended = true; dp->endresult = value; } @@ -2441,7 +2441,7 @@ void dlg_refresh(union control *ctrl, dlgparam *dp) void dlg_coloursel_start(union control *ctrl, dlgparam *dp, int r, int g, int b) { - dp->coloursel_wanted = TRUE; + dp->coloursel_wanted = true; dp->coloursel_result.r = r; dp->coloursel_result.g = g; dp->coloursel_result.b = b; @@ -2482,7 +2482,7 @@ void dlg_auto_set_fixed_pitch_flag(dlgparam *dp) quality = conf_get_int(conf, CONF_font_quality); fs = conf_get_fontspec(conf, CONF_font); - hfont = CreateFont(0, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, + hfont = CreateFont(0, 0, 0, 0, FW_DONTCARE, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, FONT_QUALITY(quality), FIXED_PITCH | FF_DONTCARE, fs->name); @@ -2491,7 +2491,7 @@ void dlg_auto_set_fixed_pitch_flag(dlgparam *dp) /* Note that the TMPF_FIXED_PITCH bit is defined upside down :-( */ is_var = (tm.tmPitchAndFamily & TMPF_FIXED_PITCH); } else { - is_var = FALSE; /* assume it's basically normal */ + is_var = false; /* assume it's basically normal */ } if (hdc) ReleaseDC(NULL, hdc); @@ -2499,7 +2499,7 @@ void dlg_auto_set_fixed_pitch_flag(dlgparam *dp) DeleteObject(hfont); if (is_var) - dp->fixed_pitch_fonts = FALSE; + dp->fixed_pitch_fonts = false; } int dlg_get_fixed_pitch_flag(dlgparam *dp) @@ -2516,12 +2516,12 @@ void dp_init(struct dlgparam *dp) { dp->nctrltrees = 0; dp->data = NULL; - dp->ended = FALSE; + dp->ended = false; dp->focused = dp->lastfocused = NULL; memset(dp->shortcuts, 0, sizeof(dp->shortcuts)); dp->hwnd = NULL; dp->wintitle = dp->errtitle = NULL; - dp->fixed_pitch_fonts = TRUE; + dp->fixed_pitch_fonts = true; } void dp_add_tree(struct dlgparam *dp, struct winctrls *wc) diff --git a/windows/windlg.c b/windows/windlg.c index 6dae33f9..d20cd805 100644 --- a/windows/windlg.c +++ b/windows/windlg.c @@ -156,14 +156,14 @@ static INT_PTR CALLBACK LogProc(HWND hwnd, UINT msg, memcpy(p, sel_nl, sizeof(sel_nl)); p += sizeof(sel_nl); } - write_aclip(CLIP_SYSTEM, clipdata, size, TRUE); + write_aclip(CLIP_SYSTEM, clipdata, size, true); sfree(clipdata); } sfree(selitems); for (i = 0; i < (ninitial + ncircular); i++) SendDlgItemMessage(hwnd, IDN_LIST, LB_SETSEL, - FALSE, i); + false, i); } } return 0; @@ -230,7 +230,7 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg, switch (LOWORD(wParam)) { case IDOK: case IDCANCEL: - EndDialog(hwnd, TRUE); + EndDialog(hwnd, true); return 0; case IDA_LICENCE: EnableWindow(hwnd, 0); @@ -249,7 +249,7 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg, } return 0; case WM_CLOSE: - EndDialog(hwnd, TRUE); + EndDialog(hwnd, true); return 0; } return 0; @@ -428,7 +428,7 @@ static INT_PTR CALLBACK GenericMainDlgProc(HWND hwnd, UINT msg, MoveWindow(hwnd, (rs.right + rs.left + rd.left - rd.right) / 2, (rs.bottom + rs.top + rd.top - rd.bottom) / 2, - rd.right - rd.left, rd.bottom - rd.top, TRUE); + rd.right - rd.left, rd.bottom - rd.top, true); } /* @@ -451,7 +451,7 @@ static INT_PTR CALLBACK GenericMainDlgProc(HWND hwnd, UINT msg, hwnd, (HMENU) IDCX_TVSTATIC, hinst, NULL); font = SendMessage(hwnd, WM_GETFONT, 0, 0); - SendMessage(tvstatic, WM_SETFONT, font, MAKELPARAM(TRUE, 0)); + SendMessage(tvstatic, WM_SETFONT, font, MAKELPARAM(true, 0)); r.left = 3; r.right = r.left + 95; @@ -468,7 +468,7 @@ static INT_PTR CALLBACK GenericMainDlgProc(HWND hwnd, UINT msg, hwnd, (HMENU) IDCX_TREEVIEW, hinst, NULL); font = SendMessage(hwnd, WM_GETFONT, 0, 0); - SendMessage(treeview, WM_SETFONT, font, MAKELPARAM(TRUE, 0)); + SendMessage(treeview, WM_SETFONT, font, MAKELPARAM(true, 0)); tvfaff.treeview = treeview; memset(tvfaff.lastat, 0, sizeof(tvfaff.lastat)); } @@ -594,7 +594,7 @@ static INT_PTR CALLBACK GenericMainDlgProc(HWND hwnd, UINT msg, i = TreeView_GetSelection(((LPNMHDR) lParam)->hwndFrom); - SendMessage (hwnd, WM_SETREDRAW, FALSE, 0); + SendMessage (hwnd, WM_SETREDRAW, false, 0); item.hItem = i; item.pszText = buffer; @@ -623,8 +623,8 @@ static INT_PTR CALLBACK GenericMainDlgProc(HWND hwnd, UINT msg, dlg_refresh(NULL, &dp); /* set up control values */ - SendMessage (hwnd, WM_SETREDRAW, TRUE, 0); - InvalidateRect (hwnd, NULL, TRUE); + SendMessage (hwnd, WM_SETREDRAW, true, 0); + InvalidateRect (hwnd, NULL, true); SetFocus(((LPNMHDR) lParam)->hwndFrom); /* ensure focus stays */ return 0; @@ -698,8 +698,8 @@ int do_config(void) int ret; ctrlbox = ctrl_new_box(); - setup_config_box(ctrlbox, FALSE, 0, 0); - win_setup_config_box(ctrlbox, &dp.hwnd, has_help(), FALSE, 0); + setup_config_box(ctrlbox, false, 0, 0); + win_setup_config_box(ctrlbox, &dp.hwnd, has_help(), false, 0); dp_init(&dp); winctrl_init(&ctrls_base); winctrl_init(&ctrls_panel); @@ -709,7 +709,7 @@ int do_config(void) dp.errtitle = dupprintf("%s Error", appname); dp.data = conf; dlg_auto_set_fixed_pitch_flag(&dp); - dp.shortcuts['g'] = TRUE; /* the treeview: `Cate&gory' */ + dp.shortcuts['g'] = true; /* the treeview: `Cate&gory' */ ret = SaneDialogBox(hinst, MAKEINTRESOURCE(IDD_MAINBOX), NULL, @@ -732,8 +732,8 @@ int do_reconfig(HWND hwnd, int protcfginfo) ctrlbox = ctrl_new_box(); protocol = conf_get_int(conf, CONF_protocol); - setup_config_box(ctrlbox, TRUE, protocol, protcfginfo); - win_setup_config_box(ctrlbox, &dp.hwnd, has_help(), TRUE, protocol); + setup_config_box(ctrlbox, true, protocol, protcfginfo); + win_setup_config_box(ctrlbox, &dp.hwnd, has_help(), true, protocol); dp_init(&dp); winctrl_init(&ctrls_base); winctrl_init(&ctrls_panel); @@ -743,7 +743,7 @@ int do_reconfig(HWND hwnd, int protcfginfo) dp.errtitle = dupprintf("%s Error", appname); dp.data = conf; dlg_auto_set_fixed_pitch_flag(&dp); - dp.shortcuts['g'] = TRUE; /* the treeview: `Cate&gory' */ + dp.shortcuts['g'] = true; /* the treeview: `Cate&gory' */ ret = SaneDialogBox(hinst, MAKEINTRESOURCE(IDD_MAINBOX), NULL, GenericMainDlgProc); diff --git a/windows/window.c b/windows/window.c index 5a6ddb7a..50bca70e 100644 --- a/windows/window.c +++ b/windows/window.c @@ -130,7 +130,7 @@ static Backend *backend; static struct unicode_data ucsdata; static int session_closed; -static int reconfiguring = FALSE; +static int reconfiguring = false; static const SessionSpecial *specials = NULL; static HMENU specials_menu = NULL; @@ -292,8 +292,8 @@ static const TermWinVtable windows_termwin_vt = { static TermWin wintw[1]; static HDC wintw_hdc; -const int share_can_be_downstream = TRUE; -const int share_can_be_upstream = TRUE; +const int share_can_be_downstream = true; +const int share_can_be_upstream = true; static int is_utf8(void) { @@ -318,7 +318,7 @@ char *win_seat_get_ttymode(Seat *seat, const char *mode) int win_seat_get_window_pixel_size(Seat *seat, int *x, int *y) { win_get_pixels(wintw, x, y); - return TRUE; + return true; } static int win_seat_output(Seat *seat, int is_stderr, const void *, int); @@ -416,7 +416,7 @@ static void start_backend(void) DeleteMenu(popup_menus[i].menu, IDM_RESTART, MF_BYCOMMAND); } - session_closed = FALSE; + session_closed = false; } static void close_session(void *ignored_context) @@ -424,7 +424,7 @@ static void close_session(void *ignored_context) char morestuff[100]; int i; - session_closed = TRUE; + session_closed = true; sprintf(morestuff, "%.70s (inactive)", appname); win_set_icon_title(wintw, morestuff); win_set_title(wintw, morestuff); @@ -511,7 +511,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) */ { char *p; - int special_launchable_argument = FALSE; + int special_launchable_argument = false; default_protocol = be_default_protocol; /* Find the appropriate default port. */ @@ -542,7 +542,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) (!p[2] || p[2] == '@' || p[2] == '&')) { /* &R restrict-acl prefix */ restrict_process_acl(); - restricted_acl = TRUE; + restricted_acl = true; p += 2; } @@ -562,7 +562,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) if (!conf_launchable(conf) && !do_config()) { cleanup_exit(0); } - special_launchable_argument = TRUE; + special_launchable_argument = true; } else if (*p == '&') { /* * An initial & means we've been given a command line @@ -585,7 +585,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) } else if (!do_config()) { cleanup_exit(0); } - special_launchable_argument = TRUE; + special_launchable_argument = true; } else if (!*p) { /* Do-nothing case for an empty command line - or rather, * for a command line that's empty _after_ we strip off @@ -792,7 +792,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) si.nMax = term->rows - 1; si.nPage = term->rows; si.nPos = 0; - SetScrollInfo(hwnd, SB_VERT, &si, FALSE); + SetScrollInfo(hwnd, SB_VERT, &si, false); } /* @@ -810,13 +810,13 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) int j; char *str; - popup_menus[SYSMENU].menu = GetSystemMenu(hwnd, FALSE); + popup_menus[SYSMENU].menu = GetSystemMenu(hwnd, false); popup_menus[CTXMENU].menu = CreatePopupMenu(); AppendMenu(popup_menus[CTXMENU].menu, MF_ENABLED, IDM_COPY, "&Copy"); AppendMenu(popup_menus[CTXMENU].menu, MF_ENABLED, IDM_PASTE, "&Paste"); savedsess_menu = CreateMenu(); - get_sesslist(&sesslist, TRUE); + get_sesslist(&sesslist, true); update_savedsess_menu(); for (j = 0; j < lenof(popup_menus); j++) { @@ -907,7 +907,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) handles = handle_get_events(&nhandles); - n = MsgWaitForMultipleObjects(nhandles, handles, FALSE, + n = MsgWaitForMultipleObjects(nhandles, handles, false, timeout, QS_ALLINPUT); if ((unsigned)(n - WAIT_OBJECT_0) < (unsigned)nhandles) { @@ -1122,8 +1122,8 @@ static void win_seat_update_specials_menu(Seat *seat) static void update_mouse_pointer(void) { LPTSTR curstype = NULL; - int force_visible = FALSE; - static int forced_visible = FALSE; + int force_visible = false; + static int forced_visible = false; switch (busy_status) { case BUSY_NOT: if (send_raw_mouse) @@ -1133,11 +1133,11 @@ static void update_mouse_pointer(void) break; case BUSY_WAITING: curstype = IDC_APPSTARTING; /* this may be an abuse */ - force_visible = TRUE; + force_visible = true; break; case BUSY_CPU: curstype = IDC_WAIT; - force_visible = TRUE; + force_visible = true; break; default: assert(0); @@ -1323,9 +1323,9 @@ static void init_palette(void) } pal = CreatePalette(logpal); if (pal) { - SelectPalette(hdc, pal, FALSE); + SelectPalette(hdc, pal, false); RealizePalette(hdc); - SelectPalette(hdc, GetStockObject(DEFAULT_PALETTE), FALSE); + SelectPalette(hdc, GetStockObject(DEFAULT_PALETTE), false); } } ReleaseDC(hwnd, hdc); @@ -1388,7 +1388,7 @@ static void general_textout(HDC hdc, int x, int y, CONST RECT *lprc, CONST INT *lpDx, int opaque) { int i, j, xp, xn; - int bkmode = 0, got_bkmode = FALSE; + int bkmode = 0, got_bkmode = false; xp = xn = x; @@ -1421,9 +1421,9 @@ static void general_textout(HDC hdc, int x, int y, CONST RECT *lprc, xp = xn; bkmode = GetBkMode(hdc); - got_bkmode = TRUE; + got_bkmode = true; SetBkMode(hdc, TRANSPARENT); - opaque = FALSE; + opaque = false; } if (got_bkmode) @@ -1442,8 +1442,8 @@ static int get_font_width(HDC hdc, const TEXTMETRIC *tm) ABCFLOAT widths[LAST-FIRST + 1]; int j; - font_varpitch = TRUE; - font_dualwidth = TRUE; + font_varpitch = true; + font_dualwidth = true; if (GetCharABCWidthsFloat(hdc, FIRST, LAST, widths)) { ret = 0; for (j = 0; j < lenof(widths); j++) { @@ -1494,7 +1494,7 @@ static void init_fonts(int pick_width, int pick_height) bold_font_mode = conf_get_int(conf, CONF_bold_style) & 1 ? BOLD_FONT : BOLD_NONE; - bold_colours = conf_get_int(conf, CONF_bold_style) & 2 ? TRUE : FALSE; + bold_colours = conf_get_int(conf, CONF_bold_style) & 2 ? true : false; und_mode = UND_FONT; font = conf_get_fontspec(conf, CONF_font); @@ -1521,12 +1521,12 @@ static void init_fonts(int pick_width, int pick_height) quality = conf_get_int(conf, CONF_font_quality); #define f(i,c,w,u) \ - fonts[i] = CreateFont (font_height, font_width, 0, 0, w, FALSE, u, FALSE, \ + fonts[i] = CreateFont (font_height, font_width, 0, 0, w, false, u, false, \ c, OUT_DEFAULT_PRECIS, \ CLIP_DEFAULT_PRECIS, FONT_QUALITY(quality), \ FIXED_PITCH | FF_DONTCARE, font->name) - f(FONT_NORMAL, font->charset, fw_dontcare, FALSE); + f(FONT_NORMAL, font->charset, fw_dontcare, false); SelectObject(hdc, fonts[FONT_NORMAL]); GetTextMetrics(hdc, &tm); @@ -1535,11 +1535,11 @@ static void init_fonts(int pick_width, int pick_height) /* Note that the TMPF_FIXED_PITCH bit is defined upside down :-( */ if (!(tm.tmPitchAndFamily & TMPF_FIXED_PITCH)) { - font_varpitch = FALSE; + font_varpitch = false; font_dualwidth = (tm.tmAveCharWidth != tm.tmMaxCharWidth); } else { - font_varpitch = TRUE; - font_dualwidth = TRUE; + font_varpitch = true; + font_dualwidth = true; } if (pick_width == 0 || pick_height == 0) { font_height = tm.tmHeight; @@ -1570,7 +1570,7 @@ static void init_fonts(int pick_width, int pick_height) ucsdata.dbcs_screenfont = (cpinfo.MaxCharSize > 1); } - f(FONT_UNDERLINE, font->charset, fw_dontcare, TRUE); + f(FONT_UNDERLINE, font->charset, fw_dontcare, true); /* * Some fonts, e.g. 9-pt Courier, draw their underlines @@ -1604,11 +1604,11 @@ static void init_fonts(int pick_width, int pick_height) SetBkColor(und_dc, RGB(0, 0, 0)); SetBkMode(und_dc, OPAQUE); ExtTextOut(und_dc, 0, 0, ETO_OPAQUE, NULL, " ", 1, NULL); - gotit = FALSE; + gotit = false; for (i = 0; i < font_height; i++) { c = GetPixel(und_dc, font_width / 2, i); if (c != RGB(0, 0, 0)) - gotit = TRUE; + gotit = true; } SelectObject(und_dc, und_oldbm); DeleteObject(und_bm); @@ -1621,7 +1621,7 @@ static void init_fonts(int pick_width, int pick_height) } if (bold_font_mode == BOLD_FONT) { - f(FONT_BOLD, font->charset, fw_bold, FALSE); + f(FONT_BOLD, font->charset, fw_bold, false); } #undef f @@ -1685,7 +1685,7 @@ static void another_font(int fontno) c = font->charset; w = fw_dontcare; - u = FALSE; + u = false; s = font->name; x = font_width; @@ -1698,13 +1698,13 @@ static void another_font(int fontno) if (fontno & FONT_BOLD) w = fw_bold; if (fontno & FONT_UNDERLINE) - u = TRUE; + u = true; quality = conf_get_int(conf, CONF_font_quality); fonts[fontno] = CreateFont(font_height * (1 + !!(fontno & FONT_HIGH)), x, 0, 0, w, - FALSE, u, FALSE, c, OUT_DEFAULT_PRECIS, + false, u, false, c, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, FONT_QUALITY(quality), DEFAULT_PITCH | FF_DONTCARE, s); @@ -1776,7 +1776,7 @@ static void wintw_request_resize(TermWin *tw, int w, int h) } else reset_window(0); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, NULL, true); } static void reset_window(int reinit) { @@ -1826,7 +1826,7 @@ static void reset_window(int reinit) { offset_height != (win_height-font_height*term->rows)/2) ){ offset_width = (win_width-font_width*term->cols)/2; offset_height = (win_height-font_height*term->rows)/2; - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, NULL, true); #ifdef RDB_DEBUG_PATCH debug((27, "reset_window() -> Reposition terminal")); #endif @@ -1847,7 +1847,7 @@ static void reset_window(int reinit) { init_fonts(win_width/term->cols, win_height/term->rows); offset_width = (win_width-font_width*term->cols)/2; offset_height = (win_height-font_height*term->rows)/2; - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, NULL, true); #ifdef RDB_DEBUG_PATCH debug((25, "reset_window() -> Z font resize to (%d, %d)", font_width, font_height)); @@ -1863,7 +1863,7 @@ static void reset_window(int reinit) { conf_get_int(conf, CONF_savelines)); offset_width = (win_width-font_width*term->cols)/2; offset_height = (win_height-font_height*term->rows)/2; - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, NULL, true); #ifdef RDB_DEBUG_PATCH debug((27, "reset_window() -> Zoomed term_size")); #endif @@ -1897,7 +1897,7 @@ static void reset_window(int reinit) { SWP_NOMOVE | SWP_NOZORDER); } - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, NULL, true); return; } @@ -1956,7 +1956,7 @@ static void reset_window(int reinit) { font_height*term->rows + extra_height, SWP_NOMOVE | SWP_NOZORDER); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, NULL, true); #ifdef RDB_DEBUG_PATCH debug((27, "reset_window() -> window resize to (%d,%d)", font_width*term->cols + extra_width, @@ -1980,7 +1980,7 @@ static void reset_window(int reinit) { extra_width = wr.right - wr.left - cr.right + cr.left +offset_width*2; extra_height = wr.bottom - wr.top - cr.bottom + cr.top+offset_height*2; - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, NULL, true); #ifdef RDB_DEBUG_PATCH debug((25, "reset_window() -> font resize to (%d,%d)", font_width, font_height)); @@ -2049,9 +2049,9 @@ static void show_mouseptr(int show) if (!conf_get_int(conf, CONF_hide_mouseptr)) show = 1; /* override if this feature disabled */ if (cursor_visible && !show) - ShowCursor(FALSE); + ShowCursor(false); else if (!cursor_visible && show) - ShowCursor(TRUE); + ShowCursor(true); cursor_visible = show; } @@ -2060,12 +2060,12 @@ static int is_alt_pressed(void) BYTE keystate[256]; int r = GetKeyboardState(keystate); if (!r) - return FALSE; + return false; if (keystate[VK_MENU] & 0x80) - return TRUE; + return true; if (keystate[VK_RMENU] & 0x80) - return TRUE; - return FALSE; + return true; + return false; } static int resizing; @@ -2084,7 +2084,7 @@ static void win_seat_notify_remote_exit(Seat *seat) PostQuitMessage(0); } else { queue_toplevel_callback(close_session, NULL); - session_closed = TRUE; + session_closed = true; /* exitcode == INT_MAX indicates that the connection was closed * by a fatal error, so an error box will be coming our way and * we should not generate this informational one. */ @@ -2128,14 +2128,14 @@ static HDC make_hdc(void) if (!hdc) return NULL; - SelectPalette(hdc, pal, FALSE); + SelectPalette(hdc, pal, false); return hdc; } static void free_hdc(HDC hdc) { assert(hwnd); - SelectPalette(hdc, GetStockObject(DEFAULT_PALETTE), FALSE); + SelectPalette(hdc, GetStockObject(DEFAULT_PALETTE), false); ReleaseDC(hwnd, hdc); } @@ -2143,10 +2143,10 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; - static int ignore_clip = FALSE; - static int need_backend_resize = FALSE; - static int fullscr_on_max = FALSE; - static int processed_resize = FALSE; + static int ignore_clip = false; + static int need_backend_resize = false; + static int fullscr_on_max = false; + static int processed_resize = false; static UINT last_mousemove = 0; int resize_action; @@ -2186,8 +2186,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, if ((HMENU)wParam == savedsess_menu) { /* About to pop up Saved Sessions sub-menu. * Refresh the session list. */ - get_sesslist(&sesslist, FALSE); /* free */ - get_sesslist(&sesslist, TRUE); + get_sesslist(&sesslist, false); /* free */ + get_sesslist(&sesslist, true); update_savedsess_menu(); return 0; } @@ -2231,7 +2231,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, sa.nLength = sizeof(sa); sa.lpSecurityDescriptor = NULL; - sa.bInheritHandle = TRUE; + sa.bInheritHandle = true; filemap = CreateFileMapping(INVALID_HANDLE_VALUE, &sa, PAGE_READWRITE, @@ -2245,7 +2245,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, } strbuf_free(serbuf); - inherit_handles = TRUE; + inherit_handles = true; cl = dupprintf("putty %s&%p:%u", argprefix, filemap, (unsigned)size); } else if (wParam == IDM_SAVEDSESS) { @@ -2254,14 +2254,14 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, if (sessno < (unsigned)sesslist.nsessions) { const char *session = sesslist.sessions[sessno]; cl = dupprintf("putty %s@%s", argprefix, session); - inherit_handles = FALSE; + inherit_handles = false; } else break; } else /* IDM_NEWSESS */ { cl = dupprintf("putty%s%s", *argprefix ? " " : "", argprefix); - inherit_handles = FALSE; + inherit_handles = false; } GetModuleFileName(NULL, b, sizeof(b) - 1); @@ -2286,7 +2286,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, if (!backend) { lp_eventlog(default_logpolicy, "----- Session restarted -----"); - term_pwron(term, FALSE); + term_pwron(term, false); start_backend(); } @@ -2300,7 +2300,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, if (reconfiguring) break; else - reconfiguring = TRUE; + reconfiguring = true; /* * Copy the current window title into the stored @@ -2314,7 +2314,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, reconfig_result = do_reconfig(hwnd, backend ? backend_cfg_info(backend) : 0); - reconfiguring = FALSE; + reconfiguring = false; if (!reconfig_result) { conf_free(prev_conf); break; @@ -2472,7 +2472,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, init_lvl = 2; } - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, NULL, true); reset_window(init_lvl); conf_free(prev_conf); @@ -2491,7 +2491,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, term_clrsb(term); break; case IDM_RESET: - term_pwron(term, TRUE); + term_pwron(term, true); if (ldisc) ldisc_echoedit_update(ldisc); break; @@ -2719,7 +2719,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, case WM_DESTROYCLIPBOARD: if (!ignore_clip) term_lost_clipboard_ownership(term, CLIP_SYSTEM); - ignore_clip = FALSE; + ignore_clip = false; return 0; case WM_PAINT: { @@ -2728,7 +2728,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, HideCaret(hwnd); hdc = BeginPaint(hwnd, &p); if (pal) { - SelectPalette(hdc, pal, TRUE); + SelectPalette(hdc, pal, true); RealizePalette(hdc); } @@ -2838,7 +2838,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, } return 0; case WM_SETFOCUS: - term_set_focus(term, TRUE); + term_set_focus(term, true); CreateCaret(hwnd, caretbm, font_width, font_height); ShowCaret(hwnd); flash_window(0); /* stop */ @@ -2847,7 +2847,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, break; case WM_KILLFOCUS: show_mouseptr(1); - term_set_focus(term, FALSE); + term_set_focus(term, false); DestroyCaret(); caret_x = caret_y = -1; /* ensure caret is replaced next time */ term_update(term); @@ -2857,12 +2857,12 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, debug((27, "WM_ENTERSIZEMOVE")); #endif EnableSizeTip(1); - resizing = TRUE; - need_backend_resize = FALSE; + resizing = true; + need_backend_resize = false; break; case WM_EXITSIZEMOVE: EnableSizeTip(0); - resizing = FALSE; + resizing = false; #ifdef RDB_DEBUG_PATCH debug((27, "WM_EXITSIZEMOVE")); #endif @@ -2870,7 +2870,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, term_size(term, conf_get_int(conf, CONF_height), conf_get_int(conf, CONF_width), conf_get_int(conf, CONF_savelines)); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, NULL, true); } break; case WM_SIZING: @@ -2900,8 +2900,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, conf_set_int(conf, CONF_height, term->rows); conf_set_int(conf, CONF_width, term->cols); - InvalidateRect(hwnd, NULL, TRUE); - need_backend_resize = TRUE; + InvalidateRect(hwnd, NULL, true); + need_backend_resize = true; } width = r->right - r->left - extra_width; @@ -2967,7 +2967,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, } /* break; (never reached) */ case WM_FULLSCR_ON_MAX: - fullscr_on_max = TRUE; + fullscr_on_max = true; break; case WM_MOVE: sys_cursor_update(); @@ -2990,7 +2990,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) SetWindowText(hwnd, window_name); if (wParam == SIZE_RESTORED) { - processed_resize = FALSE; + processed_resize = false; clear_full_screen(); if (processed_resize) { /* @@ -3003,8 +3003,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, } } if (wParam == SIZE_MAXIMIZED && fullscr_on_max) { - fullscr_on_max = FALSE; - processed_resize = FALSE; + fullscr_on_max = false; + processed_resize = false; make_full_screen(); if (processed_resize) { /* @@ -3017,7 +3017,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, } } - processed_resize = TRUE; + processed_resize = true; if (resize_action == RESIZE_DISABLED) { /* A resize, well it better be a minimize. */ @@ -3048,7 +3048,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, * arise in maximisation as well via the Aero * snap UI. */ - need_backend_resize = TRUE; + need_backend_resize = true; conf_set_int(conf, CONF_height, h); conf_set_int(conf, CONF_width, w); } else { @@ -3087,7 +3087,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, * getting sent down the connection during an NT * opaque drag.) */ - need_backend_resize = TRUE; + need_backend_resize = true; conf_set_int(conf, CONF_height, h); conf_set_int(conf, CONF_width, w); } else { @@ -3154,10 +3154,10 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, if (RealizePalette(hdc) > 0) UpdateColors(hdc); free_hdc(hdc); - return TRUE; + return true; } } - return FALSE; + return false; case WM_KEYDOWN: case WM_SYSKEYDOWN: case WM_KEYUP: @@ -3470,7 +3470,7 @@ static void do_text_internal( int text_adjust = 0; int xoffset = 0; int maxlen, remaining, opaque; - int is_cursor = FALSE; + int is_cursor = false; static int *lpDx = NULL; static int lpDx_len = 0; int *lpDx_maybe; @@ -3497,7 +3497,7 @@ static void do_text_internal( attr &= ~(ATTR_REVERSE|ATTR_BLINK|ATTR_COLOURS|ATTR_DIM); /* cursor fg and bg */ attr |= (260 << ATTR_FGSHIFT) | (261 << ATTR_BGSHIFT); - is_cursor = TRUE; + is_cursor = true; } nfont = 0; @@ -3666,7 +3666,7 @@ static void do_text_internal( maxlen = len; } - opaque = TRUE; /* start by erasing the rectangle */ + opaque = true; /* start by erasing the rectangle */ for (remaining = len; remaining > 0; text += len, remaining -= len, x += char_width * len2) { len = (maxlen < remaining ? maxlen : remaining); @@ -3831,7 +3831,7 @@ static void do_text_internal( * rectangle. */ SetBkMode(wintw_hdc, TRANSPARENT); - opaque = FALSE; + opaque = false; } if (lattr != LATTR_TOP && (force_manual_underline || (und_mode == UND_LINE @@ -4975,7 +4975,7 @@ static void wintw_set_scrollbar(TermWin *tw, int total, int start, int page) si.nPage = page; si.nPos = start; if (hwnd) - SetScrollInfo(hwnd, SB_VERT, &si, TRUE); + SetScrollInfo(hwnd, SB_VERT, &si, true); } static int wintw_setup_draw_ctx(TermWin *tw) @@ -5007,11 +5007,11 @@ static void real_palette_set(int n, int r, int g, int b) static int wintw_palette_get(TermWin *tw, int n, int *r, int *g, int *b) { if (n < 0 || n >= NALLCOLOURS) - return FALSE; + return false; *r = colours_rgb[n].r; *g = colours_rgb[n].g; *b = colours_rgb[n].b; - return TRUE; + return true; } static void wintw_palette_set(TermWin *tw, int n, int r, int g, int b) @@ -5031,7 +5031,7 @@ static void wintw_palette_set(TermWin *tw, int n, int r, int g, int b) /* If Default Background changes, we need to ensure any * space between the text area and the window border is * redrawn. */ - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, NULL, true); } } @@ -5060,7 +5060,7 @@ static void wintw_palette_reset(TermWin *tw) } else { /* Default Background may have changed. Ensure any space between * text area and window border is redrawn. */ - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, NULL, true); } } @@ -5083,7 +5083,7 @@ void write_aclip(int clipboard, char *data, int len, int must_deselect) GlobalUnlock(clipdata); if (!must_deselect) - SendMessage(hwnd, WM_IGNORE_CLIP, TRUE, 0); + SendMessage(hwnd, WM_IGNORE_CLIP, true, 0); if (OpenClipboard(hwnd)) { EmptyClipboard(); @@ -5093,7 +5093,7 @@ void write_aclip(int clipboard, char *data, int len, int must_deselect) GlobalFree(clipdata); if (!must_deselect) - SendMessage(hwnd, WM_IGNORE_CLIP, FALSE, 0); + SendMessage(hwnd, WM_IGNORE_CLIP, false, 0); } typedef struct _rgbindex { @@ -5511,7 +5511,7 @@ static void wintw_clip_write( GlobalUnlock(clipdata2); if (!must_deselect) - SendMessage(hwnd, WM_IGNORE_CLIP, TRUE, 0); + SendMessage(hwnd, WM_IGNORE_CLIP, true, 0); if (OpenClipboard(hwnd)) { EmptyClipboard(); @@ -5526,7 +5526,7 @@ static void wintw_clip_write( } if (!must_deselect) - SendMessage(hwnd, WM_IGNORE_CLIP, FALSE, 0); + SendMessage(hwnd, WM_IGNORE_CLIP, false, 0); } static DWORD WINAPI clipboard_read_threadfunc(void *param) @@ -5653,7 +5653,7 @@ static BOOL flash_window_ex(DWORD dwFlags, UINT uCount, DWORD dwTimeout) return (*p_FlashWindowEx)(&fi); } else - return FALSE; /* shrug */ + return false; /* shrug */ } static void flash_window(int mode); @@ -5685,7 +5685,7 @@ static void flash_window(int mode) if (p_FlashWindowEx) flash_window_ex(FLASHW_STOP, 0, 0); else - FlashWindow(hwnd, FALSE); + FlashWindow(hwnd, false); } } else if (mode == 2) { @@ -5704,7 +5704,7 @@ static void flash_window(int mode) 0 /* system cursor blink rate */); /* No need to schedule timer */ } else { - FlashWindow(hwnd, TRUE); + FlashWindow(hwnd, true); next_flash = schedule_timer(450, flash_window_timer, hwnd); } } @@ -5712,7 +5712,7 @@ static void flash_window(int mode) } else if ((mode == 1) && (beep_ind == B_IND_FLASH)) { /* maintain */ if (flashing && !p_FlashWindowEx) { - FlashWindow(hwnd, TRUE); /* toggle */ + FlashWindow(hwnd, true); /* toggle */ next_flash = schedule_timer(450, flash_window_timer, hwnd); } } @@ -5825,7 +5825,7 @@ static void wintw_set_zorder(TermWin *tw, int top) */ static void wintw_refresh(TermWin *tw) { - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect(hwnd, NULL, true); } /* @@ -5887,10 +5887,10 @@ static const char *wintw_get_title(TermWin *tw, int icon) static int is_full_screen() { if (!IsZoomed(hwnd)) - return FALSE; + return false; if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_CAPTION) - return FALSE; - return TRUE; + return false; + return true; } /* Get the rect/size of a full screen window using the nearest available @@ -5907,7 +5907,7 @@ static int get_fullscreen_rect(RECT * ss) /* structure copy */ *ss = mi.rcMonitor; - return TRUE; + return true; #else /* could also use code like this: ss->left = ss->top = 0; @@ -6017,7 +6017,7 @@ static int win_seat_output(Seat *seat, int is_stderr, static int win_seat_eof(Seat *seat) { - return TRUE; /* do respond to incoming EOF with outgoing */ + return true; /* do respond to incoming EOF with outgoing */ } static int win_seat_get_userpass_input( diff --git a/windows/winhandl.c b/windows/winhandl.c index cfd62987..88c375cd 100644 --- a/windows/winhandl.c +++ b/windows/winhandl.c @@ -119,7 +119,7 @@ static DWORD WINAPI handle_input_threadfunc(void *param) if (ctx->flags & HANDLE_FLAG_OVERLAPPED) { povl = &ovl; - oev = CreateEvent(NULL, TRUE, FALSE, NULL); + oev = CreateEvent(NULL, true, false, NULL); } else { povl = NULL; } @@ -141,7 +141,7 @@ static DWORD WINAPI handle_input_threadfunc(void *param) ctx->readerr = 0; if (povl && !readret && ctx->readerr == ERROR_IO_PENDING) { WaitForSingleObject(povl->hEvent, INFINITE); - readret = GetOverlappedResult(ctx->h, povl, &ctx->len, FALSE); + readret = GetOverlappedResult(ctx->h, povl, &ctx->len, false); if (!readret) ctx->readerr = GetLastError(); else @@ -223,7 +223,7 @@ static void handle_throttle(struct handle_input *ctx, int backlog) */ if (backlog < MAX_BACKLOG) { SetEvent(ctx->ev_from_main); - ctx->busy = TRUE; + ctx->busy = true; } } @@ -288,7 +288,7 @@ static DWORD WINAPI handle_output_threadfunc(void *param) if (ctx->flags & HANDLE_FLAG_OVERLAPPED) { povl = &ovl; - oev = CreateEvent(NULL, TRUE, FALSE, NULL); + oev = CreateEvent(NULL, true, false, NULL); } else { povl = NULL; } @@ -318,7 +318,7 @@ static DWORD WINAPI handle_output_threadfunc(void *param) ctx->writeerr = 0; if (povl && !writeret && GetLastError() == ERROR_IO_PENDING) { writeret = GetOverlappedResult(ctx->h, povl, - &ctx->lenwritten, TRUE); + &ctx->lenwritten, true); if (!writeret) ctx->writeerr = GetLastError(); else @@ -354,7 +354,7 @@ static void handle_try_output(struct handle_output *ctx) ctx->buffer = senddata; ctx->len = sendlen; SetEvent(ctx->ev_from_main); - ctx->busy = TRUE; + ctx->busy = true; } else if (!ctx->busy && bufchain_size(&ctx->queued_data) == 0 && ctx->outgoingeof == EOF_PENDING) { CloseHandle(ctx->h); @@ -440,12 +440,12 @@ struct handle *handle_input_new(HANDLE handle, handle_inputfn_t gotdata, h->type = HT_INPUT; h->u.i.h = handle; - h->u.i.ev_to_main = CreateEvent(NULL, FALSE, FALSE, NULL); - h->u.i.ev_from_main = CreateEvent(NULL, FALSE, FALSE, NULL); + h->u.i.ev_to_main = CreateEvent(NULL, false, false, NULL); + h->u.i.ev_from_main = CreateEvent(NULL, false, false, NULL); h->u.i.gotdata = gotdata; - h->u.i.defunct = FALSE; - h->u.i.moribund = FALSE; - h->u.i.done = FALSE; + h->u.i.defunct = false; + h->u.i.moribund = false; + h->u.i.done = false; h->u.i.privdata = privdata; h->u.i.flags = flags; @@ -455,7 +455,7 @@ struct handle *handle_input_new(HANDLE handle, handle_inputfn_t gotdata, CreateThread(NULL, 0, handle_input_threadfunc, &h->u.i, 0, &in_threadid); - h->u.i.busy = TRUE; + h->u.i.busy = true; return h; } @@ -468,12 +468,12 @@ struct handle *handle_output_new(HANDLE handle, handle_outputfn_t sentdata, h->type = HT_OUTPUT; h->u.o.h = handle; - h->u.o.ev_to_main = CreateEvent(NULL, FALSE, FALSE, NULL); - h->u.o.ev_from_main = CreateEvent(NULL, FALSE, FALSE, NULL); - h->u.o.busy = FALSE; - h->u.o.defunct = FALSE; - h->u.o.moribund = FALSE; - h->u.o.done = FALSE; + h->u.o.ev_to_main = CreateEvent(NULL, false, false, NULL); + h->u.o.ev_from_main = CreateEvent(NULL, false, false, NULL); + h->u.o.busy = false; + h->u.o.defunct = false; + h->u.o.moribund = false; + h->u.o.done = false; h->u.o.privdata = privdata; bufchain_init(&h->u.o.queued_data); h->u.o.outgoingeof = EOF_NO; @@ -499,13 +499,13 @@ struct handle *handle_add_foreign_event(HANDLE event, h->u.f.h = INVALID_HANDLE_VALUE; h->u.f.ev_to_main = event; h->u.f.ev_from_main = INVALID_HANDLE_VALUE; - h->u.f.defunct = TRUE; /* we have no thread in the first place */ - h->u.f.moribund = FALSE; - h->u.f.done = FALSE; + h->u.f.defunct = true; /* we have no thread in the first place */ + h->u.f.moribund = false; + h->u.f.done = false; h->u.f.privdata = NULL; h->u.f.callback = callback; h->u.f.ctx = ctx; - h->u.f.busy = TRUE; + h->u.f.busy = true; if (!handles_by_evtomain) handles_by_evtomain = newtree234(handle_cmp_evtomain); @@ -592,7 +592,7 @@ void handle_free(struct handle *h) * we set the moribund flag, which will be noticed next time * an operation completes. */ - h->u.g.moribund = TRUE; + h->u.g.moribund = true; } else if (h->u.g.defunct) { /* * There isn't even a subthread; we can go straight to @@ -605,9 +605,9 @@ void handle_free(struct handle *h) * to die. Set the moribund flag to indicate that it will * want destroying after that. */ - h->u.g.moribund = TRUE; - h->u.g.done = TRUE; - h->u.g.busy = TRUE; + h->u.g.moribund = true; + h->u.g.done = true; + h->u.g.busy = true; SetEvent(h->u.g.ev_from_main); } } @@ -642,8 +642,8 @@ void handle_got_event(HANDLE event) if (h->u.g.done) { handle_destroy(h); } else { - h->u.g.done = TRUE; - h->u.g.busy = TRUE; + h->u.g.done = true; + h->u.g.busy = true; SetEvent(h->u.g.ev_from_main); } return; @@ -653,7 +653,7 @@ void handle_got_event(HANDLE event) int backlog; case HT_INPUT: - h->u.i.busy = FALSE; + h->u.i.busy = false; /* * A signal on an input handle means data has arrived. @@ -662,7 +662,7 @@ void handle_got_event(HANDLE event) /* * EOF, or (nearly equivalently) read error. */ - h->u.i.defunct = TRUE; + h->u.i.defunct = true; h->u.i.gotdata(h, NULL, -h->u.i.readerr); } else { backlog = h->u.i.gotdata(h, h->u.i.buffer, h->u.i.len); @@ -671,7 +671,7 @@ void handle_got_event(HANDLE event) break; case HT_OUTPUT: - h->u.o.busy = FALSE; + h->u.o.busy = false; /* * A signal on an output handle means we have completed a @@ -684,7 +684,7 @@ void handle_got_event(HANDLE event) * and mark the thread as defunct (because the output * thread is terminating by now). */ - h->u.o.defunct = TRUE; + h->u.o.defunct = true; h->u.o.sentdata(h, -h->u.o.writeerr); } else { bufchain_consume(&h->u.o.queued_data, h->u.o.lenwritten); diff --git a/windows/winhelp.c b/windows/winhelp.c index daf92ed9..03444236 100644 --- a/windows/winhelp.c +++ b/windows/winhelp.c @@ -42,10 +42,10 @@ void init_help(void) help_path = NULL; strcpy(r, PUTTY_HELP_CONTENTS); if ( (fp = fopen(b, "r")) != NULL) { - help_has_contents = TRUE; + help_has_contents = true; fclose(fp); } else - help_has_contents = FALSE; + help_has_contents = false; #ifndef NO_HTMLHELP strcpy(r, PUTTY_CHM_FILE); @@ -120,7 +120,7 @@ void launch_help(HWND hwnd, const char *topic) help_has_contents ? HELP_FINDER : HELP_CONTENTS, 0); } } - requested_help = TRUE; + requested_help = true; } void quit_help(HWND hwnd) @@ -134,6 +134,6 @@ void quit_help(HWND hwnd) if (help_path) { WinHelp(hwnd, help_path, HELP_QUIT, 0); } - requested_help = FALSE; + requested_help = false; } } diff --git a/windows/winhsock.c b/windows/winhsock.c index 27e1e0c5..fdc225b4 100644 --- a/windows/winhsock.c +++ b/windows/winhsock.c @@ -118,7 +118,7 @@ static void sk_handle_close(Socket *s) HandleSocket *hs = container_of(s, HandleSocket, sock); if (hs->defer_close) { - hs->deferred_close = TRUE; + hs->deferred_close = true; return; } @@ -185,10 +185,10 @@ static void handle_socket_unfreeze(void *hsv) * Hand it off to the plug. Be careful of re-entrance - that might * have the effect of trying to close this socket. */ - hs->defer_close = TRUE; + hs->defer_close = true; plug_receive(hs->plug, 0, data, len); bufchain_consume(&hs->inputdata, len); - hs->defer_close = FALSE; + hs->defer_close = false; if (hs->deferred_close) { sk_handle_close(&hs->sock); return; @@ -346,7 +346,7 @@ Socket *make_handle_socket(HANDLE send_H, HANDLE recv_H, HANDLE stderr_H, hs->stderr_h = handle_input_new(hs->stderr_H, handle_stderr, hs, flags); - hs->defer_close = hs->deferred_close = FALSE; + hs->defer_close = hs->deferred_close = false; return &hs->sock; } diff --git a/windows/winjump.c b/windows/winjump.c index e42ba275..dccdb93d 100644 --- a/windows/winjump.c +++ b/windows/winjump.c @@ -492,7 +492,7 @@ static void update_jumplist_from_registry(void) IObjectArray *array = NULL; IShellLink *link = NULL; IObjectArray *pRemoved = NULL; - int need_abort = FALSE; + int need_abort = false; /* * Create an ICustomDestinationList: the top-level object which @@ -513,7 +513,7 @@ static void update_jumplist_from_registry(void) if (!SUCCEEDED(pCDL->lpVtbl->BeginList(pCDL, &num_items, COMPTR(IObjectArray, &pRemoved)))) goto cleanup; - need_abort = TRUE; + need_abort = true; if (!SUCCEEDED(pRemoved->lpVtbl->GetCount(pRemoved, &nremoved))) nremoved = 0; @@ -543,7 +543,7 @@ static void update_jumplist_from_registry(void) /* * Check that the link isn't in the user-removed list. */ - for (i = 0, found = FALSE; i < nremoved && !found; i++) { + for (i = 0, found = false; i < nremoved && !found; i++) { IShellLink *rlink; if (SUCCEEDED(pRemoved->lpVtbl->GetAt (pRemoved, i, COMPTR(IShellLink, &rlink)))) { @@ -553,7 +553,7 @@ static void update_jumplist_from_registry(void) SUCCEEDED(rlink->lpVtbl->GetDescription (rlink, desc2, sizeof(desc2)-1)) && !strcmp(desc1, desc2)) { - found = TRUE; + found = true; } rlink->lpVtbl->Release(rlink); } @@ -656,7 +656,7 @@ static void update_jumplist_from_registry(void) * Commit the jump list. */ pCDL->lpVtbl->CommitList(pCDL); - need_abort = FALSE; + need_abort = false; /* * Clean up. @@ -738,12 +738,12 @@ BOOL set_explicit_app_user_model_id() { if (p_SetCurrentProcessExplicitAppUserModelID(L"SimonTatham.PuTTY") == S_OK) { - return TRUE; + return true; } - return FALSE; + return false; } /* Function doesn't exist, which is ok for Pre-7 systems */ - return TRUE; + return true; } diff --git a/windows/winmisc.c b/windows/winmisc.c index 4a53757e..6bdbedee 100644 --- a/windows/winmisc.c +++ b/windows/winmisc.c @@ -81,12 +81,12 @@ char *get_username(void) { DWORD namelen; char *user; - int got_username = FALSE; + int got_username = false; DECL_WINDOWS_FUNCTION(static, BOOLEAN, GetUserNameExA, (EXTENDED_NAME_FORMAT, LPSTR, PULONG)); { - static int tried_usernameex = FALSE; + static int tried_usernameex = false; if (!tried_usernameex) { /* Not available on Win9x, so load dynamically */ HMODULE secur32 = load_system32_dll("secur32.dll"); @@ -97,7 +97,7 @@ char *get_username(void) HMODULE sspicli = load_system32_dll("sspicli.dll"); (void)sspicli; /* squash compiler warning about unused variable */ GET_WINDOWS_FUNCTION(secur32, GetUserNameExA); - tried_usernameex = TRUE; + tried_usernameex = true; } } @@ -125,7 +125,7 @@ char *get_username(void) if (!got_username) { /* Fall back to local user name */ namelen = 0; - if (GetUserName(NULL, &namelen) == FALSE) { + if (GetUserName(NULL, &namelen) == false) { /* * Apparently this doesn't work at least on Windows XP SP2. * Thus assume a maximum of 256. It will fail again if it @@ -604,7 +604,7 @@ int open_for_write_would_lose_data(const Filename *fn) * let the subsequent attempt to open the file for real give a * more useful error message. */ - return FALSE; + return false; } if (attrs.dwFileAttributes & (FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_DIRECTORY)) { @@ -613,7 +613,7 @@ int open_for_write_would_lose_data(const Filename *fn) * opening it for writing will not cause truncation. (It may * not _succeed_ either, but that's not our problem here!) */ - return FALSE; + return false; } if (attrs.nFileSizeHigh == 0 && attrs.nFileSizeLow == 0) { /* @@ -622,7 +622,7 @@ int open_for_write_would_lose_data(const Filename *fn) * opening it for writing won't truncate any data away because * there's nothing to truncate anyway. */ - return FALSE; + return false; } - return TRUE; + return true; } diff --git a/windows/winnet.c b/windows/winnet.c index e320397d..44092bbb 100644 --- a/windows/winnet.c +++ b/windows/winnet.c @@ -213,14 +213,14 @@ int sk_startup(int hi, int lo) winsock_ver = MAKEWORD(hi, lo); if (p_WSAStartup(winsock_ver, &wsadata)) { - return FALSE; + return false; } if (LOBYTE(wsadata.wVersion) != LOBYTE(winsock_ver)) { - return FALSE; + return false; } - return TRUE; + return true; } /* Actually define this function pointer, which won't have been @@ -524,9 +524,9 @@ SockAddr *sk_namelookup(const char *host, char **canonicalname, #ifndef NO_IPV6 ret->ais = NULL; #endif - ret->namedpipe = FALSE; + ret->namedpipe = false; ret->addresses = NULL; - ret->resolved = FALSE; + ret->resolved = false; ret->refcount = 1; *realhost = '\0'; @@ -549,7 +549,7 @@ SockAddr *sk_namelookup(const char *host, char **canonicalname, sfree(trimmed_host); } if (err == 0) - ret->resolved = TRUE; + ret->resolved = true; } else #endif { @@ -558,7 +558,7 @@ SockAddr *sk_namelookup(const char *host, char **canonicalname, * (NOTE: we don't use gethostbyname as a fallback!) */ if ( (h = p_gethostbyname(host)) ) - ret->resolved = TRUE; + ret->resolved = true; else err = p_WSAGetLastError(); } @@ -614,7 +614,7 @@ SockAddr *sk_namelookup(const char *host, char **canonicalname, ret->addresses = snewn(1, unsigned long); ret->naddresses = 1; ret->addresses[0] = p_ntohl(a); - ret->resolved = TRUE; + ret->resolved = true; strncpy(realhost, host, sizeof(realhost)); } realhost[lenof(realhost)-1] = '\0'; @@ -627,11 +627,11 @@ SockAddr *sk_nonamelookup(const char *host) { SockAddr *ret = snew(SockAddr); ret->error = NULL; - ret->resolved = FALSE; + ret->resolved = false; #ifndef NO_IPV6 ret->ais = NULL; #endif - ret->namedpipe = FALSE; + ret->namedpipe = false; ret->addresses = NULL; ret->naddresses = 0; ret->refcount = 1; @@ -644,11 +644,11 @@ SockAddr *sk_namedpipe_addr(const char *pipename) { SockAddr *ret = snew(SockAddr); ret->error = NULL; - ret->resolved = FALSE; + ret->resolved = false; #ifndef NO_IPV6 ret->ais = NULL; #endif - ret->namedpipe = TRUE; + ret->namedpipe = true; ret->addresses = NULL; ret->naddresses = 0; ret->refcount = 1; @@ -663,16 +663,16 @@ int sk_nextaddr(SockAddr *addr, SockAddrStep *step) if (step->ai) { if (step->ai->ai_next) { step->ai = step->ai->ai_next; - return TRUE; + return true; } else - return FALSE; + return false; } #endif if (step->curraddr+1 < addr->naddresses) { step->curraddr++; - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -741,7 +741,7 @@ static SockAddr sk_extractaddr_tmp( int sk_addr_needs_port(SockAddr *addr) { - return addr->namedpipe ? FALSE : TRUE; + return addr->namedpipe ? false : true; } int sk_hostname_is_local(const char *name) @@ -851,7 +851,7 @@ void sk_addrcopy(SockAddr *addr, char *buf) memcpy(buf, &((struct sockaddr_in6 *)step.ai->ai_addr)->sin6_addr, sizeof(struct in6_addr)); else - assert(FALSE); + assert(false); } else #endif if (family == AF_INET) { @@ -1015,17 +1015,17 @@ static DWORD try_connect(NetSocket *sock) SetHandleInformation((HANDLE)s, HANDLE_FLAG_INHERIT, 0); if (sock->oobinline) { - BOOL b = TRUE; + BOOL b = true; p_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, (void *) &b, sizeof(b)); } if (sock->nodelay) { - BOOL b = TRUE; + BOOL b = true; p_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (void *) &b, sizeof(b)); } if (sock->keepalive) { - BOOL b = TRUE; + BOOL b = true; p_setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (void *) &b, sizeof(b)); } @@ -1470,7 +1470,7 @@ void try_send(NetSocket *s) * a small number - so we check that case and treat * it just like WSAEWOULDBLOCK.) */ - s->writable = FALSE; + s->writable = false; return; } else { /* diff --git a/windows/winnoise.c b/windows/winnoise.c index 1dd0481b..b2305d26 100644 --- a/windows/winnoise.c +++ b/windows/winnoise.c @@ -21,7 +21,7 @@ static HMODULE wincrypt_module = NULL; int win_read_random(void *buf, unsigned wanted) { - int toret = FALSE; + int toret = false; HCRYPTPROV crypt_provider; if (!wincrypt_module) { diff --git a/windows/winnpc.c b/windows/winnpc.c index 624757a4..f5bffbf7 100644 --- a/windows/winnpc.c +++ b/windows/winnpc.c @@ -80,7 +80,7 @@ Socket *new_named_pipe_client(const char *pipename, Plug *plug) LocalFree(psd); - return make_handle_socket(pipehandle, pipehandle, NULL, plug, TRUE); + return make_handle_socket(pipehandle, pipehandle, NULL, plug, true); } #endif /* !defined NO_SECURITY */ diff --git a/windows/winnps.c b/windows/winnps.c index 3e6904f3..5ea141fa 100644 --- a/windows/winnps.c +++ b/windows/winnps.c @@ -80,7 +80,7 @@ static int create_named_pipe(NamedPipeServerSocket *ps, int first_instance) memset(&sa, 0, sizeof(sa)); sa.nLength = sizeof(sa); sa.lpSecurityDescriptor = ps->psd; - sa.bInheritHandle = FALSE; + sa.bInheritHandle = false; ps->pipehandle = CreateNamedPipe (/* lpName */ @@ -117,7 +117,7 @@ static Socket *named_pipe_accept(accept_ctx_t ctx, Plug *plug) { HANDLE conn = (HANDLE)ctx.p; - return make_handle_socket(conn, conn, NULL, plug, TRUE); + return make_handle_socket(conn, conn, NULL, plug, true); } /* @@ -136,7 +136,7 @@ static void named_pipe_accept_loop(NamedPipeServerSocket *ps, if (got_one_already) { /* If we were called with a connection already waiting, * skip this step. */ - got_one_already = FALSE; + got_one_already = false; error = 0; } else { /* @@ -173,7 +173,7 @@ static void named_pipe_accept_loop(NamedPipeServerSocket *ps, CloseHandle(conn); } - if (!create_named_pipe(ps, FALSE)) { + if (!create_named_pipe(ps, false)) { error = GetLastError(); } else { /* @@ -196,7 +196,7 @@ static void named_pipe_accept_loop(NamedPipeServerSocket *ps, static void named_pipe_connect_callback(void *vps) { NamedPipeServerSocket *ps = (NamedPipeServerSocket *)vps; - named_pipe_accept_loop(ps, TRUE); + named_pipe_accept_loop(ps, true); } /* @@ -234,18 +234,18 @@ Socket *new_named_pipe_listener(const char *pipename, Plug *plug) goto cleanup; } - if (!create_named_pipe(ret, TRUE)) { + if (!create_named_pipe(ret, true)) { ret->error = dupprintf("unable to create named pipe '%s': %s", pipename, win_strerror(GetLastError())); goto cleanup; } memset(&ret->connect_ovl, 0, sizeof(ret->connect_ovl)); - ret->connect_ovl.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + ret->connect_ovl.hEvent = CreateEvent(NULL, true, false, NULL); ret->callback_handle = handle_add_foreign_event(ret->connect_ovl.hEvent, named_pipe_connect_callback, ret); - named_pipe_accept_loop(ret, FALSE); + named_pipe_accept_loop(ret, false); cleanup: return &ret->sock; diff --git a/windows/winpgen.c b/windows/winpgen.c index 11b438dc..0c90838e 100644 --- a/windows/winpgen.c +++ b/windows/winpgen.c @@ -171,7 +171,7 @@ static INT_PTR CALLBACK PassphraseProc(HWND hwnd, UINT msg, MoveWindow(hwnd, (rs.right + rs.left + rd.left - rd.right) / 2, (rs.bottom + rs.top + rd.top - rd.bottom) / 2, - rd.right - rd.left, rd.bottom - rd.top, TRUE); + rd.right - rd.left, rd.bottom - rd.top, true); } p = (struct PassphraseProcStruct *) lParam; @@ -233,7 +233,7 @@ static int prompt_keyfile(HWND hwnd, char *dlgtitle, of.lpstrFileTitle = NULL; of.lpstrTitle = dlgtitle; of.Flags = 0; - return request_file(NULL, &of, FALSE, save); + return request_file(NULL, &of, false, save); } /* @@ -256,7 +256,7 @@ static INT_PTR CALLBACK LicenceProc(HWND hwnd, UINT msg, MoveWindow(hwnd, (rs.right + rs.left + rd.left - rd.right) / 2, (rs.bottom + rs.top + rd.top - rd.bottom) / 2, - rd.right - rd.left, rd.bottom - rd.top, TRUE); + rd.right - rd.left, rd.bottom - rd.top, true); } SetDlgItemText(hwnd, 1000, LICENCE_TEXT("\r\n\r\n")); @@ -296,7 +296,7 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg, MoveWindow(hwnd, (rs.right + rs.left + rd.left - rd.right) / 2, (rs.bottom + rs.top + rd.top - rd.bottom) / 2, - rd.right - rd.left, rd.bottom - rd.top, TRUE); + rd.right - rd.left, rd.bottom - rd.top, true); } { @@ -493,9 +493,9 @@ void ui_set_state(HWND hwnd, struct MainDlgState *state, int status) switch (status) { case 0: /* no key */ - hidemany(hwnd, nokey_ids, FALSE); - hidemany(hwnd, generating_ids, TRUE); - hidemany(hwnd, gotkey_ids, TRUE); + hidemany(hwnd, nokey_ids, false); + hidemany(hwnd, generating_ids, true); + hidemany(hwnd, gotkey_ids, true); EnableWindow(GetDlgItem(hwnd, IDC_GENERATE), 1); EnableWindow(GetDlgItem(hwnd, IDC_LOAD), 1); EnableWindow(GetDlgItem(hwnd, IDC_SAVE), 0); @@ -526,9 +526,9 @@ void ui_set_state(HWND hwnd, struct MainDlgState *state, int status) MF_GRAYED|MF_BYCOMMAND); break; case 1: /* generating key */ - hidemany(hwnd, nokey_ids, TRUE); - hidemany(hwnd, generating_ids, FALSE); - hidemany(hwnd, gotkey_ids, TRUE); + hidemany(hwnd, nokey_ids, true); + hidemany(hwnd, generating_ids, false); + hidemany(hwnd, gotkey_ids, true); EnableWindow(GetDlgItem(hwnd, IDC_GENERATE), 0); EnableWindow(GetDlgItem(hwnd, IDC_LOAD), 0); EnableWindow(GetDlgItem(hwnd, IDC_SAVE), 0); @@ -559,9 +559,9 @@ void ui_set_state(HWND hwnd, struct MainDlgState *state, int status) MF_GRAYED|MF_BYCOMMAND); break; case 2: - hidemany(hwnd, nokey_ids, TRUE); - hidemany(hwnd, generating_ids, TRUE); - hidemany(hwnd, gotkey_ids, FALSE); + hidemany(hwnd, nokey_ids, true); + hidemany(hwnd, generating_ids, true); + hidemany(hwnd, gotkey_ids, false); EnableWindow(GetDlgItem(hwnd, IDC_GENERATE), 1); EnableWindow(GetDlgItem(hwnd, IDC_LOAD), 1); EnableWindow(GetDlgItem(hwnd, IDC_SAVE), 1); @@ -739,7 +739,7 @@ void load_key_file(HWND hwnd, struct MainDlgState *state, if (type == SSH_KEYTYPE_SSH1) { char *fingerprint, *savecomment; - state->ssh2 = FALSE; + state->ssh2 = false; state->commentptr = &state->key.comment; state->key = newkey1; @@ -764,7 +764,7 @@ void load_key_file(HWND hwnd, struct MainDlgState *state, char *fp; char *savecomment; - state->ssh2 = TRUE; + state->ssh2 = true; state->commentptr = &state->ssh2key.comment; state->ssh2key = *newkey2; /* structure copy */ @@ -789,7 +789,7 @@ void load_key_file(HWND hwnd, struct MainDlgState *state, * the key data. */ ui_set_state(hwnd, state, 2); - state->key_exists = TRUE; + state->key_exists = true; /* * If the user has imported a foreign key @@ -841,7 +841,7 @@ static void start_generating_key(HWND hwnd, struct MainDlgState *state) MB_OK | MB_ICONERROR); sfree(params); } else { - state->generation_thread_exists = TRUE; + state->generation_thread_exists = true; } } @@ -871,10 +871,10 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, (LPARAM) LoadIcon(hinst, MAKEINTRESOURCE(200))); state = snew(struct MainDlgState); - state->generation_thread_exists = FALSE; - state->collecting_entropy = FALSE; + state->generation_thread_exists = false; + state->collecting_entropy = false; state->entropy = NULL; - state->key_exists = FALSE; + state->key_exists = false; SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) state); { HMENU menu, menu1; @@ -935,7 +935,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, MoveWindow(hwnd, (rs.right + rs.left + rd.left - rd.right) / 2, (rs.bottom + rs.top + rd.top - rd.bottom) / 2, - rd.right - rd.left, rd.bottom - rd.top, TRUE); + rd.right - rd.left, rd.bottom - rd.top, true); } { @@ -1012,7 +1012,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, endbox(&cp); } ui_set_key_type(hwnd, state, IDC_KEYSSH2RSA); - SetDlgItemInt(hwnd, IDC_BITS, DEFAULT_KEY_BITS, FALSE); + SetDlgItemInt(hwnd, IDC_BITS, DEFAULT_KEY_BITS, false); SendDlgItemMessage(hwnd, IDC_CURVE, CB_SETCURSEL, DEFAULT_CURVE_INDEX, 0); @@ -1049,7 +1049,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, random_add_heavynoise(state->entropy, state->entropy_size); smemclr(state->entropy, state->entropy_size); sfree(state->entropy); - state->collecting_entropy = FALSE; + state->collecting_entropy = false; start_generating_key(hwnd, state); } @@ -1114,7 +1114,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, unsigned raw_entropy_required; unsigned char *raw_entropy_buf; BOOL ok; - state->key_bits = GetDlgItemInt(hwnd, IDC_BITS, &ok, FALSE); + state->key_bits = GetDlgItemInt(hwnd, IDC_BITS, &ok, false); if (!ok) state->key_bits = DEFAULT_KEY_BITS; { @@ -1147,7 +1147,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, if (ret != IDOK) break; state->key_bits = DEFAULT_KEY_BITS; - SetDlgItemInt(hwnd, IDC_BITS, DEFAULT_KEY_BITS, FALSE); + SetDlgItemInt(hwnd, IDC_BITS, DEFAULT_KEY_BITS, false); } else if ((state->keytype == RSA || state->keytype == DSA) && state->key_bits < DEFAULT_KEY_BITS) { char *message = dupprintf @@ -1201,8 +1201,8 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, ui_set_state(hwnd, state, 1); SetDlgItemText(hwnd, IDC_GENERATING, entropy_msg); - state->key_exists = FALSE; - state->collecting_entropy = TRUE; + state->key_exists = false; + state->collecting_entropy = true; state->entropy_got = 0; state->entropy_size = (state->entropy_required * @@ -1392,8 +1392,8 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, return 0; case WM_DONEKEY: state = (struct MainDlgState *) GetWindowLongPtr(hwnd, GWLP_USERDATA); - state->generation_thread_exists = FALSE; - state->key_exists = TRUE; + state->generation_thread_exists = false; + state->key_exists = true; SendDlgItemMessage(hwnd, IDC_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0, PROGRESSRANGE)); SendDlgItemMessage(hwnd, IDC_PROGRESS, PBM_SETPOS, PROGRESSRANGE, 0); diff --git a/windows/winpgnt.c b/windows/winpgnt.c index b5e9fcbb..bae72174 100644 --- a/windows/winpgnt.c +++ b/windows/winpgnt.c @@ -58,7 +58,7 @@ static HMENU systray_menu, session_menu; static int already_running; static char *putty_path; -static int restrict_putty_acl = FALSE; +static int restrict_putty_acl = false; /* CWD for "add key" file requester. */ static filereq *keypath = NULL; @@ -222,7 +222,7 @@ static INT_PTR CALLBACK PassphraseProc(HWND hwnd, UINT msg, MoveWindow(hwnd, (rs.right + rs.left + rd.left - rd.right) / 2, (rs.bottom + rs.top + rd.top - rd.bottom) / 2, - rd.right - rd.left, rd.bottom - rd.top, TRUE); + rd.right - rd.left, rd.bottom - rd.top, true); } SetForegroundWindow(hwnd); @@ -467,7 +467,7 @@ static void prompt_add_keyfile(void) of.lpstrFileTitle = NULL; of.lpstrTitle = "Select Private Key File"; of.Flags = OFN_ALLOWMULTISELECT | OFN_EXPLORER; - if (request_file(keypath, &of, TRUE, FALSE)) { + if (request_file(keypath, &of, true, false)) { if(strlen(filelist) > of.nFileOffset) { /* Only one filename returned? */ Filename *fn = filename_from_str(filelist); @@ -520,7 +520,7 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg, MoveWindow(hwnd, (rs.right + rs.left + rd.left - rd.right) / 2, (rs.bottom + rs.top + rd.top - rd.bottom) / 2, - rd.right - rd.left, rd.bottom - rd.top, TRUE); + rd.right - rd.left, rd.bottom - rd.top, true); } if (has_help()) @@ -715,7 +715,7 @@ static void update_sessions(void) mii.fState = MFS_ENABLED; mii.wID = (index_menu * 16) + IDM_SESSIONS_BASE; mii.dwTypeData = session_name; - InsertMenuItem(session_menu, index_menu, TRUE, &mii); + InsertMenuItem(session_menu, index_menu, true, &mii); index_menu++; } index_key++; @@ -729,7 +729,7 @@ static void update_sessions(void) mii.fType = MFT_STRING; mii.fState = MFS_GRAYED; mii.dwTypeData = _T("(No sessions)"); - InsertMenuItem(session_menu, index_menu, TRUE, &mii); + InsertMenuItem(session_menu, index_menu, true, &mii); } } @@ -748,7 +748,7 @@ PSID get_default_sid(void) PSECURITY_DESCRIPTOR psd = NULL; PSID sid = NULL, copy = NULL, ret = NULL; - if ((proc = OpenProcess(MAXIMUM_ALLOWED, FALSE, + if ((proc = OpenProcess(MAXIMUM_ALLOWED, false, GetCurrentProcessId())) == NULL) goto cleanup; @@ -795,7 +795,7 @@ static void pageant_reply_BinarySink_write( memcpy(rep->buf + rep->len, data, len); rep->len += len; } else { - rep->overflowed = TRUE; + rep->overflowed = true; } } @@ -821,7 +821,7 @@ static char *answer_filemapping_message(const char *mapname) debug(("mapname = \"%s\"\n", mapname)); #endif - maphandle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, mapname); + maphandle = OpenFileMapping(FILE_MAP_ALL_ACCESS, false, mapname); if (maphandle == NULL || maphandle == INVALID_HANDLE_VALUE) { err = dupprintf("OpenFileMapping(\"%s\"): %s", mapname, win_strerror(GetLastError())); @@ -928,7 +928,7 @@ static char *answer_filemapping_message(const char *mapname) reply.buf = (char *)mapaddr + 4; reply.size = mapsize - 4; reply.len = 0; - reply.overflowed = FALSE; + reply.overflowed = false; BinarySink_INIT(&reply, pageant_reply_BinarySink_write); if (msglen > mapsize - 4) { @@ -939,7 +939,7 @@ static char *answer_filemapping_message(const char *mapname) (unsigned char *)mapaddr + 4, msglen, NULL, NULL); if (reply.overflowed) { reply.len = 0; - reply.overflowed = FALSE; + reply.overflowed = false; pageant_failure_msg(BinarySink_UPCAST(&reply), "output would overflow message buffer", NULL, NULL); @@ -993,7 +993,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, PostMessage(hwnd, WM_SYSTRAY2, cursorpos.x, cursorpos.y); } else if (lParam == WM_LBUTTONDBLCLK) { /* Run the default menu item. */ - UINT menuitem = GetMenuDefaultItem(systray_menu, FALSE, 0); + UINT menuitem = GetMenuDefaultItem(systray_menu, false, 0); if (menuitem != -1) PostMessage(hwnd, WM_COMMAND, menuitem, 0); } @@ -1085,7 +1085,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, mii.fMask = MIIM_TYPE; mii.cch = MAX_PATH; mii.dwTypeData = buf; - GetMenuItemInfo(session_menu, wParam, FALSE, &mii); + GetMenuItemInfo(session_menu, wParam, false, &mii); param[0] = '\0'; if (restrict_putty_acl) strcat(param, "&R"); @@ -1258,7 +1258,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) restrict_process_acl(); } else if (!strcmp(argv[i], "-restrict-putty-acl") || !strcmp(argv[i], "-restrict_putty_acl")) { - restrict_putty_acl = TRUE; + restrict_putty_acl = true; } else if (!strcmp(argv[i], "-c")) { /* * If we see `-c', then the rest of the @@ -1274,7 +1274,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) Filename *fn = filename_from_str(argv[i]); win_add_keyfile(fn); filename_free(fn); - added_keys = TRUE; + added_keys = true; } } @@ -1356,7 +1356,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) initial_menuitems_count = GetMenuItemCount(session_menu); /* Set the default menu item. */ - SetMenuDefaultItem(systray_menu, IDM_VIEWKEYS, FALSE); + SetMenuDefaultItem(systray_menu, IDM_VIEWKEYS, false); ShowWindow(hwnd, SW_HIDE); diff --git a/windows/winpgntc.c b/windows/winpgntc.c index c6607715..d079c9b9 100644 --- a/windows/winpgntc.c +++ b/windows/winpgntc.c @@ -20,9 +20,9 @@ int agent_exists(void) HWND hwnd; hwnd = FindWindow("Pageant", "Pageant"); if (!hwnd) - return FALSE; + return false; else - return TRUE; + return true; } void agent_cancel_query(agent_pending_query *q) @@ -75,9 +75,9 @@ agent_pending_query *agent_query( if (psd) { if (p_InitializeSecurityDescriptor (psd, SECURITY_DESCRIPTOR_REVISION) && - p_SetSecurityDescriptorOwner(psd, usersid, FALSE)) { + p_SetSecurityDescriptorOwner(psd, usersid, false)) { sa.nLength = sizeof(sa); - sa.bInheritHandle = TRUE; + sa.bInheritHandle = true; sa.lpSecurityDescriptor = psd; psa = &sa; } else { diff --git a/windows/winplink.c b/windows/winplink.c index d2a7b80e..b777443a 100644 --- a/windows/winplink.c +++ b/windows/winplink.c @@ -42,7 +42,7 @@ static Conf *conf; int term_ldisc(Terminal *term, int mode) { - return FALSE; + return false; } static void plink_echoedit_update(Seat *seat, int echo, int edit) { @@ -75,7 +75,7 @@ static int plink_output(Seat *seat, int is_stderr, const void *data, int len) static int plink_eof(Seat *seat) { handle_write_eof(stdout_handle); - return FALSE; /* do not respond to incoming EOF with outgoing */ + return false; /* do not respond to incoming EOF with outgoing */ } static int plink_get_userpass_input(Seat *seat, prompts_t *p, bufchain *input) @@ -254,8 +254,8 @@ void stdouterr_sent(struct handle *h, int new_backlog) } } -const int share_can_be_downstream = TRUE; -const int share_can_be_upstream = TRUE; +const int share_can_be_downstream = true; +const int share_can_be_upstream = true; int main(int argc, char **argv) { @@ -265,7 +265,7 @@ int main(int argc, char **argv) int exitcode; int errors; int use_subsystem = 0; - int just_test_share_exists = FALSE; + int just_test_share_exists = false; unsigned long now, next, then; const struct BackendVtable *vt; @@ -292,7 +292,7 @@ int main(int argc, char **argv) */ conf = conf_new(); do_defaults(NULL, conf); - loaded_session = FALSE; + loaded_session = false; default_protocol = conf_get_int(conf, CONF_protocol); default_port = conf_get_int(conf, CONF_port); errors = 0; @@ -336,7 +336,7 @@ int main(int argc, char **argv) pgp_fingerprints(); exit(1); } else if (!strcmp(p, "-shareexists")) { - just_test_share_exists = TRUE; + just_test_share_exists = true; } else if (*p != '-') { char *command; int cmdlen, cmdsize; @@ -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_int(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_int(conf, CONF_ssh_subsys, true); if (!*conf_get_str(conf, CONF_remote_cmd) && !*conf_get_str(conf, CONF_remote_cmd2) && @@ -422,7 +422,7 @@ int main(int argc, char **argv) !conf_get_int(conf, CONF_x11_forward) && !conf_get_int(conf, CONF_agentfwd) && !conf_get_str_nthstrkey(conf, CONF_portfwd, 0)) - conf_set_int(conf, CONF_ssh_simple, TRUE); + conf_set_int(conf, CONF_ssh_simple, true); logctx = log_init(default_logpolicy, conf); @@ -446,7 +446,7 @@ int main(int argc, char **argv) /* * Start up the connection. */ - netevent = CreateEvent(NULL, FALSE, FALSE, NULL); + netevent = CreateEvent(NULL, false, false, NULL); { const char *error; char *realhost; @@ -488,7 +488,7 @@ int main(int argc, char **argv) main_thread_id = GetCurrentThreadId(); - sending = FALSE; + sending = false; now = GETTICKCOUNT(); @@ -501,7 +501,7 @@ int main(int argc, char **argv) if (!sending && backend_sendok(backend)) { stdin_handle = handle_input_new(inhandle, stdin_gotdata, NULL, 0); - sending = TRUE; + sending = true; } if (toplevel_callback_pending()) { @@ -523,7 +523,7 @@ int main(int argc, char **argv) handles = handle_get_events(&nhandles); handles = sresize(handles, nhandles+1, HANDLE); handles[nhandles] = netevent; - n = MsgWaitForMultipleObjects(nhandles+1, handles, FALSE, ticks, + n = MsgWaitForMultipleObjects(nhandles+1, handles, false, ticks, QS_POSTMESSAGE); if ((unsigned)(n - WAIT_OBJECT_0) < (unsigned)nhandles) { handle_got_event(handles[n - WAIT_OBJECT_0]); diff --git a/windows/winprint.c b/windows/winprint.c index 083f6e1c..cb9184ba 100644 --- a/windows/winprint.c +++ b/windows/winprint.c @@ -32,7 +32,7 @@ DECL_WINDOWS_FUNCTION(static, BOOL, WritePrinter, static void init_winfuncs(void) { - static int initialised = FALSE; + static int initialised = false; if (initialised) return; { @@ -53,7 +53,7 @@ static void init_winfuncs(void) GET_WINDOWS_FUNCTION_PP(winspool_module, EndPagePrinter); GET_WINDOWS_FUNCTION_PP(winspool_module, WritePrinter); } - initialised = TRUE; + initialised = true; } static int printer_add_enum(int param, DWORD level, char **buffer, @@ -80,11 +80,11 @@ static int printer_add_enum(int param, DWORD level, char **buffer, if (p_EnumPrinters(param, NULL, level, (LPBYTE)((*buffer)+offset), needed, &needed, &nprinters) == 0) - return FALSE; + return false; *nprinters_ptr += nprinters; - return TRUE; + return true; } printer_enum *printer_start_enum(int *nprinters_ptr) diff --git a/windows/winproxy.c b/windows/winproxy.c index d0a8884b..c83e2b4f 100644 --- a/windows/winproxy.c +++ b/windows/winproxy.c @@ -48,7 +48,7 @@ Socket *platform_new_connection(SockAddr *addr, const char *hostname, */ sa.nLength = sizeof(sa); sa.lpSecurityDescriptor = NULL; /* default */ - sa.bInheritHandle = TRUE; + sa.bInheritHandle = true; if (!CreatePipe(&us_from_cmd, &cmd_to_us, &sa, 0)) { sfree(cmd); return new_error_socket_fmt( @@ -91,7 +91,7 @@ Socket *platform_new_connection(SockAddr *addr, const char *hostname, si.hStdInput = cmd_from_us; si.hStdOutput = cmd_to_us; si.hStdError = cmd_err_to_us; - CreateProcess(NULL, cmd, NULL, NULL, TRUE, + CreateProcess(NULL, cmd, NULL, NULL, true, CREATE_NO_WINDOW | NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi); CloseHandle(pi.hProcess); @@ -106,5 +106,5 @@ Socket *platform_new_connection(SockAddr *addr, const char *hostname, CloseHandle(cmd_err_to_us); return make_handle_socket(us_to_cmd, us_from_cmd, us_from_cmd_err, - plug, FALSE); + plug, false); } diff --git a/windows/winsecur.c b/windows/winsecur.c index 76dcae91..656c327a 100644 --- a/windows/winsecur.c +++ b/windows/winsecur.c @@ -18,12 +18,12 @@ static PSID worldsid, networksid, usersid; int got_advapi(void) { - static int attempted = FALSE; + static int attempted = false; static int successful; static HMODULE advapi; if (!attempted) { - attempted = TRUE; + attempted = true; advapi = load_system32_dll("advapi32.dll"); successful = advapi && GET_WINDOWS_FUNCTION(advapi, GetSecurityInfo) && @@ -50,7 +50,7 @@ PSID get_user_sid(void) if (!got_advapi()) goto cleanup; - if ((proc = OpenProcess(MAXIMUM_ALLOWED, FALSE, + if ((proc = OpenProcess(MAXIMUM_ALLOWED, false, GetCurrentProcessId())) == NULL) goto cleanup; @@ -104,7 +104,7 @@ int getsids(char **error) #pragma clang diagnostic pop #endif - int ret = FALSE; + int ret = false; *error = NULL; @@ -135,7 +135,7 @@ int getsids(char **error) } } - ret = TRUE; + ret = true; cleanup: return ret; @@ -149,7 +149,7 @@ int make_private_security_descriptor(DWORD permissions, { EXPLICIT_ACCESS ea[3]; int acl_err; - int ret = FALSE; + int ret = false; *psd = NULL; @@ -197,19 +197,19 @@ int make_private_security_descriptor(DWORD permissions, goto cleanup; } - if (!SetSecurityDescriptorOwner(*psd, usersid, FALSE)) { + if (!SetSecurityDescriptorOwner(*psd, usersid, false)) { *error = dupprintf("unable to set owner in security descriptor: %s", win_strerror(GetLastError())); goto cleanup; } - if (!SetSecurityDescriptorDacl(*psd, TRUE, *acl, FALSE)) { + if (!SetSecurityDescriptorDacl(*psd, true, *acl, false)) { *error = dupprintf("unable to set DACL in security descriptor: %s", win_strerror(GetLastError())); goto cleanup; } - ret = TRUE; + ret = true; cleanup: if (!ret) { @@ -232,7 +232,7 @@ static int really_restrict_process_acl(char **error) { EXPLICIT_ACCESS ea[2]; int acl_err; - int ret=FALSE; + int ret=false; PACL acl = NULL; static const DWORD nastyace=WRITE_DAC | WRITE_OWNER | @@ -279,7 +279,7 @@ static int really_restrict_process_acl(char **error) } - ret=TRUE; + ret=true; cleanup: if (!ret) { @@ -317,7 +317,7 @@ void restrict_process_acl(void) #if !defined NO_SECURITY ret = really_restrict_process_acl(&error); #else - ret = FALSE; + ret = false; error = dupstr("ACL restrictions not compiled into this binary"); #endif if (!ret) diff --git a/windows/winsecur.h b/windows/winsecur.h index a56f7fb8..dd4da9ee 100644 --- a/windows/winsecur.h +++ b/windows/winsecur.h @@ -46,9 +46,9 @@ PSID get_user_sid(void); * servers, i.e. allowing access only to the current user id and also * only local (i.e. not over SMB) connections. * - * If this function returns TRUE, then 'psd' and 'acl' will have been + * If this function returns true, then 'psd' and 'acl' will have been * filled in with memory allocated using LocalAlloc (and hence must be - * freed later using LocalFree). If it returns FALSE, then instead + * freed later using LocalFree). If it returns false, then instead * 'error' has been filled with a dynamically allocated error message. */ int make_private_security_descriptor(DWORD permissions, diff --git a/windows/winser.c b/windows/winser.c index 3fba2989..d848c20c 100644 --- a/windows/winser.c +++ b/windows/winser.c @@ -107,18 +107,18 @@ static const char *serial_configure(Serial *serial, HANDLE serport, Conf *conf) /* * Boilerplate. */ - dcb.fBinary = TRUE; + dcb.fBinary = true; dcb.fDtrControl = DTR_CONTROL_ENABLE; - dcb.fDsrSensitivity = FALSE; - dcb.fTXContinueOnXoff = FALSE; - dcb.fOutX = FALSE; - dcb.fInX = FALSE; - dcb.fErrorChar = FALSE; - dcb.fNull = FALSE; + dcb.fDsrSensitivity = false; + dcb.fTXContinueOnXoff = false; + dcb.fOutX = false; + dcb.fInX = false; + dcb.fErrorChar = false; + dcb.fNull = false; dcb.fRtsControl = RTS_CONTROL_ENABLE; - dcb.fAbortOnError = FALSE; - dcb.fOutxCtsFlow = FALSE; - dcb.fOutxDsrFlow = FALSE; + dcb.fAbortOnError = false; + dcb.fOutxCtsFlow = false; + dcb.fOutxDsrFlow = false; /* * Configurable parameters. @@ -151,17 +151,17 @@ static const char *serial_configure(Serial *serial, HANDLE serport, Conf *conf) str = "no"; break; case SER_FLOW_XONXOFF: - dcb.fOutX = dcb.fInX = TRUE; + dcb.fOutX = dcb.fInX = true; str = "XON/XOFF"; break; case SER_FLOW_RTSCTS: dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; - dcb.fOutxCtsFlow = TRUE; + dcb.fOutxCtsFlow = true; str = "RTS/CTS"; break; case SER_FLOW_DSRDTR: dcb.fDtrControl = DTR_CONTROL_HANDSHAKE; - dcb.fOutxDsrFlow = TRUE; + dcb.fOutxDsrFlow = true; str = "DSR/DTR"; break; } @@ -204,7 +204,7 @@ static const char *serial_init(Seat *seat, Backend **backend_handle, serial->port = INVALID_HANDLE_VALUE; serial->out = serial->in = NULL; serial->bufsize = 0; - serial->break_in_progress = FALSE; + serial->break_in_progress = false; serial->backend.vt = &serial_backend; *backend_handle = &serial->backend; @@ -329,7 +329,7 @@ static void serbreak_timer(void *ctx, unsigned long now) if (now == serial->clearbreak_time && serial->port) { ClearCommBreak(serial->port); - serial->break_in_progress = FALSE; + serial->break_in_progress = false; logevent(serial->logctx, "Finished serial break"); } } @@ -356,7 +356,7 @@ static void serial_special(Backend *be, SessionSpecialCode code, int arg) */ serial->clearbreak_time = schedule_timer(TICKSPERSEC * 2 / 5, serbreak_timer, serial); - serial->break_in_progress = TRUE; + serial->break_in_progress = true; } return; diff --git a/windows/winsftp.c b/windows/winsftp.c index 06531529..c85c6c8f 100644 --- a/windows/winsftp.c +++ b/windows/winsftp.c @@ -25,7 +25,7 @@ void platform_get_x11_auth(struct X11Display *display, Conf *conf) { /* Do nothing, therefore no auth. */ } -const int platform_uses_x11_unix_by_default = TRUE; +const int platform_uses_x11_unix_by_default = true; /* ---------------------------------------------------------------------- * File access abstraction. @@ -440,12 +440,12 @@ void finish_wildcard_matching(WildcardMatcher *dir) int vet_filename(const char *name) { if (strchr(name, '/') || strchr(name, '\\') || strchr(name, ':')) - return FALSE; + return false; if (!name[strspn(name, ".")]) /* entirely composed of dots */ - return FALSE; + return false; - return TRUE; + return true; } int create_directory(const char *name) @@ -479,7 +479,7 @@ char *do_select(SOCKET skt, int startup) if (startup) { events = (FD_CONNECT | FD_READ | FD_WRITE | FD_OOB | FD_CLOSE | FD_ACCEPT); - netevent = CreateEvent(NULL, FALSE, FALSE, NULL); + netevent = CreateEvent(NULL, false, false, NULL); } else { events = 0; } @@ -534,7 +534,7 @@ int do_eventsel_loop(HANDLE other_event) else otherindex = -1; - n = WaitForMultipleObjects(nallhandles, handles, FALSE, ticks); + n = WaitForMultipleObjects(nallhandles, handles, false, ticks); if ((unsigned)(n - WAIT_OBJECT_0) < (unsigned)nhandles) { handle_got_event(handles[n - WAIT_OBJECT_0]); @@ -721,7 +721,7 @@ char *ssh_sftp_get_cmdline(const char *prompt, int no_fds_ok) * Create a second thread to read from stdin. Process network * and timing events until it terminates. */ - ctx->event = CreateEvent(NULL, FALSE, FALSE, NULL); + ctx->event = CreateEvent(NULL, false, false, NULL); ctx->line = NULL; hThread = CreateThread(NULL, 0, command_read_thread, ctx, 0, &threadid); diff --git a/windows/winshare.c b/windows/winshare.c index af4bc974..864dd9c6 100644 --- a/windows/winshare.c +++ b/windows/winshare.c @@ -161,9 +161,9 @@ int platform_ssh_share(const char *pi_name, Conf *conf, memset(&sa, 0, sizeof(sa)); sa.nLength = sizeof(sa); sa.lpSecurityDescriptor = psd; - sa.bInheritHandle = FALSE; + sa.bInheritHandle = false; - mutex = CreateMutex(&sa, FALSE, mutexname); + mutex = CreateMutex(&sa, false, mutexname); if (!mutex) { *logtext = dupprintf("CreateMutex(\"%s\") failed: %s", diff --git a/windows/winstore.c b/windows/winstore.c index 7c4be074..52f9b337 100644 --- a/windows/winstore.c +++ b/windows/winstore.c @@ -24,7 +24,7 @@ static const char *const puttystr = PUTTY_REG_POS "\\Sessions"; static const char hex[16] = "0123456789ABCDEF"; -static int tried_shgetfolderpath = FALSE; +static int tried_shgetfolderpath = false; static HMODULE shell32_module = NULL; DECL_WINDOWS_FUNCTION(static, HRESULT, SHGetFolderPathA, (HWND, int, HANDLE, DWORD, LPSTR)); @@ -511,7 +511,7 @@ static int try_random_seed(char const *path, int action, HANDLE *ret) win_strerror(GetLastError())); } *ret = INVALID_HANDLE_VALUE; - return FALSE; /* so we'll do the next ones too */ + return false; /* so we'll do the next ones too */ } *ret = CreateFile(path, @@ -576,7 +576,7 @@ static HANDLE access_random_seed(int action) * so stuff that. */ shell32_module = load_system32_dll("shell32.dll"); GET_WINDOWS_FUNCTION(shell32_module, SHGetFolderPathA); - tried_shgetfolderpath = TRUE; + tried_shgetfolderpath = true; } if (p_SHGetFolderPathA) { if (SUCCEEDED(p_SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, diff --git a/windows/winstuff.h b/windows/winstuff.h index 0a55be89..d71663c3 100644 --- a/windows/winstuff.h +++ b/windows/winstuff.h @@ -622,7 +622,7 @@ BOOL set_explicit_app_user_model_id(); /* * Exports from winnoise.c. */ -int win_read_random(void *buf, unsigned wanted); /* returns TRUE on success */ +int win_read_random(void *buf, unsigned wanted); /* returns true on success */ /* * Extra functions in winstore.c over and above the interface in @@ -654,7 +654,7 @@ char *get_jumplist_registry_entries(void); #define CLIPNAME_EXPLICIT "System clipboard" #define CLIPNAME_EXPLICIT_OBJECT "system clipboard" /* These defaults are the ones PuTTY has historically had */ -#define CLIPUI_DEFAULT_AUTOCOPY TRUE +#define CLIPUI_DEFAULT_AUTOCOPY true #define CLIPUI_DEFAULT_MOUSE CLIPUI_EXPLICIT #define CLIPUI_DEFAULT_INS CLIPUI_EXPLICIT diff --git a/windows/winx11.c b/windows/winx11.c index b8c7fa7d..eb15b39a 100644 --- a/windows/winx11.c +++ b/windows/winx11.c @@ -16,4 +16,4 @@ void platform_get_x11_auth(struct X11Display *disp, Conf *conf) x11_get_auth_from_authfile(disp, xauthpath); } -const int platform_uses_x11_unix_by_default = FALSE; +const int platform_uses_x11_unix_by_default = false; diff --git a/x11fwd.c b/x11fwd.c index 287003fd..4f1bb45c 100644 --- a/x11fwd.c +++ b/x11fwd.c @@ -209,7 +209,7 @@ struct X11Display *x11_setup_display(const char *display, Conf *conf, */ if (localcopy[0] == '/') { disp->unixsocketpath = localcopy; - disp->unixdomain = TRUE; + disp->unixdomain = true; disp->hostname = NULL; disp->displaynum = -1; disp->screennum = 0; @@ -258,7 +258,7 @@ struct X11Display *x11_setup_display(const char *display, Conf *conf, else if (!*hostname || !strcmp(hostname, "unix")) disp->unixdomain = platform_uses_x11_unix_by_default; else - disp->unixdomain = FALSE; + disp->unixdomain = false; if (!disp->hostname && !disp->unixdomain) disp->hostname = dupstr("localhost"); @@ -310,7 +310,7 @@ struct X11Display *x11_setup_display(const char *display, Conf *conf, sk_addr_free(ux); } else { sk_addr_free(disp->addr); - disp->unixdomain = TRUE; + disp->unixdomain = true; disp->addr = ux; /* Fill in the rest in a moment */ } @@ -469,7 +469,7 @@ void x11_get_auth_from_authfile(struct X11Display *disp, ptrlen addr, protoname, data; char *displaynum_string; int displaynum; - int ideal_match = FALSE; + int ideal_match = false; char *ourhostname; /* A maximally sized (wildly implausible) .Xauthority record @@ -527,7 +527,7 @@ void x11_get_auth_from_authfile(struct X11Display *disp, BinarySource_BARE_INIT(src, buf, size); while (!ideal_match) { - int match = FALSE; + int match = false; if (src->pos >= MAX_RECORD_SIZE) { size -= src->pos; @@ -597,7 +597,7 @@ void x11_get_auth_from_authfile(struct X11Display *disp, char buf[4]; sk_addrcopy(disp->addr, buf); if (addr.len == 4 && !memcmp(addr.ptr, buf, 4)) { - match = TRUE; + match = true; /* If this is a "localhost" entry, note it down * but carry on looking for a Unix-domain entry. */ ideal_match = !localhost; @@ -610,7 +610,7 @@ void x11_get_auth_from_authfile(struct X11Display *disp, char buf[16]; sk_addrcopy(disp->addr, buf); if (addr.len == 16 && !memcmp(addr.ptr, buf, 16)) { - match = TRUE; + match = true; ideal_match = !localhost; } } @@ -620,7 +620,7 @@ void x11_get_auth_from_authfile(struct X11Display *disp, && ourhostname && ptrlen_eq_string(addr, ourhostname)) /* A matching Unix-domain socket is always the best * match. */ - match = ideal_match = TRUE; + match = ideal_match = true; break; } @@ -660,7 +660,7 @@ void x11_format_auth_for_authfile( put_uint16(bs, 6); /* indicates IPv6 */ put_stringpl_xauth(bs, make_ptrlen(ipv6buf, 16)); } else { - assert(FALSE && "Bad address type in x11_format_auth_for_authfile"); + assert(false && "Bad address type in x11_format_auth_for_authfile"); } { @@ -720,7 +720,7 @@ static void x11_receive(Plug *plug, int urgent, char *data, int len) struct X11Connection *xconn = container_of( plug, struct X11Connection, plug); - xconn->no_data_sent_to_x_client = FALSE; + xconn->no_data_sent_to_x_client = false; sshfwd_write(xconn->c, data, len); } @@ -811,8 +811,8 @@ Channel *x11_new_channel(tree234 *authtree, SshChannel *c, xconn->authtree = authtree; xconn->verified = 0; xconn->data_read = 0; - xconn->input_wanted = TRUE; - xconn->no_data_sent_to_x_client = TRUE; + xconn->input_wanted = true; + xconn->no_data_sent_to_x_client = true; xconn->c = c; /* @@ -882,7 +882,7 @@ static void x11_send_init_error(struct X11Connection *xconn, memcpy(reply + 8, full_message, msglen); sshfwd_write(xconn->c, reply, 8 + msgsize); sshfwd_write_eof(xconn->c); - xconn->no_data_sent_to_x_client = FALSE; + xconn->no_data_sent_to_x_client = false; sfree(reply); sfree(full_message); } @@ -898,9 +898,9 @@ static int x11_parse_ip(const char *addr_string, unsigned long *ip) if (addr_string && 4 == sscanf(addr_string, "%d.%d.%d.%d", i+0, i+1, i+2, i+3)) { *ip = (i[0] << 24) | (i[1] << 16) | (i[2] << 8) | i[3]; - return TRUE; + return true; } else { - return FALSE; + return false; } }