summary refs log tree commit diff
path: root/chat.c
diff options
context:
space:
mode:
authorJune McEnroe2022-02-19 20:20:19 -0500
committerJune McEnroe2022-02-19 20:20:19 -0500
commit073cebec7a5a07ab2b829e40ce47ec3b1d774bd9 (patch)
treead20f89bb88ca5bd3499c2628b03a00d67985a4c /chat.c
parent3359a5d69b0fe3c08812f7db83e27958ffec820f (diff)
Factor out input handling to input.c
Diffstat (limited to 'chat.c')
-rw-r--r--chat.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/chat.c b/chat.c
index 57cae6d..c4b256c 100644
--- a/chat.c
+++ b/chat.c
@@ -375,7 +375,7 @@ int main(int argc, char *argv[]) {
 
 	ircConfig(insecure, trust, cert, priv);
 
-	uiInitEarly();
+	uiInit();
 	sig_t cursesWinch = signal(SIGWINCH, signalHandler);
 	if (save) {
 		uiLoad(save);
@@ -407,7 +407,8 @@ int main(int argc, char *argv[]) {
 	ircFormat("NICK :%s\r\n", nick);
 	ircFormat("USER %s 0 * :%s\r\n", user, real);
 
-	uiInitLate();
+	// Avoid disabling VINTR until main loop.
+	inputInit();
 	signal(SIGHUP, signalHandler);
 	signal(SIGINT, signalHandler);
 	signal(SIGALRM, signalHandler);
@@ -436,7 +437,7 @@ int main(int argc, char *argv[]) {
 		int nfds = poll(fds, (pipes ? ARRAY_LEN(fds) : 2), -1);
 		if (nfds < 0 && errno != EINTR) err(EX_IOERR, "poll");
 		if (nfds > 0) {
-			if (fds[0].revents) uiRead();
+			if (fds[0].revents) inputRead();
 			if (fds[1].revents) ircRecv();
 			if (fds[2].revents) utilRead();
 			if (fds[3].revents) execRead();
@@ -488,7 +489,7 @@ int main(int argc, char *argv[]) {
 			cursesWinch(SIGWINCH);
 			// doupdate(3) needs to be called for KEY_RESIZE to be picked up.
 			uiDraw();
-			uiRead();
+			inputRead();
 		}
 
 		uiDraw();