summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@free.fr>2009-04-23 20:08:51 (GMT)
committerErwan Velu <erwan.velu@free.fr>2009-04-23 20:08:51 (GMT)
commit3058efaac90bbc57c1e332a80d76094382cec138 (patch)
treeb7ce400f31246dc8ee9d50a3737ed6b70cedcd8f
parent98bd2d140d31e5ce4b83589a546a70183a22b4e1 (diff)
downloadhdt-3058efaac90bbc57c1e332a80d76094382cec138.zip
hdt-3058efaac90bbc57c1e332a80d76094382cec138.tar.gz
hdt-3058efaac90bbc57c1e332a80d76094382cec138.tar.bz2
hdt-3058efaac90bbc57c1e332a80d76094382cec138.tar.xz
hdt: displaying only populated VPD' items
Impact: No need to display empty items This commit improve VPD menu by not displaying empty items
-rw-r--r--com32/hdt/hdt-menu-vpd.c70
1 files changed, 42 insertions, 28 deletions
diff --git a/com32/hdt/hdt-menu-vpd.c b/com32/hdt/hdt-menu-vpd.c
index 817c107..49caf8e 100644
--- a/com32/hdt/hdt-menu-vpd.c
+++ b/com32/hdt/hdt-menu-vpd.c
@@ -47,54 +47,68 @@ void compute_vpd(struct s_my_menu *menu, struct s_hardware *hardware)
add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
menu->items_count++;
- snprintf(buffer, sizeof buffer, "Bios Build ID : %s",
+ if (strlen(hardware->vpd.bios_build_id) > 0) {
+ snprintf(buffer, sizeof buffer, "Bios Build ID : %s",
hardware->vpd.bios_build_id);
- snprintf(statbuffer, sizeof statbuffer, "Bios Build ID: %s",
+ snprintf(statbuffer, sizeof statbuffer, "Bios Build ID: %s",
hardware->vpd.bios_build_id);
- add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
- menu->items_count++;
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
+ }
- snprintf(buffer, sizeof buffer, "Bios Release Date : %s",
+ if (strlen(hardware->vpd.bios_release_date) > 0) {
+ snprintf(buffer, sizeof buffer, "Bios Release Date : %s",
hardware->vpd.bios_release_date);
- snprintf(statbuffer, sizeof statbuffer, "Bios Release Date: %s",
+ snprintf(statbuffer, sizeof statbuffer, "Bios Release Date: %s",
hardware->vpd.bios_release_date);
- add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
- menu->items_count++;
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
+ }
- snprintf(buffer, sizeof buffer, "Bios Version : %s",
+ if (strlen(hardware->vpd.bios_version) > 0) {
+ snprintf(buffer, sizeof buffer, "Bios Version : %s",
hardware->vpd.bios_version);
- snprintf(statbuffer, sizeof statbuffer, "Bios Version: %s",
+ snprintf(statbuffer, sizeof statbuffer, "Bios Version: %s",
hardware->vpd.bios_version);
- add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
- menu->items_count++;
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
+ }
- snprintf(buffer, sizeof buffer, "Default Flash Filename : %s",
+ if (strlen(hardware->vpd.default_flash_filename) > 0) {
+ snprintf(buffer, sizeof buffer, "Default Flash Filename : %s",
hardware->vpd.default_flash_filename);
- snprintf(statbuffer, sizeof statbuffer, "Default Flash Filename: %s",
+ snprintf(statbuffer, sizeof statbuffer, "Default Flash Filename: %s",
hardware->vpd.default_flash_filename);
- add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
- menu->items_count++;
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
+ }
- snprintf(buffer, sizeof buffer, "Box Serial Number : %s",
+ if (strlen(hardware->vpd.box_serial_number) > 0) {
+ snprintf(buffer, sizeof buffer, "Box Serial Number : %s",
hardware->vpd.box_serial_number);
- snprintf(statbuffer, sizeof statbuffer, "Box Serial Number: %s",
+ snprintf(statbuffer, sizeof statbuffer, "Box Serial Number: %s",
hardware->vpd.box_serial_number);
- add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
- menu->items_count++;
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
+ }
- snprintf(buffer, sizeof buffer, "Motherboard Serial Number: %s",
+ if (strlen(hardware->vpd.motherboard_serial_number) > 0) {
+ snprintf(buffer, sizeof buffer, "Motherboard Serial Number: %s",
hardware->vpd.motherboard_serial_number);
- snprintf(statbuffer, sizeof statbuffer, "Motherboard Serial Number: %s",
+ snprintf(statbuffer, sizeof statbuffer, "Motherboard Serial Number: %s",
hardware->vpd.motherboard_serial_number);
- add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
- menu->items_count++;
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
+ }
- snprintf(buffer, sizeof buffer, "Machine Type/Model : %s",
+ if (strlen(hardware->vpd.machine_type_model) > 0) {
+ snprintf(buffer, sizeof buffer, "Machine Type/Model : %s",
hardware->vpd.machine_type_model);
- snprintf(statbuffer, sizeof statbuffer, "Machine Type/Model: %s",
+ snprintf(statbuffer, sizeof statbuffer, "Machine Type/Model: %s",
hardware->vpd.machine_type_model);
- add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
- menu->items_count++;
+ add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
+ menu->items_count++;
+ }
printf("MENU: VPD menu done (%d items)\n", menu->items_count);
}