DWORD flags;
char dir[ MAX_PATH ];
char *p;
+ const char *ext;
if (cp == NULL) emacs_abort ();
if (*p == '/')
*p = '\\';
+ /* CreateProcess handles batch files as exe specially. This special
+ handling fails when both the batch file and arguments are quoted.
+ We pass NULL as exe to avoid the special handling. */
+ if (exe && cmdline[0] == '"' &&
+ (ext = strrchr (exe, '.')) &&
+ (xstrcasecmp (ext, ".bat") == 0
+ || xstrcasecmp (ext, ".cmd") == 0))
+ exe = NULL;
+
flags = (!NILP (Vw32_start_process_share_console)
? CREATE_NEW_PROCESS_GROUP
: CREATE_NEW_CONSOLE);
if (egetenv ("CMDPROXY"))
strcpy (cmdname, egetenv ("CMDPROXY"));
else
- {
- lispstpcpy (cmdname, Vinvocation_directory);
- strcat (cmdname, "cmdproxy.exe");
- }
+ strcpy (lispstpcpy (cmdname, Vinvocation_directory), "cmdproxy.exe");
/* Can't use unixtodos_filename here, since that needs its file
name argument encoded in UTF-8. */
if (GetLocaleInfo (try_lcid, LOCALE_SABBREVLANGNAME,
locval, LOCALE_NAME_MAX_LENGTH))
{
+ size_t locval_len;
+
/* This is for when they only specify the language, as in "ENU". */
if (stricmp (locval, lname) == 0)
{
found_lcid = try_lcid;
return FALSE;
}
- strcat (locval, "_");
+ locval_len = strlen (locval);
+ strcpy (locval + locval_len, "_");
if (GetLocaleInfo (try_lcid, LOCALE_SABBREVCTRYNAME,
- locval + strlen (locval), LOCALE_NAME_MAX_LENGTH))
+ locval + locval_len + 1, LOCALE_NAME_MAX_LENGTH))
{
- size_t locval_len = strlen (locval);
-
+ locval_len = strlen (locval);
if (strnicmp (locval, lname, locval_len) == 0
&& (lname[locval_len] == '.'
|| lname[locval_len] == '\0'))