[gnome-system-monitor] Add OpenBSD support.



commit 8cc3d4d04963bc5f4e70fa6d81a8ad009eac9021
Author: Antoine Jacoutot <ajacoutot openbsd org>
Date:   Tue Jun 14 18:47:38 2011 +0200

    Add OpenBSD support.
    
    Add OpenBSDSysInfo() for getting OpenBSD system information.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=652584

 src/sysinfo.cpp |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp
index 01d195a..3ce7e1d 100644
--- a/src/sysinfo.cpp
+++ b/src/sysinfo.cpp
@@ -387,6 +387,28 @@ namespace {
   };
 
 
+  class OpenBSDSysInfo
+    : public SysInfo
+  {
+  public:
+    OpenBSDSysInfo()
+    {
+      this->load_openbsd_info();
+    }
+
+  private:
+    void load_openbsd_info()
+    {
+      this->distro_name = "OpenBSD";
+      this->distro_release = this->kernel;
+
+      std::ifstream input("/etc/motd");
+
+      if (input)
+        std::getline(input, this->kernel);
+   }
+  };
+
   SysInfo* get_sysinfo()
   {
     if (char *p = g_find_program_in_path("lsb_release")) {
@@ -399,6 +421,9 @@ namespace {
     else if (SysInfo::system() == "NetBSD") {
       return new NetBSDSysInfo;
     }
+    else if (SysInfo::system() == "OpenBSD") {
+      return new OpenBSDSysInfo;
+    }
 
     return new SysInfo;
   }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]