X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/799dfcfab944cd604ee0850f37e0dcb07f02d84d..059710302fbac6693280e7a27b3797f49a524c97:/unix/uxplink.c diff --git a/unix/uxplink.c b/unix/uxplink.c index 8d0e169a..e59a701b 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -170,8 +170,6 @@ int from_backend(void *frontend_handle, int is_stderr, { int osize, esize; - assert(len > 0); - if (is_stderr) { bufchain_add(&stderr_data, data, len); try_output(1); @@ -210,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"); @@ -220,17 +219,25 @@ static void usage(void) printf(" -batch disable all interactive prompts\n"); printf("The following options only apply to SSH connections:\n"); printf(" -pw passw login with specified password\n"); - printf(" -D listen-port Dynamic SOCKS-based port forwarding\n"); - printf(" -L listen-port:host:port Forward local port to " - "remote address\n"); - printf(" -R listen-port:host:port Forward remote port to" - " local address\n"); + printf(" -D [listen-IP:]listen-port\n"); + printf(" Dynamic SOCKS-based port forwarding\n"); + printf(" -L [listen-IP:]listen-port:host:port\n"); + printf(" Forward local port to remote address\n"); + printf(" -R [listen-IP:]listen-port:host:port\n"); + printf(" Forward remote port to local address\n"); printf(" -X -x enable / disable X11 forwarding\n"); printf(" -A -a enable / disable agent forwarding\n"); printf(" -t -T enable / disable pty allocation\n"); printf(" -1 -2 force use of particular protocol version\n"); 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"); + exit(1); +} + +static void version(void) +{ + printf("plink: %s\n", ver); exit(1); } @@ -244,6 +251,7 @@ int main(int argc, char **argv) int connopen; int exitcode; int errors; + int use_subsystem = 0; void *ldisc, *logctx; ssh_get_line = console_get_line; @@ -297,6 +305,11 @@ int main(int argc, char **argv) continue; } else if (!strcmp(p, "-batch")) { console_batch_mode = 1; + } else if (!strcmp(p, "-s")) { + /* Save status to write to cfg later. */ + use_subsystem = 1; + } else if (!strcmp(p, "-V")) { + version(); } else if (!strcmp(p, "-o")) { if (argc <= 1) { fprintf(stderr, @@ -467,6 +480,12 @@ int main(int argc, char **argv) cmdline_run_saved(&cfg); /* + * Apply subsystem status. + */ + if (use_subsystem) + cfg.ssh_subsys = TRUE; + + /* * Trim a colon suffix off the hostname if it's there. */ cfg.host[strcspn(cfg.host, ":")] = '\0';