diff src/emacs.c @ 3655:3e6cc11cfe9f

Interact properly with shells lacking job control (sh, rc, es...) * sysdep.c [BSD] (inherited_pgroup): New variable. (narrow_foreground_group, widen_foreground_group): New functions. (init_sys_modes): Call narrow_foreground_group. (reset_sys_modes): Call widen_foreground_group. * emacs.c [BSD] (inherited_pgroup): Add extern declaration. [BSD] (main): Set inherited_pgroup, and put ourselves in our own pgroup.
author Jim Blandy <jimb@redhat.com>
date Fri, 11 Jun 1993 16:22:03 +0000
parents 0761060b16a3
children 5acf09035d16
line wrap: on
line diff
--- a/src/emacs.c	Fri Jun 11 16:20:38 1993 +0000
+++ b/src/emacs.c	Fri Jun 11 16:22:03 1993 +0000
@@ -81,6 +81,11 @@
    priority; Those functions have their own extern declaration.  */
 int emacs_priority;
 
+#ifdef BSD
+/* See sysdep.c.  */
+extern int inherited_pgroup;
+#endif
+
 #ifdef HAVE_X_WINDOWS
 /* If non-zero, -d was specified, meaning we're using some window system. */
 int display_arg;
@@ -292,17 +297,18 @@
 #endif
 
   clearerr (stdin);
-#if 0 /* Without EMACS_SET_TTY_PGRP, this causes Emacs to hang
-	 when run under a non-job-control shell.
-	 EMACS_SET_TTY_PGRP seems correct, but breaks even more.  */
+
 #ifdef BSD
   {
-    int pid = getpid ();
-    setpgrp (0, pid);
-    EMACS_SET_TTY_PGRP (0, &pid);
+#ifdef GETPGRP_NO_ARG
+    inherited_pgroup = getpgrp (0);
+#else /* THISSENTENCE_NO_VERB */
+    inherited_pgroup = getpgrp (0);
+#endif
+    setpgrp (0, getpid ());
   }
 #endif
-#endif
+
 
 #ifdef APOLLO
 #ifndef APOLLO_SR10