ref: 2f183cc86675d21d2d3d3db3394eb011ba408226
parent: c40564c2256b8a323565b48cb55b94094361a103
author: halfwit <michaelmisch1985@gmail.com>
date: Thu Oct 15 08:02:20 PDT 2020
Some errors, some leftover
--- a/libdraw/init.c
+++ b/libdraw/init.c
@@ -60,16 +60,14 @@
}
fd = open("/env/font", O_RDONLY);
- if(fd >= 0){
- read(fd, buf, sizeof(buf));
- fontname = buf;
- }
+ read(fd, buf, sizeof(buf));
+ fontname = buf;
/*
* Build fonts with caches==depth of screen, for speed.
* If conversion were faster, we'd use 0 and save memory.
*/
- if(fontname == nil){
+ if(strcmp(fontname, "") != 0){
snprintf(buf, sizeof buf, "%d %d\n0 %d\t%s\n", df->height, df->ascent,
df->n-1, deffontname);
//BUG: Need something better for this installsubfont("*default*", df);
--- a/mouse.c
+++ b/mouse.c
@@ -54,13 +54,13 @@
int n;
char buf[1+4*12];
- if((n = read(x9di.mfd, buf, 1 + 4 * 12)) < = 0)
+ if((n = read(x9di.mfd, buf, 1 + 4 * 12)) <= 0)
return 0;
if (n != 1 + 4 * 12)
FatalError("Bad mouse event");
- if (buf == 'r') {
+ if (buf[0] == 'r') {
x9devResize();
return 0;
}
--- a/x9dev.c
+++ b/x9dev.c
@@ -36,15 +36,6 @@
{
int fd;
char path[256]; /* Plan9 Maxpath */
-
- c = calloc(1, sizeof(*c));
- c->ctx = calloc(1, sizeof(c->ctx));
- c->ctx->read = ctxread;
- c->ctx->begin = ctxbegin;
- c->ctx->end = ctxend;
- c->ctx->error = ctxerror;
- c->ctx->aux = c;
- c->ctx->r = x9r;
/* We have 9p, we can init */
if(initdraw(NULL, "x9dev") < 0)
@@ -56,7 +47,6 @@
x9di.dpi = 100;
x9di.bpl = bytesperline(Rect(0, 0, x9di.width, x9di.height), x9di.depth);
x9di.fb = malloc(x9di.bpl * x9di.height);
- x9di.ctx = c->ctx;
sprintf(path, "%s/mouse", _display->devdir);
x9di.mfd = open(path, O_RDWR|O_NONBLOCK);