Skip to content

Commit d2fc44b

Browse files
committed
no ioctl except on linux
1 parent 48f2f54 commit d2fc44b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

CRT.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ int putenv(char*);
114114

115115
//#link ncurses
116116

117+
bool CRT_linuxConsole = false;
118+
117119
bool CRT_hasColors;
118120

119121
int CRT_delay;
@@ -162,6 +164,8 @@ void CRT_init() {
162164
if (strcmp(term, "xterm") == 0) {
163165
putenv("TERM=xterm-color");
164166
term = "xterm-color";
167+
} else if (strcmp(term, "linux") == 0) {
168+
CRT_linuxConsole = true;
165169
}
166170

167171
CRT_delay = 0;
@@ -514,8 +518,10 @@ int CRT_getCharacter() {
514518
#else
515519
unsigned int modifiers = 6;
516520
#endif
517-
int err = ioctl(0, TIOCLINUX, &modifiers);
518-
if (err) return ch;
521+
if (CRT_linuxConsole) {
522+
int err = ioctl(0, TIOCLINUX, &modifiers);
523+
if (err) return ch;
524+
}
519525
switch (modifiers) {
520526
case SHIFT_MASK:
521527
switch (ch) {

0 commit comments

Comments
 (0)