diff options
author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2024-04-22 00:35:53 -0300 |
---|---|---|
committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2024-04-22 00:35:53 -0300 |
commit | 5f01c706267c595de92406a32e7f31ef5056c2d0 (patch) | |
tree | d1e74ef54efc41ada622900fe3e2a50dee44a237 /modules/devices/resources.c | |
parent | 09fcc751ef158898c315ebc9299a0fa3a722d914 (diff) |
New upstream version 2.0.3preupstream/2.0.3pre
Diffstat (limited to 'modules/devices/resources.c')
-rw-r--r-- | modules/devices/resources.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/modules/devices/resources.c b/modules/devices/resources.c index 15cb8f21..c9d1ccb5 100644 --- a/modules/devices/resources.c +++ b/modules/devices/resources.c @@ -1,10 +1,10 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2008 Leandro A. F. Pereira <leandro@hardinfo.org> + * Copyright (C) 2003-2008 L. A. F. Pereira <l@tia.mat.br> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 2. + * the Free Software Foundation, version 2 or later. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -37,21 +37,27 @@ static gchar *_resource_obtain_name(gchar *name) 0, 0, NULL); _regex_module = g_regex_new("^[0-9a-zA-Z\\_\\-]+$", 0, 0, NULL); } - + name = g_strstrip(name); - + if (g_regex_match(_regex_pci, name, 0, NULL)) { temp = module_call_method_param("devices::getPCIDeviceDescription", name); if (temp) { + if (params.markup_ok) return g_strdup_printf("<b><small>PCI</small></b> %s", (gchar *)idle_free(temp)); + else + return g_strdup_printf("PCI %s", (gchar *)idle_free(temp)); } } else if (g_regex_match(_regex_module, name, 0, NULL)) { temp = module_call_method_param("computer::getKernelModuleDescription", name); if (temp) { + if (params.markup_ok) return g_strdup_printf("<b><small>Module</small></b> %s", (gchar *)idle_free(temp)); + else + return g_strdup_printf("Module %s", (gchar *)idle_free(temp)); } } - + return g_strdup(name); } #else @@ -66,7 +72,7 @@ void scan_device_resources(gboolean reload) SCAN_START(); FILE *io; gchar buffer[256]; - gint i; + guint i; gint zero_to_zero_addr = 0; struct { @@ -77,10 +83,10 @@ void scan_device_resources(gboolean reload) { "/proc/iomem", "[Memory]\n" }, { "/proc/dma", "[DMA]\n" } }; - + g_free(_resources); _resources = g_strdup(""); - + for (i = 0; i < G_N_ELEMENTS(resources); i++) { if ((io = fopen(resources[i].file, "r"))) { _resources = h_strconcat(_resources, resources[i].description, NULL); @@ -92,8 +98,12 @@ void scan_device_resources(gboolean reload) if (strstr(temp[0], "0000-0000")) zero_to_zero_addr++; - _resources = h_strdup_cprintf("<tt>%s</tt>=%s\n", _resources, - temp[0], name); + if (params.markup_ok) + _resources = h_strdup_cprintf("<tt>%s</tt>=%s\n", _resources, + temp[0], name); + else + _resources = h_strdup_cprintf(">%s=%s\n", _resources, + temp[0], name); g_strfreev(temp); g_free(name); |