From b0b5ac94457ada220fe7fa0664346ef77da241d9 Mon Sep 17 00:00:00 2001 From: "Leandro A. F. Pereira" Date: Sat, 1 Nov 2008 09:57:15 -0300 Subject: Add GCC version information --- hardinfo2/arch/linux/common/os.h | 29 +++++++++++++++++++++++++++++ hardinfo2/benchmark.c | 2 +- hardinfo2/computer.c | 2 ++ hardinfo2/computer.h | 1 + 4 files changed, 33 insertions(+), 1 deletion(-) 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 @@ -16,6 +16,34 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +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) { @@ -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; -- cgit v1.2.3