X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=windows%2Fwinplink.c;h=8ffa4651030c9901b5a2f3d0923af1424f29b381;hb=9f9d72ec58642e91b4f93ee4405a8086ee2fb2f0;hp=188d89bb3e08137a60be3e8cd6e16029c22e9812;hpb=8c09f85a64ff31d05f37304a041fd766507a19f0;p=PuTTY.git diff --git a/windows/winplink.c b/windows/winplink.c index 188d89bb..8ffa4651 100644 --- a/windows/winplink.c +++ b/windows/winplink.c @@ -21,7 +21,7 @@ struct agent_callback { int len; }; -void fatalbox(char *p, ...) +void fatalbox(const char *p, ...) { va_list ap; fprintf(stderr, "FATAL ERROR: "); @@ -35,7 +35,7 @@ void fatalbox(char *p, ...) } cleanup_exit(1); } -void modalfatalbox(char *p, ...) +void modalfatalbox(const char *p, ...) { va_list ap; fprintf(stderr, "FATAL ERROR: "); @@ -49,7 +49,7 @@ void modalfatalbox(char *p, ...) } cleanup_exit(1); } -void nonfatal(char *p, ...) +void nonfatal(const char *p, ...) { va_list ap; fprintf(stderr, "ERROR: "); @@ -58,7 +58,7 @@ void nonfatal(char *p, ...) va_end(ap); fputc('\n', stderr); } -void connection_fatal(void *frontend, char *p, ...) +void connection_fatal(void *frontend, const char *p, ...) { va_list ap; fprintf(stderr, "FATAL ERROR: "); @@ -72,7 +72,7 @@ void connection_fatal(void *frontend, char *p, ...) } cleanup_exit(1); } -void cmdline_error(char *p, ...) +void cmdline_error(const char *p, ...) { va_list ap; fprintf(stderr, "plink: "); @@ -98,7 +98,7 @@ int term_ldisc(Terminal *term, int mode) { return FALSE; } -void ldisc_update(void *frontend, int echo, int edit) +void frontend_echoedit_update(void *frontend, int echo, int edit) { /* Update stdin read mode to reflect changes in line discipline. */ DWORD mode; @@ -145,7 +145,7 @@ int from_backend_eof(void *frontend_handle) return FALSE; /* do not respond to incoming EOF with outgoing */ } -int get_userpass_input(prompts_t *p, unsigned char *in, int inlen) +int get_userpass_input(prompts_t *p, const unsigned char *in, int inlen) { int ret; ret = cmdline_get_passwd_input(p, in, inlen); @@ -303,6 +303,7 @@ int main(int argc, char **argv) int errors; int got_host = FALSE; int use_subsystem = 0; + int just_test_share_exists = FALSE; unsigned long now, next, then; sklist = NULL; @@ -364,6 +365,8 @@ int main(int argc, char **argv) } else if (!strcmp(p, "-pgpfp")) { pgp_fingerprints(); exit(1); + } else if (!strcmp(p, "-shareexists")) { + just_test_share_exists = TRUE; } else { fprintf(stderr, "plink: unknown option \"%s\"\n", p); errors = 1; @@ -596,6 +599,19 @@ int main(int argc, char **argv) logctx = log_init(NULL, conf); console_provide_logctx(logctx); + 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. */