Oops; telnet:// URLs can have a trailing slash
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Fri, 21 Jul 2000 10:58:33 +0000 (10:58 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Fri, 21 Jul 2000 10:58:33 +0000 (10:58 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@515 cda61777-01e9-0310-a592-d414129be87e

window.c

index e9419d7..aa6fda5 100644 (file)
--- a/window.c
+++ b/window.c
@@ -179,14 +179,18 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
              * Telnet URL.
              */
             if (!strncmp(q, "telnet://", 9)) {
+                char c;
+
                 q += 9;
                 cfg.protocol = PROT_TELNET;
                 p = q;
-                while (*p && *p != ':') p++;
-                if (*p) {
+                while (*p && *p != ':' && *p != '/') p++;
+                c = *p;
+                if (*p)
                     *p++ = '\0';
+                if (c == ':')
                     cfg.port = atoi(p);
-                else
+                else
                     cfg.port = -1;
                 strncpy (cfg.host, q, sizeof(cfg.host)-1);
                 cfg.host[sizeof(cfg.host)-1] = '\0';