diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-09-09 04:40:34 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-09-09 04:40:34 +0200 |
commit | 8dd9bc2815347435c8f92bb329a0209b50660618 (patch) | |
tree | f444a693e05a35f1aa0471ed823f6cd6b60e7d4f /src/madc.cpp | |
parent | d8dda96481a9614b5d7550643f794a9831c6b474 (diff) | |
download | mad-8dd9bc2815347435c8f92bb329a0209b50660618.tar mad-8dd9bc2815347435c8f92bb329a0209b50660618.zip |
Kommandos in einzelne Argumente aufteilen
Diffstat (limited to 'src/madc.cpp')
-rw-r--r-- | src/madc.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/madc.cpp b/src/madc.cpp index 06d65af..af39f2d 100644 --- a/src/madc.cpp +++ b/src/madc.cpp @@ -20,6 +20,7 @@ #include "Net/ClientConnection.h" #include "Net/IPAddress.h" #include "Common/RequestManager.h" +#include "Common/Util.h" #include "Client/RequestProcessor.h" #include <iostream> @@ -48,13 +49,18 @@ static void handleCommand(char *cmd) { if(!*cmd) return; - if(std::strcmp(cmd, "quit") == 0) { + std::vector<std::string> splitCmd = Mad::Common::Util::split(cmd); + + if(splitCmd.empty()) + return; + + if(splitCmd[0] == "quit") { processor->requestDisconnect(); rl_callback_handler_remove(); } else { - std::cerr << "Unknown command \"" << cmd << "\"." << std::endl; + std::cerr << "Unknown command \"" << splitCmd[0] << "\"." << std::endl; } add_history(cmd); |