changeset 38139:b2e0c0638bf2

(WinMain): Add quotes around executable name.
author Jason Rumney <jasonr@gnu.org>
date Wed, 20 Jun 2001 22:36:29 +0000
parents a7bf2382c0d7
children 2831c6d134b5
files nt/runemacs.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/nt/runemacs.c	Wed Jun 20 11:03:58 2001 +0000
+++ b/nt/runemacs.c	Wed Jun 20 22:36:29 2001 +0000
@@ -44,8 +44,10 @@
     goto error;
   *p = 0;
 
-  new_cmdline = alloca (MAX_PATH + strlen (cmdline) + 1);
-  strcpy (new_cmdline, modname);
+  new_cmdline = alloca (MAX_PATH + strlen (cmdline) + 3);
+  /* Quote executable name in case of spaces in the path. */
+  *new_cmdline = '"';
+  strcpy (new_cmdline + 1, modname);
 
 #ifdef CHOOSE_NEWEST_EXE
   {
@@ -57,7 +59,7 @@
     WIN32_FIND_DATA wfd;
     HANDLE fh;
     p = new_cmdline + strlen (new_cmdline);
-    strcpy (p, "\\emacs*.exe ");
+    strcpy (p, "\\emacs*.exe\" ");
     fh = FindFirstFile (new_cmdline, &wfd);
     if (fh == INVALID_HANDLE_VALUE)
       goto error;
@@ -78,7 +80,7 @@
     strcat (p, " ");
   }
 #else
-  strcat (new_cmdline, "\\emacs.exe ");
+  strcat (new_cmdline, "\\emacs.exe\" ");
 #endif
 
   /* Append original arguments if any; first look for arguments we