aboutsummaryrefslogtreecommitdiffstats
path: root/nt/cmdproxy.c
diff options
context:
space:
mode:
authorGeoff Voelker1998-11-10 21:07:13 +0000
committerGeoff Voelker1998-11-10 21:07:13 +0000
commit8de1edce6aa5c394c5b20168d9e4c1cd3205e1fd (patch)
treea9064dd22c4109f038ab1b939cdc69a389ac5060 /nt/cmdproxy.c
parent5dbd225734d2d112b94f3509877b9c2c72fdd13d (diff)
downloademacs-8de1edce6aa5c394c5b20168d9e4c1cd3205e1fd.tar.gz
emacs-8de1edce6aa5c394c5b20168d9e4c1cd3205e1fd.zip
(main): Set environment size only when running
command.com.
Diffstat (limited to 'nt/cmdproxy.c')
-rw-r--r--nt/cmdproxy.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/nt/cmdproxy.c b/nt/cmdproxy.c
index 312d6f6b3cb..ce72ba129c9 100644
--- a/nt/cmdproxy.c
+++ b/nt/cmdproxy.c
@@ -583,6 +583,7 @@ main (int argc, char ** argv)
583 { 583 {
584 char * p; 584 char * p;
585 int extra_arg_space = 0; 585 int extra_arg_space = 0;
586 int run_command_dot_com;
586 587
587 progname = getenv ("COMSPEC"); 588 progname = getenv ("COMSPEC");
588 if (!progname) 589 if (!progname)
@@ -594,6 +595,10 @@ main (int argc, char ** argv)
594 if (progname == NULL || strchr (progname, '\\') == NULL) 595 if (progname == NULL || strchr (progname, '\\') == NULL)
595 fail ("error: the program %s could not be found.\n", getenv ("COMSPEC")); 596 fail ("error: the program %s could not be found.\n", getenv ("COMSPEC"));
596 597
598 /* Need to set environment size when running command.com. */
599 run_command_dot_com =
600 (stricmp (strrchr (progname, '\\'), "command.com") == 0);
601
597 /* Work out how much extra space is required for 602 /* Work out how much extra space is required for
598 pass_through_args. */ 603 pass_through_args. */
599 for (argv = pass_through_args; *argv != NULL; ++argv) 604 for (argv = pass_through_args; *argv != NULL; ++argv)
@@ -620,8 +625,7 @@ main (int argc, char ** argv)
620 for (argv = pass_through_args; *argv != NULL; ++argv) 625 for (argv = pass_through_args; *argv != NULL; ++argv)
621 p += wsprintf (p, " %s", *argv); 626 p += wsprintf (p, " %s", *argv);
622 627
623 if (GetVersion () & 0x80000000) 628 if (run_command_dot_com)
624 /* Set environment size to something reasonable on Windows 95. */
625 wsprintf(p, " /e:%d /c %s", envsize, cmdline); 629 wsprintf(p, " /e:%d /c %s", envsize, cmdline);
626 else 630 else
627 wsprintf(p, " /c %s", cmdline); 631 wsprintf(p, " /c %s", cmdline);
@@ -629,12 +633,10 @@ main (int argc, char ** argv)
629 } 633 }
630 else 634 else
631 { 635 {
632 if (GetVersion () & 0x80000000) 636 if (run_command_dot_com)
633 { 637 {
634 /* Provide dir arg expected by command.com when first 638 /* Provide dir arg expected by command.com when first
635 started interactively (the "command search path"). 639 started interactively (the "command search path"). To
636 cmd.exe does not require it, but accepts it silently -
637 presumably other DOS compatible shells do the same. To
638 avoid potential problems with spaces in command dir 640 avoid potential problems with spaces in command dir
639 (which cannot be quoted - command.com doesn't like it), 641 (which cannot be quoted - command.com doesn't like it),
640 we always use the 8.3 form. */ 642 we always use the 8.3 form. */
@@ -644,7 +646,6 @@ main (int argc, char ** argv)
644 *(++p) = '\0'; 646 *(++p) = '\0';
645 } 647 }
646 else 648 else
647 /* Dir arg not needed on NT. */
648 path[0] = '\0'; 649 path[0] = '\0';
649 650
650 cmdline = p = alloca (strlen (progname) + extra_arg_space + 651 cmdline = p = alloca (strlen (progname) + extra_arg_space +
@@ -658,8 +659,7 @@ main (int argc, char ** argv)
658 for (argv = pass_through_args; *argv != NULL; ++argv) 659 for (argv = pass_through_args; *argv != NULL; ++argv)
659 p += wsprintf (p, " %s", *argv); 660 p += wsprintf (p, " %s", *argv);
660 661
661 if (GetVersion () & 0x80000000) 662 if (run_command_dot_com)
662 /* Set environment size to something reasonable on Windows 95. */
663 wsprintf (p, " /e:%d", envsize); 663 wsprintf (p, " /e:%d", envsize);
664 } 664 }
665 } 665 }