changeset 12988:4ccd1ffa8b33

(sys_subshell) [MSDOS]: Handle SUSPEND env var. Disable error report from subshell if system returns non-zero. Don't call vfork before calling system. Don't call wait_for_termination. (sys_select): Turn it off if MSDOS. (reset_sys_modes): Support EMACSCOLORS env var.
author Richard M. Stallman <rms@gnu.org>
date Sat, 02 Sep 1995 16:22:17 +0000
parents bca5676d8cb9
children 84916366643e
files src/sysdep.c
diffstat 1 files changed, 22 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/sysdep.c	Sat Sep 02 16:20:15 1995 +0000
+++ b/src/sysdep.c	Sat Sep 02 16:22:17 1995 +0000
@@ -720,19 +720,26 @@
 #ifdef WINDOWSNT
   pid = -1;
 #else /* not WINDOWSNT */
+#ifdef MSDOS
+  pid = 0;
+#else  
   pid = vfork ();
-
   if (pid == -1)
     error ("Can't spawn subshell");
+#endif
+
   if (pid == 0)
 #endif /* not WINDOWSNT */
     {
-      char *sh;
+      char *sh = 0;
 
 #ifdef MSDOS    /* MW, Aug 1993 */
       getwd (oldwd);
+      if (sh == 0)
+	sh = (char *) egetenv ("SUSPEND");	/* KFS, 1994-12-14 */
 #endif
-      sh = (char *) egetenv ("SHELL");
+      if (sh == 0)
+	sh = (char *) egetenv ("SHELL");
       if (sh == 0)
 	sh = "sh";
 
@@ -756,8 +763,10 @@
 #ifdef MSDOS    /* Demacs 1.1.2 91/10/20 Manabu Higashida */
       st = system (sh);
       chdir (oldwd);
+#if 0	/* This is also reported if last command executed in subshell failed, KFS */
       if (st)
 	report_file_error ("Can't execute subshell", Fcons (build_string (sh), Qnil));
+#endif
 #else /* not MSDOS */
 #ifdef  WINDOWSNT
       /* Waits for process completion */
@@ -776,7 +785,9 @@
 
   save_signal_handlers (saved_handlers);
   synch_process_alive = 1;
+#ifndef MSDOS
   wait_for_termination (pid);
+#endif
   restore_signal_handlers (saved_handlers);
 #endif /* !VMS */
 }
@@ -1607,10 +1618,14 @@
 #ifdef MSDOS
   if (!EQ (Vwindow_system, Qnil))
     {
-      /* Change to grey on white.  */
+      char *colors = getenv("EMACSCOLORS");
+      int color = 0x07;      /* Change to white on black  */
+      if (colors && strlen (colors) >= 5 && colors[2] == ';')
+	color = ((colors[4] & 0x07) << 4) || (colors[3] & 0x07);
+      if ((stdout)->_cnt < 3) fflush(stdout); /* avoid call to _flsbuf */
       putchar ('\e');
       putchar ('A');
-      putchar (7);
+      putchar (color);
     }
 #endif
   clear_end_of_line (FRAME_WIDTH (selected_frame));
@@ -2211,6 +2226,7 @@
   }
 }
 
+#ifndef MSDOS
 #ifndef VMS
 #if !defined (HAVE_SELECT) || defined (BROKEN_SELECT_NON_X)
 
@@ -2331,9 +2347,6 @@
 #ifdef FIONREAD
 		      status = ioctl (fd, FIONREAD, &avail);
 #else /* no FIONREAD */
-#ifdef MSDOS
-		      abort (); /* I don't think we need it.  */
-#else /* not MSDOS */
 		      /* Hoping it will return -1 if nothing available
 			 or 0 if all 0 chars requested are read.  */
 		      if (proc_buffered_char[fd] >= 0)
@@ -2344,7 +2357,6 @@
 			  if (avail > 0)
 			    proc_buffered_char[fd] = buf;
 			}
-#endif /* not MSDOS */
 #endif /* no FIONREAD */
 		    }
 		  if (status >= 0 && avail > 0)
@@ -2365,10 +2377,6 @@
       while (select_alarmed == 0 && *local_timeout != 0
 	     && process_tick == update_tick)
 	{
-#ifdef MSDOS
-	  sleep_or_kbd_hit (SELECT_PAUSE, FD_ISSET (0, &orfds) != 0);
-	  select_alarm ();
-#else /* not MSDOS */
 	  /* If we are interested in terminal input,
 	     wait by reading the terminal.
 	     That makes instant wakeup for terminal input at least.  */
@@ -2380,7 +2388,6 @@
 	    }
 	  else
 	    pause ();
-#endif /* not MSDOS */
 	}
       (*local_timeout) -= SELECT_PAUSE;
       /* Reset the old alarm if there was one */
@@ -2473,6 +2480,7 @@
 
 #endif /* not HAVE_SELECT */
 #endif /* not VMS */
+#endif /* not MSDOS */
 
 #ifdef BSD4_1
 /*