hdt: Using del_multi_spaces for the cpu model
authorErwan Velu <erwan.velu@free.fr>
Mon, 30 Nov 2009 11:27:37 +0000 (12:27 +0100)
committerErwan Velu <erwan.velu@free.fr>
Fri, 4 Dec 2009 09:11:16 +0000 (10:11 +0100)
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
com32/hdt/hdt-common.c
com32/hdt/hdt-menu-processor.c

index 2fcea95..683a6b3 100644 (file)
@@ -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);
 
index ce59453..59175ce 100644 (file)
@@ -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;
 }
 
index b2b8614..abb9a1a 100644 (file)
@@ -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++;