summaryrefslogtreecommitdiffstats
path: root/lib/Utils
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
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')
-rw-r--r--lib/Utils/Makefile.am1
-rw-r--r--lib/Utils/stringops.cpp30
2 files changed, 31 insertions, 0 deletions
diff --git a/lib/Utils/Makefile.am b/lib/Utils/Makefile.am
index 1b141bd..0ca7a2b 100644
--- a/lib/Utils/Makefile.am
+++ b/lib/Utils/Makefile.am
@@ -5,6 +5,7 @@ lib_LTLIBRARIES = libABRTUtils.la
# xconnect.cpp
libABRTUtils_la_SOURCES = \
+ stringops.cpp \
xfuncs.cpp \
encbase64.cpp \
read_write.cpp \
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);
+ }
+}