[comp.windows.x] SIGTTOU to xterm

tml@hemuli.UUCP (Tor Lillqvist) (03/31/89)

I am running X11R3 clients on an HP9000/840 running HP-UX.  I have
noticed that when I start up a new xterm in the background from the
(job-control) shell, it stops for tty output.  If I fg it, it doesn't
output anything, and after a ^Z and bg it continues merrily in the
background.  I finally checked what caused this, and noticed that
tgetent in main.c calls something called reset_shell_mode, which
apparently does an ioctl that causes the SIGTTOU.

I fixed this by using setupterm instead of tgetent (which is the right
thing to do anyhow as tgetent is a termcap compatibility routine that
may go away).

*** main.c~	Thu Jan 12 18:22:47 1989
--- main.c	Thu Mar 30 20:22:45 1989
***************
*** 1273,1278
  	}
  	TermName = NULL;
  	if (resource.term_name) {
  	    if (tgetent (ptr, resource.term_name) == 1) {
  		TermName = resource.term_name;
  		if (!screen->TekEmu)

--- 1273,1284 -----
  	}
  	TermName = NULL;
  	if (resource.term_name) {
+ #ifdef SYSV
+ 	    int rc, null = open("/dev/null", 2);
+ 	    setupterm(resource.term_name, null, &rc);
+ 	    close(null);
+ 	    if (rc == 1) {
+ #else
  	    if (tgetent (ptr, resource.term_name) == 1) {
  #endif
  		TermName = resource.term_name;
***************
*** 1274,1279
  	TermName = NULL;
  	if (resource.term_name) {
  	    if (tgetent (ptr, resource.term_name) == 1) {
  		TermName = resource.term_name;
  		if (!screen->TekEmu)
  		    resize (screen, TermName, termcap, newtc);

--- 1280,1286 -----
  	    if (rc == 1) {
  #else
  	    if (tgetent (ptr, resource.term_name) == 1) {
+ #endif
  		TermName = resource.term_name;
  		if (!screen->TekEmu)
  		    resize (screen, TermName, termcap, newtc);
***************
*** 1284,1289
  	}
  	if (!TermName) {
  	    while (*envnew != NULL) {
  		if(tgetent(ptr, *envnew) == 1) {
  			TermName = *envnew;
  			if(!screen->TekEmu)

--- 1291,1302 -----
  	}
  	if (!TermName) {
  	    while (*envnew != NULL) {
+ #ifdef SYSV
+ 		int rc, null = open("/dev/null", 2);
+ 		setupterm(*envnew, null, &rc);
+ 		close(null);
+ 		if(rc == 1) {
+ #else
  		if(tgetent(ptr, *envnew) == 1) {
  #endif
  			TermName = *envnew;
***************
*** 1285,1290
  	if (!TermName) {
  	    while (*envnew != NULL) {
  		if(tgetent(ptr, *envnew) == 1) {
  			TermName = *envnew;
  			if(!screen->TekEmu)
  			    resize(screen, TermName, termcap, newtc);

--- 1298,1304 -----
  		if(rc == 1) {
  #else
  		if(tgetent(ptr, *envnew) == 1) {
+ #endif
  			TermName = *envnew;
  			if(!screen->TekEmu)
  			    resize(screen, TermName, termcap, newtc);

-- 
Tor Lillqvist
Technical Research Centre of Finland, Computing Services
tml%hemuli.uucp@santra.hut.fi