Commit | Line | Data |
---|---|---|
2dd7d7a6 | 1 | #ifndef lint |
c52bfe14 | 2 | static char *sccsid = "@(#)wwspawn.c 3.4 83/10/19"; |
2dd7d7a6 EW |
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: | |
03e75950 | 12 | wwerrno = WWE_SYS; |
2dd7d7a6 EW |
13 | return -1; |
14 | case 0: | |
bb05dfb5 | 15 | wp->ww_state = WWS_INCHILD; |
4711df8b | 16 | wwenviron(wp); |
2dd7d7a6 EW |
17 | return 0; |
18 | default: | |
bb05dfb5 EW |
19 | wp->ww_state = WWS_HASPROC; |
20 | (void) close(wp->ww_tty); | |
2b44d852 | 21 | wp->ww_tty = -1; |
2dd7d7a6 EW |
22 | return wp->ww_pid; |
23 | } | |
24 | } |