~foura/wired

c0172717d6d97c793847defd61d0fa8bf78f2fa3 — james palmer 1 year, 2 months ago 789c8e5
add control-d to send the message. strip trailing control-d and newlines.
1 files changed, 13 insertions(+), 0 deletions(-)

M main.c
M main.c => main.c +13 -0
@@ 57,6 57,11 @@ wineventproc(void *aux)
				sendp(ctl, "act");
				
			break;
		case 'I':
			if(strcmp(ev.text, "") == 0)
				sendp(ctl, "send");
				
			break;
		}
	}	
}


@@ 66,11 71,19 @@ readbody(AWin *w)
{
	Biobuf *fd;
	char *buf;
	int i;
	
	fd = awinfsbopen(w, "body", OREAD);
	buf = Brdstr(fd, '\0', 0);
	Bterm(fd);
	
	for(i = strlen(buf)-1; i > 0; i--) {
		if(buf[i] == '' || buf[i] == '\n')
			buf[i] = '\0';
		else
			break;
	}
	
	awinclear(w);
	
	return buf;