mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
fixes.. to bool
This commit is contained in:
parent
24d332fac7
commit
310d0da9a4
13 changed files with 223 additions and 208 deletions
|
@ -19,18 +19,18 @@ int ukbhit(void) {
|
|||
int error;
|
||||
static struct termios Otty, Ntty;
|
||||
|
||||
if ( tcgetattr( 0, &Otty) == -1) return -1;
|
||||
if ( tcgetattr(STDIN_FILENO, &Otty) == -1) return -1;
|
||||
|
||||
Ntty = Otty;
|
||||
Ntty.c_iflag = 0x000; // input mode
|
||||
Ntty.c_oflag = 0x000; // output mode
|
||||
Ntty.c_lflag &= ~ICANON; // control mode = raw
|
||||
Ntty.c_cc[VMIN] = 1; // return if at least 1 character is in the queue
|
||||
Ntty.c_cc[VTIME] = 0; // no timeout. Wait forever
|
||||
|
||||
Ntty.c_iflag = 0; /* input mode */
|
||||
Ntty.c_oflag = 0; /* output mode */
|
||||
Ntty.c_lflag &= ~ICANON; /* raw mode */
|
||||
Ntty.c_cc[VMIN] = CMIN; /* minimum time to wait */
|
||||
Ntty.c_cc[VTIME] = CTIME; /* minimum characters to wait for */
|
||||
|
||||
if (0 == (error = tcsetattr(0, TCSANOW, &Ntty))) {
|
||||
error += ioctl(0, FIONREAD, &cnt);
|
||||
error += tcsetattr(0, TCSANOW, &Otty);
|
||||
if (0 == (error = tcsetattr(STDIN_FILENO, TCSANOW, &Ntty))) { // set new attributes
|
||||
error += ioctl(STDIN_FILENO, FIONREAD, &cnt); // get number of characters available
|
||||
error += tcsetattr(STDIN_FILENO, TCSANOW, &Otty); // reset attributes
|
||||
}
|
||||
|
||||
return ( error == 0 ? cnt : -1 );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue