X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/d69a46c00d4706796c4060a91c5ab403d7438184..7d22c2e8c8e4104bcd39f35ebeaa5f81edd374cf:/unix/uxplink.c diff --git a/unix/uxplink.c b/unix/uxplink.c index 6c5b5544..179f2545 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -186,7 +186,6 @@ int main(int argc, char **argv) int i, skcount, sksize, socketstate; int connopen; int exitcode; - void *logctx; void *ldisc; ssh_get_line = console_get_line; @@ -237,10 +236,19 @@ int main(int argc, char **argv) continue; } else if (!strcmp(p, "-batch")) { console_batch_mode = 1; + } else if (!strcmp(p, "-o")) { + if (argc <= 1) + fprintf(stderr, + "plink: option \"-o\" requires an argument\n"); + else + --argc, provide_xrm_string(*++argv); } } else if (*p) { if (!*cfg.host) { char *q = p; + + do_defaults(NULL, &cfg); + /* * If the hostname starts with "telnet:", set the * protocol to Telnet and process the string as a @@ -441,6 +449,7 @@ int main(int argc, char **argv) /* * Start up the connection. */ + logctx = log_init(NULL); { char *error; char *realhost; @@ -453,7 +462,6 @@ int main(int argc, char **argv) fprintf(stderr, "Unable to open connection:\n%s\n", error); return 1; } - logctx = log_init(NULL); back->provide_logctx(backhandle, logctx); ldisc = ldisc_create(NULL, back, backhandle, NULL); sfree(realhost); @@ -584,5 +592,6 @@ int main(int argc, char **argv) fprintf(stderr, "Remote process exit code unavailable\n"); exitcode = 1; /* this is an error condition */ } - return exitcode; + cleanup_exit(exitcode); + return exitcode; /* shouldn't happen, but placates gcc */ }