URI:
       tnewwindow.c - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       tnewwindow.c (423B)
       ---
            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 }