rsc | ed7c8e8 | 2003-09-30 17:47:42 +0000 | [diff] [blame] | 1 | #include <u.h> |
2 | #include <libc.h> | ||||
3 | #include <draw.h> | ||||
4 | |||||
5 | /* Connect us to new window, if possible */ | ||||
6 | int | ||||
7 | newwindow(char *str) | ||||
8 | { | ||||
9 | int fd; | ||||
10 | char *wsys; | ||||
11 | char buf[256]; | ||||
12 | |||||
13 | wsys = getenv("wsys"); | ||||
14 | if(wsys == nil) | ||||
15 | return -1; | ||||
16 | fd = open(wsys, ORDWR); | ||||
17 | free(wsys); | ||||
18 | if(fd < 0) | ||||
19 | return -1; | ||||
20 | rfork(RFNAMEG); | ||||
21 | if(str) | ||||
22 | snprint(buf, sizeof buf, "new %s", str); | ||||
23 | else | ||||
24 | strcpy(buf, "new"); | ||||
25 | return mount(fd, -1, "/dev", MBEFORE, buf); | ||||
26 | } | ||||
27 |