summaryrefslogtreecommitdiffstats
path: root/lib/Utils/stringops.cpp
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2009-11-12 15:27:35 +0100
committerKarel Klic <kklic@redhat.com>2009-11-12 15:27:35 +0100
commit43761c9351636628da1c37035fa2dcea523cfa80 (patch)
treedd444131dd32020f3cf12d018a48a814aee4cace /lib/Utils/stringops.cpp
parentcb3c80e309ca3d679a381ec419ec8658a6109144 (diff)
parent9b5293641cdc39bb33b39f6773c0537700514f4e (diff)
downloadabrt-43761c9351636628da1c37035fa2dcea523cfa80.tar.gz
abrt-43761c9351636628da1c37035fa2dcea523cfa80.tar.xz
abrt-43761c9351636628da1c37035fa2dcea523cfa80.zip
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
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);
+ }
+}