summaryrefslogtreecommitdiff
path: root/arch/linux/common/.svn
diff options
context:
space:
mode:
authorSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:35 -0500
committerSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:35 -0500
commit720f5023a8f68aaaa54cb6b7bf46efee23b5b4c3 (patch)
tree26a8d91183787418455f65c2bb44ed641800dad3 /arch/linux/common/.svn
parent854292407779593a401a1d5ce71add51880fa84f (diff)
Import Upstream version 0.4.1
Diffstat (limited to 'arch/linux/common/.svn')
-rw-r--r--arch/linux/common/.svn/README.txt2
-rw-r--r--arch/linux/common/.svn/empty-file0
-rw-r--r--arch/linux/common/.svn/entries151
-rw-r--r--arch/linux/common/.svn/format1
-rw-r--r--arch/linux/common/.svn/prop-base/alsa.h.svn-base0
-rw-r--r--arch/linux/common/.svn/prop-base/filesystem.h.svn-base0
-rw-r--r--arch/linux/common/.svn/prop-base/inputdevices.h.svn-base0
-rw-r--r--arch/linux/common/.svn/prop-base/loadavg.h.svn-base0
-rw-r--r--arch/linux/common/.svn/prop-base/memory.h.svn-base0
-rw-r--r--arch/linux/common/.svn/prop-base/modules.h.svn-base0
-rw-r--r--arch/linux/common/.svn/prop-base/net.h.svn-base0
-rw-r--r--arch/linux/common/.svn/prop-base/os.h.svn-base0
-rw-r--r--arch/linux/common/.svn/prop-base/pci.h.svn-base0
-rw-r--r--arch/linux/common/.svn/prop-base/samba.h.svn-base0
-rw-r--r--arch/linux/common/.svn/prop-base/sensors.h.svn-base0
-rw-r--r--arch/linux/common/.svn/prop-base/storage.h.svn-base0
-rw-r--r--arch/linux/common/.svn/prop-base/uptime.h.svn-base0
-rw-r--r--arch/linux/common/.svn/prop-base/usb.h.svn-base0
-rw-r--r--arch/linux/common/.svn/props/alsa.h.svn-work0
-rw-r--r--arch/linux/common/.svn/props/filesystem.h.svn-work0
-rw-r--r--arch/linux/common/.svn/props/inputdevices.h.svn-work0
-rw-r--r--arch/linux/common/.svn/props/loadavg.h.svn-work0
-rw-r--r--arch/linux/common/.svn/props/memory.h.svn-work0
-rw-r--r--arch/linux/common/.svn/props/modules.h.svn-work0
-rw-r--r--arch/linux/common/.svn/props/net.h.svn-work0
-rw-r--r--arch/linux/common/.svn/props/os.h.svn-work0
-rw-r--r--arch/linux/common/.svn/props/pci.h.svn-work0
-rw-r--r--arch/linux/common/.svn/props/samba.h.svn-work0
-rw-r--r--arch/linux/common/.svn/props/sensors.h.svn-work0
-rw-r--r--arch/linux/common/.svn/props/storage.h.svn-work0
-rw-r--r--arch/linux/common/.svn/props/uptime.h.svn-work0
-rw-r--r--arch/linux/common/.svn/props/usb.h.svn-work0
-rw-r--r--arch/linux/common/.svn/text-base/alsa.h.svn-base69
-rw-r--r--arch/linux/common/.svn/text-base/filesystem.h.svn-base102
-rw-r--r--arch/linux/common/.svn/text-base/inputdevices.h.svn-base122
-rw-r--r--arch/linux/common/.svn/text-base/loadavg.h.svn-base47
-rw-r--r--arch/linux/common/.svn/text-base/memory.h.svn-base56
-rw-r--r--arch/linux/common/.svn/text-base/modules.h.svn-base129
-rw-r--r--arch/linux/common/.svn/text-base/net.h.svn-base203
-rw-r--r--arch/linux/common/.svn/text-base/nfs.h.svn-base29
-rw-r--r--arch/linux/common/.svn/text-base/os.h.svn-base203
-rw-r--r--arch/linux/common/.svn/text-base/pci.h.svn-base190
-rw-r--r--arch/linux/common/.svn/text-base/samba.h.svn-base80
-rw-r--r--arch/linux/common/.svn/text-base/sensors.h.svn-base237
-rw-r--r--arch/linux/common/.svn/text-base/storage.h.svn-base268
-rw-r--r--arch/linux/common/.svn/text-base/uptime.h.svn-base75
-rw-r--r--arch/linux/common/.svn/text-base/usb.h.svn-base132
47 files changed, 2096 insertions, 0 deletions
diff --git a/arch/linux/common/.svn/README.txt b/arch/linux/common/.svn/README.txt
new file mode 100644
index 00000000..271a8ce9
--- /dev/null
+++ b/arch/linux/common/.svn/README.txt
@@ -0,0 +1,2 @@
+This is a Subversion working copy administrative directory.
+Visit http://subversion.tigris.org/ for more information.
diff --git a/arch/linux/common/.svn/empty-file b/arch/linux/common/.svn/empty-file
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/empty-file
diff --git a/arch/linux/common/.svn/entries b/arch/linux/common/.svn/entries
new file mode 100644
index 00000000..590cfded
--- /dev/null
+++ b/arch/linux/common/.svn/entries
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wc-entries
+ xmlns="svn:">
+<entry
+ committed-rev="9"
+ name=""
+ committed-date="2006-03-07T18:26:23.507991Z"
+ url="svn+ssh://lafp@svn.berlios.de/svnroot/repos/hardinfo/trunk/hardinfo2/arch/linux/common"
+ last-author="lafp"
+ kind="dir"
+ uuid="03931a0e-0c0b-0410-87e6-c9e79dddb921"
+ repos="svn+ssh://lafp@svn.berlios.de/svnroot/repos/hardinfo"
+ revision="9"/>
+<entry
+ committed-rev="1"
+ name="usb.h"
+ text-time="2006-05-20T14:29:25.000000Z"
+ committed-date="2006-01-23T22:38:33.949992Z"
+ checksum="0c0cac5253587505cc065f0e256a5d4d"
+ last-author="lafp"
+ kind="file"
+ prop-time="2006-05-20T14:29:24.000000Z"/>
+<entry
+ committed-rev="1"
+ name="sensors.h"
+ text-time="2006-05-20T14:29:25.000000Z"
+ committed-date="2006-01-23T22:38:33.949992Z"
+ checksum="29e1c509624467fe7314b4735e7111c0"
+ last-author="lafp"
+ kind="file"
+ prop-time="2006-05-20T14:29:24.000000Z"/>
+<entry
+ committed-rev="12"
+ name="inputdevices.h"
+ text-time="2006-05-20T19:41:49.000000Z"
+ committed-date="2006-05-20T19:59:34.736889Z"
+ checksum="01a7b3bd4ca502e604a6feb9092523d8"
+ last-author="lafp"
+ kind="file"
+ prop-time="2006-05-20T14:29:24.000000Z"
+ revision="12"/>
+<entry
+ committed-rev="1"
+ name="uptime.h"
+ text-time="2006-05-20T14:29:25.000000Z"
+ committed-date="2006-01-23T22:38:33.949992Z"
+ checksum="4f5d1b5cb05b0f74f1cc5030d58568a4"
+ last-author="lafp"
+ kind="file"
+ prop-time="2006-05-20T14:29:24.000000Z"/>
+<entry
+ committed-rev="1"
+ name="storage.h"
+ text-time="2006-05-20T14:29:25.000000Z"
+ committed-date="2006-01-23T22:38:33.949992Z"
+ checksum="d5793dc35001654f593b7b20028065d8"
+ last-author="lafp"
+ kind="file"
+ prop-time="2006-05-20T14:29:25.000000Z"/>
+<entry
+ committed-rev="1"
+ name="memory.h"
+ text-time="2006-05-20T14:29:25.000000Z"
+ committed-date="2006-01-23T22:38:33.949992Z"
+ checksum="6003144cee387dca46d2ef91429c1d49"
+ last-author="lafp"
+ kind="file"
+ prop-time="2006-05-20T14:29:25.000000Z"/>
+<entry
+ committed-rev="1"
+ name="modules.h"
+ text-time="2006-05-20T14:29:25.000000Z"
+ committed-date="2006-01-23T22:38:33.949992Z"
+ checksum="1ad54b4dd6e3eec6b953ad4ddf0fd860"
+ last-author="lafp"
+ kind="file"
+ prop-time="2006-05-20T14:29:25.000000Z"/>
+<entry
+ committed-rev="4"
+ name="pci.h"
+ text-time="2006-05-20T14:29:25.000000Z"
+ committed-date="2006-01-31T23:35:06.244169Z"
+ checksum="37a5c5e99c34cbb4adbc4aa31e7fd457"
+ last-author="lafp"
+ kind="file"
+ prop-time="2006-05-20T14:29:24.000000Z"/>
+<entry
+ committed-rev="1"
+ name="loadavg.h"
+ text-time="2006-05-20T14:29:25.000000Z"
+ committed-date="2006-01-23T22:38:33.949992Z"
+ checksum="d5c6e755bc626cbad504197c6806f532"
+ last-author="lafp"
+ kind="file"
+ prop-time="2006-05-20T14:29:24.000000Z"/>
+<entry
+ committed-rev="1"
+ name="alsa.h"
+ text-time="2006-05-20T14:29:25.000000Z"
+ committed-date="2006-01-23T22:38:33.949992Z"
+ checksum="59621ae90495ca734fffde1d5c6a17f8"
+ last-author="lafp"
+ kind="file"
+ prop-time="2006-05-20T14:29:24.000000Z"/>
+<entry
+ committed-rev="4"
+ name="os.h"
+ text-time="2006-05-20T14:29:25.000000Z"
+ committed-date="2006-01-31T23:35:06.244169Z"
+ checksum="5096953136a76251742ceedbe95b4b27"
+ last-author="lafp"
+ kind="file"
+ prop-time="2006-05-20T14:29:24.000000Z"/>
+<entry
+ committed-rev="18"
+ name="samba.h"
+ text-time="2006-06-16T14:09:12.000000Z"
+ committed-date="2006-06-16T14:09:52.687901Z"
+ checksum="41d760d05bea9c45eba0622fe168b2fd"
+ last-author="lafp"
+ kind="file"
+ prop-time="2006-05-20T14:29:24.000000Z"
+ revision="18"/>
+<entry
+ committed-rev="9"
+ name="filesystem.h"
+ text-time="2006-05-20T14:29:25.000000Z"
+ committed-date="2006-03-07T18:26:23.507991Z"
+ checksum="964d2ae62a1d35e125607b9e13d56762"
+ last-author="lafp"
+ kind="file"
+ prop-time="2006-05-20T14:29:25.000000Z"/>
+<entry
+ committed-rev="4"
+ name="net.h"
+ text-time="2006-05-20T14:29:25.000000Z"
+ committed-date="2006-01-31T23:35:06.244169Z"
+ checksum="cda86d4df0a7b91c598f6da5ec63b13e"
+ last-author="lafp"
+ kind="file"
+ prop-time="2006-05-20T14:29:25.000000Z"/>
+<entry
+ committed-rev="14"
+ name="nfs.h"
+ text-time="2006-05-22T16:03:07.000000Z"
+ committed-date="2006-05-22T16:05:56.041082Z"
+ checksum="65db4676d1ef228ef7821c71ae185f67"
+ last-author="lafp"
+ kind="file"
+ revision="14"/>
+</wc-entries>
diff --git a/arch/linux/common/.svn/format b/arch/linux/common/.svn/format
new file mode 100644
index 00000000..b8626c4c
--- /dev/null
+++ b/arch/linux/common/.svn/format
@@ -0,0 +1 @@
+4
diff --git a/arch/linux/common/.svn/prop-base/alsa.h.svn-base b/arch/linux/common/.svn/prop-base/alsa.h.svn-base
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/prop-base/alsa.h.svn-base
diff --git a/arch/linux/common/.svn/prop-base/filesystem.h.svn-base b/arch/linux/common/.svn/prop-base/filesystem.h.svn-base
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/prop-base/filesystem.h.svn-base
diff --git a/arch/linux/common/.svn/prop-base/inputdevices.h.svn-base b/arch/linux/common/.svn/prop-base/inputdevices.h.svn-base
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/prop-base/inputdevices.h.svn-base
diff --git a/arch/linux/common/.svn/prop-base/loadavg.h.svn-base b/arch/linux/common/.svn/prop-base/loadavg.h.svn-base
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/prop-base/loadavg.h.svn-base
diff --git a/arch/linux/common/.svn/prop-base/memory.h.svn-base b/arch/linux/common/.svn/prop-base/memory.h.svn-base
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/prop-base/memory.h.svn-base
diff --git a/arch/linux/common/.svn/prop-base/modules.h.svn-base b/arch/linux/common/.svn/prop-base/modules.h.svn-base
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/prop-base/modules.h.svn-base
diff --git a/arch/linux/common/.svn/prop-base/net.h.svn-base b/arch/linux/common/.svn/prop-base/net.h.svn-base
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/prop-base/net.h.svn-base
diff --git a/arch/linux/common/.svn/prop-base/os.h.svn-base b/arch/linux/common/.svn/prop-base/os.h.svn-base
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/prop-base/os.h.svn-base
diff --git a/arch/linux/common/.svn/prop-base/pci.h.svn-base b/arch/linux/common/.svn/prop-base/pci.h.svn-base
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/prop-base/pci.h.svn-base
diff --git a/arch/linux/common/.svn/prop-base/samba.h.svn-base b/arch/linux/common/.svn/prop-base/samba.h.svn-base
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/prop-base/samba.h.svn-base
diff --git a/arch/linux/common/.svn/prop-base/sensors.h.svn-base b/arch/linux/common/.svn/prop-base/sensors.h.svn-base
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/prop-base/sensors.h.svn-base
diff --git a/arch/linux/common/.svn/prop-base/storage.h.svn-base b/arch/linux/common/.svn/prop-base/storage.h.svn-base
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/prop-base/storage.h.svn-base
diff --git a/arch/linux/common/.svn/prop-base/uptime.h.svn-base b/arch/linux/common/.svn/prop-base/uptime.h.svn-base
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/prop-base/uptime.h.svn-base
diff --git a/arch/linux/common/.svn/prop-base/usb.h.svn-base b/arch/linux/common/.svn/prop-base/usb.h.svn-base
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/prop-base/usb.h.svn-base
diff --git a/arch/linux/common/.svn/props/alsa.h.svn-work b/arch/linux/common/.svn/props/alsa.h.svn-work
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/props/alsa.h.svn-work
diff --git a/arch/linux/common/.svn/props/filesystem.h.svn-work b/arch/linux/common/.svn/props/filesystem.h.svn-work
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/props/filesystem.h.svn-work
diff --git a/arch/linux/common/.svn/props/inputdevices.h.svn-work b/arch/linux/common/.svn/props/inputdevices.h.svn-work
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/props/inputdevices.h.svn-work
diff --git a/arch/linux/common/.svn/props/loadavg.h.svn-work b/arch/linux/common/.svn/props/loadavg.h.svn-work
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/props/loadavg.h.svn-work
diff --git a/arch/linux/common/.svn/props/memory.h.svn-work b/arch/linux/common/.svn/props/memory.h.svn-work
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/props/memory.h.svn-work
diff --git a/arch/linux/common/.svn/props/modules.h.svn-work b/arch/linux/common/.svn/props/modules.h.svn-work
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/props/modules.h.svn-work
diff --git a/arch/linux/common/.svn/props/net.h.svn-work b/arch/linux/common/.svn/props/net.h.svn-work
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/props/net.h.svn-work
diff --git a/arch/linux/common/.svn/props/os.h.svn-work b/arch/linux/common/.svn/props/os.h.svn-work
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/props/os.h.svn-work
diff --git a/arch/linux/common/.svn/props/pci.h.svn-work b/arch/linux/common/.svn/props/pci.h.svn-work
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/props/pci.h.svn-work
diff --git a/arch/linux/common/.svn/props/samba.h.svn-work b/arch/linux/common/.svn/props/samba.h.svn-work
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/props/samba.h.svn-work
diff --git a/arch/linux/common/.svn/props/sensors.h.svn-work b/arch/linux/common/.svn/props/sensors.h.svn-work
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/props/sensors.h.svn-work
diff --git a/arch/linux/common/.svn/props/storage.h.svn-work b/arch/linux/common/.svn/props/storage.h.svn-work
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/props/storage.h.svn-work
diff --git a/arch/linux/common/.svn/props/uptime.h.svn-work b/arch/linux/common/.svn/props/uptime.h.svn-work
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/props/uptime.h.svn-work
diff --git a/arch/linux/common/.svn/props/usb.h.svn-work b/arch/linux/common/.svn/props/usb.h.svn-work
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/arch/linux/common/.svn/props/usb.h.svn-work
diff --git a/arch/linux/common/.svn/text-base/alsa.h.svn-base b/arch/linux/common/.svn/text-base/alsa.h.svn-base
new file mode 100644
index 00000000..0c0744ae
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/alsa.h.svn-base
@@ -0,0 +1,69 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+gchar *
+computer_get_alsacards(Computer * computer)
+{
+ GSList *p;
+ gchar *tmp = "";
+ gint n = 0;
+
+ if (computer->alsa) {
+ for (p = computer->alsa->cards; p; p = p->next) {
+ AlsaCard *ac = (AlsaCard *) p->data;
+
+ tmp =
+ g_strdup_printf("Audio Adapter#%d=%s\n%s", ++n,
+ ac->friendly_name, tmp);
+ }
+ }
+
+ return tmp;
+}
+
+static AlsaInfo *
+computer_get_alsainfo(void)
+{
+ AlsaInfo *ai;
+ AlsaCard *ac;
+ FILE *cards;
+ gchar buffer[128];
+
+ cards = fopen("/proc/asound/cards", "r");
+ if (!cards)
+ return NULL;
+
+ ai = g_new0(AlsaInfo, 1);
+
+ while (fgets(buffer, 128, cards)) {
+ gchar **tmp;
+
+ ac = g_new0(AlsaCard, 1);
+
+ tmp = g_strsplit(buffer, ":", 0);
+
+ ac->friendly_name = g_strdup(tmp[1]);
+ ai->cards = g_slist_append(ai->cards, ac);
+
+ g_strfreev(tmp);
+ fgets(buffer, 128, cards); /* skip next line */
+ }
+ fclose(cards);
+
+ return ai;
+}
diff --git a/arch/linux/common/.svn/text-base/filesystem.h.svn-base b/arch/linux/common/.svn/text-base/filesystem.h.svn-base
new file mode 100644
index 00000000..79784c8f
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/filesystem.h.svn-base
@@ -0,0 +1,102 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Some code from xfce4-mount-plugin, version 0.4.3
+ * Copyright (C) 2005 Jean-Baptiste jb_dul@yahoo.com
+ * Distributed under the terms of GNU GPL 2.
+ */
+#include <sys/vfs.h>
+#define KB 1024
+#define MB 1048576
+#define GB 1073741824
+
+static gchar *fs_list = NULL;
+
+static gchar *
+fs_human_readable(gfloat size)
+{
+ if (size < KB)
+ return g_strdup_printf("%.1f B", size);
+ if (size < MB)
+ return g_strdup_printf("%.1f KiB", size / KB);
+ if (size < GB)
+ return g_strdup_printf("%.1f MiB", size / MB);
+
+ return g_strdup_printf("%.1f GiB", size / GB);
+}
+
+static void
+scan_filesystems(void)
+{
+ FILE *mtab;
+ gchar buf[1024];
+ struct statfs sfs;
+
+ g_free(fs_list);
+ fs_list = g_strdup("");
+
+ mtab = fopen("/etc/mtab", "r");
+ if (!mtab)
+ return;
+
+ while (fgets(buf, 1024, mtab)) {
+ gfloat size, used, avail;
+ gchar **tmp;
+
+ tmp = g_strsplit(buf, " ", 0);
+ if (!statfs(tmp[1], &sfs)) {
+ size = (float) sfs.f_bsize * (float) sfs.f_blocks;
+ avail = (float) sfs.f_bsize * (float) sfs.f_bavail;
+ used = size - avail;
+
+ gchar *strsize = fs_human_readable(size),
+ *stravail = fs_human_readable(avail),
+ *strused = fs_human_readable(used);
+
+ gchar *strhash;
+ if ((strhash = g_hash_table_lookup(moreinfo, tmp[0]))) {
+ g_hash_table_remove(moreinfo, tmp[0]);
+ g_free(strhash);
+ }
+
+ strhash = g_strdup_printf("[%s]\n"
+ "Filesystem=%s\n"
+ "Mounted As=%s\n"
+ "Mount Point=%s\n"
+ "Size=%s\n"
+ "Used=%s\n"
+ "Available=%s\n",
+ tmp[0],
+ tmp[2],
+ strstr(tmp[3], "rw") ? "Read-Write" :
+ "Read-Only", tmp[1], strsize, strused,
+ stravail);
+ g_hash_table_insert(moreinfo, g_strdup(tmp[0]), strhash);
+
+ fs_list = g_strdup_printf("%s$%s$%s=%s total, %s free\n",
+ fs_list,
+ tmp[0], tmp[0], strsize, stravail);
+
+ g_free(strsize);
+ g_free(stravail);
+ g_free(strused);
+ }
+ g_strfreev(tmp);
+ }
+
+ fclose(mtab);
+}
diff --git a/arch/linux/common/.svn/text-base/inputdevices.h.svn-base b/arch/linux/common/.svn/text-base/inputdevices.h.svn-base
new file mode 100644
index 00000000..44a109ca
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/inputdevices.h.svn-base
@@ -0,0 +1,122 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+static gchar *input_icons = NULL;
+
+static gboolean
+remove_input_devices(gpointer key, gpointer value, gpointer data)
+{
+ if (!strncmp((gchar *) key, "INP", 3)) {
+ g_free((gchar *) key);
+ g_free((GtkTreeIter *) value);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static struct {
+ char *name;
+ char *icon;
+} input_devices[] = {
+ { "Keyboard", "keyboard.png" },
+ { "Joystick", "joystick.png" },
+ { "Mouse", "mouse.png" },
+ { "Speaker", "audio.png" },
+ { "Unknown", "module.png" },
+};
+
+void
+scan_inputdevices(void)
+{
+ FILE *dev;
+ gchar buffer[128];
+ gchar *tmp, *name = NULL, *phys = NULL;
+ gint bus, vendor, product, version;
+ int d = 0, n = 0;
+
+ dev = fopen("/proc/bus/input/devices", "r");
+ if (!dev)
+ return;
+
+ if (input_list) {
+ g_hash_table_foreach_remove(devices, remove_input_devices, NULL);
+ g_free(input_list);
+ g_free(input_icons);
+ }
+ input_list = g_strdup("");
+ input_icons = g_strdup("");
+
+ while (fgets(buffer, 128, dev)) {
+ tmp = buffer;
+
+ switch (*tmp) {
+ case 'N':
+ name = g_strdup(tmp + strlen("N: Name="));
+ remove_quotes(name);
+ break;
+ case 'P':
+ phys = g_strdup(tmp + strlen("P: Phys="));
+ break;
+ case 'I':
+ sscanf(tmp, "I: Bus=%x Vendor=%x Product=%x Version=%x",
+ &bus, &vendor, &product, &version);
+ break;
+ case 'H':
+ if (strstr(tmp, "kbd"))
+ d = 0; //INPUT_KEYBOARD;
+ else if (strstr(tmp, "js"))
+ d = 1; //INPUT_JOYSTICK;
+ else if (strstr(tmp, "mouse"))
+ d = 2; //INPUT_MOUSE;
+ else
+ d = 4; //INPUT_UNKNOWN;
+ break;
+ case '\n':
+ if (strstr(name, "PC Speaker")) {
+ d = 3; // INPUT_PCSPKR
+ }
+
+ tmp = g_strdup_printf("INP%d", ++n);
+ input_list = g_strdup_printf("%s$%s$%s=\n",
+ input_list,
+ tmp, name);
+ input_icons = g_strdup_printf("%sIcon$%s$%s=%s\n",
+ input_icons,
+ tmp, name,
+ input_devices[d].icon);
+ gchar *strhash = g_strdup_printf("[Device Information]\n"
+ "Name=%s\n"
+ "Type=%s\n"
+ "Bus=0x%x\n"
+ "Vendor=0x%x\n"
+ "Product=0x%x\n"
+ "Version=0x%x\n"
+ "Connected to=%s\n",
+ name, input_devices[d].name,
+ bus, vendor, product,
+ version, phys);
+ g_hash_table_insert(devices, tmp, strhash);
+
+ g_free(phys);
+ g_free(name);
+ }
+ }
+
+ fclose(dev);
+}
diff --git a/arch/linux/common/.svn/text-base/loadavg.h.svn-base b/arch/linux/common/.svn/text-base/loadavg.h.svn-base
new file mode 100644
index 00000000..28132b5f
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/loadavg.h.svn-base
@@ -0,0 +1,47 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+static LoadInfo *
+computer_get_loadinfo(void)
+{
+ LoadInfo *li = g_new0(LoadInfo, 1);
+ FILE *procloadavg;
+
+ procloadavg = fopen("/proc/loadavg", "r");
+ fscanf(procloadavg, "%f %f %f", &(li->load1), &(li->load5),
+ &(li->load15));
+ fclose(procloadavg);
+
+ return li;
+}
+
+static gchar *
+computer_get_formatted_loadavg()
+{
+ LoadInfo *li;
+ gchar *tmp;
+
+ li = computer_get_loadinfo();
+
+ tmp =
+ g_strdup_printf("%.2f, %.2f, %.2f", li->load1, li->load5,
+ li->load15);
+
+ g_free(li);
+ return tmp;
+}
diff --git a/arch/linux/common/.svn/text-base/memory.h.svn-base b/arch/linux/common/.svn/text-base/memory.h.svn-base
new file mode 100644
index 00000000..def4cc1d
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/memory.h.svn-base
@@ -0,0 +1,56 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+static MemoryInfo *
+computer_get_memory(void)
+{
+ MemoryInfo *mi;
+ FILE *procmem;
+ gchar buffer[128];
+
+ procmem = fopen("/proc/meminfo", "r");
+ if (!procmem)
+ return NULL;
+ mi = g_new0(MemoryInfo, 1);
+
+ while (fgets(buffer, 128, procmem)) {
+ gchar **tmp = g_strsplit(buffer, ":", 2);
+
+ tmp[0] = g_strstrip(tmp[0]);
+ tmp[1] = g_strstrip(tmp[1]);
+
+ get_int("MemTotal", mi->total);
+ get_int("MemFree", mi->free);
+ get_int("Cached", mi->cached);
+
+ g_strfreev(tmp);
+ }
+ fclose(procmem);
+
+ mi->used = mi->total - mi->free;
+
+ mi->total /= 1000;
+ mi->cached /= 1000;
+ mi->used /= 1000;
+ mi->free /= 1000;
+
+ mi->used -= mi->cached;
+ mi->ratio = 1 - (gdouble) mi->used / mi->total;
+
+ return mi;
+}
diff --git a/arch/linux/common/.svn/text-base/modules.h.svn-base b/arch/linux/common/.svn/text-base/modules.h.svn-base
new file mode 100644
index 00000000..69f7ebd6
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/modules.h.svn-base
@@ -0,0 +1,129 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+void
+scan_modules(void)
+{
+ FILE *lsmod;
+ gchar buffer[1024];
+
+ lsmod = popen("/sbin/lsmod", "r");
+ if (!lsmod)
+ return;
+
+ fgets(buffer, 1024, lsmod); /* Discards the first line */
+
+ while (fgets(buffer, 1024, lsmod)) {
+ gchar *buf, *strmodule, *hashkey;
+ gchar *author = NULL,
+ *description = NULL,
+ *license = NULL,
+ *deps = NULL, *vermagic = NULL, *filename = NULL, modname[64];
+ FILE *modi;
+ glong memory;
+
+ shell_status_pulse();
+
+ buf = buffer;
+
+ sscanf(buf, "%s %ld", modname, &memory);
+
+ hashkey = g_strdup_printf("MOD%s", modname);
+ buf = g_strdup_printf("/sbin/modinfo %s", modname);
+
+ modi = popen(buf, "r");
+ while (fgets(buffer, 1024, modi)) {
+ gchar **tmp = g_strsplit(buffer, ":", 2);
+
+ GET_STR("author", author);
+ GET_STR("description", description);
+ GET_STR("license", license);
+ GET_STR("depends", deps);
+ GET_STR("vermagic", vermagic);
+ GET_STR("filename", filename);
+
+ g_strfreev(tmp);
+ }
+ pclose(modi);
+ g_free(buf);
+
+ /* old modutils includes quotes in some strings; strip them */
+ /*remove_quotes(modname);
+ remove_quotes(description);
+ remove_quotes(vermagic);
+ remove_quotes(author);
+ remove_quotes(license); */
+
+ /* old modutils displays <none> when there's no value for a
+ given field; this is not desirable in the module name
+ display, so change it to an empty string */
+ if (description && !strcmp(description, "&lt;none&gt;")) {
+ g_free(description);
+ description = g_strdup("");
+ }
+
+ /* append this module to the list of modules */
+ module_list = g_strdup_printf("%s$%s$%s=%s\n",
+ module_list,
+ hashkey,
+ modname,
+ description ? description : "");
+
+#define NONE_IF_NULL(var) (var) ? (var) : "N/A"
+
+ /* create the module information string */
+ strmodule = g_strdup_printf("[Module Information]\n"
+ "Path=%s\n"
+ "Used Memory=%.2fKiB\n"
+ "[Description]\n"
+ "Name=%s\n"
+ "Description=%s\n"
+ "Version Magic=%s\n"
+ "[Copyright]\n"
+ "Author=%s\n"
+ "License=%s\n",
+ NONE_IF_NULL(filename),
+ memory / 1024.0,
+ NONE_IF_NULL(modname),
+ NONE_IF_NULL(description),
+ NONE_IF_NULL(vermagic),
+ NONE_IF_NULL(author),
+ NONE_IF_NULL(license));
+
+ /* if there are dependencies, append them to that string */
+ if (deps && strlen(deps)) {
+ gchar **tmp = g_strsplit(deps, ",", 0);
+
+ strmodule = g_strconcat(strmodule,
+ "\n[Dependencies]\n",
+ g_strjoinv("=\n", tmp),
+ "=\n", NULL);
+ g_strfreev(tmp);
+ g_free(deps);
+ }
+
+ g_hash_table_insert(devices, hashkey, strmodule);
+
+ g_free(license);
+ g_free(description);
+ g_free(author);
+ g_free(vermagic);
+ g_free(filename);
+ }
+ pclose(lsmod);
+}
diff --git a/arch/linux/common/.svn/text-base/net.h.svn-base b/arch/linux/common/.svn/text-base/net.h.svn-base
new file mode 100644
index 00000000..87e7e59b
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/net.h.svn-base
@@ -0,0 +1,203 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+static gchar *network_interfaces = NULL;
+
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <linux/sockios.h>
+#include <sys/socket.h>
+
+typedef struct _NetInfo NetInfo;
+struct _NetInfo {
+ char name[16];
+ int mtu;
+ unsigned char mac[8];
+};
+
+
+void get_net_info(char *if_name, NetInfo *netinfo)
+{
+ struct ifreq ifr;
+ int fd;
+
+ fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
+
+ strcpy(ifr.ifr_name, if_name);
+ strcpy(netinfo->name, if_name);
+
+ if (ioctl(fd, SIOCGIFMTU, &ifr) < 0) {
+ netinfo->mtu = 0;
+ } else {
+ netinfo->mtu = ifr.ifr_mtu;
+ }
+
+ strcpy(ifr.ifr_name, if_name);
+ if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) {
+ memset(netinfo->mac, 0, 8);
+ } else {
+ memcpy(netinfo->mac, ifr.ifr_ifru.ifru_hwaddr.sa_data, 8);
+ }
+
+ shutdown(fd, 0);
+}
+
+static struct {
+ char *type;
+ char *label;
+} netdev2type[] = {
+ { "eth", "Ethernet" },
+ { "lo", "Loopback" },
+ { "ppp", "Point-to-Point" },
+ { "ath", "Wireless" },
+ { "wlan", "Wireless" },
+ { "tun", "Virtual Point-to-Point (TUN)" },
+ { "tap", "Ethernet (TAP)" },
+ { "plip", "Parallel Line Internet Protocol" },
+ { "irlan", "Infrared" },
+ { "slip", "Serial Line Internet Protocol" },
+ { "isdn", "Integrated Services Digital Network" },
+ { "sit", "IPv6-over-IPv4 Tunnel" },
+ { "vmnet8", "VMWare Virtual Network Interface (NAT)" },
+ { "vmnet", "VMWare Virtual Network Interface" },
+ { NULL, "Unknown" },
+};
+
+static const gchar *
+net_get_iface_type(gchar *name)
+{
+ int i;
+
+ for (i = 0; netdev2type[i].type; i++) {
+ if (g_str_has_prefix(name, netdev2type[i].type))
+ break;
+ }
+
+ return netdev2type[i].label;
+}
+
+static gboolean
+remove_net_devices(gpointer key, gpointer value, gpointer data)
+{
+ if (!strncmp((gchar *) key, "NET", 4)) {
+ g_free((gchar *) key);
+ g_free((GtkTreeIter *) value);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static void
+scan_net_interfaces_24(void)
+{
+ FILE *proc_net;
+ NetInfo ni;
+ gchar buffer[256];
+ gchar *devid, *detailed;
+ gulong recv_bytes;
+ gulong recv_errors;
+ gulong recv_packets;
+
+ gulong trans_bytes;
+ gulong trans_errors;
+ gulong trans_packets;
+
+ if (!g_file_test("/proc/net/dev", G_FILE_TEST_EXISTS)) {
+ if (network_interfaces) {
+ g_free(network_interfaces);
+ network_interfaces = g_strdup("[Network Interfaces]\n"
+ "None found=\n");
+ }
+
+ return;
+ }
+
+ if (network_interfaces) {
+ g_free(network_interfaces);
+ }
+
+ network_interfaces = g_strdup("[Network Interfaces]\n");
+
+ proc_net = fopen("/proc/net/dev", "r");
+ while (fgets(buffer, 256, proc_net)) {
+ if (strchr(buffer, ':')) {
+ gint trash;
+ gchar ifacename[16];
+ gchar *buf = buffer;
+ gint i;
+
+ buf = g_strstrip(buf);
+
+ memset(ifacename, 0, 16);
+
+ for (i = 0; buffer[i] != ':' && i < 16; i++) {
+ ifacename[i] = buffer[i];
+ }
+
+ buf = strchr(buf, ':') + 1;
+
+ /* iface: bytes packets errs drop fifo frame compressed multicast */
+ sscanf(buf, "%ld %ld %ld %d %d %d %d %d %ld %ld %ld",
+ &recv_bytes, &recv_packets,
+ &recv_errors, &trash, &trash, &trash, &trash,
+ &trash, &trans_bytes, &trans_packets,
+ &trans_errors);
+
+ gfloat recv_mb = recv_bytes / 1048576.0;
+ gfloat trans_mb = trans_bytes / 1048576.0;
+
+ devid = g_strdup_printf("NET%s", ifacename);
+ network_interfaces = g_strdup_printf("%s$%s$%s=Sent %.2fMiB, received %.2fMiB\n",
+ network_interfaces,
+ devid,
+ ifacename,
+ trans_mb,
+ recv_mb);
+
+ get_net_info(ifacename, &ni);
+ detailed = g_strdup_printf("[Network Adapter Properties]\n"
+ "Interface Type=%s\n"
+ "Hardware Address=%02x:%02x:%02x:%02x:%02x:%02x\n"
+ "MTU=%d\n"
+ "Bytes Sent=%ld (%.2fMiB)\n"
+ "Bytes Received=%ld (%.2fMiB)\n",
+ net_get_iface_type(ifacename),
+ ni.mac[0], ni.mac[1],
+ ni.mac[2], ni.mac[3],
+ ni.mac[4], ni.mac[5],
+ ni.mtu,
+ recv_bytes, recv_mb,
+ trans_bytes, trans_mb);
+ g_hash_table_insert(moreinfo, devid, detailed);
+ }
+ }
+ fclose(proc_net);
+}
+
+static void
+scan_net_interfaces(void)
+{
+ /* FIXME: See if we're running Linux 2.6 and if /sys is mounted, then use
+ that instead of /proc/net/dev */
+
+ /* remove old devices from global device table */
+ g_hash_table_foreach_remove(moreinfo, remove_net_devices, NULL);
+
+ scan_net_interfaces_24();
+}
diff --git a/arch/linux/common/.svn/text-base/nfs.h.svn-base b/arch/linux/common/.svn/text-base/nfs.h.svn-base
new file mode 100644
index 00000000..5ae22797
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/nfs.h.svn-base
@@ -0,0 +1,29 @@
+static gchar *nfs_shares_list = NULL;
+void
+scan_nfs_shared_directories(void)
+{
+ FILE *exports;
+ gchar buf[512];
+
+ if (nfs_shares_list) {
+ g_free(nfs_shares_list);
+ }
+
+ nfs_shares_list = g_strdup("");
+
+ exports = fopen("/etc/exports", "r");
+ if (!exports)
+ return;
+
+ while (fgets(buf, 512, exports)) {
+ if (buf[0] != '/')
+ continue;
+
+ strend(buf, ' ');
+ strend(buf, '\t');
+
+ nfs_shares_list = g_strconcat(nfs_shares_list, buf, "=\n", NULL);
+ }
+ fclose(exports);
+}
+
diff --git a/arch/linux/common/.svn/text-base/os.h.svn-base b/arch/linux/common/.svn/text-base/os.h.svn-base
new file mode 100644
index 00000000..0f7b59e3
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/os.h.svn-base
@@ -0,0 +1,203 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+static gchar *
+get_libc_version(void)
+{
+ FILE *libc;
+ gchar buf[256], *tmp, *p;
+
+ libc = popen("/lib/libc.so.6", "r");
+ if (!libc) goto err;
+
+ fgets(buf, 256, libc);
+ if (pclose(libc)) goto err;
+
+ tmp = strstr(buf, "version ");
+ if (!tmp) goto err;
+
+ p = strchr(tmp, ',');
+ if (p) *p = '\0';
+ else goto err;
+
+ return g_strdup_printf("GNU C Library version %s (%sstable)",
+ strchr(tmp, ' ') + 1,
+ strstr(buf, " stable ") ? "" : "un");
+ err:
+ return g_strdup("Unknown");
+}
+
+static gchar *
+get_os_compiled_date(void)
+{
+ FILE *procversion;
+ gchar buf[512];
+
+ procversion = fopen("/proc/sys/kernel/version", "r");
+ if (!procversion)
+ return g_strdup("Unknown");
+
+ fgets(buf, 512, procversion);
+ fclose(procversion);
+
+ return g_strdup(buf);
+}
+
+
+#include <gdk/gdkx.h>
+
+void
+detect_desktop_environment(OperatingSystem * os)
+{
+ const gchar *tmp = g_getenv("GNOME_DESKTOP_SESSION_ID");
+ FILE *version;
+ int maj, min;
+
+ if (tmp) {
+ /* FIXME: this might not be true, as the gnome-panel in path
+ may not be the one that's running.
+ see where the user's running panel is and run *that* to
+ obtain the version. */
+ version = popen("gnome-panel --version", "r");
+ if (version) {
+ fscanf(version, "Gnome gnome-panel %d.%d", &maj, &min);
+ if (pclose(version))
+ goto unknown;
+ } else {
+ goto unknown;
+ }
+
+ os->desktop =
+ g_strdup_printf("GNOME %d.%d (session name: %s)", maj, min,
+ tmp);
+ } else if (g_getenv("KDE_FULL_SESSION")) {
+ version = popen("kcontrol --version", "r");
+ if (version) {
+ char buf[32];
+
+ fgets(buf, 32, version);
+
+ fscanf(version, "KDE: %d.%d", &maj, &min);
+ if (pclose(version))
+ goto unknown;
+ } else {
+ goto unknown;
+ }
+
+ os->desktop = g_strdup_printf("KDE %d.%d", maj, min);
+ } else {
+ unknown:
+ if (!g_getenv("DISPLAY")) {
+ os->desktop = g_strdup("Terminal");
+ } else {
+ const gchar *windowman;
+ GdkScreen *screen = gdk_screen_get_default();
+
+ windowman = gdk_x11_screen_get_window_manager_name(screen);
+
+ if (g_str_equal(windowman, "Xfwm4")) {
+ /* FIXME: check if xprop -root | grep XFCE_DESKTOP_WINDOW
+ is defined */
+ os->desktop = g_strdup("XFCE 4");
+ } else {
+ os->desktop = g_strdup_printf("Unknown (Window Manager: %s)",
+ windowman);
+ }
+ }
+ }
+}
+
+static OperatingSystem *
+computer_get_os(void)
+{
+ struct utsname utsbuf;
+ OperatingSystem *os;
+ int i;
+
+ os = g_new0(OperatingSystem, 1);
+
+ os->compiled_date = get_os_compiled_date();
+
+ /* Attempt to get the Distribution name; try using /etc/lsb-release first,
+ then doing the legacy method (checking for /etc/$DISTRO-release files) */
+ if (g_file_test("/etc/lsb-release", G_FILE_TEST_EXISTS)) {
+ FILE *release;
+ gchar buffer[128];
+
+ release = popen("lsb_release -d", "r");
+ fgets(buffer, 128, release);
+ pclose(release);
+
+ os->distro = buffer;
+ os->distro = g_strdup(os->distro + strlen("Description:\t"));
+ }
+
+ for (i = 0;; i++) {
+ if (distro_db[i].file == NULL) {
+ os->distrocode = g_strdup("unk");
+ os->distro = g_strdup("Unknown distribution");
+ break;
+ }
+
+ if (g_file_test(distro_db[i].file, G_FILE_TEST_EXISTS)) {
+
+
+ FILE *distro_ver;
+ char buf[128];
+
+ distro_ver = fopen(distro_db[i].file, "r");
+ fgets(buf, 128, distro_ver);
+ fclose(distro_ver);
+
+ buf[strlen(buf) - 1] = 0;
+
+ if (!os->distro) {
+ /*
+ * HACK: Some Debian systems doesn't include
+ * the distribuition name in /etc/debian_release,
+ * so add them here.
+ */
+ if (!strncmp(distro_db[i].codename, "deb", 3) &&
+ ((buf[0] >= '0' && buf[0] <= '9') || buf[0] != 'D')) {
+ os->distro = g_strdup_printf
+ ("Debian GNU/Linux %s", buf);
+ } else {
+ os->distro = g_strdup(buf);
+ }
+ }
+ os->distrocode = g_strdup(distro_db[i].codename);
+
+ break;
+ }
+ }
+
+ /* Kernel and hostname info */
+ uname(&utsbuf);
+ os->kernel = g_strdup_printf("%s %s (%s)", utsbuf.sysname,
+ utsbuf.release, utsbuf.machine);
+ os->hostname = g_strdup(utsbuf.nodename);
+ os->language = g_strdup(g_getenv("LC_MESSAGES"));
+ os->homedir = g_strdup(g_get_home_dir());
+ os->username = g_strdup_printf("%s (%s)",
+ g_get_user_name(), g_get_real_name());
+ os->libc = get_libc_version();
+ scan_languages(os);
+ detect_desktop_environment(os);
+
+ return os;
+}
diff --git a/arch/linux/common/.svn/text-base/pci.h.svn-base b/arch/linux/common/.svn/text-base/pci.h.svn-base
new file mode 100644
index 00000000..f8c9d319
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/pci.h.svn-base
@@ -0,0 +1,190 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+void
+scan_pci(void)
+{
+ FILE *lspci;
+ gchar buffer[256], *buf, *strhash = NULL, *strdevice = NULL;
+ gchar *category = NULL, *name = NULL;
+ gint n = 0;
+
+ //if (g_file_test("/usr/bin/gksudo", G_FILE_TEST_EXISTS)) {
+ // lspci = popen("gksudo '/bin/lspci -v'", "r");
+ //} else {
+ lspci = popen(LSPCI, "r");
+ //}
+
+ if (!lspci) {
+ return;
+ }
+
+ gchar *icon;
+
+ int x = 0; /* unique Memory, Capability and I/O port */
+ while (fgets(buffer, 256, lspci)) {
+ buf = g_strstrip(buffer);
+
+ if (!strncmp(buf, "Flags", 5)) {
+ gint irq = 0, freq = 0, latency = 0, i;
+ gchar **list;
+ gboolean bus_master;
+
+ buf += 7;
+
+ bus_master = FALSE;
+
+ list = g_strsplit(buf, ", ", 10);
+ for (i = 0; i <= 10; i++) {
+ if (!list[i])
+ break;
+
+ if (!strncmp(list[i], "IRQ", 3))
+ sscanf(list[i], "IRQ %d", &irq);
+ else if (strstr(list[i], "Mhz"))
+ sscanf(list[i], "%dMhz", &freq);
+ else if (!strncmp(list[i], "bus master", 10))
+ bus_master = TRUE;
+ else if (!strncmp(list[i], "latency", 7))
+ sscanf(list[i], "latency %d", &latency);
+ }
+ g_strfreev(list);
+
+ if (irq)
+ strdevice = g_strdup_printf("%sIRQ=%d\n", strdevice, irq);
+ if (freq)
+ strdevice =
+ g_strdup_printf("%sFrequency=%dMHz\n", strdevice,
+ freq);
+ if (latency)
+ strdevice =
+ g_strdup_printf("%sLatency=%d\n", strdevice, latency);
+
+ strdevice =
+ g_strdup_printf("%sBus Master=%s\n", strdevice,
+ bus_master ? "Yes" : "No");
+ } else if (!strncmp(buf, "Subsystem", 9)) {
+ WALK_UNTIL(' ');
+ buf++;
+ strdevice =
+ g_strdup_printf("%sOEM Vendor=%s\n", strdevice, buf);
+ } else if (!strncmp(buf, "Capabilities", 12)
+ && !strstr(buf, "only to root") &&
+ !strstr(buf, "access denied")) {
+ WALK_UNTIL(' ');
+ WALK_UNTIL(']');
+ buf++;
+ strdevice =
+ g_strdup_printf("%sCapability#%d=%s\n", strdevice, ++x,
+ buf);
+ } else if (!strncmp(buf, "Memory at", 9) && strstr(buf, "[size=")) {
+ gint mem;
+ gchar unit;
+ gboolean prefetch;
+ gboolean _32bit;
+
+ prefetch = strstr(buf, "non-prefetchable") ? FALSE : TRUE;
+ _32bit = strstr(buf, "32-bit") ? TRUE : FALSE;
+
+ WALK_UNTIL('[');
+ sscanf(buf, "[size=%d%c", &mem, &unit);
+
+ strdevice = g_strdup_printf("%sMemory#%d=%d%cB (%s%s)\n",
+ strdevice, ++x,
+ mem,
+ (unit == ']') ? ' ' : unit,
+ _32bit ? "32-bit, " : "",
+ prefetch ? "prefetchable" :
+ "non-prefetchable");
+
+ } else if (!strncmp(buf, "I/O", 3)) {
+ guint io_addr, io_size;
+
+ sscanf(buf, "I/O ports at %x [size=%d]", &io_addr, &io_size);
+
+ strdevice =
+ g_strdup_printf("%sI/O ports at#%d=0x%x - 0x%x\n",
+ strdevice, ++x, io_addr,
+ io_addr + io_size);
+ } else if ((buf[0] >= '0' && buf[0] <= '9') && (buf[4] == ':' || buf[2] == ':')) {
+ gint bus, device, function, domain;
+ gpointer start, end;
+
+ if (strdevice != NULL && strhash != NULL) {
+ g_hash_table_insert(devices, strhash, strdevice);
+ g_free(category);
+ g_free(name);
+ }
+
+ if (buf[4] == ':') {
+ sscanf(buf, "%x:%x:%x.%d", &domain, &bus, &device, &function);
+ } else {
+ /* lspci without domain field */
+ sscanf(buf, "%x:%x.%x", &bus, &device, &function);
+ domain = 0;
+ }
+
+ WALK_UNTIL(' ');
+
+ start = buf;
+
+ WALK_UNTIL(':');
+ end = buf + 1;
+ *buf = 0;
+
+ buf = start + 1;
+ category = g_strdup(buf);
+
+ buf = end;
+ start = buf;
+ WALK_UNTIL('(');
+ *buf = 0;
+ buf = start + 1;
+
+ if (strstr(category, "RAM memory")) icon = "mem";
+ else if (strstr(category, "Multimedia")) icon = "media";
+ else if (strstr(category, "USB")) icon = "usb";
+ else icon = "pci";
+
+ name = g_strdup(buf);
+
+ strhash = g_strdup_printf("PCI%d", n);
+ strdevice = g_strdup_printf("[Device Information]\n"
+ "Name=%s\n"
+ "Class=%s\n"
+ "Domain=%d\n"
+ "Bus, device, function=%d, %d, %d\n",
+ name, category, domain, bus,
+ device, function);
+ pci_list = g_strdup_printf("%s$PCI%d$%s=%s\n", pci_list, n, category,
+ name);
+
+ n++;
+ }
+ }
+
+ if (pclose(lspci)) {
+ /* error (no pci, perhaps?) */
+ pci_list = g_strconcat(pci_list, "No PCI devices found=\n", NULL);
+ } else if (strhash) {
+ /* insert the last device */
+ g_hash_table_insert(devices, strhash, strdevice);
+ g_free(category);
+ g_free(name);
+ }
+}
diff --git a/arch/linux/common/.svn/text-base/samba.h.svn-base b/arch/linux/common/.svn/text-base/samba.h.svn-base
new file mode 100644
index 00000000..5f5ecbe5
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/samba.h.svn-base
@@ -0,0 +1,80 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+static gchar *smb_shares_list = NULL;
+void
+scan_samba_shared_directories(void)
+{
+ GKeyFile *keyfile;
+ GError *error = NULL;
+ gchar **groups;
+ gchar *smbconf;
+ gsize length;
+ gint i = 0;
+
+ if (smb_shares_list) {
+ g_free(smb_shares_list);
+ }
+
+ keyfile = g_key_file_new();
+
+ if (!g_file_get_contents("/etc/samba/smb.conf", &smbconf, &length, &error)) {
+ smb_shares_list = g_strdup("Cannot open /etc/samba/smb.conf=\n");
+ g_error_free(error);
+ goto cleanup;
+ }
+
+ gchar *_smbconf = smbconf;
+ for (; *_smbconf; _smbconf++)
+ if (*_smbconf == ';') *_smbconf = '\0';
+
+ if (!g_key_file_load_from_data(keyfile, smbconf, length, 0, &error)) {
+ smb_shares_list = g_strdup("Cannot parse smb.conf=\n");
+ g_error_free(error);
+ goto cleanup;
+ }
+
+ smb_shares_list = g_strdup("");
+
+ groups = g_key_file_get_groups(keyfile, NULL);
+ while (groups[i]) {
+ if (g_key_file_has_key(keyfile, groups[i], "path", NULL) &&
+ g_key_file_has_key(keyfile, groups[i], "available", NULL)) {
+
+ gchar *available = g_key_file_get_string(keyfile, groups[i], "available", NULL);
+
+ if (g_str_equal(available, "yes")) {
+ gchar *path = g_key_file_get_string(keyfile, groups[i], "path", NULL);
+ smb_shares_list = g_strconcat(smb_shares_list, groups[i], "=",
+ path, "\n", NULL);
+ g_free(path);
+ }
+
+ g_free(available);
+ }
+
+ i++;
+ }
+
+ g_strfreev(groups);
+
+ cleanup:
+ g_key_file_free(keyfile);
+ g_free(smbconf);
+}
+
diff --git a/arch/linux/common/.svn/text-base/sensors.h.svn-base b/arch/linux/common/.svn/text-base/sensors.h.svn-base
new file mode 100644
index 00000000..ef834de2
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/sensors.h.svn-base
@@ -0,0 +1,237 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+static gchar *sensors = NULL;
+static GHashTable *sensor_labels = NULL;
+static GHashTable *sensor_compute = NULL;
+
+static void
+read_sensor_labels(gchar *driver)
+{
+ FILE *conf;
+ gchar buf[256], *line, *p;
+ gboolean lock = FALSE;
+ gint i;
+
+ sensor_labels = g_hash_table_new_full(g_str_hash, g_str_equal,
+ g_free, g_free);
+ sensor_compute = g_hash_table_new(g_str_hash, g_str_equal);
+
+ conf = fopen("/etc/sensors.conf", "r");
+ if (!conf)
+ return;
+
+ while (fgets(buf, 256, conf)) {
+ line = buf;
+
+ remove_linefeed(line);
+ strend(line, '#');
+
+ if (*line == '\0') {
+ continue;
+ } else if (lock && strstr(line, "label")) { /* label lines */
+ gchar **names = g_strsplit(strstr(line, "label") + 5, " ", 0);
+ gchar *name = NULL, *value = NULL;
+
+ for (i = 0; names[i]; i++) {
+ if (names[i][0] == '\0')
+ continue;
+
+ if (!name) name = g_strdup(names[i]);
+ else if (!value) value = g_strdup(names[i]);
+ else value = g_strconcat(value, " ", names[i], NULL);
+ }
+
+ remove_quotes(value);
+ g_hash_table_insert(sensor_labels, name, value);
+
+ g_strfreev(names);
+ } else if (lock && strstr(line, "ignore")) { /* ignore lines */
+ p = strstr(line, "ignore") + 6;
+ if (!strchr(p, ' '))
+ continue;
+
+ while (*p == ' ') p++;
+ g_hash_table_insert(sensor_labels, g_strdup(p), "ignore");
+ } else if (lock && strstr(line, "compute")) { /* compute lines */
+ gchar **formulas = g_strsplit(strstr(line, "compute") + 7, " ", 0);
+ gchar *name = NULL, *formula = NULL;
+
+ for (i = 0; formulas[i]; i++) {
+ if (formulas[i][0] == '\0')
+ continue;
+ if (formulas[i][0] == ',')
+ break;
+
+ if (!name) name = g_strdup(formulas[i]);
+ else if (!formula) formula = g_strdup(formulas[i]);
+ else formula = g_strconcat(formula, formulas[i], NULL);
+ }
+
+ g_strfreev(formulas);
+ g_hash_table_insert(sensor_compute, name, math_string_to_postfix(formula));
+ } else if (g_str_has_prefix(line, "chip")) { /* chip lines (delimiter) */
+ if (lock == FALSE) {
+ gchar **chips = g_strsplit(line, " ", 0);
+
+ for (i = 1; chips[i]; i++) {
+ strend(chips[i], '*');
+
+ if (g_str_has_prefix(driver, chips[i] + 1)) {
+ lock = TRUE;
+ break;
+ }
+ }
+
+ g_strfreev(chips);
+ } else {
+ break;
+ }
+ }
+ }
+
+ fclose(conf);
+}
+
+static gchar *
+get_sensor_label(gchar *sensor)
+{
+ gchar *ret;
+
+ ret = g_hash_table_lookup(sensor_labels, sensor);
+ if (!ret) ret = g_strdup(sensor);
+ else ret = g_strdup(ret);
+
+ return ret;
+}
+
+static float
+adjust_sensor(gchar *name, float value)
+{
+ GSList *postfix;
+
+ postfix = g_hash_table_lookup(sensor_compute, name);
+ if (!postfix) return value;
+
+ return math_postfix_eval(postfix, value);
+}
+
+static void
+read_sensors(void)
+{
+ gchar *path_hwmon, *path_sensor, *tmp, *driver, *name, *mon;
+ int hwmon, count;
+
+ if (sensors)
+ g_free(sensors);
+
+ hwmon = 0;
+ sensors = g_strdup("");
+
+ path_hwmon = g_strdup_printf("/sys/class/hwmon/hwmon%d/device/", hwmon);
+ while (g_file_test(path_hwmon, G_FILE_TEST_EXISTS)) {
+ tmp = g_strdup_printf("%sdriver", path_hwmon);
+ driver = g_file_read_link(tmp, NULL);
+ g_free(tmp);
+
+ tmp = g_path_get_basename(driver);
+ g_free(driver);
+ driver = tmp;
+
+ if (!sensor_labels) {
+ read_sensor_labels(driver);
+ }
+
+ sensors = g_strdup_printf("%s[Driver Info]\n"
+ "Name=%s\n", sensors, driver);
+
+ sensors = g_strconcat(sensors, "[Cooling Fans]\n", NULL);
+ for (count = 1; ; count++) {
+ path_sensor = g_strdup_printf("%sfan%d_input", path_hwmon, count);
+ if (!g_file_get_contents(path_sensor, &tmp, NULL, NULL)) {
+ g_free(path_sensor);
+ break;
+ }
+
+ mon = g_strdup_printf("fan%d", count);
+ name = get_sensor_label(mon);
+ if (!g_str_equal(name, "ignore")) {
+ sensors = g_strdup_printf("%s%s=%.0fRPM\n",
+ sensors, name,
+ adjust_sensor(mon, atof(tmp)));
+ }
+
+ g_free(name);
+ g_free(mon);
+ g_free(tmp);
+ g_free(path_sensor);
+ }
+
+ sensors = g_strconcat(sensors, "[Temperatures]\n", NULL);
+ for (count = 1; ; count++) {
+ path_sensor = g_strdup_printf("%stemp%d_input", path_hwmon, count);
+ if (!g_file_get_contents(path_sensor, &tmp, NULL, NULL)) {
+ g_free(path_sensor);
+ break;
+ }
+
+ mon = g_strdup_printf("temp%d", count);
+ name = get_sensor_label(mon);
+ if (!g_str_equal(name, "ignore")) {
+ sensors = g_strdup_printf("%s%s=%.2f\302\260C\n",
+ sensors, name,
+ adjust_sensor(mon, atof(tmp) / 1000.0));
+ }
+
+ g_free(tmp);
+ g_free(name);
+ g_free(path_sensor);
+ g_free(mon);
+ }
+
+ sensors = g_strconcat(sensors, "[Voltage Values]\n", NULL);
+ for (count = 0; ; count++) {
+ path_sensor = g_strdup_printf("%sin%d_input", path_hwmon, count);
+ if (!g_file_get_contents(path_sensor, &tmp, NULL, NULL)) {
+ g_free(path_sensor);
+ break;
+ }
+
+
+ mon = g_strdup_printf("in%d", count);
+ name = get_sensor_label(mon);
+ if (!g_str_equal(name, "ignore")) {
+ sensors = g_strdup_printf("%s%s=%.3fV\n",
+ sensors, name,
+ adjust_sensor(mon, atof(tmp) / 1000.0));
+ }
+
+ g_free(tmp);
+ g_free(mon);
+ g_free(name);
+ g_free(path_sensor);
+ }
+
+ g_free(path_hwmon);
+ g_free(driver);
+ path_hwmon = g_strdup_printf("/sys/class/hwmon/hwmon%d/device/", ++hwmon);
+ }
+
+ g_free(path_hwmon);
+}
+
diff --git a/arch/linux/common/.svn/text-base/storage.h.svn-base b/arch/linux/common/.svn/text-base/storage.h.svn-base
new file mode 100644
index 00000000..4fb682a9
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/storage.h.svn-base
@@ -0,0 +1,268 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+static gchar *storage_icons = "";
+
+static gboolean
+remove_scsi_devices(gpointer key, gpointer value, gpointer data)
+{
+ if (!strncmp((gchar *) key, "SCSI", 4)) {
+ g_free((gchar *) key);
+ g_free((GtkTreeIter *) value);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/* SCSI support by Pascal F.Martin <pascalmartin@earthlink.net> */
+void
+scan_scsi(void)
+{
+ FILE *proc_scsi;
+ gchar buffer[256], *buf;
+ gint n = 0;
+ gint scsi_controller;
+ gint scsi_channel;
+ gint scsi_id;
+ gint scsi_lun;
+ gchar *vendor = NULL, *revision = NULL, *model = NULL;
+
+ /* remove old devices from global device table */
+ g_hash_table_foreach_remove(devices, remove_scsi_devices, NULL);
+
+ if (!g_file_test("/proc/scsi/scsi", G_FILE_TEST_EXISTS))
+ return;
+
+ storage_list = g_strconcat(storage_list, "\n[SCSI Disks]\n", NULL);
+
+ proc_scsi = fopen("/proc/scsi/scsi", "r");
+ while (fgets(buffer, 256, proc_scsi)) {
+ buf = g_strstrip(buffer);
+ if (!strncmp(buf, "Host: scsi", 10)) {
+ sscanf(buf,
+ "Host: scsi%d Channel: %d Id: %d Lun: %d",
+ &scsi_controller, &scsi_channel, &scsi_id, &scsi_lun);
+
+ n++;
+ } else if (!strncmp(buf, "Vendor: ", 8)) {
+ char *p;
+ char *rev = strstr(buf, "Rev: ");
+
+ model = strstr(buf, "Model: ");
+
+ if (model == NULL) {
+ model = buf + strlen(buf);
+ }
+ p = model;
+ while (*(--p) == ' ');
+ *(++p) = 0;
+ vendor = g_strdup(buf + 8);
+
+ if (rev != NULL) {
+ revision = g_strdup(rev + 5);
+ } else {
+ rev = model + strlen(model);
+ }
+ p = rev;
+ while (*(--p) == ' ');
+ *(++p) = 0;
+ model = g_strdup_printf("%s %s", vendor, model + 7);
+
+ } else if (!strncmp(buf, "Type: ", 8)) {
+ char *p = strstr(buf, "ANSI SCSI revi");
+ gchar *type = NULL, *icon = NULL;
+
+ if (p != NULL) {
+ while (*(--p) == ' ');
+ *(++p) = 0;
+
+ static struct {
+ char *type;
+ char *label;
+ char *icon;
+ } type2icon[] = {
+ { "Direct-Access", "Disk", "hdd"},
+ { "Sequential-Access", "Tape", "tape"},
+ { "Printer", "Printer", "lpr"},
+ { "WORM", "CD-ROM", "cd"},
+ { "CD-ROM", "CD-ROM", "cd"},
+ { "Scanner", "Scanner", "scanner"},
+ { NULL, "Generic", "scsi"}
+ };
+ int i;
+
+ for (i = 0; type2icon[i].type != NULL; i++)
+ if (!strcmp(buf + 8, type2icon[i].type))
+ break;
+
+ type = type2icon[i].label;
+ icon = type2icon[i].icon;
+ }
+
+ gchar *devid = g_strdup_printf("SCSI%d", n);
+ storage_list = g_strdup_printf("%s$%s$%s=\n", storage_list, devid, model);
+ storage_icons = g_strdup_printf("%sIcon$%s$%s=%s.png\n", storage_icons, devid, model, icon);
+
+ gchar *strhash = g_strdup_printf("[Device Information]\n"
+ "Model=%s\n"
+ "Type=%s\n"
+ "Revision=%s\n"
+ "[SCSI Controller]\n"
+ "Controller=scsi%d\n"
+ "Channel=%d\n"
+ "ID=%d\n" "LUN=%d\n",
+ model,
+ type,
+ revision,
+ scsi_controller,
+ scsi_channel,
+ scsi_id,
+ scsi_lun);
+ g_hash_table_insert(devices, devid, strhash);
+
+ g_free(model);
+ g_free(revision);
+ g_free(vendor);
+ }
+ }
+ fclose(proc_scsi);
+}
+
+static gboolean
+remove_ide_devices(gpointer key, gpointer value, gpointer data)
+{
+ if (!strncmp((gchar *) key, "IDE", 3)) {
+ g_free((gchar *) key);
+ g_free((gchar *) value);
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+void
+scan_ide(void)
+{
+ FILE *proc_ide;
+ gchar *device, iface, *model, *media, *pgeometry = NULL, *lgeometry =
+ NULL;
+ gint n = 0, i = 0, cache;
+
+ /* remove old devices from global device table */
+ g_hash_table_foreach_remove(devices, remove_ide_devices, NULL);
+
+ storage_list = g_strdup_printf("%s\n[IDE Disks]\n", storage_list);
+
+ iface = 'a';
+ for (i = 0; i <= 16; i++) {
+ device = g_strdup_printf("/proc/ide/hd%c/model", iface);
+ if (g_file_test(device, G_FILE_TEST_EXISTS)) {
+ gchar buf[64];
+
+ cache = 0;
+
+ proc_ide = fopen(device, "r");
+ fgets(buf, 64, proc_ide);
+ fclose(proc_ide);
+
+ buf[strlen(buf) - 1] = 0;
+
+ model = g_strdup(buf);
+
+ g_free(device);
+
+ device = g_strdup_printf("/proc/ide/hd%c/media", iface);
+ proc_ide = fopen(device, "r");
+ fgets(buf, 64, proc_ide);
+ fclose(proc_ide);
+ buf[strlen(buf) - 1] = 0;
+
+ media = g_strdup(buf);
+
+ g_free(device);
+
+ device = g_strdup_printf("/proc/ide/hd%c/cache", iface);
+ if (g_file_test(device, G_FILE_TEST_EXISTS)) {
+ proc_ide = fopen(device, "r");
+ fscanf(proc_ide, "%d", &cache);
+ fclose(proc_ide);
+ }
+ g_free(device);
+
+ device = g_strdup_printf("/proc/ide/hd%c/geometry", iface);
+ if (g_file_test(device, G_FILE_TEST_EXISTS)) {
+ gchar *tmp;
+
+ proc_ide = fopen(device, "r");
+
+ fgets(buf, 64, proc_ide);
+ for (tmp = buf; *tmp; tmp++) {
+ if (*tmp >= '0' && *tmp <= '9')
+ break;
+ }
+
+ pgeometry = g_strdup(g_strstrip(tmp));
+
+ fgets(buf, 64, proc_ide);
+ for (tmp = buf; *tmp; tmp++) {
+ if (*tmp >= '0' && *tmp <= '9')
+ break;
+ }
+ lgeometry = g_strdup(g_strstrip(tmp));
+
+ fclose(proc_ide);
+ }
+ g_free(device);
+
+ n++;
+
+ gchar *devid = g_strdup_printf("IDE%d", n);
+
+ storage_list = g_strdup_printf("%s$%s$%s=\n", storage_list,
+ devid, model);
+ storage_icons = g_strdup_printf("%sIcon$%s$%s=%s.png\n", storage_icons, devid,
+ model, g_str_equal(media, "cdrom") ? \
+ "cdrom" : "hdd");
+
+ gchar *strhash = g_strdup_printf("[Device Information]\n"
+ "Model=%s\n"
+ "Device Name=hd%c\n"
+ "Media=%s\n" "Cache=%dkb\n",
+ model, iface, media, cache);
+ if (pgeometry && lgeometry)
+ strhash = g_strdup_printf("%s[Geometry]\n"
+ "Physical=%s\n"
+ "Logical=%s\n",
+ strhash, pgeometry, lgeometry);
+
+ g_hash_table_insert(devices, devid, strhash);
+
+ g_free(model);
+ model = "";
+
+ g_free(pgeometry);
+ pgeometry = NULL;
+ g_free(lgeometry);
+ lgeometry = NULL;
+ } else
+ g_free(device);
+
+ iface++;
+ }
+}
diff --git a/arch/linux/common/.svn/text-base/uptime.h.svn-base b/arch/linux/common/.svn/text-base/uptime.h.svn-base
new file mode 100644
index 00000000..cf339bf3
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/uptime.h.svn-base
@@ -0,0 +1,75 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+static UptimeInfo *
+computer_get_uptime(void)
+{
+ UptimeInfo *ui = g_new0(UptimeInfo, 1);
+ FILE *procuptime;
+ gulong minutes;
+
+ if ((procuptime = fopen("/proc/uptime", "r")) != NULL) {
+ fscanf(procuptime, "%lu", &minutes);
+ ui->minutes = minutes / 60;
+ fclose(procuptime);
+ } else {
+ return NULL;
+ }
+
+ ui->hours = ui->minutes / 60;
+ ui->minutes %= 60;
+ ui->days = ui->hours / 24;
+ ui->hours %= 24;
+
+ return ui;
+}
+
+static gchar *
+computer_get_formatted_uptime()
+{
+ UptimeInfo *ui;
+ gchar *tmp;
+
+ ui = computer_get_uptime();
+
+ /* FIXME: Use ngettext */
+#define plural(x) ((x > 1) ? "s" : "")
+
+
+ if (ui->days < 1) {
+ if (ui->hours < 1) {
+ tmp =
+ g_strdup_printf("%d minute%s", ui->minutes,
+ plural(ui->minutes));
+ } else {
+ tmp =
+ g_strdup_printf("%d hour%s, %d minute%s", ui->hours,
+ plural(ui->hours), ui->minutes,
+ plural(ui->minutes));
+ }
+ } else {
+ tmp =
+ g_strdup_printf("%d day%s, %d hour%s and %d minute%s",
+ ui->days, plural(ui->days), ui->hours,
+ plural(ui->hours), ui->minutes,
+ plural(ui->minutes));
+ }
+
+ g_free(ui);
+ return tmp;
+}
diff --git a/arch/linux/common/.svn/text-base/usb.h.svn-base b/arch/linux/common/.svn/text-base/usb.h.svn-base
new file mode 100644
index 00000000..a52be2cb
--- /dev/null
+++ b/arch/linux/common/.svn/text-base/usb.h.svn-base
@@ -0,0 +1,132 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+static gboolean
+remove_usb_devices(gpointer key, gpointer value, gpointer data)
+{
+ if (!strncmp((gchar *) key, "USB", 3)) {
+ GtkTreeIter *iter = (GtkTreeIter *) data;
+
+ g_free((gchar *) value);
+ g_free(iter);
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static gchar *usb_list = NULL;
+void
+scan_usb(void)
+{
+ FILE *dev;
+ gchar buffer[128];
+ gchar *tmp, *manuf = NULL, *product = NULL, *mxpwr;
+ gint bus, level, port, classid, trash;
+ gint vendor, prodid;
+ gfloat ver, rev, speed;
+ int n = 0;
+
+ dev = fopen("/proc/bus/usb/devices", "r");
+ if (!dev)
+ return;
+
+ if (usb_list) {
+ g_hash_table_foreach_remove(devices, remove_usb_devices, NULL);
+ g_free(usb_list);
+ }
+ usb_list = g_strdup("");
+
+ while (fgets(buffer, 128, dev)) {
+ tmp = buffer;
+
+ switch (*tmp) {
+ case 'T':
+ sscanf(tmp,
+ "T: Bus=%d Lev=%d Prnt=%d Port=%d Cnt=%d Dev#=%d Spd=%f",
+ &bus, &level, &trash, &port, &trash, &trash, &speed);
+ break;
+ case 'D':
+ sscanf(tmp, "D: Ver=%f Cls=%x", &ver, &classid);
+ break;
+ case 'P':
+ sscanf(tmp, "P: Vendor=%x ProdID=%x Rev=%f",
+ &vendor, &prodid, &rev);
+ break;
+ case 'S':
+ if (strstr(tmp, "Manufacturer=")) {
+ manuf = g_strdup(strchr(tmp, '=') + 1);
+ remove_linefeed(manuf);
+ } else if (strstr(tmp, "Product=")) {
+ product = g_strdup(strchr(tmp, '=') + 1);
+ remove_linefeed(product);
+ }
+ break;
+ case 'C':
+ mxpwr = strstr(buffer, "MxPwr=") + 6;
+
+ tmp = g_strdup_printf("USB%d", ++n);
+
+ if (*product == '\0') {
+ g_free(product);
+ if (classid == 9) {
+ product = g_strdup_printf("USB %.2f Hub", ver);
+ } else {
+ product = g_strdup_printf("Unknown USB %.2f Device (class %d)",
+ ver, classid);
+ }
+ }
+
+
+ if (classid == 9) { /* hub */
+ usb_list = g_strdup_printf("%s[%s#%d]\n",
+ usb_list, product, n);
+ } else { /* everything else */
+ usb_list = g_strdup_printf("%s$%s$%s=\n",
+ usb_list, tmp, product);
+
+ gchar *strhash = g_strdup_printf("[Device Information]\n"
+ "Product=%s\n"
+ "Manufacturer=%s\n"
+ "[Port #%d]\n"
+ "Speed=%.2fMbit/s\n"
+ "Max Current=%s\n"
+ "[Misc]\n"
+ "USB Version=%.2f\n"
+ "Revision=%.2f\n"
+ "Class=0x%x\n"
+ "Vendor=0x%x\n"
+ "Product ID=0x%x\n"
+ "Bus=%d\n" "Level=%d\n",
+ product, manuf,
+ port, speed, mxpwr,
+ ver, rev, classid,
+ vendor, prodid, bus, level);
+
+ g_hash_table_insert(devices, tmp, strhash);
+ }
+
+ g_free(manuf);
+ g_free(product);
+ manuf = g_strdup("");
+ product = g_strdup("");
+ }
+ }
+
+ fclose(dev);
+}