Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2020-01-30 09:40:21 +0300
committerSimon Tatham <anakin@pobox.com>2020-01-30 09:40:21 +0300
commitd20d3b20fd06c3792021367cfaf95240457ba51f (patch)
treef291f5a113748fcbd5c54cf4183a21d3c9a7f923 /psftp.c
parent06e9f7115317ea9684ea707ba203c7ed79ea90b1 (diff)
Remove FLAG_VERBOSE.
The global 'int flags' has always been an ugly feature of this code base, and I suddenly thought that perhaps it's time to start throwing it out, one flag at a time, until it's totally unused. My first target is FLAG_VERBOSE. This was usually set by cmdline.c when it saw a -v option on the program's command line, except that GUI PuTTY itself sets it unconditionally on startup. And then various bits of the code would check it in order to decide whether to print a given message. In the current system of front-end abstraction traits, there's no _one_ place that I can move it to. But there are two: every place that checked FLAG_VERBOSE has access to either a Seat or a LogPolicy. So now each of those traits has a query method for 'do I want verbose messages?'. A good effect of this is that subsidiary Seats, like the ones used in Uppity for the main SSH server module itself and the server end of shell channels, now get to have their own verbosity setting instead of inheriting the one global one. In fact I don't expect any code using those Seats to be generating any messages at all, but if that changes later, we'll have a way to control it. (Who knows, perhaps logging in Uppity might become a thing.) As part of this cleanup, I've added a new flag to cmdline_tooltype, called TOOLTYPE_NO_VERBOSE_OPTION. The unconditionally-verbose tools now set that, and it has the effect of making cmdline.c disallow -v completely. So where 'putty -v' would previously have been silently ignored ("I was already verbose"), it's now an error, reminding you that that option doesn't actually do anything. Finally, the 'default_logpolicy' provided by uxcons.c and wincons.c (with identical definitions) has had to move into a new file of its own, because now it has to ask cmdline.c for the verbosity setting as well as asking console.c for the rest of its methods. So there's a new file clicons.c which can only be included by programs that link against both cmdline.c _and_ one of the *cons.c, and I've renamed the logpolicy to reflect that.
Diffstat (limited to 'psftp.c')
-rw-r--r--psftp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/psftp.c b/psftp.c
index a9aeb4fa..4d128c03 100644
--- a/psftp.c
+++ b/psftp.c
@@ -64,6 +64,7 @@ static const SeatVtable psftp_seat_vt = {
nullseat_get_window_pixel_size,
console_stripctrl_new,
nullseat_set_trust_status_vacuously,
+ cmdline_seat_verbose,
};
static Seat psftp_seat[1] = {{ &psftp_seat_vt }};
@@ -2709,9 +2710,9 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
"exec sftp-server");
conf_set_bool(conf, CONF_ssh_subsys2, false);
- psftp_logctx = log_init(default_logpolicy, conf);
+ psftp_logctx = log_init(console_cli_logpolicy, conf);
- platform_psftp_pre_conn_setup();
+ platform_psftp_pre_conn_setup(console_cli_logpolicy);
err = backend_init(&ssh_backend, psftp_seat, &backend, psftp_logctx, conf,
conf_get_str(conf, CONF_host),
@@ -2798,7 +2799,7 @@ int psftp_main(int argc, char *argv[])
i++; /* skip next argument */
} else if (ret == 1) {
/* We have our own verbosity in addition to `flags'. */
- if (flags & FLAG_VERBOSE)
+ if (cmdline_verbose())
verbose = true;
} else if (strcmp(argv[i], "-h") == 0 ||
strcmp(argv[i], "-?") == 0 ||