From a3e36f364d45ef282c3eca535a588b292e8509cb Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Mon, 30 Nov 2009 12:27:37 +0100 Subject: [PATCH] hdt: Using del_multi_spaces for the cpu model Impact: avoid multi spaces in the cpu model Some cpu vendors like to put multi spaces in the model name. We don't need it for a cleaner & shorter display --- com32/hdt/hdt-cli-cpu.c | 2 +- com32/hdt/hdt-common.c | 5 +++++ com32/hdt/hdt-menu-processor.c | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/com32/hdt/hdt-cli-cpu.c b/com32/hdt/hdt-cli-cpu.c index 2fcea95..683a6b3 100644 --- a/com32/hdt/hdt-cli-cpu.c +++ b/com32/hdt/hdt-cli-cpu.c @@ -42,7 +42,7 @@ void main_show_cpu(int argc __unused, char **argv __unused, detect_dmi(hardware); more_printf("CPU\n"); more_printf(" Manufacturer : %s \n", hardware->cpu.vendor); - more_printf(" Product : %s \n", del_multi_spaces(hardware->cpu.model)); + more_printf(" Product : %s \n", hardware->cpu.model); more_printf(" CPU Cores : %d \n", hardware->cpu.num_cores); more_printf(" L2 Cache : %dK\n", hardware->cpu.l2_cache_size); diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c index ce59453..59175ce 100644 --- a/com32/hdt/hdt-common.c +++ b/com32/hdt/hdt-common.c @@ -535,6 +535,11 @@ void cpu_detect(struct s_hardware *hardware) if (strlen(remove_spaces(hardware->cpu.model)) == 0) strncpy(hardware->cpu.model, hardware->dmi.processor.version, sizeof(hardware->cpu.model)); + + /* Some CPUs like to put many spaces in the model name + * That makes some weird display in console/menu + * Let's remove that mulitple spaces */ + strncpy(hardware->cpu.model,del_multi_spaces(hardware->cpu.model),sizeof(hardware->cpu.model)); hardware->cpu_detection = true; } diff --git a/com32/hdt/hdt-menu-processor.c b/com32/hdt/hdt-menu-processor.c index b2b8614..abb9a1a 100644 --- a/com32/hdt/hdt-menu-processor.c +++ b/com32/hdt/hdt-menu-processor.c @@ -64,9 +64,9 @@ void compute_processor(struct s_my_menu *menu, struct s_hardware *hardware) menu->items_count++; snprintf(buffer, sizeof buffer, "Model : %s", - del_multi_spaces(hardware->cpu.model)); + hardware->cpu.model); snprintf(statbuffer, sizeof statbuffer, "Model: %s", - del_multi_spaces(hardware->cpu.model)); + hardware->cpu.model); add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); menu->items_count++; -- 2.7.4