[comp.unix.wizards] SIGTTOU ?/need help

douglas@dcc1.UUCP (04/29/87)

	Hi,

	I need some help here. The following program is a test program
	I wrote to so my problem. The PROBLEM: After a succesfull call
	to /bin/su user_name (ie: I went into the sub-shell as the user
	I su'ed to), the calling program below gets a SIGTTOU and returns
	to the csh. I must then do a '%fg' to complete the program.
	This does not happen until some ioctl() is done. If I di a
	'fprintf(stderr,"message\n")' after the 'system()' call, it would
	print up, but then stop on the 'raw()' statement.

	QUESTION: Why does this happen, and how can I solve the problem.

	NOTE: I'm on a VAX 11/750 unber BRL 4.2 UNIX.
----------------------------------------------------------------------
#include <curses.h>
/*	%cc -DDO_IOCTL t.c -lcurses -ltermcap	*/

main(argc,argv)
int	argc;
char	*argv[];
{
char	buf[80];

if (argc != 2) {
	fprintf(stderr,"usage: t login_name\n");
	exit(1);
}

initscr();

sprintf(buf,"/bin/su %s",argv[1]);
system(buf);

#ifdef	DO_IOCTL
raw();
noecho();
noraw();
echo();
#endif	DO_IOCTL
clear();
move(LINES-2,0);
printw("BYE");
move(LINES-1,0);
refresh();
endwin();
}
----------------------------------------------------------------------

	Thanks in advance for any help.
	Douglas