summaryrefslogtreecommitdiffstats
path: root/lib/Utils/stringops.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Utils/stringops.cpp')
-rw-r--r--lib/Utils/stringops.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/Utils/stringops.cpp b/lib/Utils/stringops.cpp
new file mode 100644
index 0000000..73084fc
--- /dev/null
+++ b/lib/Utils/stringops.cpp
@@ -0,0 +1,30 @@
+#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)
+ {
+ pArgs.push_back(item);
+ item.clear();
+ }
+ else
+ {
+ item += psArgs[ii];
+ }
+ }
+
+ if (item.size() != 0)
+ {
+ pArgs.push_back(item);
+ }
+}