From b1ba95336c5208bbf0f7a15b294007e9ccf9bfbc Mon Sep 17 00:00:00 2001 From: Andrew Alderwick Date: Tue, 11 Jan 2022 23:50:41 +0000 Subject: [PATCH] Remove unistd.h from uxnemu.c. --- src/uxnemu.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/uxnemu.c b/src/uxnemu.c index 6498fce..785b4ed 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -1,5 +1,4 @@ #include -#include #include #include "uxn.h" @@ -90,7 +89,7 @@ stdin_handler(void *p) { SDL_Event event; event.type = stdin_event; - while(read(0, &event.cbutton.button, 1) > 0) + while(fread(&event.cbutton.button, 1, 1, stdin) > 0) SDL_PushEvent(&event); return 0; (void)p; @@ -183,8 +182,12 @@ system_deo_special(Device *d, Uint8 port) static void console_deo(Device *d, Uint8 port) { - if(port > 0x7) - write(port - 0x7, (char *)&d->dat[port], 1); + FILE *fd = port == 0x8 ? stdout : port == 0x9 ? stderr + : 0; + if(fd) { + fputc(d->dat[port], fd); + fflush(fd); + } } static Uint8