diff --git a/doc/ncmpcpp.1 b/doc/ncmpcpp.1 index 4f017059..05aba139 100644 --- a/doc/ncmpcpp.1 +++ b/doc/ncmpcpp.1 @@ -45,7 +45,7 @@ Raise/lower volume by given number of percents and exit. .SH "CONFIGURATION" When ncmpcpp starts, it tries to read user's settings from the ~/.ncmpcpp/config file. If no user's configuration is found, ncmpcpp uses its default configuration. An example configuration file containing all default values is provided with ncmpcpp and can be found usually in /usr/share/doc/ncmpcpp (exact location may depend on used distribution/OS/configure prefix). -Note: Each config option value must be enclosed in quotation marks (var = "example"). +Note: Each config option value must be enclosed in quotation marks (var = "example"). If you want to use quotation mark inside config option, prepend character '\' to it. Note: COLOR has to be the name (not a number) of one of colors 1-8 from SONG FORMAT section. diff --git a/src/helpers.cpp b/src/helpers.cpp index 253b666d..bfa4ed08 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -288,12 +288,20 @@ string GetLineValue(string &line, char a, char b, bool once) size_t i; for (i = line.find(a); i != string::npos && pos[1] < 0; i = line.find(b, i)) { + if (i && line[i-1] == '\\') + { + i++; + continue; + } if (once) line[i] = 0; pos[pos[0] >= 0] = i++; } pos[0]++; - return pos[0] >= 0 && pos[1] >= 0 ? line.substr(pos[0], pos[1]-pos[0]) : ""; + string result = pos[0] >= 0 && pos[1] >= 0 ? line.substr(pos[0], pos[1]-pos[0]) : ""; + for (i = result.find("\\\""); i != string::npos; i = result.find("\\\"")) + result.replace(i, 2, "\""); + return result; } void RemoveTheWord(string &s)