diff options
| author | Jiri Moskovcak <jmoskovc@localhost.localdomain> | 2009-11-18 15:51:49 +0100 |
|---|---|---|
| committer | Jiri Moskovcak <jmoskovc@localhost.localdomain> | 2009-11-18 15:51:49 +0100 |
| commit | b6a34a21048ca7edfa913e8c5ee094f4cb85503f (patch) | |
| tree | d1b768d95fbbf2904edd8ac4fb8f6e977841d5c9 /lib/Utils/stringops.cpp | |
| parent | dfcf49e5a3d80fcf61bd4dbac4f8d95d45996278 (diff) | |
| parent | 344a3dcc7a22e0e5dd74fe0bfb0483220c3dc7ad (diff) | |
| download | abrt-b6a34a21048ca7edfa913e8c5ee094f4cb85503f.tar.gz abrt-b6a34a21048ca7edfa913e8c5ee094f4cb85503f.tar.xz abrt-b6a34a21048ca7edfa913e8c5ee094f4cb85503f.zip | |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'lib/Utils/stringops.cpp')
| -rw-r--r-- | lib/Utils/stringops.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/Utils/stringops.cpp b/lib/Utils/stringops.cpp index 1b3793f..dc71b5b 100644 --- a/lib/Utils/stringops.cpp +++ b/lib/Utils/stringops.cpp @@ -3,24 +3,33 @@ void parse_args(const char *psArgs, vector_string_t& pArgs, int quote) { unsigned ii; - bool is_quote = false; + bool inside_quotes = false; std::string item; for (ii = 0; psArgs[ii]; ii++) { - if (quote != -1 && psArgs[ii] == quote) + if (quote != -1) { - is_quote = !is_quote; + if (psArgs[ii] == quote) + { + inside_quotes = !inside_quotes; + continue; + } + /* inside quotes we support escaping with \x */ + if (inside_quotes && psArgs[ii] == '\\' && psArgs[ii+1]) + { + ii++; + item += psArgs[ii]; + continue; + } } - else if (psArgs[ii] == ',' && !is_quote) + if (psArgs[ii] == ',' && !inside_quotes) { pArgs.push_back(item); item.clear(); + continue; } - else - { - item += psArgs[ii]; - } + item += psArgs[ii]; } if (item.size() != 0) |
