changeset 23683:cb300ad44b55

(main): Set environment size only when running command.com.
author Geoff Voelker <voelker@cs.washington.edu>
date Tue, 10 Nov 1998 21:07:13 +0000
parents 8d1cbb6f0fb9
children 25077ab7295c
files nt/cmdproxy.c
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/nt/cmdproxy.c	Tue Nov 10 21:06:50 1998 +0000
+++ b/nt/cmdproxy.c	Tue Nov 10 21:07:13 1998 +0000
@@ -583,6 +583,7 @@
     {
       char * p;
       int    extra_arg_space = 0;
+      int    run_command_dot_com;
 
       progname = getenv ("COMSPEC");
       if (!progname)
@@ -594,6 +595,10 @@
       if (progname == NULL || strchr (progname, '\\') == NULL)
 	fail ("error: the program %s could not be found.\n", getenv ("COMSPEC"));
 
+      /* Need to set environment size when running command.com.  */
+      run_command_dot_com =
+	(stricmp (strrchr (progname, '\\'), "command.com") == 0);
+
       /* Work out how much extra space is required for
          pass_through_args.  */
       for (argv = pass_through_args; *argv != NULL; ++argv)
@@ -620,8 +625,7 @@
 	  for (argv = pass_through_args; *argv != NULL; ++argv)
 	    p += wsprintf (p, " %s", *argv);
 
-	  if (GetVersion () & 0x80000000)
-	    /* Set environment size to something reasonable on Windows 95.  */
+	  if (run_command_dot_com)
 	    wsprintf(p, " /e:%d /c %s", envsize, cmdline);
 	  else
 	    wsprintf(p, " /c %s", cmdline);
@@ -629,12 +633,10 @@
 	}
       else
 	{
-	  if (GetVersion () & 0x80000000)
+	  if (run_command_dot_com)
 	    {
 	      /* Provide dir arg expected by command.com when first
-		 started interactively (the "command search path").
-		 cmd.exe does not require it, but accepts it silently -
-		 presumably other DOS compatible shells do the same.  To
+		 started interactively (the "command search path").  To
 		 avoid potential problems with spaces in command dir
 		 (which cannot be quoted - command.com doesn't like it),
 		 we always use the 8.3 form.  */
@@ -644,7 +646,6 @@
 	      *(++p) = '\0';
 	    }
 	  else
-	    /* Dir arg not needed on NT.  */
 	    path[0] = '\0';
 
 	  cmdline = p = alloca (strlen (progname) + extra_arg_space +
@@ -658,8 +659,7 @@
 	  for (argv = pass_through_args; *argv != NULL; ++argv)
 	    p += wsprintf (p, " %s", *argv);
 
-	  if (GetVersion () & 0x80000000)
-	    /* Set environment size to something reasonable on Windows 95.  */
+	  if (run_command_dot_com)
 	    wsprintf (p, " /e:%d", envsize);
 	}
     }