[gnu.emacs.bug] 18.52 process.c fix for SysV with ptys

erik@mpx2.UUCP (Erik Murrey) (11/23/88)

GNU Emacs 18.52.4 of Tue Nov 22 1988 on mpx2 (xenix)

(This may be old news, for all I know...)

Problem:
	Inferior shells on System-V Unix-es with ptys do
	not get a controlling terminal.

Repeat By:
	Run an inferior shell.  Try to echo something to /dev/tty.
	error: /dev/tty cannot create.

	A "ps" will also show a ? in the TTY column.

Fix:
	In process.c, the setpgrp() code in create_process() doesn't
	get compiled in unless you have TIOCNOTTY defined.  I don't
	think that TIOCNOTTY would be defined under AT&T Sys-V.
	In any case, it wasn't on my Xenix System-V box.

	To fix it, I moved the #endif of TIOCNOTTY up above the
	test for USG:

	It worked for me...  mileage may vary...

*** emacs18_52/src/process.c.ORIG	Sat Aug 20 10:27:41 1988
--- emacs18_52/src/process.c	Tue Nov 22 17:53:03 1988
***************
*** 998,1004
  	    int j = open ("/dev/tty", O_RDWR, 0);
  	    ioctl (j, TIOCNOTTY, 0);
  	    close (j);
! 
  #if !defined (RTU) && !defined(UNIPLUS)
  #ifdef USG
  	    setpgrp ();

--- 998,1006 -----
  	    int j = open ("/dev/tty", O_RDWR, 0);
  	    ioctl (j, TIOCNOTTY, 0);
  	    close (j);
! 	  }
! #endif /* TIOCNOTTY */
! 	if (ptyname) {
  #if !defined (RTU) && !defined(UNIPLUS)
  #ifdef USG
  	    setpgrp ();
***************
*** 1012,1018
  	      abort ();
  #endif /* not UNIPLUS and not RTU */
  	  }
- #endif /* TIOCNOTTY */
  #endif /* HAVE_PTYS */
  	child_setup_tty (xforkout);
  	child_setup (xforkin, xforkout, xforkout, new_argv, env);

--- 1014,1019 -----
  	      abort ();
  #endif /* not UNIPLUS and not RTU */
  	  }
  #endif /* HAVE_PTYS */
  	child_setup_tty (xforkout);
  	child_setup (xforkin, xforkout, xforkout, new_argv, env);


-- 
Erik Murrey                            /|   //  /~~~~/  |  /
MPX Data Systems, Inc.                / | / /  /____/   |/
erik@mpx2.UUCP                       /  /  /  /        /|  Data Systems, Inc. 
{spl1,vu-vlsi,bpa}!mpx1!erik        /     /  /       /  |====================