This patch fixes the problem that although the user did specify textinst for the installation and bargraph gets the parameter -t, the warning about the undefined $wsys is printed out. This happened because of a OR in main() of bargraph, where newwin() is executed, but should not. Notes: Sun Apr 24 13:47:05 EDT 2005 rsc Ignoring the setting of textmode and rbar, the old code said if(textmode || newwin(p) < 0) ; else initdraw(); while the new code says if(!textmode){ if(newwin(p) < 0) ; else initdraw(); } and I fail to see how these are different. I'm sure it's something obvious -- please help. Reference: /n/sources/patch/sorry/bargraph-wsys Date: Sun Apr 24 19:02:02 CES 2005 Reviewed-by: rsc --- /sys/lib/dist/cmd/bargraph.c Sun Apr 24 19:01:53 2005 +++ /sys/lib/dist/cmd/bargraph.c Sun Apr 24 19:01:50 2005 @@ -123,6 +123,7 @@ Event e; int k, die, parent, child; + child = -1; parent = getpid(); die = 0; @@ -148,7 +149,6 @@ drawbar(); } postnote(PNCTL, child, "kill"); - die = 1; } @@ -192,14 +192,16 @@ while(q = strchr(p, ',')) *q = ' '; Binit(&b, lfd, OREAD); - if(textmode || newwin(p) < 0){ - textmode = 1; - rbar = Rect(0, 0, 60, 1); - }else{ - initdraw(0, 0, "bar"); - initcolor(); - einit(Emouse|Ekeyboard); - eresized(0); + rbar = Rect(0, 0, 60, 1); + if(!textmode) { + if(newwin(p) < 0){ + textmode = 1; + }else{ + initdraw(0, 0, "bar"); + initcolor(); + einit(Emouse|Ekeyboard); + eresized(0); + } } bar(&b); } @@ -233,7 +235,7 @@ { char *srv, *mntsrv; char spec[100]; - int srvfd, cons, pid; + int srvfd, cons; switch(rfork(RFFDG|RFPROC|RFNAMEG|RFENVG|RFNOTEG|RFNOWAIT)){ case -1: @@ -255,9 +257,7 @@ srv = malloc(strlen(mntsrv)+10); sprint(srv, "/mnt/term%s", mntsrv); free(mntsrv); - pid = 0; /* can't send notes to remote processes! */ - }else - pid = getpid(); + } srvfd = open(srv, ORDWR); free(srv); if(srvfd == -1){