// replacement get_s which is EL_BIND aware static char * el_get_s (char *buffer, int chars) { // char *head = buffer; // for ( ;; Sleep( 10 ) ) { // INPUT_RECORD _record; // DWORD _read = 0; if ( ReadConsoleInputA( GetStdHandle( STD_INPUT_HANDLE ), &_record, 1, &_read ) == FALSE ) break; // if we didnt read a key if ( _read == 0 ) continue; // only interested in key events if ( _record.EventType != KEY_EVENT ) continue; // is the key down if (! _record.Event.KeyEvent.bKeyDown ) continue; // read the ascii key character char _key = _record.Event.KeyEvent.uChar.AsciiChar; // non ascii conformant key press if ( _key == 0 ) { // check the scan code // if VK_UP scroll back through history // if VK_DOWN scroll forward through history continue; } // try to execute any bind this key may have if ( runBind( _key ) ) continue; // if we read a return key if ( _key == '\n' || _key == '\r' ) { con_return( ); break; } // key is backspace if ( _key == 0x8 ) { // avoid deleting past beginning if ( head > buffer ) { con_backspace( ); head--; } continue; } // add this key to the input buffer if ( (head-buffer) < (chars-1) ) { con_output( _key ); *(head++) = _key; } } // insert end of line character *head = '\0'; return buffer; }
void RemoteControl::establishServerSocket() { runSocket(); runBind(); runListen(); }