aboutsummaryrefslogtreecommitdiffstats
path: root/src/msdos.c
diff options
context:
space:
mode:
authorEli Zaretskii2000-07-31 06:24:21 +0000
committerEli Zaretskii2000-07-31 06:24:21 +0000
commit74c07fafcf70857973e6ea82f249e3e7bc2827e4 (patch)
tree0ce85e66a5d5c316cd0caf5957d5781674cec6d5 /src/msdos.c
parent261196242e151ff82c9473d1543f3bb1e931338d (diff)
downloademacs-74c07fafcf70857973e6ea82f249e3e7bc2827e4.tar.gz
emacs-74c07fafcf70857973e6ea82f249e3e7bc2827e4.zip
(run_msdos_command): Save and restore the master
environment, for the case that child_setup signals an error. When mirroring slashes in DOS shell commands, don't fail if argv[2] has embedded blanks.
Diffstat (limited to 'src/msdos.c')
-rw-r--r--src/msdos.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/msdos.c b/src/msdos.c
index 8ec5a21faf7..64e6c3cd2b0 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -4651,18 +4651,23 @@ run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv)
4651 saveargv1 = argv[1]; 4651 saveargv1 = argv[1];
4652 saveargv2 = argv[2]; 4652 saveargv2 = argv[2];
4653 argv[1] = "/c"; 4653 argv[1] = "/c";
4654 if (argv[2]) 4654 /* We only need to mirror slashes if a DOS shell will be invoked
4655 not via `system' (which does the mirroring itself). Yes, that
4656 means DJGPP v1.x will lose here. */
4657 if (argv[2] && argv[3])
4655 { 4658 {
4656 char *p = alloca (strlen (argv[2]) + 1); 4659 char *p = alloca (strlen (argv[2]) + 1);
4657 4660
4658 strcpy (argv[2] = p, saveargv2); 4661 strcpy (argv[2] = p, saveargv2);
4659 while (*p && isspace (*p)) 4662 while (*p && isspace (*p))
4660 p++; 4663 p++;
4661 while (*p && !isspace (*p)) 4664 while (*p)
4662 if (*p == '/') 4665 {
4663 *p++ = '\\'; 4666 if (*p == '/')
4664 else 4667 *p++ = '\\';
4665 p++; 4668 else
4669 p++;
4670 }
4666 } 4671 }
4667 } 4672 }
4668 4673
@@ -4703,6 +4708,7 @@ run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv)
4703 if (*cmnd) 4708 if (*cmnd)
4704 { 4709 {
4705 extern char **environ; 4710 extern char **environ;
4711 char **save_env = environ;
4706 int save_system_flags = __system_flags; 4712 int save_system_flags = __system_flags;
4707 4713
4708 /* Request the most powerful version of `system'. We need 4714 /* Request the most powerful version of `system'. We need
@@ -4717,6 +4723,7 @@ run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv)
4717 environ = envv; 4723 environ = envv;
4718 result = system (cmnd); 4724 result = system (cmnd);
4719 __system_flags = save_system_flags; 4725 __system_flags = save_system_flags;
4726 environ = save_env;
4720 } 4727 }
4721 else 4728 else
4722 result = 0; /* emulate Unixy shell behavior with empty cmd line */ 4729 result = 0; /* emulate Unixy shell behavior with empty cmd line */