X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/dc108ebccfec3f75989081e31c248790824cb856..5a9bf7646e1e86a8c24570d571e7e7507517700e:/unix/uxplink.c diff --git a/unix/uxplink.c b/unix/uxplink.c index 1f09409e..c9b50759 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -208,6 +208,7 @@ static void usage(void) printf("Usage: plink [options] [user@]host [command]\n"); printf(" (\"host\" can also be a PuTTY saved session name)\n"); printf("Options:\n"); + printf(" -V print version information\n"); printf(" -v show verbose messages\n"); printf(" -load sessname Load settings from saved session\n"); printf(" -ssh -telnet -rlogin -raw\n"); @@ -231,7 +232,6 @@ static void usage(void) printf(" -C enable compression\n"); printf(" -i key private key file for authentication\n"); printf(" -s remote command is an SSH subsystem (SSH-2 only)\n"); - printf(" -V print version information\n"); exit(1); } @@ -270,6 +270,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; @@ -396,13 +397,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 { @@ -557,7 +560,7 @@ int main(int argc, char **argv) int nodelay = cfg.tcp_nodelay && isatty(0); 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\n", error); return 1;