shithub: libacme

Download patch

ref: 4831c35a42234eebce41369cc63250710afa012a
parent: 9893a823a6d9046ba646d3a6034c36111ce0032f
author: james palmer <[email protected]>
date: Wed Jun 2 13:40:37 EDT 2021

more oops.

--- a/event.c
+++ b/event.c
@@ -9,7 +9,8 @@
 {
 	int c, n;
 	
-	while('0' <= (c = Bgetc(bio) && c <= '9')
+	n = 0;
+	while('0' <= (c = Bgetc(bio)) && c <= '9')
 		n = n*10+(c-'0');
 	if(c != ' ') {
 		werrstr("event number syntax: %c", c);
@@ -26,14 +27,14 @@
 	Rune r;
 	
 	len = 0;
-	runes = evgetnum(bio);
-	for(i = 0; i < runes; i++ {
-		if((r = Bgetrune(bio)) < 0)
+	runes = eventgetnum(bio);
+	for(i = 0; i < runes; i++) {
+		if((r = Bgetrune(bio)) == -1)
 			break;
-		len += runetochar(e->text + len, &r);
+		len += runetochar(ev->text + len, &r);
 	}
 	
-	e->text[len] = '\0';
+	ev->text[len] = '\0';
 	return len;
 }
 
@@ -59,20 +60,20 @@
 	}
 	
 	if(ev->flags & 0x2) {
-		e->p = e->q0;
-		flags = e->flags;
+		ev->p = ev->q0;
+		flags = ev->flags;
 		goto Again;
 	}
 	
-	e->flags |= flags;
-	return e->origin;
+	ev->flags |= flags;
+	return ev->origin;
 }
 
 void
 eventsend(Win *w, Event *ev)
 {
-	if(e->flags & 0x2)
-		fprint(w->event, "%c%c%d %d\n", e->origin, e->type, e->p0, e->p0);
+	if(ev->flags & 0x2)
+		fprint(w->event, "%c%c%d %d\n", ev->origin, ev->type, ev->p, ev->p);
 	else
-		fprint(w->event, "%c%c%d %d\n, e->origin, e->type, e->q0, e->q1);
+		fprint(w->event, "%c%c%d %d\n", ev->origin, ev->type, ev->q0, ev->q1);
 }
--- a/window.c
+++ b/window.c
@@ -103,7 +103,7 @@
 	errorfd = winopen(w, "errors", OWRITE);
 	
 	va_start(args, fmt);
-	vfprint(w->body, fmt, args);
+	vfprint(errorfd, fmt, args);
 	va_end(args);
 	
 	close(errorfd);