mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-05 23:36:23 +00:00
fix some unix stuff
This commit is contained in:
@@ -63,20 +63,12 @@ static int _getch() {
|
||||
char buf = 0;
|
||||
struct termios old;
|
||||
fflush(stdout);
|
||||
if (tcgetattr(0, &old) < 0)
|
||||
perror("tcsetattr()");
|
||||
old.c_lflag &= ~unsigned(ICANON);
|
||||
old.c_lflag &= ~unsigned(ECHO);
|
||||
old.c_cc[VMIN] = 1;
|
||||
old.c_cc[VTIME] = 0;
|
||||
if (tcsetattr(0, TCSANOW, &old) < 0)
|
||||
perror("tcsetattr ICANON");
|
||||
if (read(0, &buf, 1) < 0)
|
||||
perror("read()");
|
||||
old.c_lflag |= ICANON;
|
||||
old.c_lflag |= ECHO;
|
||||
if (tcsetattr(0, TCSADRAIN, &old) < 0)
|
||||
perror("tcsetattr ~ICANON");
|
||||
// no echo printf("%c\n", buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user