]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Pageant now allows filenames with spaces on cmdline. Thanks to Brian Coogan
authorSimon Tatham <anakin@pobox.com>
Mon, 25 Sep 2000 10:55:00 +0000 (10:55 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 25 Sep 2000 10:55:00 +0000 (10:55 +0000)
[originally from svn r623]

pageant.c

index 09ef17e13a721075fdafc6d74d5616accc516dad..1619749035f370e6e94e82a89fee98f93306f03b 100644 (file)
--- a/pageant.c
+++ b/pageant.c
@@ -608,16 +608,28 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
 
     /*
      * Process the command line and add RSA keys as listed on it.
-     * FIXME: we don't support spaces in filenames here. We should.
      */
     {
-        char *p = cmdline;
+        char *p;
+        int inquotes = 0;
+        p = cmdline;
         while (*p) {
             while (*p && isspace(*p)) p++;
             if (*p && !isspace(*p)) {
-                char *q = p;
-                while (*p && !isspace(*p)) p++;
-                if (*p) *p++ = '\0';
+                char *q = p, *pp = p;
+                while (*p && (inquotes || !isspace(*p)))
+                {
+                    if (*p == '"') {
+                        inquotes = !inquotes;
+                        p++;
+                        continue;
+                    }
+                    *pp++ = *p++;
+                }
+                if (*pp) {
+                    if (*p) p++;
+                    *pp++ = '\0';
+                }
                 add_keyfile(q);
             }
         }