TIOCNOTTY dissasociates the calling process from the starting
tty.
{ /* associated with the starting tty */
int fd;
if( (fd = open("/dev/tty",0)) < 0)
err("can`t open /dev/tty");
else
{
(void)ioctl(fd,TIOCNOTTY,(char *)0);
(void)close(fd);
}
} /* unassociated with any tty */