summary refs log tree commit diff
path: root/ingest.c
diff options
context:
space:
mode:
Diffstat (limited to 'ingest.c')
-rw-r--r--ingest.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ingest.c b/ingest.c
index fba2435..27035af 100644
--- a/ingest.c
+++ b/ingest.c
@@ -17,6 +17,7 @@
 #include <assert.h>
 #include <err.h>
 #include <fcntl.h>
+#include <locale.h>
 #include <poll.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -26,12 +27,17 @@
 #include <sys/un.h>
 #include <sysexits.h>
 #include <unistd.h>
+#include <wchar.h>
+
+#include "stream.h"
 
 int main(void) {
 	int error;
+	setlocale(LC_CTYPE, "");
 
 	// TODO: Read info from file.
 	const char *path = "example.sock";
+	termInit(24, 80);
 	
 	int server = socket(PF_LOCAL, SOCK_STREAM, 0);
 	if (server < 0) err(EX_OSERR, "socket");
@@ -78,15 +84,16 @@ int main(void) {
 		if (fds[1].revents) {
 			int client = accept(server, NULL, NULL);
 			if (client < 0) err(EX_IOERR, "accept");
-			maxClient++;
-			assert(client == maxClient);
+			fcntl(client, F_SETFL, O_NONBLOCK);
 
 			int yes = 1;
-			fcntl(client, F_SETFL, O_NONBLOCK);
 			error = setsockopt(client, SOL_SOCKET, SO_NOSIGPIPE, &yes, sizeof(yes));
 			if (error) err(EX_IOERR, "setsockopt");
 
 			// TODO: Send snapshot.
+
+			maxClient++;
+			assert(client == maxClient);
 		}
 	}
 	err(EX_IOERR, "poll");