]> code.delx.au - gnu-emacs/blobdiff - nt/runemacs.c
Remove unnecessary whitespaces.
[gnu-emacs] / nt / runemacs.c
index c1b2895174844b4748b111e6f0ed741bd7dc34f5..2f114aea6593c4461a58f2aacde375af51ba043e 100644 (file)
@@ -20,8 +20,6 @@
 
 /* #define CHOOSE_NEWEST_EXE */
 
-#define WIN32
-
 #include <windows.h>
 #include <string.h>
 #include <malloc.h>
@@ -46,8 +44,10 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
     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
   {
@@ -59,7 +59,7 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
     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;
@@ -80,7 +80,7 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
     strcat (p, " ");
   }
 #else
-  strcat (new_cmdline, "\\emacs.exe ");
+  strcat (new_cmdline, "\\emacs.exe\" ");
 #endif
 
   /* Append original arguments if any; first look for arguments we