aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro A. F. Pereira <leandro@hardinfo.org>2008-11-01 09:57:15 -0300
committerLeandro A. F. Pereira <leandro@hardinfo.org>2008-11-01 09:57:15 -0300
commitb0b5ac94457ada220fe7fa0664346ef77da241d9 (patch)
tree4ebc8dc5dba6d922f6a402ee06461bd48deb9606
parent26bfbc6e7310f76b8fca6fee2957a74e7fd1feae (diff)
Add GCC version information
-rw-r--r--hardinfo2/arch/linux/common/os.h29
-rw-r--r--hardinfo2/benchmark.c2
-rw-r--r--hardinfo2/computer.c2
-rw-r--r--hardinfo2/computer.h1
4 files changed, 33 insertions, 1 deletions
diff --git a/hardinfo2/arch/linux/common/os.h b/hardinfo2/arch/linux/common/os.h
index 183815a0..5654e8b4 100644
--- a/hardinfo2/arch/linux/common/os.h
+++ b/hardinfo2/arch/linux/common/os.h
@@ -17,6 +17,34 @@
*/
static gchar *
+get_default_gcc_version(void)
+{
+ char *buf;
+
+ if (g_spawn_command_line_sync("gcc -v",
+ NULL,
+ &buf,
+ NULL,
+ NULL)) {
+ char *return_value;
+
+ if (!(return_value = strstr(buf, "gcc version "))) {
+ goto err;
+ }
+
+ return_value += sizeof("gcc version");
+ return_value = g_strdup_printf("GNU C Compiler version %s", return_value);
+
+ g_free(buf);
+
+ return return_value;
+ }
+
+err:
+ return g_strdup("Unknown");
+}
+
+static gchar *
get_libc_version(void)
{
FILE *libc;
@@ -206,6 +234,7 @@ computer_get_os(void)
os->username = g_strdup_printf("%s (%s)",
g_get_user_name(), g_get_real_name());
os->libc = get_libc_version();
+ os->gcc = get_default_gcc_version();
scan_languages(os);
detect_desktop_environment(os);
diff --git a/hardinfo2/benchmark.c b/hardinfo2/benchmark.c
index 746ec12d..cd7b268d 100644
--- a/hardinfo2/benchmark.c
+++ b/hardinfo2/benchmark.c
@@ -135,7 +135,7 @@ gdouble benchmark_parallel_for(guint start, guint end,
g_slist_free(threads);
g_timer_destroy(timer);
- DEBUG("finishing; all threads took %d seconds to finish", elapsed_time);
+ DEBUG("finishing; all threads took %f seconds to finish", elapsed_time);
return elapsed_time;
}
diff --git a/hardinfo2/computer.c b/hardinfo2/computer.c
index 809fc0c0..5c1ae460 100644
--- a/hardinfo2/computer.c
+++ b/hardinfo2/computer.c
@@ -258,6 +258,7 @@ gchar *callback_os()
"Kernel=%s\n"
"Compiled=%s\n"
"C Library=%s\n"
+ "Default C Compiler=%s\n"
"Distribution=%s\n"
"[Current Session]\n"
"Computer Name=%s\n"
@@ -271,6 +272,7 @@ gchar *callback_os()
computer->os->kernel,
computer->os->compiled_date,
computer->os->libc,
+ computer->os->gcc,
computer->os->distro,
computer->os->hostname,
computer->os->username,
diff --git a/hardinfo2/computer.h b/hardinfo2/computer.h
index b4715641..b2874c69 100644
--- a/hardinfo2/computer.h
+++ b/hardinfo2/computer.h
@@ -135,6 +135,7 @@ struct _Processor {
struct _OperatingSystem {
gchar *kernel;
gchar *libc;
+ gchar *gcc;
gchar *distrocode, *distro;
gchar *hostname;
gchar *language;