summaryrefslogtreecommitdiffstats
path: root/lib/Utils/parse_release.cpp
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2009-11-12 16:58:07 +0100
committerKarel Klic <kklic@redhat.com>2009-11-12 16:58:07 +0100
commit32cee84a34c005fe0d2863f439007ec633687fa8 (patch)
tree149ca7014e4295de3788f28ae88e9d9d7003da46 /lib/Utils/parse_release.cpp
parent5a8a8a6c99c9067e0dfcce839c32826a2badff0b (diff)
parent3938e6e075867ae3a349ba307ee672aa458d2662 (diff)
downloadabrt-32cee84a34c005fe0d2863f439007ec633687fa8.tar.gz
abrt-32cee84a34c005fe0d2863f439007ec633687fa8.tar.xz
abrt-32cee84a34c005fe0d2863f439007ec633687fa8.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 00000000..33d3edb1
--- /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++;
+ }
+}