X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fuxplink.c;h=8351a6ea7280528acbe8660a0db18e66237823c0;hb=48eafd66aa274c32fc8169a0d36619663905c210;hp=40b126615e31f3b3662a29ac8585ba2e4c100b84;hpb=b5423b51d468b76eb2b6cd19bb2c900b882e24f3;p=PuTTY.git diff --git a/unix/uxplink.c b/unix/uxplink.c index 40b12661..8351a6ea 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -581,6 +581,8 @@ static void usage(void) printf(" -N don't start a shell/command (SSH-2 only)\n"); printf(" -nc host:port\n"); printf(" open tunnel in place of session (SSH-2 only)\n"); + printf(" -shareexists\n"); + printf(" test whether a connection-sharing upstream exists\n"); exit(1); } @@ -607,6 +609,7 @@ int main(int argc, char **argv) int errors; int use_subsystem = 0; int got_host = FALSE; + int just_test_share_exists = FALSE; unsigned long now; struct winsize size; @@ -685,6 +688,8 @@ int main(int argc, char **argv) --argc; provide_xrm_string(*++argv); } + } else if (!strcmp(p, "-shareexists")) { + just_test_share_exists = TRUE; } else { fprintf(stderr, "plink: unknown option \"%s\"\n", p); errors = 1; @@ -959,6 +964,19 @@ int main(int argc, char **argv) !conf_get_str_nthstrkey(conf, CONF_portfwd, 0)) conf_set_int(conf, CONF_ssh_simple, TRUE); + if (just_test_share_exists) { + if (!back->test_for_upstream) { + fprintf(stderr, "Connection sharing not supported for connection " + "type '%s'\n", back->name); + return 1; + } + if (back->test_for_upstream(conf_get_str(conf, CONF_host), + conf_get_int(conf, CONF_port), conf)) + return 0; + else + return 1; + } + /* * Start up the connection. */