From dcd0d2e4d8a827d06a10344855d8d044bd26630d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 8 Mar 2013 02:24:24 +0300 Subject: Add chat command for execute external programs. New chat command: /execute NAME[ PAR] NAME - program name PAR - parameter --- src/commands.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/commands.cpp') diff --git a/src/commands.cpp b/src/commands.cpp index dce8c57e0..abd30f713 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1056,6 +1056,23 @@ impHandler1(open) openBrowser(url); } +impHandler1(execute) +{ + const size_t idx = args.find(" "); + std::string name; + std::string params; + if (idx == std::string::npos) + { + name = args; + } + else + { + name = args.substr(0, idx); + params = args.substr(idx + 1); + } + execFile(name, name, params, ""); +} + #ifdef DEBUG_DUMP_LEAKS1 void showRes(std::string str, ResourceManager::Resources *res); -- cgit v1.2.3-60-g2f50