diff options
author | Leandro A. F. Pereira <leandro@hardinfo.org> | 2008-11-01 09:57:15 -0300 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2008-11-01 09:57:15 -0300 |
commit | b0b5ac94457ada220fe7fa0664346ef77da241d9 (patch) | |
tree | 4ebc8dc5dba6d922f6a402ee06461bd48deb9606 /hardinfo2/arch/linux/common | |
parent | 26bfbc6e7310f76b8fca6fee2957a74e7fd1feae (diff) |
Add GCC version information
Diffstat (limited to 'hardinfo2/arch/linux/common')
-rw-r--r-- | hardinfo2/arch/linux/common/os.h | 29 |
1 files changed, 29 insertions, 0 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); |