changeset 7774:f9cde3320987

(run_msdos_command): Make local copy of argv[2] on stack, not on heap. (run_msdos_command): When changing argv[2] from using slashes to using backslashes, only do so on the first white-space delimited part.
author Karl Heuer <kwzh@gnu.org>
date Fri, 03 Jun 1994 04:50:17 +0000
parents 2226c7efb3da
children 4c63040423a8
files src/msdos.c
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/msdos.c	Fri Jun 03 04:08:32 1994 +0000
+++ b/src/msdos.c	Fri Jun 03 04:50:17 1994 +0000
@@ -527,11 +527,20 @@
   if (msshell)
     {
       saveargv1 = argv[1];
+      saveargv2 = argv[2];
       argv[1] = "/c";
       if (argv[2])
 	{
-	  saveargv2 = argv[2];
-	  unixtodos_filename (argv[2] = strdup (argv[2]));
+	  char *p = alloca (strlen (argv[2]) + 1);
+
+	  strcpy (argv[2] = p, saveargv2);
+	  while (*p && isspace (*p))
+	    p++;
+	  while (*p && !isspace (*p))
+	    if (*p == '/')
+	      *p++ = '\\';
+	    else
+	      p++;
 	}
     }
 
@@ -578,11 +587,7 @@
   if (msshell)
     {
       argv[1] = saveargv1;
-      if (argv[2])
-	{
-	  free (argv[2]);
-	  argv[2] = saveargv2;
-	}
+      argv[2] = saveargv2;
     }
   return result;
 }