xref: /original-bsd/usr.bin/window/wwspawn.c (revision a9157423)
1 #ifndef lint
2 static	char *sccsid = "@(#)wwspawn.c	3.2 83/08/17";
3 #endif
4 
5 #include "ww.h"
6 
7 wwfork(wp)
8 register struct ww *wp;
9 {
10 	switch (wp->ww_pid = fork()) {
11 	case -1:
12 		return -1;
13 	case 0:
14 		moncontrol(0);
15 		wp->ww_state = WWS_INCHILD;
16 		wwenviron(wp);
17 		return 0;
18 	default:
19 		wp->ww_state = WWS_HASPROC;
20 		(void) close(wp->ww_tty);
21 		wp->ww_tty = -1;
22 		return wp->ww_pid;
23 	}
24 }
25