diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-10-10 15:28:26 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-10-10 15:28:26 +0200 |
commit | 969b9f5e5d8a727e5d5588b3385967045f511e5e (patch) | |
tree | d380537f19f7b52eeb3344bd9cd6b3d5fbc5f5e5 | |
parent | fcab8098d6a9a385e0e5edfb26f4abf615da77ca (diff) | |
download | mad-969b9f5e5d8a727e5d5588b3385967045f511e5e.tar mad-969b9f5e5d8a727e5d5588b3385967045f511e5e.zip |
Only try to read char when POLLIN is set
-rw-r--r-- | src/madc.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/madc.cpp b/src/madc.cpp index 18ed477..6d4b680 100644 --- a/src/madc.cpp +++ b/src/madc.cpp @@ -61,6 +61,11 @@ static void handleCommand(char *cmd) { } } +static void charHandler(short events) { + if(events & POLLIN) + rl_callback_read_char(); +} + static void activateReadline() { if(parser->willDisconnect()) return; @@ -107,7 +112,7 @@ int main(int argc, char *argv[]) { parser = new Mad::Client::CommandParser(connection); parser->signalFinished().connect(sigc::ptr_fun(activateReadline)); - Net::FdManager::getFdManager()->registerFd(STDIN_FILENO, sigc::hide(sigc::ptr_fun(rl_callback_read_char))); + Net::FdManager::getFdManager()->registerFd(STDIN_FILENO, sigc::ptr_fun(charHandler)); activateReadline(); |