1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-03 04:22:47 -05:00

Since r7265, a user could not launch a PuTTY session to a specific host by

simply specifying a hostname on the command line -- this would bring up the
config dialog. Use a slightly more sophisticated notion of whether the user
meant to launch a session.

[originally from svn r7321]
[r7265 == 5d76e00dac]
This commit is contained in:
Jacob Nevins
2007-02-25 00:50:24 +00:00
parent fe1909e0e2
commit befd797f97
5 changed files with 28 additions and 12 deletions

View File

@ -2408,7 +2408,7 @@ static void help(FILE *fp) {
}
}
int do_cmdline(int argc, char **argv, int do_everything,
int do_cmdline(int argc, char **argv, int do_everything, int *allow_launch,
struct gui_data *inst, Config *cfg)
{
int err = 0;
@ -2614,7 +2614,8 @@ int do_cmdline(int argc, char **argv, int do_everything,
exit(1);
} else if(p[0] != '-' && (!do_everything ||
process_nonoption_arg(p, cfg))) {
process_nonoption_arg(p, cfg,
allow_launch))) {
/* do nothing */
} else {
@ -3477,15 +3478,22 @@ int pt_main(int argc, char **argv)
/* Splatter this argument so it doesn't clutter a ps listing */
memset(argv[1], 0, strlen(argv[1]));
} else {
if (do_cmdline(argc, argv, 0, inst, &inst->cfg))
/* By default, we bring up the config dialog, rather than launching
* a session. This gets set to TRUE if something happens to change
* that (e.g., a hostname is specified on the command-line). */
int allow_launch = FALSE;
if (do_cmdline(argc, argv, 0, &allow_launch, inst, &inst->cfg))
exit(1); /* pre-defaults pass to get -class */
do_defaults(NULL, &inst->cfg);
if (do_cmdline(argc, argv, 1, inst, &inst->cfg))
if (do_cmdline(argc, argv, 1, &allow_launch, inst, &inst->cfg))
exit(1); /* post-defaults, do everything */
cmdline_run_saved(&inst->cfg);
if ((!loaded_session || !cfg_launchable(&inst->cfg)) &&
if (loaded_session)
allow_launch = TRUE;
if ((!allow_launch || !cfg_launchable(&inst->cfg)) &&
!cfgbox(&inst->cfg))
exit(0); /* config box hit Cancel */
}