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 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'hardinfo2/arch/linux/common/os.h') 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); -- cgit v1.2.3