mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
Move 'loaded_session' into cmdline.c.
I haven't managed to make this one _not_ be a mutable variable, but at least it's not global across all tools any more: it lives in cmdline.c along with the code that decides what to set it to, and cmdline.c exports a query method to ask for its value.
This commit is contained in:
parent
492e6b1187
commit
22deebfc3e
@ -146,9 +146,11 @@ static bool cmdline_check_unavailable(int flag, const char *p)
|
|||||||
static bool seen_hostname_argument = false;
|
static bool seen_hostname_argument = false;
|
||||||
static bool seen_port_argument = false;
|
static bool seen_port_argument = false;
|
||||||
static bool seen_verbose_option = false;
|
static bool seen_verbose_option = false;
|
||||||
|
static bool loaded_session = false;
|
||||||
bool cmdline_verbose(void) { return seen_verbose_option; }
|
bool cmdline_verbose(void) { return seen_verbose_option; }
|
||||||
bool cmdline_seat_verbose(Seat *seat) { return cmdline_verbose(); }
|
bool cmdline_seat_verbose(Seat *seat) { return cmdline_verbose(); }
|
||||||
bool cmdline_lp_verbose(LogPolicy *lp) { return cmdline_verbose(); }
|
bool cmdline_lp_verbose(LogPolicy *lp) { return cmdline_verbose(); }
|
||||||
|
bool cmdline_loaded_session(void) { return loaded_session; }
|
||||||
|
|
||||||
int cmdline_process_param(const char *p, char *value,
|
int cmdline_process_param(const char *p, char *value,
|
||||||
int need_save, Conf *conf)
|
int need_save, Conf *conf)
|
||||||
|
3
pscp.c
3
pscp.c
@ -302,7 +302,7 @@ static void do_cmd(char *host, char *user, char *cmd)
|
|||||||
* If we haven't loaded session details already (e.g., from -load),
|
* If we haven't loaded session details already (e.g., from -load),
|
||||||
* try looking for a session called "host".
|
* try looking for a session called "host".
|
||||||
*/
|
*/
|
||||||
if (!loaded_session) {
|
if (!cmdline_loaded_session()) {
|
||||||
/* Try to load settings for `host' into a temporary config */
|
/* Try to load settings for `host' into a temporary config */
|
||||||
Conf *conf2 = conf_new();
|
Conf *conf2 = conf_new();
|
||||||
conf_set_str(conf2, CONF_host, "");
|
conf_set_str(conf2, CONF_host, "");
|
||||||
@ -2236,7 +2236,6 @@ int psftp_main(int argc, char *argv[])
|
|||||||
/* Load Default Settings before doing anything else. */
|
/* Load Default Settings before doing anything else. */
|
||||||
conf = conf_new();
|
conf = conf_new();
|
||||||
do_defaults(NULL, conf);
|
do_defaults(NULL, conf);
|
||||||
loaded_session = false;
|
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
int ret;
|
int ret;
|
||||||
|
3
psftp.c
3
psftp.c
@ -2568,7 +2568,7 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
|
|||||||
* If we haven't loaded session details already (e.g., from -load),
|
* If we haven't loaded session details already (e.g., from -load),
|
||||||
* try looking for a session called "host".
|
* try looking for a session called "host".
|
||||||
*/
|
*/
|
||||||
if (!loaded_session) {
|
if (!cmdline_loaded_session()) {
|
||||||
/* Try to load settings for `host' into a temporary config */
|
/* Try to load settings for `host' into a temporary config */
|
||||||
Conf *conf2 = conf_new();
|
Conf *conf2 = conf_new();
|
||||||
conf_set_str(conf2, CONF_host, "");
|
conf_set_str(conf2, CONF_host, "");
|
||||||
@ -2772,7 +2772,6 @@ int psftp_main(int argc, char *argv[])
|
|||||||
/* Load Default Settings before doing anything else. */
|
/* Load Default Settings before doing anything else. */
|
||||||
conf = conf_new();
|
conf = conf_new();
|
||||||
do_defaults(NULL, conf);
|
do_defaults(NULL, conf);
|
||||||
loaded_session = false;
|
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
int ret;
|
int ret;
|
||||||
|
6
putty.h
6
putty.h
@ -586,11 +586,6 @@ extern const char *const appname;
|
|||||||
GLOBAL int default_protocol;
|
GLOBAL int default_protocol;
|
||||||
GLOBAL int default_port;
|
GLOBAL int default_port;
|
||||||
|
|
||||||
/*
|
|
||||||
* This is set true by cmdline.c iff a session is loaded with "-load".
|
|
||||||
*/
|
|
||||||
GLOBAL bool loaded_session;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mechanism for getting text strings such as usernames and passwords
|
* Mechanism for getting text strings such as usernames and passwords
|
||||||
* from the front-end.
|
* from the front-end.
|
||||||
@ -1958,6 +1953,7 @@ void cmdline_cleanup(void);
|
|||||||
int cmdline_get_passwd_input(prompts_t *p);
|
int cmdline_get_passwd_input(prompts_t *p);
|
||||||
bool cmdline_host_ok(Conf *);
|
bool cmdline_host_ok(Conf *);
|
||||||
bool cmdline_verbose(void);
|
bool cmdline_verbose(void);
|
||||||
|
bool cmdline_loaded_session(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Here we have a flags word provided by each tool, which describes
|
* Here we have a flags word provided by each tool, which describes
|
||||||
|
@ -615,7 +615,6 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
conf = conf_new();
|
conf = conf_new();
|
||||||
do_defaults(NULL, conf);
|
do_defaults(NULL, conf);
|
||||||
loaded_session = false;
|
|
||||||
default_protocol = conf_get_int(conf, CONF_protocol);
|
default_protocol = conf_get_int(conf, CONF_protocol);
|
||||||
default_port = conf_get_int(conf, CONF_port);
|
default_port = conf_get_int(conf, CONF_port);
|
||||||
errors = false;
|
errors = false;
|
||||||
|
@ -260,7 +260,6 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
conf = conf_new();
|
conf = conf_new();
|
||||||
do_defaults(NULL, conf);
|
do_defaults(NULL, conf);
|
||||||
loaded_session = false;
|
|
||||||
default_protocol = conf_get_int(conf, CONF_protocol);
|
default_protocol = conf_get_int(conf, CONF_protocol);
|
||||||
default_port = conf_get_int(conf, CONF_port);
|
default_port = conf_get_int(conf, CONF_port);
|
||||||
errors = false;
|
errors = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user