[bim] Invert #ifdef __linux__ to match #ifdef __toaru__ earlier

This commit is contained in:
K. Lange 2018-08-19 19:49:13 +09:00
parent 2688a4ca8f
commit dd973824c0

View File

@ -305,12 +305,10 @@ int bim_getch(void) {
_bim_unget = -1; _bim_unget = -1;
return out; return out;
} }
#ifdef __linux__ #ifdef __toaru__
struct pollfd fds[1]; int fds[] = {global_config.tty_in};
fds[0].fd = global_config.tty_in; int index = fswait2(1,fds,200);
fds[0].events = POLLIN; if (index == 0) {
int ret = poll(fds,1,200);
if (ret > 0 && fds[0].revents & POLLIN) {
unsigned char buf[1]; unsigned char buf[1];
read(global_config.tty_in, buf, 1); read(global_config.tty_in, buf, 1);
return buf[0]; return buf[0];
@ -318,9 +316,11 @@ int bim_getch(void) {
return -1; return -1;
} }
#else #else
int fds[] = {global_config.tty_in}; struct pollfd fds[1];
int index = fswait2(1,fds,200); fds[0].fd = global_config.tty_in;
if (index == 0) { fds[0].events = POLLIN;
int ret = poll(fds,1,200);
if (ret > 0 && fds[0].revents & POLLIN) {
unsigned char buf[1]; unsigned char buf[1];
read(global_config.tty_in, buf, 1); read(global_config.tty_in, buf, 1);
return buf[0]; return buf[0];