-#elif defined(SIGTSTP) /* BSD */
- /* change process group */
-#ifndef __EMX__
- setpgrp(0, getpid());
-#endif
- /* lose controlling tty */
- if ((fd = open("/dev/tty", O_RDWR)) >= 0) {
- ioctl(fd, TIOCNOTTY, (char *) 0);
- close(fd); /* not checking should be safe, there were no writes */
- }
-#else /* SVR3 and older */
- /* change process group */
-#ifndef __EMX__
- setpgrp();
-#endif
-
- /* lose controlling tty */
- set_signal_handler(SIGHUP, SIG_IGN);
- if ((childpid = fork()) < 0) {
- report(stderr, "fork (%s)\n", strerror(errno));
- return(PS_IOERR);
- }
- else if (childpid > 0) {
- exit(0); /* parent */
- }
-#endif