(shut_down_emacs): Handle GETPGRP_NO_ARG.
authorRichard M. Stallman <rms@gnu.org>
Wed, 2 Jun 1993 19:11:58 +0000 (19:11 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 2 Jun 1993 19:11:58 +0000 (19:11 +0000)
(main) [BSD]: Delete the setpgrp (both times).

src/emacs.c

index e24b51e..285911b 100644 (file)
@@ -292,8 +292,16 @@ main (argc, argv, envp)
 #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
-  setpgrp (0, getpid ());
+  {
+    int pid = getpid ();
+    setpgrp (0, pid);
+    EMACS_SET_TTY_PGRP (0, &pid);
+  }
+#endif
 #endif
 
 #ifdef APOLLO
@@ -323,11 +331,6 @@ main (argc, argv, envp)
   setuid (getuid ());
 #endif /* PRIO_PROCESS */
 
-#ifdef BSD
-  /* interrupt_input has trouble if we aren't in a separate process group.  */
-  setpgrp (getpid (), getpid ());
-#endif
-
   inhibit_window_system = 0;
 
   /* Handle the -t switch, which specifies filename to use as terminal */
@@ -677,7 +680,11 @@ shut_down_emacs (sig, no_x)
   {
     int tpgrp;
     if (EMACS_GET_TTY_PGRP (0, &tpgrp) != -1
+#ifdef GETPGRP_NO_ARG
+       && tpgrp == getpgrp ())
+#else
        && tpgrp == getpgrp (0))
+#endif
       {
        fflush (stdout);
        reset_sys_modes ();