diff options
author | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:48 -0500 |
---|---|---|
committer | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:48 -0500 |
commit | 7c47b5b9584f5011aeba18d7e1b26b3d3124825f (patch) | |
tree | 11b07e1c73a22a6ec5ebd710c9a72e972a4c571b /arch/linux | |
parent | 4979bb6cbbbe39eb44c32530cd13f86bf44e5d77 (diff) |
Import Upstream version 0.5.1
Diffstat (limited to 'arch/linux')
-rw-r--r-- | arch/linux/common/alsa.h | 2 | ||||
-rw-r--r-- | arch/linux/common/battery.h | 2 | ||||
-rw-r--r-- | arch/linux/common/dmi.h | 60 | ||||
-rw-r--r-- | arch/linux/common/loadavg.h | 2 | ||||
-rw-r--r-- | arch/linux/common/modules.h | 2 | ||||
-rw-r--r-- | arch/linux/common/os.h | 28 | ||||
-rw-r--r-- | arch/linux/common/pci.h | 2 | ||||
-rw-r--r-- | arch/linux/common/storage.h | 10 | ||||
-rw-r--r-- | arch/linux/common/uptime.h | 2 |
9 files changed, 78 insertions, 32 deletions
diff --git a/arch/linux/common/alsa.h b/arch/linux/common/alsa.h index 5609471c..ddd58edd 100644 --- a/arch/linux/common/alsa.h +++ b/arch/linux/common/alsa.h @@ -60,7 +60,7 @@ computer_get_alsainfo(void) ai->cards = g_slist_append(ai->cards, ac); g_strfreev(tmp); - fgets(buffer, 128, cards); /* skip next line */ + (void)fgets(buffer, 128, cards); /* skip next line */ } fclose(cards); diff --git a/arch/linux/common/battery.h b/arch/linux/common/battery.h index 7dfa5423..d378fdef 100644 --- a/arch/linux/common/battery.h +++ b/arch/linux/common/battery.h @@ -217,7 +217,7 @@ __scan_battery_apm(void) if ((procapm = fopen("/proc/apm", "r"))) { int old_percentage = percentage; - fscanf(procapm, "%s %s %s 0x%x %s %s %d%%", + (void)fscanf(procapm, "%s %s %s 0x%x %s %s %d%%", apm_drv_ver, apm_bios_ver, trash, &ac_bat, trash, trash, &percentage); fclose(procapm); diff --git a/arch/linux/common/dmi.h b/arch/linux/common/dmi.h index f69fdc21..7c5e6e6f 100644 --- a/arch/linux/common/dmi.h +++ b/arch/linux/common/dmi.h @@ -70,16 +70,35 @@ gboolean dmi_get_info_dmidecode() if ((dmi_pipe = popen(temp, "r"))) { g_free(temp); - fgets(buffer, 256, dmi_pipe); + (void)fgets(buffer, 256, dmi_pipe); if (pclose(dmi_pipe)) { dmi_failed = TRUE; break; } - - dmi_info = h_strdup_cprintf("%s=%s\n", - dmi_info, - info->name, - buffer); + + const gchar *url = vendor_get_url(buffer); + if (url) { + const gchar *vendor = vendor_get_name(buffer); + if (g_strstr_len(vendor, -1, g_strstrip(buffer)) || + g_strstr_len(g_strstrip(buffer), -1, vendor)) { + dmi_info = h_strdup_cprintf("%s=%s (%s)\n", + dmi_info, + info->name, + g_strstrip(buffer), + url); + } else { + dmi_info = h_strdup_cprintf("%s=%s (%s, %s)\n", + dmi_info, + info->name, + g_strstrip(buffer), + vendor, url); + } + } else { + dmi_info = h_strdup_cprintf("%s=%s\n", + dmi_info, + info->name, + buffer); + } } else { g_free(temp); dmi_failed = TRUE; @@ -120,13 +139,32 @@ gboolean dmi_get_info_sys() continue; if ((dmi_file = fopen(info->file, "r"))) { - fgets(buffer, 256, dmi_file); + (void)fgets(buffer, 256, dmi_file); fclose(dmi_file); - dmi_info = h_strdup_cprintf("%s=%s\n", - dmi_info, - info->name, - buffer); + const gchar *url = vendor_get_url(buffer); + if (url) { + const gchar *vendor = vendor_get_name(buffer); + if (g_strstr_len(vendor, -1, g_strstrip(buffer)) || + g_strstr_len(g_strstrip(buffer), -1, vendor)) { + dmi_info = h_strdup_cprintf("%s=%s (%s)\n", + dmi_info, + info->name, + g_strstrip(buffer), + url); + } else { + dmi_info = h_strdup_cprintf("%s=%s (%s, %s)\n", + dmi_info, + info->name, + g_strstrip(buffer), + vendor, url); + } + } else { + dmi_info = h_strdup_cprintf("%s=%s\n", + dmi_info, + info->name, + g_strstrip(buffer)); + } } else { dmi_failed = TRUE; break; diff --git a/arch/linux/common/loadavg.h b/arch/linux/common/loadavg.h index 7c028679..ce2d8775 100644 --- a/arch/linux/common/loadavg.h +++ b/arch/linux/common/loadavg.h @@ -23,7 +23,7 @@ computer_get_loadinfo(void) FILE *procloadavg; procloadavg = fopen("/proc/loadavg", "r"); - fscanf(procloadavg, "%f %f %f", &(li->load1), &(li->load5), + (void)fscanf(procloadavg, "%f %f %f", &(li->load1), &(li->load5), &(li->load15)); fclose(procloadavg); diff --git a/arch/linux/common/modules.h b/arch/linux/common/modules.h index 7ea238b7..78fb9de3 100644 --- a/arch/linux/common/modules.h +++ b/arch/linux/common/modules.h @@ -56,7 +56,7 @@ scan_modules_do(void) return; } - fgets(buffer, 1024, lsmod); /* Discards the first line */ + (void)fgets(buffer, 1024, lsmod); /* Discards the first line */ while (fgets(buffer, 1024, lsmod)) { gchar *buf, *strmodule, *hashkey; diff --git a/arch/linux/common/os.h b/arch/linux/common/os.h index 01853123..f3c2c2d8 100644 --- a/arch/linux/common/os.h +++ b/arch/linux/common/os.h @@ -28,11 +28,13 @@ get_default_gcc_version(void) NULL)) { char *return_value; - if (!(return_value = strstr(buf, "gcc version "))) { + if (!(return_value = strstr(buf, "gcc "))) { goto err; } - return_value += sizeof("gcc version"); + return_value = strstr(return_value, " ") + 1; + return_value = strstr(return_value, " ") + 1; + return_value = g_strdup_printf("GNU C Compiler version %s", return_value); g_free(buf); @@ -53,7 +55,7 @@ get_libc_version(void) libc = popen("/lib/libc.so.6", "r"); if (!libc) goto err; - fgets(buf, 256, libc); + (void)fgets(buf, 256, libc); if (pclose(libc)) goto err; tmp = strstr(buf, "version "); @@ -80,7 +82,7 @@ get_os_compiled_date(void) if (!procversion) return g_strdup("Unknown"); - fgets(buf, 512, procversion); + (void)fgets(buf, 512, procversion); fclose(procversion); return g_strdup(buf); @@ -103,7 +105,7 @@ detect_desktop_environment(OperatingSystem * os) obtain the version. */ version = popen("gnome-about --gnome-version", "r"); if (version) { - fscanf(version, "Version: %s", vers); + (void)fscanf(version, "Version: %s", vers); if (pclose(version)) goto unknown; } else { @@ -112,13 +114,19 @@ detect_desktop_environment(OperatingSystem * os) os->desktop = g_strdup_printf("GNOME %s", vers); } else if (g_getenv("KDE_FULL_SESSION")) { - version = popen("kcontrol --version", "r"); + + if (g_getenv("KDE_SESSION_VERSION") && strstr(g_getenv("KDE_SESSION_VERSION"),(gchar *)"4")) { + version = popen("kwin --version", "r"); + } else { + version = popen("kcontrol --version", "r"); + } + if (version) { char buf[32]; - fgets(buf, 32, version); + (void)fgets(buf, 32, version); - fscanf(version, "KDE: %s", vers); + (void)fscanf(version, "KDE: %s", vers); if (pclose(version)) goto unknown; } else { @@ -172,7 +180,7 @@ computer_get_os(void) release = popen("lsb_release -d", "r"); if (release) { - fgets(buffer, 128, release); + (void)fgets(buffer, 128, release); pclose(release); os->distro = buffer; @@ -192,7 +200,7 @@ computer_get_os(void) char buf[128]; distro_ver = fopen(distro_db[i].file, "r"); - fgets(buf, 128, distro_ver); + (void)fgets(buf, 128, distro_ver); fclose(distro_ver); buf[strlen(buf) - 1] = 0; diff --git a/arch/linux/common/pci.h b/arch/linux/common/pci.h index a1ea1021..73d87c7f 100644 --- a/arch/linux/common/pci.h +++ b/arch/linux/common/pci.h @@ -33,7 +33,7 @@ __scan_pci(void) { FILE *lspci; gchar buffer[256], *buf, *strhash = NULL, *strdevice = NULL; - gchar *category = NULL, *name = NULL, *icon, *lspci_path, *command_line; + gchar *category = NULL, *name = NULL, *icon, *lspci_path, *command_line = NULL; gint n = 0, x = 0; if ((lspci_path = find_program("lspci")) == NULL) { diff --git a/arch/linux/common/storage.h b/arch/linux/common/storage.h index 5208f028..06593a09 100644 --- a/arch/linux/common/storage.h +++ b/arch/linux/common/storage.h @@ -180,7 +180,7 @@ __scan_ide_devices(void) cache = 0; proc_ide = fopen(device, "r"); - fgets(buf, 128, proc_ide); + (void)fgets(buf, 128, proc_ide); fclose(proc_ide); buf[strlen(buf) - 1] = 0; @@ -191,7 +191,7 @@ __scan_ide_devices(void) device = g_strdup_printf("/proc/ide/hd%c/media", iface); proc_ide = fopen(device, "r"); - fgets(buf, 128, proc_ide); + (void)fgets(buf, 128, proc_ide); fclose(proc_ide); buf[strlen(buf) - 1] = 0; @@ -257,7 +257,7 @@ __scan_ide_devices(void) 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); + (void)fscanf(proc_ide, "%d", &cache); fclose(proc_ide); } g_free(device); @@ -268,7 +268,7 @@ __scan_ide_devices(void) proc_ide = fopen(device, "r"); - fgets(buf, 64, proc_ide); + (void)fgets(buf, 64, proc_ide); for (tmp = buf; *tmp; tmp++) { if (*tmp >= '0' && *tmp <= '9') break; @@ -276,7 +276,7 @@ __scan_ide_devices(void) pgeometry = g_strdup(g_strstrip(tmp)); - fgets(buf, 64, proc_ide); + (void)fgets(buf, 64, proc_ide); for (tmp = buf; *tmp; tmp++) { if (*tmp >= '0' && *tmp <= '9') break; diff --git a/arch/linux/common/uptime.h b/arch/linux/common/uptime.h index b2412cd2..8fdc3a27 100644 --- a/arch/linux/common/uptime.h +++ b/arch/linux/common/uptime.h @@ -24,7 +24,7 @@ computer_get_uptime(void) gulong minutes; if ((procuptime = fopen("/proc/uptime", "r")) != NULL) { - fscanf(procuptime, "%lu", &minutes); + (void)fscanf(procuptime, "%lu", &minutes); ui->minutes = minutes / 60; fclose(procuptime); } else { |