Browse code

Remove unistd.h from uxnemu.c.

Andrew Alderwick authored on 11/01/2022 23:50:41
Showing 1 changed files
... ...
@@ -1,5 +1,4 @@
1 1
 #include <stdio.h>
2
-#include <unistd.h>
3 2
 #include <time.h>
4 3
 
5 4
 #include "uxn.h"
... ...
@@ -90,7 +89,7 @@ stdin_handler(void *p)
90 89
 {
91 90
 	SDL_Event event;
92 91
 	event.type = stdin_event;
93
-	while(read(0, &event.cbutton.button, 1) > 0)
92
+	while(fread(&event.cbutton.button, 1, 1, stdin) > 0)
94 93
 		SDL_PushEvent(&event);
95 94
 	return 0;
96 95
 	(void)p;
... ...
@@ -183,8 +182,12 @@ system_deo_special(Device *d, Uint8 port)
183 182
 static void
184 183
 console_deo(Device *d, Uint8 port)
185 184
 {
186
-	if(port > 0x7)
187
-		write(port - 0x7, (char *)&d->dat[port], 1);
185
+	FILE *fd = port == 0x8 ? stdout : port == 0x9 ? stderr
186
+												  : 0;
187
+	if(fd) {
188
+		fputc(d->dat[port], fd);
189
+		fflush(fd);
190
+	}
188 191
 }
189 192
 
190 193
 static Uint8