changeset 19699:ce0b47a57e23

(sys_subshell) [DOS_NT]: Save and restore parent's working directory. (sys_subshell) [WINDOWSNT]: Share MSDOS code. Don't take console. (init_sys_modes, reset_sys_modes) [WINDOWSNT]: Do it even with a read_socket_hook.
author Geoff Voelker <voelker@cs.washington.edu>
date Wed, 03 Sep 1997 00:37:00 +0000
parents fea1ad59e248
children 3c251b1dcdf5
files src/sysdep.c
diffstat 1 files changed, 19 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/sysdep.c	Wed Sep 03 00:36:38 1997 +0000
+++ b/src/sysdep.c	Wed Sep 03 00:37:00 1997 +0000
@@ -714,7 +714,7 @@
 sys_subshell ()
 {
 #ifndef VMS
-#ifdef MSDOS	/* Demacs 1.1.2 91/10/20 Manabu Higashida */
+#ifdef DOS_NT	/* Demacs 1.1.2 91/10/20 Manabu Higashida */
   int st;
   char oldwd[MAXPATHLEN+1]; /* Fixed length is safe on MSDOS.  */
 #endif
@@ -752,11 +752,7 @@
   str[len] = 0;
  xyzzy:
 
-#ifdef WINDOWSNT
-  pid = -1;
-#else /* not WINDOWSNT */
-
-#ifdef MSDOS
+#ifdef DOS_NT
   pid = 0;
 #if __DJGPP__ > 1
   save_signal_handlers (saved_handlers);
@@ -769,11 +765,10 @@
 #endif
 
   if (pid == 0)
-#endif /* not WINDOWSNT */
     {
       char *sh = 0;
 
-#ifdef MSDOS    /* MW, Aug 1993 */
+#ifdef DOS_NT    /* MW, Aug 1993 */
       getwd (oldwd);
       if (sh == 0)
 	sh = (char *) egetenv ("SUSPEND");	/* KFS, 1994-12-14 */
@@ -811,10 +806,9 @@
 #ifdef  WINDOWSNT
       /* Waits for process completion */
       pid = _spawnlp (_P_WAIT, sh, sh, NULL);
+      chdir (oldwd);
       if (pid == -1)
 	write (1, "Can't execute subshell", 22);
-
-      take_console ();
 #else   /* not WINDOWSNT */
       execlp (sh, sh, 0);
       write (1, "Can't execute subshell", 22);
@@ -829,7 +823,7 @@
   synch_process_alive = 1;
 #endif
 
-#ifndef MSDOS
+#ifndef DOS_NT
   wait_for_termination (pid);
 #endif
   restore_signal_handlers (saved_handlers);
@@ -1550,7 +1544,13 @@
 #ifdef HAVE_WINDOW_SYSTEM
   /* Emacs' window system on MSDOG uses the `internal terminal' and therefore
      needs the initialization code below.  */
-  if (! read_socket_hook && EQ (Vwindow_system, Qnil))
+  if (EQ (Vwindow_system, Qnil)
+#ifndef WINDOWSNT
+      /* When running in tty mode on NT/Win95, we have a read_socket
+	 hook, but still need the rest of the initialization code below.  */
+      && (! read_socket_hook)
+#endif
+      )
 #endif
     set_terminal_modes ();
 
@@ -1691,7 +1691,13 @@
 #ifdef HAVE_WINDOW_SYSTEM
   /* Emacs' window system on MSDOG uses the `internal terminal' and therefore
      needs the clean-up code below.  */
-  if (read_socket_hook || !EQ (Vwindow_system, Qnil))
+  if (!EQ (Vwindow_system, Qnil)
+#ifndef WINDOWSNT
+      /* When running in tty mode on NT/Win95, we have a read_socket
+	 hook, but still need the rest of the clean-up code below.  */
+      || read_socket_hook
+#endif
+      )
     return;
 #endif
   cursor_to (FRAME_HEIGHT (selected_frame) - 1, 0);