X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=plink.c;h=3afd73cde017e0eb0cca1945334ad5699fa18b5b;hb=0edefb1809a783e8302ac2faf604e99729c6cda0;hp=e049d254d06bc1cd3ee37082b39b7898eef015e0;hpb=2b4e286954882420ca3122464b5a40f16362dda9;p=PuTTY.git diff --git a/plink.c b/plink.c index e049d254..3afd73cd 100644 --- a/plink.c +++ b/plink.c @@ -1,5 +1,5 @@ /* - * PLink - a command-line (stdin/stdout) variant of PuTTY. + * PLink - a Windows command-line (stdin/stdout) variant of PuTTY. */ #include @@ -295,6 +295,7 @@ int main(int argc, char **argv) * Process the command line. */ do_defaults(NULL, &cfg); + loaded_session = FALSE; default_protocol = cfg.protocol; default_port = cfg.port; errors = 0; @@ -409,13 +410,15 @@ int main(int argc, char **argv) */ Config cfg2; do_defaults(p, &cfg2); - if (cfg2.host[0] == '\0') { + if (loaded_session || cfg2.host[0] == '\0') { /* No settings for this host; use defaults */ + /* (or session was already loaded with -load) */ strncpy(cfg.host, p, sizeof(cfg.host) - 1); cfg.host[sizeof(cfg.host) - 1] = '\0'; cfg.port = default_port; } else { cfg = cfg2; + /* Ick: patch up internal pointer after copy */ cfg.remote_cmd_ptr = cfg.remote_cmd; } } else { @@ -564,7 +567,7 @@ int main(int argc, char **argv) (GetFileType(GetStdHandle(STD_INPUT_HANDLE)) == FILE_TYPE_CHAR); error = back->init(NULL, &backhandle, &cfg, cfg.host, cfg.port, - &realhost, nodelay); + &realhost, nodelay, cfg.tcp_keepalives); if (error) { fprintf(stderr, "Unable to open connection:\n%s", error); return 1;