mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 16:41:11 +02:00
added to portfwd tool - Windows keyboard fix (#1035)
* added to portfwd tool - Windows keyboard fix * is it just a hick-up
This commit is contained in:
parent
504a552c77
commit
ba8855fa71
|
@ -26,6 +26,7 @@
|
||||||
#define SOCKET_TIMEOUT 2
|
#define SOCKET_TIMEOUT 2
|
||||||
#define INFO_INTERVAL 5
|
#define INFO_INTERVAL 5
|
||||||
|
|
||||||
|
// REVISIT: may become obsolete
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#define STDIN_FILENO _fileno(stdin)
|
#define STDIN_FILENO _fileno(stdin)
|
||||||
#endif
|
#endif
|
||||||
|
@ -156,10 +157,12 @@ int get_port_from_json (uint16_t *port, json_object_t *json, char *key, int tag,
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------
|
||||||
|
// PLATFORM-DEPENDANT CODE
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(WIN32)
|
||||||
// taken from https://web.archive.org/web/20170407122137/http://cc.byexamples.com/2007/04/08/non-blocking-user-input-in-loop-without-ncurses/
|
// taken from https://web.archive.org/web/20170407122137/http://cc.byexamples.com/2007/04/08/non-blocking-user-input-in-loop-without-ncurses/
|
||||||
int kbhit () {
|
int _kbhit () {
|
||||||
|
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
|
@ -172,6 +175,7 @@ int kbhit () {
|
||||||
|
|
||||||
return FD_ISSET(STDIN_FILENO, &fds);
|
return FD_ISSET(STDIN_FILENO, &fds);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------
|
||||||
|
@ -311,7 +315,7 @@ reset_main_loop:
|
||||||
// read answer packet by packet which are only accepted if a corresponding request was sent before
|
// read answer packet by packet which are only accepted if a corresponding request was sent before
|
||||||
// of which we know about by having set the related tag, tag_info
|
// of which we know about by having set the related tag, tag_info
|
||||||
// a valid sock address indicates that we have seen a valid answer to the info request
|
// a valid sock address indicates that we have seen a valid answer to the info request
|
||||||
while(keep_running && !kbhit()) {
|
while(keep_running && !_kbhit()) {
|
||||||
// current time
|
// current time
|
||||||
now = time(NULL);
|
now = time(NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user