{
if (fd[0] >= 0)
close (fd[0]);
-#if defined (USG) && !defined (IRIX)
+#ifdef USG
setpgrp ();
#else
setpgrp (pid, pid);
/* If we are controlling the terminal, reset terminal modes */
#ifdef EMACS_HAVE_TTY_PGRP
{
+#ifdef USG
+ int pgrp = getpgrp ();
+#else
+ int pgrp = getpgrp (0);
+#endif
int tpgrp;
if (EMACS_GET_TTY_PGRP (0, &tpgrp) != -1
- && tpgrp == getpgrp (0))
+ && tpgrp == pgrp)
{
fflush (stdout);
reset_sys_modes ();
int j = open ("/dev/tty", O_RDWR, 0);
ioctl (j, TIOCNOTTY, 0);
close (j);
-#if !defined (USG) || defined (IRIX)
+#ifndef USG
/* In order to get a controlling terminal on some versions
of BSD, it is necessary to put the process in pgrp 0
before it opens the terminal. */
strcpy (pty_name, name); \
}
-/* Use the BSD versions of the getpgrp and setpgrp functions. */
-#define setpgrp(pid, pgrp) BSDsetpgrp((pid), (pgrp))
-#define getpgrp(pid) BSDgetpgrp(pid)
-
/* jpff@maths.bath.ac.uk reports `struct exception' is not defined
on this system, so inhibit use of matherr. */
#define NO_MATHERR
#else
#ifdef SIGTSTP
- EMACS_KILLPG (getpgrp (0), SIGTSTP);
+ {
+#ifdef USG
+ int pgrp = getpgrp ();
+#else
+ int pgrp = getpgrp (0);
+#endif
+ EMACS_KILLPG (pgrp, SIGTSTP);
+ }
#else /* No SIGTSTP */
#ifdef USG_JOBCTRL /* If you don't know what this is don't mess with it */