Commit f1213ec3 authored by Urs Fleisch's avatar Urs Fleisch
Browse files

Allow escaping of single quotes in kid3-cli, [feature-requests#57].

parent ab43bd2d
...@@ -192,26 +192,19 @@ QStringList splitArgs(const QString& str) ...@@ -192,26 +192,19 @@ QStringList splitArgs(const QString& str)
} }
} }
do { do {
if (c == QLatin1Char('\'')) { if (c == QLatin1Char('"') || c == QLatin1Char('\'')) {
int spos = pos; const QChar quote = c;
do {
if (pos >= str.size())
return QStringList();
c = str.at(pos++);
} while (c != QLatin1Char('\''));
param += str.midRef(spos, pos - spos - 1);
} else if (c == QLatin1Char('"')) {
for (;;) { for (;;) {
if (pos >= str.size()) if (pos >= str.size())
return QStringList(); return QStringList();
c = str.at(pos++); c = str.at(pos++);
if (c == QLatin1Char('"')) if (c == quote)
break; break;
if (c == QLatin1Char('\\')) { if (c == QLatin1Char('\\')) {
if (pos >= str.size()) if (pos >= str.size())
return QStringList(); return QStringList();
c = str.at(pos++); c = str.at(pos++);
if (c != QLatin1Char('"') && c != QLatin1Char('\\')) if (c != quote && c != QLatin1Char('\\'))
param += QLatin1Char('\\'); param += QLatin1Char('\\');
} }
param += c; param += c;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment