diff options
author | Pierre-Alexandre Meyer <pierre@mouraf.org> | 2009-03-14 10:13:59 -0700 |
---|---|---|
committer | Pierre-Alexandre Meyer <pierre@mouraf.org> | 2009-03-14 15:27:28 -0700 |
commit | a000236c38990c5dd76694d1988d8505354eefec (patch) | |
tree | fcadaa75f7298448e2b11e4dc0e5a86ac9b3521f /com32/hdt/hdt-menu-summary.c | |
parent | 82600be21cadaa6d4f1330c9b50134fc9dd6df9d (diff) | |
download | syslinux-a000236c38990c5dd76694d1988d8505354eefec.tar.gz |
hdt: Fix indentation in source files
Impact: Cleanups.
Fix indentation in all *.c files by sticking to the Linux style (indent
-linux), using 2 spaces for indentation.
Misc.: Corrected typos in comments, wrapped to 80 characters.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Diffstat (limited to 'com32/hdt/hdt-menu-summary.c')
-rw-r--r-- | com32/hdt/hdt-menu-summary.c | 251 |
1 files changed, 151 insertions, 100 deletions
diff --git a/com32/hdt/hdt-menu-summary.c b/com32/hdt/hdt-menu-summary.c index 9bbefbfe..6401221a 100644 --- a/com32/hdt/hdt-menu-summary.c +++ b/com32/hdt/hdt-menu-summary.c @@ -28,131 +28,182 @@ #include "hdt-menu.h" -/* Computing Summary menu*/ -void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware) { - char buffer[SUBMENULEN+1]; - char statbuffer[STATLEN+1]; +/* Computing Summary menu */ +void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware) +{ + char buffer[SUBMENULEN + 1]; + char statbuffer[STATLEN + 1]; char bank_number[10]; - menu->menu = add_menu(" Summary ",-1); - menu->items_count=0; + menu->menu = add_menu(" Summary ", -1); + menu->items_count = 0; - set_menu_pos(SUBMENU_Y,SUBMENU_X); + set_menu_pos(SUBMENU_Y, SUBMENU_X); - snprintf(buffer,sizeof buffer,"CPU Vendor : %s",hardware->cpu.vendor); - snprintf(statbuffer,sizeof statbuffer,"CPU Vendor: %s",hardware->cpu.vendor); - add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0); + snprintf(buffer, sizeof buffer, "CPU Vendor : %s", + hardware->cpu.vendor); + snprintf(statbuffer, sizeof statbuffer, "CPU Vendor: %s", + hardware->cpu.vendor); + add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); menu->items_count++; - snprintf(buffer,sizeof buffer,"CPU Model : %s",hardware->cpu.model); - snprintf(statbuffer,sizeof statbuffer,"CPU Model: %s",hardware->cpu.model); - add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0); + snprintf(buffer, sizeof buffer, "CPU Model : %s", + hardware->cpu.model); + snprintf(statbuffer, sizeof statbuffer, "CPU Model: %s", + hardware->cpu.model); + add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); menu->items_count++; - add_item("","",OPT_SEP,"",0); + add_item("", "", OPT_SEP, "", 0); if (hardware->is_dmi_valid == true) { - snprintf(buffer,sizeof buffer,"System Vendor : %s",hardware->dmi.system.manufacturer); - snprintf(statbuffer,sizeof statbuffer,"System Vendor: %s",hardware->dmi.system.manufacturer); - add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0); - menu->items_count++; - - snprintf(buffer,sizeof buffer,"System Product: %s",hardware->dmi.system.product_name); - snprintf(statbuffer,sizeof statbuffer,"System Product Name: %s",hardware->dmi.system.product_name); - add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0); - menu->items_count++; - - snprintf(buffer,sizeof buffer,"System Serial : %s",hardware->dmi.system.serial); - snprintf(statbuffer,sizeof statbuffer,"System Serial Number: %s",hardware->dmi.system.serial); - add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0); - menu->items_count++; - - add_item("","",OPT_SEP,"",0); - - snprintf(buffer,sizeof buffer,"Bios Version : %s",hardware->dmi.bios.version); - snprintf(statbuffer,sizeof statbuffer,"Bios Version: %s",hardware->dmi.bios.version); - add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0); - menu->items_count++; - - snprintf(buffer,sizeof buffer,"Bios Release : %s",hardware->dmi.bios.release_date); - snprintf(statbuffer,sizeof statbuffer,"Bios Release Date: %s",hardware->dmi.bios.release_date); - add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0); - menu->items_count++; - - add_item("","",OPT_SEP,"",0); - - for (int i=0;i<hardware->dmi.memory_count;i++) { - if (hardware->dmi.memory[i].filled==true) { + snprintf(buffer, sizeof buffer, "System Vendor : %s", + hardware->dmi.system.manufacturer); + snprintf(statbuffer, sizeof statbuffer, "System Vendor: %s", + hardware->dmi.system.manufacturer); + add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); + menu->items_count++; + + snprintf(buffer, sizeof buffer, "System Product: %s", + hardware->dmi.system.product_name); + snprintf(statbuffer, sizeof statbuffer, + "System Product Name: %s", + hardware->dmi.system.product_name); + add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); + menu->items_count++; + + snprintf(buffer, sizeof buffer, "System Serial : %s", + hardware->dmi.system.serial); + snprintf(statbuffer, sizeof statbuffer, + "System Serial Number: %s", + hardware->dmi.system.serial); + add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); + menu->items_count++; + + add_item("", "", OPT_SEP, "", 0); + + snprintf(buffer, sizeof buffer, "Bios Version : %s", + hardware->dmi.bios.version); + snprintf(statbuffer, sizeof statbuffer, "Bios Version: %s", + hardware->dmi.bios.version); + add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); + menu->items_count++; + + snprintf(buffer, sizeof buffer, "Bios Release : %s", + hardware->dmi.bios.release_date); + snprintf(statbuffer, sizeof statbuffer, "Bios Release Date: %s", + hardware->dmi.bios.release_date); + add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); + menu->items_count++; + + add_item("", "", OPT_SEP, "", 0); + + for (int i = 0; i < hardware->dmi.memory_count; i++) { + if (hardware->dmi.memory[i].filled == true) { /* When discovering the first item, let's clear the screen */ - memset(bank_number,0,sizeof(bank_number)); - snprintf(bank_number,sizeof(bank_number),"%d ",i); - if (strncmp(hardware->dmi.memory[i].size,"Free",4)) { - snprintf(buffer,sizeof buffer,"Mem bank %02d : %s %s@%s", - i,hardware->dmi.memory[i].size, hardware->dmi.memory[i].type, hardware->dmi.memory[i].speed); - snprintf(statbuffer,sizeof statbuffer,"Memory bank %02d : %s %s@%s", - i,hardware->dmi.memory[i].size, hardware->dmi.memory[i].type, hardware->dmi.memory[i].speed); - add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0); - menu->items_count++; - } + memset(bank_number, 0, sizeof(bank_number)); + snprintf(bank_number, sizeof(bank_number), + "%d ", i); + if (strncmp + (hardware->dmi.memory[i].size, "Free", 4)) { + snprintf(buffer, sizeof buffer, + "Mem bank %02d : %s %s@%s", + i, + hardware->dmi.memory[i].size, + hardware->dmi.memory[i].type, + hardware->dmi.memory[i].speed); + snprintf(statbuffer, sizeof statbuffer, + "Memory bank %02d : %s %s@%s", + i, + hardware->dmi.memory[i].size, + hardware->dmi.memory[i].type, + hardware->dmi.memory[i].speed); + add_item(buffer, statbuffer, + OPT_INACTIVE, NULL, 0); + menu->items_count++; + } + } } - } - add_item("","",OPT_SEP,"",0); - } + add_item("", "", OPT_SEP, "", 0); + } - snprintf(buffer,sizeof buffer,"Nb PCI Devices: %d",hardware->nb_pci_devices); - snprintf(statbuffer,sizeof statbuffer,"Number of PCI Devices: %d",hardware->nb_pci_devices); - add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0); + snprintf(buffer, sizeof buffer, "Nb PCI Devices: %d", + hardware->nb_pci_devices); + snprintf(statbuffer, sizeof statbuffer, "Number of PCI Devices: %d", + hardware->nb_pci_devices); + add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); menu->items_count++; - add_item("","",OPT_SEP,"",0); + add_item("", "", OPT_SEP, "", 0); - if (hardware->is_pxe_valid==true) { - struct s_pxe *p = &hardware->pxe; + if (hardware->is_pxe_valid == true) { + struct s_pxe *p = &hardware->pxe; - snprintf(buffer,sizeof buffer, "PXE MAC Address: %s", p->mac_addr); - snprintf(statbuffer,sizeof statbuffer, "PXE MAC Address: %s", p->mac_addr); - add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0); - menu->items_count++; + snprintf(buffer, sizeof buffer, "PXE MAC Address: %s", + p->mac_addr); + snprintf(statbuffer, sizeof statbuffer, "PXE MAC Address: %s", + p->mac_addr); + add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); + menu->items_count++; - snprintf(buffer,sizeof buffer, "PXE IP Address : %d.%d.%d.%d", p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3]); - snprintf(statbuffer,sizeof statbuffer, "PXE IP Address: %d.%d.%d.%d", p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3]); - add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0); - menu->items_count++; + snprintf(buffer, sizeof buffer, "PXE IP Address : %d.%d.%d.%d", + p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], + p->ip_addr[3]); + snprintf(statbuffer, sizeof statbuffer, + "PXE IP Address: %d.%d.%d.%d", p->ip_addr[0], + p->ip_addr[1], p->ip_addr[2], p->ip_addr[3]); + add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); + menu->items_count++; - add_item("","",OPT_SEP,"",0); + add_item("", "", OPT_SEP, "", 0); } if (hardware->modules_pcimap_return_code != -ENOMODULESPCIMAP) { - bool kmod=false; - struct pci_device *pci_device; - char kernel_modules [LINUX_KERNEL_MODULE_SIZE*MAX_KERNEL_MODULES_PER_PCI_DEVICE]; - - /* For every detected pci device, grab its kernel module to compute this submenu */ - for_each_pci_func(pci_device, hardware->pci_domain) { - memset(kernel_modules,0,sizeof kernel_modules); - for (int i=0; i<pci_device->dev_info->linux_kernel_module_count;i++) { - if (i>0) { - strncat(kernel_modules," | ",3); - } - strncat(kernel_modules, pci_device->dev_info->linux_kernel_module[i],LINUX_KERNEL_MODULE_SIZE-1); - } - /* No need to add unknown kernel modules*/ - if (strlen(kernel_modules)>0) { - snprintf(buffer,sizeof buffer,"%s (%s)",kernel_modules, pci_device->dev_info->class_name); - snprintf(statbuffer, sizeof statbuffer,"%04x:%04x %s : %s\n", - pci_device->vendor, pci_device->product, - pci_device->dev_info->vendor_name, - pci_device->dev_info->product_name); - - add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0); - menu->items_count++; - kmod=true; + bool kmod = false; + struct pci_device *pci_device; + char kernel_modules[LINUX_KERNEL_MODULE_SIZE * + MAX_KERNEL_MODULES_PER_PCI_DEVICE]; + + /* + * For every detected pci device, grab its kernel module to compute + * this submenu + */ + for_each_pci_func(pci_device, hardware->pci_domain) { + memset(kernel_modules, 0, sizeof kernel_modules); + for (int i = 0; + i < + pci_device->dev_info->linux_kernel_module_count; + i++) { + if (i > 0) { + strncat(kernel_modules, " | ", 3); } + strncat(kernel_modules, + pci_device->dev_info-> + linux_kernel_module[i], + LINUX_KERNEL_MODULE_SIZE - 1); + } + /* No need to add unknown kernel modules */ + if (strlen(kernel_modules) > 0) { + snprintf(buffer, sizeof buffer, "%s (%s)", + kernel_modules, + pci_device->dev_info->class_name); + snprintf(statbuffer, sizeof statbuffer, + "%04x:%04x %s : %s\n", + pci_device->vendor, + pci_device->product, + pci_device->dev_info->vendor_name, + pci_device->dev_info->product_name); + + add_item(buffer, statbuffer, OPT_INACTIVE, NULL, + 0); + menu->items_count++; + kmod = true; + } } - if (kmod==true) add_item("","",OPT_SEP,"",0); + if (kmod == true) + add_item("", "", OPT_SEP, "", 0); } - printf("MENU: Summary menu done (%d items)\n",menu->items_count); + printf("MENU: Summary menu done (%d items)\n", menu->items_count); } - |