History

devdraw.9p: rename variables (preparing for drawfs)

yiyus committed 15 years ago

Commit bc61af91 parent 24569131 file · +27 −27Browse files

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t