summaryrefslogtreecommitdiff
path: root/nt
diff options
context:
space:
mode:
authorJason Rumney <jasonr@gnu.org>2001-06-20 22:36:29 +0000
committerJason Rumney <jasonr@gnu.org>2001-06-20 22:36:29 +0000
commit6cd8f3aeda7d2f246076ed877afd5607bad59f4a (patch)
tree4173454b2d770fcb788e9db6080dd4627b23210a /nt
parent3156903b0472b88434f3e5023043379f98adaf2f (diff)
downloademacs-6cd8f3aeda7d2f246076ed877afd5607bad59f4a.tar.gz
(WinMain): Add quotes around executable name.
Diffstat (limited to 'nt')
-rw-r--r--nt/runemacs.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/nt/runemacs.c b/nt/runemacs.c
index b918bec7249..2f114aea659 100644
--- a/nt/runemacs.c
+++ b/nt/runemacs.c
@@ -44,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
{
@@ -57,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;
@@ -78,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