diff options
author | Greg Clayton <gclayton@apple.com> | 2013-03-06 02:19:38 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-03-06 02:19:38 +0000 |
commit | 21c895e3d50399c696867f904915accc38bbecce (patch) | |
tree | 93ea4e51337688ccd25fee41cd8850bfc4e680d9 /lldb/source/Interpreter/OptionValueString.cpp | |
parent | ff2a3ad81b8e39802a4e5bd61a8e2b848b73737f (diff) | |
download | bcm5719-llvm-21c895e3d50399c696867f904915accc38bbecce.tar.gz bcm5719-llvm-21c895e3d50399c696867f904915accc38bbecce.zip |
Now that "settings set" will strip leading and trailing spaces, we need a way to be able to specify string values that contain spaces. So now settings setting <property> <value>" can have a <value> that is quoted:
settings set prompt "(lldb2) "
llvm-svn: 176545
Diffstat (limited to 'lldb/source/Interpreter/OptionValueString.cpp')
-rw-r--r-- | lldb/source/Interpreter/OptionValueString.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lldb/source/Interpreter/OptionValueString.cpp b/lldb/source/Interpreter/OptionValueString.cpp index 91a980340ad..df047bd9899 100644 --- a/lldb/source/Interpreter/OptionValueString.cpp +++ b/lldb/source/Interpreter/OptionValueString.cpp @@ -55,6 +55,28 @@ OptionValueString::SetValueFromCString (const char *value_cstr, VarSetOperationType op) { Error error; + + std::string value_str_no_quotes; + if (value_cstr) + { + switch (value_cstr[0]) + { + case '"': + case '\'': + { + size_t len = strlen(value_cstr); + if (len <= 1 || value_cstr[len-1] != value_cstr[0]) + { + error.SetErrorString("mismatched quotes"); + return error; + } + value_str_no_quotes.assign (value_cstr + 1, len - 2); + value_cstr = value_str_no_quotes.c_str(); + } + break; + } + } + switch (op) { case eVarSetOperationInvalid: |