diff options
Diffstat (limited to 'lib/Utils/stringops.cpp')
-rw-r--r-- | lib/Utils/stringops.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/Utils/stringops.cpp b/lib/Utils/stringops.cpp new file mode 100644 index 0000000..2304acc --- /dev/null +++ b/lib/Utils/stringops.cpp @@ -0,0 +1,32 @@ +#include "abrtlib.h" + +void parse_args(const char *psArgs, vector_string_t& pArgs, const char quote) +{ + unsigned ii; + bool is_quote = false; + std::string item; + + for (ii = 0; psArgs[ii]; ii++) + { + if (quote != -1 && psArgs[ii] == quote) + { + is_quote = !is_quote; + } + else if (psArgs[ii] == ',' && !is_quote) + { + printf("%s\n", item.c_str()); + pArgs.push_back(item); + item.clear(); + } + else + { + item += psArgs[ii]; + } + } + + if (item.size() != 0) + { + printf("%s\n", item.c_str()); + pArgs.push_back(item); + } +} |