summaryrefslogtreecommitdiffstats
path: root/lib/Utils/parse_release.cpp
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2009-11-11 22:30:27 +0100
committerKarel Klic <kklic@redhat.com>2009-11-11 22:30:27 +0100
commit07a12979cbf321c03c615f921aec601492e8d196 (patch)
treea0eba8c5b0cf06be829c378ca8704470e37a036b /lib/Utils/parse_release.cpp
parent4bb5f0163c1cf3c65745ea06f1b42545ecaa35d7 (diff)
parent640af192338643b3c9e6fbe0304726e951239c2b (diff)
downloadabrt-07a12979cbf321c03c615f921aec601492e8d196.tar.gz
abrt-07a12979cbf321c03c615f921aec601492e8d196.tar.xz
abrt-07a12979cbf321c03c615f921aec601492e8d196.zip
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'lib/Utils/parse_release.cpp')
-rw-r--r--lib/Utils/parse_release.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/Utils/parse_release.cpp b/lib/Utils/parse_release.cpp
new file mode 100644
index 0000000..33d3edb
--- /dev/null
+++ b/lib/Utils/parse_release.cpp
@@ -0,0 +1,38 @@
+#include "abrtlib.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+using namespace std;
+
+void parse_release(const char *pRelease, string& pProduct, string& pVersion)
+{
+ if (strstr(pRelease, "Rawhide"))
+ {
+ pProduct = "Fedora";
+ pVersion = "rawhide";
+ return;
+ }
+ if (strstr(pRelease, "Fedora"))
+ {
+ pProduct = "Fedora";
+ }
+ else if (strstr(pRelease, "Red Hat Enterprise Linux"))
+ {
+ pProduct = "Red Hat Enterprise Linux ";
+ }
+
+ const char *release = strstr(pRelease, "release");
+ const char *space = release ? strchr(release, ' ') : NULL;
+
+ if (space++) while (*space != '\0' && *space != ' ')
+ {
+ /* Eat string like "5.2" */
+ pVersion += *space;
+ if (pProduct == "Red Hat Enterprise Linux ")
+ {
+ pProduct += *space;
+ }
+ space++;
+ }
+}