aboutsummaryrefslogtreecommitdiffstats
path: root/nt
diff options
context:
space:
mode:
authorGeoff Voelker1998-04-23 23:38:28 +0000
committerGeoff Voelker1998-04-23 23:38:28 +0000
commitec025f9d8dd7e07712f5faa2f68bb20a997a1fe2 (patch)
tree2788c087c9b3791ed1f935010071f96ea0386a5d /nt
parent89e840e56ca4b707d98365d7c2f2e649afc31eba (diff)
downloademacs-ec025f9d8dd7e07712f5faa2f68bb20a997a1fe2.tar.gz
emacs-ec025f9d8dd7e07712f5faa2f68bb20a997a1fe2.zip
(main): Only set environment size for real shell, and
provide extra directory argument, when running on Windows 95.
Diffstat (limited to 'nt')
-rw-r--r--nt/cmdproxy.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/nt/cmdproxy.c b/nt/cmdproxy.c
index 64eae8d286a..d7882480daf 100644
--- a/nt/cmdproxy.c
+++ b/nt/cmdproxy.c
@@ -543,7 +543,7 @@ main (int argc, char ** argv)
543#else 543#else
544 /* Probably a mistake for there to be extra args; not fatal. */ 544 /* Probably a mistake for there to be extra args; not fatal. */
545 if (argc > 0) 545 if (argc > 0)
546 warn ("warning: extra args ignored after %s\n", argv[-1]); 546 warn ("warning: extra args ignored after '%s'\n", argv[-1]);
547#endif 547#endif
548 548
549 pass_through_args[num_pass_through_args] = NULL; 549 pass_through_args[num_pass_through_args] = NULL;
@@ -578,7 +578,7 @@ main (int argc, char ** argv)
578 } 578 }
579 } 579 }
580 580
581pass_to_shell: 581 pass_to_shell:
582 if (need_shell) 582 if (need_shell)
583 { 583 {
584 char * p; 584 char * p;
@@ -620,22 +620,32 @@ pass_to_shell:
620 for (argv = pass_through_args; *argv != NULL; ++argv) 620 for (argv = pass_through_args; *argv != NULL; ++argv)
621 p += wsprintf (p, " %s", *argv); 621 p += wsprintf (p, " %s", *argv);
622 622
623 /* Always set environment size to something reasonable. */ 623 if (GetVersion () & 0x80000000)
624 wsprintf(p, " /e:%d /c %s", envsize, cmdline); 624 /* Set environment size to something reasonable on Windows 95. */
625 wsprintf(p, " /e:%d /c %s", envsize, cmdline);
626 else
627 wsprintf(p, " /c %s", cmdline);
625 cmdline = buf; 628 cmdline = buf;
626 } 629 }
627 else 630 else
628 { 631 {
629 /* Provide dir arg expected by command.com when first started 632 if (GetVersion () & 0x80000000)
630 interactively (the "command search path"). cmd.exe does 633 {
631 not require it, but accepts it silently - presumably other 634 /* Provide dir arg expected by command.com when first
632 DOS compatible shells do the same. To avoid potential 635 started interactively (the "command search path").
633 problems with spaces in command dir (which cannot be quoted 636 cmd.exe does not require it, but accepts it silently -
634 - command.com doesn't like it), we always use the 8.3 form. */ 637 presumably other DOS compatible shells do the same. To
635 GetShortPathName (progname, path, sizeof (path)); 638 avoid potential problems with spaces in command dir
636 p = strrchr (path, '\\'); 639 (which cannot be quoted - command.com doesn't like it),
637 /* Trailing slash is acceptable, so always leave it. */ 640 we always use the 8.3 form. */
638 *(++p) = '\0'; 641 GetShortPathName (progname, path, sizeof (path));
642 p = strrchr (path, '\\');
643 /* Trailing slash is acceptable, so always leave it. */
644 *(++p) = '\0';
645 }
646 else
647 /* Dir arg not needed on NT. */
648 path[0] = '\0';
639 649
640 cmdline = p = alloca (strlen (progname) + extra_arg_space + 650 cmdline = p = alloca (strlen (progname) + extra_arg_space +
641 strlen (path) + 13); 651 strlen (path) + 13);
@@ -648,9 +658,9 @@ pass_to_shell:
648 for (argv = pass_through_args; *argv != NULL; ++argv) 658 for (argv = pass_through_args; *argv != NULL; ++argv)
649 p += wsprintf (p, " %s", *argv); 659 p += wsprintf (p, " %s", *argv);
650 660
651 /* Always set environment size to something reasonable - again 661 if (GetVersion () & 0x80000000)
652 cmd.exe ignores this silently. */ 662 /* Set environment size to something reasonable on Windows 95. */
653 wsprintf (p, " /e:%d", envsize); 663 wsprintf (p, " /e:%d", envsize);
654 } 664 }
655 } 665 }
656 666