mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 21:29:49 +00:00
Fix RCons.readCharTimeout() ##cons
This commit is contained in:
parent
78d8894a9e
commit
11a049f4fe
@ -1,4 +1,4 @@
|
||||
/* radare2 - LGPL - Copyright 2008-2022 - pancake, Jody Frankowski */
|
||||
/* radare2 - LGPL - Copyright 2008-2023 - pancake, Jody Frankowski */
|
||||
|
||||
#include <r_cons.h>
|
||||
#include <r_util.h>
|
||||
|
@ -552,15 +552,17 @@ static int __cons_readchar_w32(ut32 usec) {
|
||||
}
|
||||
#endif
|
||||
|
||||
R_API int r_cons_readchar_timeout(ut32 usec) {
|
||||
R_API int r_cons_readchar_timeout(ut32 msec) {
|
||||
#if R2__UNIX__
|
||||
struct timeval tv;
|
||||
fd_set fdset, errset;
|
||||
FD_ZERO (&fdset);
|
||||
FD_ZERO (&errset);
|
||||
FD_SET (0, &fdset);
|
||||
tv.tv_sec = 0; // usec / 1000;
|
||||
tv.tv_usec = 1000 * usec;
|
||||
ut32 secs = msec / 1000;
|
||||
tv.tv_sec = secs;
|
||||
ut32 usec = (msec - secs) * 1000;
|
||||
tv.tv_usec = usec;
|
||||
r_cons_set_raw (1);
|
||||
if (select (1, &fdset, NULL, &errset, &tv) == 1) {
|
||||
return r_cons_readchar ();
|
||||
|
Loading…
Reference in New Issue
Block a user