diff src/sysdep.c @ 179:9ad43877534d r20-3b16

Import from CVS: tag r20-3b16
author cvs
date Mon, 13 Aug 2007 09:52:19 +0200
parents 2d532a89d707
children 3d6bfa290dbd
line wrap: on
line diff
--- a/src/sysdep.c	Mon Aug 13 09:51:18 2007 +0200
+++ b/src/sysdep.c	Mon Aug 13 09:52:19 2007 +0200
@@ -67,6 +67,14 @@
 #include <sys/times.h>
 #endif
 
+#ifdef WINDOWSNT
+#include <direct.h>
+/* In process.h which conflicts with the local copy.  */
+#define _P_WAIT 0
+int _CRTAPI1 _spawnlp (int, const char *, const char *, ...);
+int _CRTAPI1 _getpid (void);
+#endif
+
 /* ------------------------------- */
 /*           VMS includes          */
 /* ------------------------------- */
@@ -604,11 +612,17 @@
   str[len] = 0;
  xyzzy:
 
+#ifdef WINDOWSNT
+  pid = -1;
+#else /* not WINDOWSNT */
+
   pid = vfork ();
 
   if (pid == -1)
     error ("Can't spawn subshell");
   if (pid == 0)
+
+#endif /* not WINDOWSNT */
   {
       char *sh = 0;
 
@@ -644,9 +658,21 @@
 			   Fcons (build_string (sh), Qnil));
 #endif
 #else /* not MSDOS */
+#ifdef WINDOWSNT
+      /* Waits for process completion */
+      pid = _spawnlp (_P_WAIT, sh, sh, NULL);
+      if (pid == -1)
+        write (1, "Can't execute subshell", 22);
+
+#if 0
+/* This relates to the GNU Emacs console port, not required under X ? */
+      take_console ();
+#endif
+#else   /* not WINDOWSNT */
     execlp (sh, sh, 0);
     write (1, "Can't execute subshell", 22);
     _exit (1);
+#endif /* not WINDOWSNT */
 #endif /* not MSDOS */
   }
 
@@ -2640,7 +2666,7 @@
   new_action.sa_flags = 0;
 #endif
   sigaction (signal_number, &new_action, &old_action);
-  return (old_action.sa_handler);
+  return (signal_handler_t) (old_action.sa_handler);
 
 #endif /* not 0 */
 }