Unified · Split
| @@ -25,7 +25,7 @@ void mousethread(void*); · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | int chatty = 0; |
| 27 | 27 | int drawsleep; |
| 28 | −int fd; | |
| 28 | +int wsysfd; | |
| 29 | 29 | |
| 30 | 30 | Channel *kbdchan; |
| 31 | 31 | Channel *mousechan; |
| @@ -48,7 +48,7 @@ bell(void *v, char *msg) · 16 unmodified lines | ||
| 48 | 48 | void |
| 49 | 49 | threadmain(int argc, char **argv) |
| 50 | 50 | { |
| 51 | − char *addr, *defaddr, *ns; | |
| 51 | + char *defwsys, *wsysaddr, *ns; | |
| 52 | 52 | uchar buf[4], *mbuf; |
| 53 | 53 | int nmbuf, n, nn; |
| 54 | 54 | Ioproc *io; |
| @@ -89,20 +89,20 @@ threadmain(int argc, char **argv) · 34 unmodified lines | ||
| 89 | 89 | * Connect to 9P server defined by $WSYS |
| 90 | 90 | * or unix!$NAMESPACE/wsys. |
| 91 | 91 | */ |
| 92 | − addr = getenv("WSYS"); | |
| 93 | − defaddr = nil; | |
| 94 | − if(addr == 0){ | |
| 92 | + wsysaddr = getenv("WSYS"); | |
| 93 | + defwsys = nil; | |
| 94 | + if(wsysaddr == 0){ | |
| 95 | 95 | ns = getns(); |
| 96 | 96 | if(ns == nil) |
| 97 | 97 | sysfatal("no name space"); |
| 98 | − defaddr = smprint("unix!%s/wsys", ns); | |
| 99 | − addr = defaddr; | |
| 98 | + defwsys = smprint("unix!%s/wsys", ns); | |
| 99 | + wsysaddr = defwsys; | |
| 100 | 100 | } |
| 101 | − fd = dial(addr, 0, 0, 0); | |
| 102 | − if(fd < 0) | |
| 103 | − sysfatal("dial %s: %r", addr); | |
| 104 | − if(addr == defaddr) | |
| 105 | − free(addr); | |
| 101 | + wsysfd = dial(wsysaddr, 0, 0, 0); | |
| 102 | + if(wsysfd < 0) | |
| 103 | + sysfatal("dial %s: %r", wsysaddr); | |
| 104 | + if(wsysaddr == defwsys) | |
| 105 | + free(wsysaddr); | |
| 106 | 106 | |
| 107 | 107 | mbuf = nil; |
| 108 | 108 | nmbuf = 0; |
| @@ -255,7 +255,7 @@ runmsg(Wsysmsg *m) · 146 unmodified lines | ||
| 255 | 255 | Rectangle r; |
| 256 | 256 | static int border; |
| 257 | 257 | static CFid *fcons, *fcursor, *fmouse, *fctl, *fdata, *frddraw; |
| 258 | − static CFsys *fsys; | |
| 258 | + static CFsys *wsysfs; | |
| 259 | 259 | |
| 260 | 260 | static int na; |
| 261 | 261 | static uchar *aa; |
| @@ -263,14 +263,14 @@ runmsg(Wsysmsg *m) · 1 unmodified line | ||
| 263 | 263 | switch(m->type){ |
| 264 | 264 | case Tinit: |
| 265 | 265 | sprint((char*)buf, "new %s", m->winsize); |
| 266 | − if((fsys = fsmount(fd, (char*)buf)) == nil) | |
| 266 | + if((wsysfs = fsmount(wsysfd, (char*)buf)) == nil) | |
| 267 | 267 | sysfatal("fsmount: %r"); |
| 268 | 268 | |
| 269 | − fcons = fsopen(fsys, "cons", OREAD); | |
| 270 | − fmouse = fsopen(fsys, "mouse", ORDWR); | |
| 271 | − fcursor = fsopen(fsys, "cursor", OWRITE); | |
| 269 | + fcons = fsopen(wsysfs, "cons", OREAD); | |
| 270 | + fmouse = fsopen(wsysfs, "mouse", ORDWR); | |
| 271 | + fcursor = fsopen(wsysfs, "cursor", OWRITE); | |
| 272 | 272 | |
| 273 | − f = fsopen(fsys, "label", OWRITE); | |
| 273 | + f = fsopen(wsysfs, "label", OWRITE); | |
| 274 | 274 | fsprint(f, m->label); |
| 275 | 275 | fsclose(f); |
| 276 | 276 | |
| @@ -281,7 +281,7 @@ runmsg(Wsysmsg *m) · 4 unmodified lines | ||
| 281 | 281 | */ |
| 282 | 282 | kbdchan = chancreate(sizeof(uchar), 12); |
| 283 | 283 | mousechan = chancreate(sizeof(uchar), 12); |
| 284 | − f= fsopen(fsys, "consctl", OWRITE); | |
| 284 | + f= fsopen(wsysfs, "consctl", OWRITE); | |
| 285 | 285 | fsprint(f, "rawon"); |
| 286 | 286 | threadcreate(kbdthread, fcons, STACK); |
| 287 | 287 | threadcreate(mousethread, fmouse, STACK); |
| @@ -290,11 +290,11 @@ runmsg(Wsysmsg *m) · 2 unmodified lines | ||
| 290 | 290 | * Open draw(3) files and register |
| 291 | 291 | * image named winname |
| 292 | 292 | */ |
| 293 | − fctl = fsopen(fsys, "draw/new", ORDWR); | |
| 293 | + fctl = fsopen(wsysfs, "draw/new", ORDWR); | |
| 294 | 294 | fsread(fctl, buf, 12*12); |
| 295 | 295 | n = atoi((char*)buf); |
| 296 | 296 | sprint((char*)buf, "draw/%d/data", n); |
| 297 | − fdata = fsopen(fsys, (char*)buf, ORDWR); | |
| 297 | + fdata = fsopen(wsysfs, (char*)buf, ORDWR); | |
| 298 | 298 | |
| 299 | 299 | replymsg(m); |
| 300 | 300 | break; |
| @@ -338,14 +338,14 @@ runmsg(Wsysmsg *m) · 37 unmodified lines | ||
| 338 | 338 | break; |
| 339 | 339 | |
| 340 | 340 | case Tlabel: |
| 341 | − f = fsopen(fsys, "label", OWRITE); | |
| 341 | + f = fsopen(wsysfs, "label", OWRITE); | |
| 342 | 342 | fsprint(f, m->label); |
| 343 | 343 | fsclose(f); |
| 344 | 344 | replymsg(m); |
| 345 | 345 | break; |
| 346 | 346 | |
| 347 | 347 | case Trdsnarf: |
| 348 | − f = fsopen(fsys, "snarf", OREAD); | |
| 348 | + f = fsopen(wsysfs, "snarf", OREAD); | |
| 349 | 349 | fsread(f, buf, sizeof buf); |
| 350 | 350 | fsclose(f); |
| 351 | 351 | m->snarf = strdup((char*)buf); |
| @@ -353,7 +353,7 @@ runmsg(Wsysmsg *m) · 1 unmodified line | ||
| 353 | 353 | break; |
| 354 | 354 | |
| 355 | 355 | case Twrsnarf: |
| 356 | − f = fsopen(fsys, "snarf", OWRITE); | |
| 356 | + f = fsopen(wsysfs, "snarf", OWRITE); | |
| 357 | 357 | fsprint(f, m->snarf); |
| 358 | 358 | fsclose(f); |
| 359 | 359 | replymsg(m); |
| @@ -399,7 +399,7 @@ runmsg(Wsysmsg *m) · 39 unmodified lines | ||
| 399 | 399 | */ |
| 400 | 400 | SET(n); |
| 401 | 401 | if(m->count == 2 && m->data[0] == 'J' && m->data[1] == 'I'){ |
| 402 | − f = fsopen(fsys, "winname", OREAD); | |
| 402 | + f = fsopen(wsysfs, "winname", OREAD); | |
| 403 | 403 | buf[0] = 'n'; |
| 404 | 404 | n = fsread(f, &buf[1+4+1], 64); |
| 405 | 405 | border = (strncmp((char*)&buf[1+4+1], "noborder", 8) != 0); |
| @@ -441,14 +441,14 @@ End: · 35 unmodified lines | ||
| 441 | 441 | break; |
| 442 | 442 | |
| 443 | 443 | case Ttop: |
| 444 | − f = fsopen(fsys, "wctl", OWRITE); | |
| 444 | + f = fsopen(wsysfs, "wctl", OWRITE); | |
| 445 | 445 | fsprint(f, "top"); |
| 446 | 446 | fsclose(f); |
| 447 | 447 | replymsg(m); |
| 448 | 448 | break; |
| 449 | 449 | |
| 450 | 450 | case Tresize: |
| 451 | − f = fsopen(fsys, "wctl", OWRITE); | |
| 451 | + f = fsopen(wsysfs, "wctl", OWRITE); | |
| 452 | 452 | fsprint(f, "resize %d %d", Dx(m->rect), Dy(m->rect)); |
| 453 | 453 | fsclose(f); |
| 454 | 454 | replymsg(m); |