Extra line in the help text to mention you can use a saved session
[sgt/putty] / plink.c
diff --git a/plink.c b/plink.c
index 2802feb..9c0a14a 100644 (file)
--- a/plink.c
+++ b/plink.c
@@ -314,11 +314,7 @@ void try_output(int is_stderr)
 
 int from_backend(int is_stderr, char *data, int len)
 {
-    int pos;
-    DWORD ret;
     HANDLE h = (is_stderr ? errhandle : outhandle);
-    void *writedata;
-    int writelen;
     int osize, esize;
 
     if (is_stderr) {
@@ -343,6 +339,7 @@ static void usage(void)
     printf("PuTTY Link: command-line connection utility\n");
     printf("%s\n", ver);
     printf("Usage: plink [options] [user@]host [command]\n");
+    printf("       (\"host\" can also be a PuTTY saved session name)\n");
     printf("Options:\n");
     printf("  -v        show verbose messages\n");
     printf("  -ssh      force use of ssh protocol\n");
@@ -356,7 +353,8 @@ char *do_select(SOCKET skt, int startup)
 {
     int events;
     if (startup) {
-       events = FD_READ | FD_WRITE | FD_OOB | FD_CLOSE | FD_ACCEPT;
+       events = (FD_CONNECT | FD_READ | FD_WRITE |
+                 FD_OOB | FD_CLOSE | FD_ACCEPT);
     } else {
        events = 0;
     }
@@ -471,6 +469,7 @@ int main(int argc, char **argv)
                    command[cmdlen++] = d;
                } while (c != EOF);
                cfg.remote_cmd_ptr = command;
+               cfg.remote_cmd_ptr2 = NULL;
                cfg.nopty = TRUE;      /* command => no terminal */
            } else if (!strcmp(p, "-P") && argc > 1) {
                --argc, portnumber = atoi(*++argv);
@@ -770,6 +769,8 @@ int main(int argc, char **argv)
                if (!WSAEnumNetworkEvents(socket, NULL, &things)) {
                    noise_ultralight(socket);
                    noise_ultralight(things.lNetworkEvents);
+                   if (things.lNetworkEvents & FD_CONNECT)
+                       connopen &= select_result(wp, (LPARAM) FD_CONNECT);
                    if (things.lNetworkEvents & FD_READ)
                        connopen &= select_result(wp, (LPARAM) FD_READ);
                    if (things.lNetworkEvents & FD_CLOSE)