Integrate change #13058 from maintperl;
authorJarkko Hietaniemi <jhi@iki.fi>
Sat, 17 Nov 2001 15:35:22 +0000 (15:35 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Sat, 17 Nov 2001 15:35:22 +0000 (15:35 +0000)
change#12559 breaks things on Win9x because command.com doesn't
grok dquotes at all; disable all the system() smarts for
command.com

p4raw-link: @13058 on //depot/maint-5.6/perl: 50ebe189cec19a941749051b01f36b6a9a290d1e
p4raw-link: @12559 on //depot/maint-5.6/perl: c196af81e4de7395bbcca7607214cb47be8a55c0

p4raw-id: //depot/perl@13062
p4raw-integrated: from //depot/maint-5.6/perl@13061 'merge in'
win32/win32.c (@12747..)

win32/win32.c

index b23ce65..4c36cc7 100644 (file)
@@ -3109,6 +3109,7 @@ create_command_line(char *cname, STRLEN clen, const char * const *args)
     STRLEN len = 0;
     bool bat_file = FALSE;
     bool cmd_shell = FALSE;
+    bool dumb_shell = FALSE;
     bool extra_quotes = FALSE;
     bool quote_next = FALSE;
 
@@ -3154,6 +3155,11 @@ create_command_line(char *cname, STRLEN clen, const char * const *args)
                cmd_shell = TRUE;
                len += 3;
            }
+           else if (stricmp(exe, "command.com") == 0
+                    || stricmp(exe, "command") == 0)
+           {
+               dumb_shell = TRUE;
+           }
        }
     }
 
@@ -3182,25 +3188,27 @@ create_command_line(char *cname, STRLEN clen, const char * const *args)
 
        /* we want to protect empty arguments and ones with spaces with
         * dquotes, but only if they aren't already there */
-       if (!curlen) {
-           do_quote = 1;
-       }
-       else if (!(arg[0] == '"' && curlen > 1 && arg[curlen-1] == '"')) {
-           STRLEN i = 0;
-           while (i < curlen) {
-               if (isSPACE(arg[i])) {
-                   do_quote = 1;
-                   break;
+       if (!dumb_shell) {
+           if (!curlen) {
+               do_quote = 1;
+           }
+           else if (!(arg[0] == '"' && curlen > 1 && arg[curlen-1] == '"')) {
+               STRLEN i = 0;
+               while (i < curlen) {
+                   if (isSPACE(arg[i])) {
+                       do_quote = 1;
+                       break;
+                   }
+                   i++;
                }
-               i++;
            }
-       }
-       else if (quote_next) {
-           /* ok, we know the argument already has quotes; see if it
-            * really is multiple arguments pretending to be one and
-            * force a set of quotes around it */
-           if (*find_next_space(arg))
-               do_quote = 1;
+           else if (quote_next) {
+               /* ok, we know the argument already has quotes; see if it
+                * really is multiple arguments pretending to be one and
+                * force a set of quotes around it */
+               if (*find_next_space(arg))
+                   do_quote = 1;
+           }
        }
 
        if (do_quote)