aboutsummaryrefslogtreecommitdiff
path: root/src/Process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Process.cpp')
-rw-r--r--src/Process.cpp23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/Process.cpp b/src/Process.cpp
index d82da42..29eb5fc 100644
--- a/src/Process.cpp
+++ b/src/Process.cpp
@@ -2,32 +2,21 @@
namespace dchat
{
- std::string escapeCommand(const std::string &cmd)
+ std::string escapeCommandArg(const std::string &cmd)
{
std::string result;
result.reserve(cmd.size());
- bool escape = false;
+ result += "'";
for(char c : cmd)
{
- if(c == '\\')
- escape = !escape;
+ if(c == '\'')
+ result += "\"'\""; // "'"
else
- {
- if(escape)
- result += "\\";
-
- if(c == '"')
- result += "\\\""; // \"
- else if(c == '\'')
- result += "\\'"; // \'
- else
- result += c;
-
- escape = false;
- }
+ result += c;
}
+ result += "'";
return result;
}
} \ No newline at end of file