1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#include "../include/dchat/Process.hpp" namespace dchat { std::string escapeCommandArg(const std::string &cmd) { std::string result; result.reserve(cmd.size()); result += "'"; for(char c : cmd) { if(c == '\'') result += "\"'\""; // "'" else result += c; } result += "'"; return result; } }