From 9ed3df89eb355c0e55d1157961516f02a4d1836f Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Thu, 16 Apr 2009 22:48:14 +0200 Subject: [PATCH] hdt: Improving more_printf & clear_screen management Impact: greatly improve user experience This commit adds more coherency in more_printf & clear_screen usage --- com32/hdt/hdt-cli-cpu.c | 2 +- com32/hdt/hdt-cli-dmi.c | 168 +++++++++++++++++++++---------------------- com32/hdt/hdt-cli-hdt.c | 26 +++---- com32/hdt/hdt-cli-kernel.c | 6 +- com32/hdt/hdt-cli-pci.c | 61 ++++++++-------- com32/hdt/hdt-cli-pxe.c | 16 ++--- com32/hdt/hdt-cli-syslinux.c | 12 ++-- com32/hdt/hdt-cli-vesa.c | 30 ++++---- com32/hdt/hdt-cli.c | 48 ++++++------- com32/hdt/hdt-common.c | 2 +- 10 files changed, 181 insertions(+), 190 deletions(-) diff --git a/com32/hdt/hdt-cli-cpu.c b/com32/hdt/hdt-cli-cpu.c index 9aea114..f12201c 100644 --- a/com32/hdt/hdt-cli-cpu.c +++ b/com32/hdt/hdt-cli-cpu.c @@ -65,7 +65,7 @@ static void show_cpu(int argc __unused, char **argv __unused, { char buffer[81]; char buffer1[81]; - clear_screen(); + reset_more_printf(); more_printf("CPU\n"); more_printf("Vendor : %s\n", hardware->cpu.vendor); more_printf("Model : %s\n", hardware->cpu.model); diff --git a/com32/hdt/hdt-cli-dmi.c b/com32/hdt/hdt-cli-dmi.c index 82b326d..bea852d 100644 --- a/com32/hdt/hdt-cli-dmi.c +++ b/com32/hdt/hdt-cli-dmi.c @@ -40,38 +40,38 @@ static void show_dmi_modules(int argc __unused, char** argv __unused, char available_dmi_commands[1024]; memset(available_dmi_commands, 0, sizeof(available_dmi_commands)); - more_printf("Available DMI modules on your system:\n"); + printf("Available DMI modules on your system:\n"); if (hardware->dmi.base_board.filled == true) - more_printf("\t%s\n", CLI_DMI_BASE_BOARD); + printf("\t%s\n", CLI_DMI_BASE_BOARD); if (hardware->dmi.battery.filled == true) - more_printf("\t%s\n", CLI_DMI_BATTERY); + printf("\t%s\n", CLI_DMI_BATTERY); if (hardware->dmi.bios.filled == true) - more_printf("\t%s\n", CLI_DMI_BIOS); + printf("\t%s\n", CLI_DMI_BIOS); if (hardware->dmi.chassis.filled == true) - more_printf("\t%s\n", CLI_DMI_CHASSIS); + printf("\t%s\n", CLI_DMI_CHASSIS); for (int i = 0; i < hardware->dmi.memory_count; i++) { if (hardware->dmi.memory[i].filled == true) { - more_printf("\tbank \n", CLI_DMI_MEMORY); + printf("\tbank \n"); break; } } if (hardware->dmi.processor.filled == true) - more_printf("\t%s\n", CLI_DMI_PROCESSOR); + printf("\t%s\n", CLI_DMI_PROCESSOR); if (hardware->dmi.system.filled == true) - more_printf("\t%s\n", CLI_DMI_SYSTEM); + printf("\t%s\n", CLI_DMI_SYSTEM); if (hardware->dmi.ipmi.filled == true) - more_printf("\t%s\n", CLI_DMI_IPMI); + printf("\t%s\n", CLI_DMI_IPMI); } static void show_dmi_base_board(int argc __unused, char** argv __unused, struct s_hardware *hardware) { if (hardware->dmi.base_board.filled == false) { - more_printf("base_board information not found on your system, see " + printf("base_board information not found on your system, see " "`show list' to see which module is available.\n"); return; } - clear_screen(); + reset_more_printf(); more_printf("Base board\n"); more_printf(" Manufacturer : %s\n", hardware->dmi.base_board.manufacturer); @@ -93,31 +93,30 @@ static void show_dmi_system(int argc __unused, char** argv __unused, struct s_hardware *hardware) { if (hardware->dmi.system.filled == false) { - more_printf("system information not found on your system, see " + printf("system information not found on your system, see " "`show list' to see which module is available.\n"); return; } - clear_screen(); - more_printf("System\n"); - more_printf(" Manufacturer : %s\n", hardware->dmi.system.manufacturer); - more_printf(" Product Name : %s\n", hardware->dmi.system.product_name); - more_printf(" Version : %s\n", hardware->dmi.system.version); - more_printf(" Serial : %s\n", hardware->dmi.system.serial); - more_printf(" UUID : %s\n", hardware->dmi.system.uuid); - more_printf(" Wakeup Type : %s\n", hardware->dmi.system.wakeup_type); - more_printf(" SKU Number : %s\n", hardware->dmi.system.sku_number); - more_printf(" Family : %s\n", hardware->dmi.system.family); + printf("System\n"); + printf(" Manufacturer : %s\n", hardware->dmi.system.manufacturer); + printf(" Product Name : %s\n", hardware->dmi.system.product_name); + printf(" Version : %s\n", hardware->dmi.system.version); + printf(" Serial : %s\n", hardware->dmi.system.serial); + printf(" UUID : %s\n", hardware->dmi.system.uuid); + printf(" Wakeup Type : %s\n", hardware->dmi.system.wakeup_type); + printf(" SKU Number : %s\n", hardware->dmi.system.sku_number); + printf(" Family : %s\n", hardware->dmi.system.family); } static void show_dmi_bios(int argc __unused, char** argv __unused, struct s_hardware *hardware) { if (hardware->dmi.bios.filled == false) { - more_printf("bios information not found on your system, see " + printf("bios information not found on your system, see " "`show list' to see which module is available.\n"); return; } - clear_screen(); + reset_more_printf(); more_printf("BIOS\n"); more_printf(" Vendor : %s\n", hardware->dmi.bios.vendor); more_printf(" Version : %s\n", hardware->dmi.bios.version); @@ -164,29 +163,28 @@ static void show_dmi_chassis(int argc __unused, char** argv __unused, "`show list' to see which module is available.\n"); return; } - clear_screen(); - more_printf("Chassis\n"); - more_printf(" Manufacturer : %s\n", + printf("Chassis\n"); + printf(" Manufacturer : %s\n", hardware->dmi.chassis.manufacturer); - more_printf(" Type : %s\n", hardware->dmi.chassis.type); - more_printf(" Lock : %s\n", hardware->dmi.chassis.lock); - more_printf(" Version : %s\n", + printf(" Type : %s\n", hardware->dmi.chassis.type); + printf(" Lock : %s\n", hardware->dmi.chassis.lock); + printf(" Version : %s\n", hardware->dmi.chassis.version); - more_printf(" Serial : %s\n", hardware->dmi.chassis.serial); - more_printf(" Asset Tag : %s\n", + printf(" Serial : %s\n", hardware->dmi.chassis.serial); + printf(" Asset Tag : %s\n", hardware->dmi.chassis.asset_tag); - more_printf(" Boot up state : %s\n", + printf(" Boot up state : %s\n", hardware->dmi.chassis.boot_up_state); - more_printf(" Power supply state : %s\n", + printf(" Power supply state : %s\n", hardware->dmi.chassis.power_supply_state); - more_printf(" Thermal state : %s\n", + printf(" Thermal state : %s\n", hardware->dmi.chassis.thermal_state); - more_printf(" Security Status : %s\n", + printf(" Security Status : %s\n", hardware->dmi.chassis.security_status); - more_printf(" OEM Information : %s\n", + printf(" OEM Information : %s\n", hardware->dmi.chassis.oem_information); - more_printf(" Height : %u\n", hardware->dmi.chassis.height); - more_printf(" NB Power Cords : %u\n", + printf(" Height : %u\n", hardware->dmi.chassis.height); + printf(" NB Power Cords : %u\n", hardware->dmi.chassis.nb_power_cords); } @@ -197,22 +195,21 @@ static void show_dmi_ipmi(int argc __unused, char **argv __unused, more_printf("IPMI module not available\n"); return; } - clear_screen(); - more_printf("IPMI\n"); - more_printf(" Interface Type : %s\n", + printf("IPMI\n"); + printf(" Interface Type : %s\n", hardware->dmi.ipmi.interface_type); - more_printf(" Specification Ver. : %u.%u\n", + printf(" Specification Ver. : %u.%u\n", hardware->dmi.ipmi.major_specification_version, hardware->dmi.ipmi.minor_specification_version); - more_printf(" I2C Slave Address : 0x%02x\n", + printf(" I2C Slave Address : 0x%02x\n", hardware->dmi.ipmi.I2C_slave_address); - more_printf(" Nv Storage Address : %u\n", + printf(" Nv Storage Address : %u\n", hardware->dmi.ipmi.nv_address); uint32_t high = hardware->dmi.ipmi.base_address >> 32; uint32_t low = hardware->dmi.ipmi.base_address & 0xFFFF; - more_printf(" Base Address : %08X%08X\n", + printf(" Base Address : %08X%08X\n", high,(low & ~1)); - more_printf(" IRQ : %d\n", + printf(" IRQ : %d\n", hardware->dmi.ipmi.irq); } @@ -220,32 +217,31 @@ static void show_dmi_battery(int argc __unused, char** argv __unused, struct s_hardware *hardware) { if (hardware->dmi.battery.filled == false) { - more_printf("battery information not found on your system, see " + printf("battery information not found on your system, see " "`show list' to see which module is available.\n"); return; } - clear_screen(); - more_printf("Battery \n"); - more_printf(" Vendor : %s\n", + printf("Battery \n"); + printf(" Vendor : %s\n", hardware->dmi.battery.manufacturer); - more_printf(" Manufacture Date : %s\n", + printf(" Manufacture Date : %s\n", hardware->dmi.battery.manufacture_date); - more_printf(" Serial : %s\n", hardware->dmi.battery.serial); - more_printf(" Name : %s\n", hardware->dmi.battery.name); - more_printf(" Chemistry : %s\n", + printf(" Serial : %s\n", hardware->dmi.battery.serial); + printf(" Name : %s\n", hardware->dmi.battery.name); + printf(" Chemistry : %s\n", hardware->dmi.battery.chemistry); - more_printf(" Design Capacity : %s\n", + printf(" Design Capacity : %s\n", hardware->dmi.battery.design_capacity); - more_printf(" Design Voltage : %s\n", + printf(" Design Voltage : %s\n", hardware->dmi.battery.design_voltage); - more_printf(" SBDS : %s\n", hardware->dmi.battery.sbds); - more_printf(" SBDS Manuf. Date : %s\n", + printf(" SBDS : %s\n", hardware->dmi.battery.sbds); + printf(" SBDS Manuf. Date : %s\n", hardware->dmi.battery.sbds_manufacture_date); - more_printf(" SBDS Chemistry : %s\n", + printf(" SBDS Chemistry : %s\n", hardware->dmi.battery.sbds_chemistry); - more_printf(" Maximum Error : %s\n", + printf(" Maximum Error : %s\n", hardware->dmi.battery.maximum_error); - more_printf(" OEM Info : %s\n", + printf(" OEM Info : %s\n", hardware->dmi.battery.oem_info); } @@ -253,11 +249,11 @@ static void show_dmi_cpu(int argc __unused, char** argv __unused, struct s_hardware *hardware) { if (hardware->dmi.processor.filled == false) { - more_printf("processor information not found on your system, see " + printf("processor information not found on your system, see " "`show list' to see which module is available.\n"); return; } - clear_screen(); + reset_more_printf(); more_printf("CPU\n"); more_printf(" Socket Designation : %s\n", hardware->dmi.processor.socket_designation); @@ -310,51 +306,51 @@ static void show_dmi_cpu(int argc __unused, char** argv __unused, static void show_dmi_memory_bank(int argc, char** argv, struct s_hardware *hardware) { - long bank = -1; + int bank = -1; /* Sanitize arguments */ if (argc > 0) bank = strtol(argv[0], (char **)NULL, 10); if (errno == ERANGE || bank < 0) { - more_printf("This bank number is incorrect\n"); + printf("This bank number is incorrect\n"); return; } if ((bank >= hardware->dmi.memory_count) || (bank < 0)) { - more_printf("Bank %d number doesn't exists\n", bank); + printf("Bank %d number doesn't exists\n", bank); return; } if (hardware->dmi.memory[bank].filled == false) { - more_printf("Bank %d doesn't contain any information\n", bank); + printf("Bank %d doesn't contain any information\n", bank); return; } - more_printf("Memory Bank %d\n", bank); - more_printf(" Form Factor : %s\n", + printf("Memory Bank %d\n", bank); + printf(" Form Factor : %s\n", hardware->dmi.memory[bank].form_factor); - more_printf(" Type : %s\n", hardware->dmi.memory[bank].type); - more_printf(" Type Detail : %s\n", + printf(" Type : %s\n", hardware->dmi.memory[bank].type); + printf(" Type Detail : %s\n", hardware->dmi.memory[bank].type_detail); - more_printf(" Speed : %s\n", hardware->dmi.memory[bank].speed); - more_printf(" Size : %s\n", hardware->dmi.memory[bank].size); - more_printf(" Device Set : %s\n", + printf(" Speed : %s\n", hardware->dmi.memory[bank].speed); + printf(" Size : %s\n", hardware->dmi.memory[bank].size); + printf(" Device Set : %s\n", hardware->dmi.memory[bank].device_set); - more_printf(" Device Loc. : %s\n", + printf(" Device Loc. : %s\n", hardware->dmi.memory[bank].device_locator); - more_printf(" Bank Locator : %s\n", + printf(" Bank Locator : %s\n", hardware->dmi.memory[bank].bank_locator); - more_printf(" Total Width : %s\n", + printf(" Total Width : %s\n", hardware->dmi.memory[bank].total_width); - more_printf(" Data Width : %s\n", + printf(" Data Width : %s\n", hardware->dmi.memory[bank].data_width); - more_printf(" Error : %s\n", hardware->dmi.memory[bank].error); - more_printf(" Vendor : %s\n", + printf(" Error : %s\n", hardware->dmi.memory[bank].error); + printf(" Vendor : %s\n", hardware->dmi.memory[bank].manufacturer); - more_printf(" Serial : %s\n", hardware->dmi.memory[bank].serial); - more_printf(" Asset Tag : %s\n", + printf(" Serial : %s\n", hardware->dmi.memory[bank].serial); + printf(" Asset Tag : %s\n", hardware->dmi.memory[bank].asset_tag); - more_printf(" Part Number : %s\n", + printf(" Part Number : %s\n", hardware->dmi.memory[bank].part_number); } @@ -365,10 +361,10 @@ void main_show_dmi(int argc __unused, char **argv __unused, detect_dmi(hardware); if (hardware->is_dmi_valid == false) { - more_printf("No valid DMI table found, exiting.\n"); + printf("No valid DMI table found, exiting.\n"); return; } - more_printf("DMI Table version %d.%d found\n", + printf("DMI Table version %d.%d found\n", hardware->dmi.dmitable.major_version, hardware->dmi.dmitable.minor_version); diff --git a/com32/hdt/hdt-cli-hdt.c b/com32/hdt/hdt-cli-hdt.c index cc7b30b..abbfe44 100644 --- a/com32/hdt/hdt-cli-hdt.c +++ b/com32/hdt/hdt-cli-hdt.c @@ -52,7 +52,7 @@ static void main_show_modes(int argc __unused, char** argv __unused, { int i; - more_printf("Available modes:\n"); + printf("Available modes:\n"); for (i = 0; i < MAX_MODES; i++) more_printf("\t%s\n", list_modes[i]->name); } @@ -68,7 +68,7 @@ static void cli_set_mode(int argc, char **argv, cli_mode_t new_mode; if (argc <= 0) { - more_printf("Which mode?\n"); + printf("Which mode?\n"); return; } @@ -114,7 +114,7 @@ static void show_cli_help(int argc __unused, char** argv __unused, find_cli_mode_descr(hdt_cli.mode, ¤t_mode); - more_printf("Available commands are:\n"); + printf("Available commands are:\n"); /* List first default modules of the mode */ if (current_mode->default_modules != NULL ) { @@ -128,7 +128,7 @@ static void show_cli_help(int argc __unused, char** argv __unused, /* List secondly the show modules of the mode */ if (current_mode->show_modules != NULL && current_mode->show_modules->nb_modules != 0) { - more_printf("show commands:\n"); + printf("show commands:\n"); for (j = 0; j < current_mode->show_modules->nb_modules; j++) more_printf("\t%s\n", current_mode->show_modules->modules[j].name); @@ -137,7 +137,7 @@ static void show_cli_help(int argc __unused, char** argv __unused, /* List thirdly the set modules of the mode */ if (current_mode->set_modules != NULL && current_mode->set_modules->nb_modules != 0) { - more_printf("set commands:\n"); + printf("set commands:\n"); for (j = 0; j < current_mode->set_modules->nb_modules; j++) more_printf("\t%s\n", current_mode->set_modules->modules[j].name); @@ -158,10 +158,10 @@ static void show_cli_help(int argc __unused, char** argv __unused, current_mode->default_modules, &associated_module); if (associated_module == NULL) - more_printf("%s ", + printf("%s ", hdt_mode.default_modules->modules[j].name); } - more_printf("\n"); + printf("\n"); } main_show_modes(argc, argv, hardware); @@ -219,14 +219,14 @@ void main_show_summary(int argc __unused, char **argv __unused, void main_show_hdt(int argc __unused, char **argv __unused, struct s_hardware *hardware __unused) { - more_printf("HDT\n"); - more_printf(" Product : %s\n", PRODUCT_NAME); - more_printf(" Version : %s\n", VERSION); - more_printf(" Author : %s\n", AUTHOR); - more_printf(" Contact : %s\n", CONTACT); + printf("HDT\n"); + printf(" Product : %s\n", PRODUCT_NAME); + printf(" Version : %s\n", VERSION); + printf(" Author : %s\n", AUTHOR); + printf(" Contact : %s\n", CONTACT); char *contributors[NB_CONTRIBUTORS] = CONTRIBUTORS; for (int c = 0; c < NB_CONTRIBUTORS; c++) { - more_printf(" Contributor : %s\n", contributors[c]); + printf(" Contributor : %s\n", contributors[c]); } } diff --git a/com32/hdt/hdt-cli-kernel.c b/com32/hdt/hdt-cli-kernel.c index 700f238..00dd02d 100644 --- a/com32/hdt/hdt-cli-kernel.c +++ b/com32/hdt/hdt-cli-kernel.c @@ -104,13 +104,13 @@ static void show_kernel_modules(int argc __unused, char **argv __unused, if (hardware->pci_ids_return_code == -ENOPCIIDS) { nopciids = true; - more_printf(" Missing pci.ids, we can't compute the list\n"); + printf(" Missing pci.ids, we can't compute the list\n"); return; } if (hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP) { nomodulespcimap = true; - more_printf + printf (" Missing modules.pcimap, we can't compute the list\n"); return; } @@ -141,7 +141,7 @@ static void show_kernel_modules(int argc __unused, char **argv __unused, /* Print the found items */ for (int i = 0; i < MAX_PCI_CLASSES; i++) { if (strlen(category_name[i]) > 1) { - more_printf("%s : %s\n", category_name[i], modules[i]); + printf("%s : %s\n", category_name[i], modules[i]); } } } diff --git a/com32/hdt/hdt-cli-pci.c b/com32/hdt/hdt-cli-pci.c index a1b64c4..15ea017 100644 --- a/com32/hdt/hdt-cli-pci.c +++ b/com32/hdt/hdt-cli-pci.c @@ -47,7 +47,7 @@ static void show_pci_device(int argc, char **argv, { int i = 0; struct pci_device *pci_device = NULL, *temp_pci_device; - long pcidev = -1; + int pcidev = -1; bool nopciids = false; bool nomodulespcimap = false; char kernel_modules[LINUX_KERNEL_MODULE_SIZE * @@ -56,17 +56,17 @@ static void show_pci_device(int argc, char **argv, /* Sanitize arguments */ if (argc <= 0) { - more_printf("show device \n"); + printf("show device \n"); return; } else pcidev = strtol(argv[0], (char **)NULL, 10); if (errno == ERANGE) { - more_printf("This PCI device number is incorrect\n"); + printf("This PCI device number is incorrect\n"); return; } if ((pcidev > hardware->nb_pci_devices) || (pcidev <= 0)) { - more_printf("PCI device %d doesn't exists\n", pcidev); + printf("PCI device %d doesn't exists\n", pcidev); return; } if (hardware->pci_ids_return_code == -ENOPCIIDS) { @@ -87,7 +87,7 @@ static void show_pci_device(int argc, char **argv, } if (pci_device == NULL) { - more_printf("We were enabled to find PCI device %d\n", pcidev); + printf("We were enabled to find PCI device %d\n", pcidev); return; } @@ -104,43 +104,41 @@ static void show_pci_device(int argc, char **argv, if (pci_device->dev_info->linux_kernel_module_count == 0) strlcpy(kernel_modules, "unknown", 7); - clear_screen(); - more_printf("PCI Device %d\n", pcidev); + printf("PCI Device %d\n", pcidev); if (nopciids == false) { - more_printf("Vendor Name : %s\n", + printf("Vendor Name : %s\n", pci_device->dev_info->vendor_name); - more_printf("Product Name : %s\n", + printf("Product Name : %s\n", pci_device->dev_info->product_name); - more_printf("Class Name : %s\n", + printf("Class Name : %s\n", pci_device->dev_info->class_name); } if (nomodulespcimap == false) { - more_printf("Kernel module : %s\n", kernel_modules); + printf("Kernel module : %s\n", kernel_modules); } - more_printf("Vendor ID : %04x\n", pci_device->vendor); - more_printf("Product ID : %04x\n", pci_device->product); - more_printf("SubVendor ID : %04x\n", pci_device->sub_vendor); - more_printf("SubProduct ID : %04x\n", pci_device->sub_product); - more_printf("Class ID : %02x.%02x.%02x\n", pci_device->class[2], + printf("Vendor ID : %04x\n", pci_device->vendor); + printf("Product ID : %04x\n", pci_device->product); + printf("SubVendor ID : %04x\n", pci_device->sub_vendor); + printf("SubProduct ID : %04x\n", pci_device->sub_product); + printf("Class ID : %02x.%02x.%02x\n", pci_device->class[2], pci_device->class[1], pci_device->class[0]); - more_printf("Revision : %02x\n", pci_device->revision); + printf("Revision : %02x\n", pci_device->revision); if ((pci_device->dev_info->irq > 0) && (pci_device->dev_info->irq < 255)) more_printf("IRQ : %0d\n", pci_device->dev_info->irq); - more_printf("Latency : %0d\n", pci_device->dev_info->latency); - more_printf("PCI Bus : %02d\n", bus); - more_printf("PCI Slot : %02d\n", slot); - more_printf("PCI Func : %02d\n", func); + printf("Latency : %0d\n", pci_device->dev_info->latency); + printf("PCI Bus : %02d\n", bus); + printf("PCI Slot : %02d\n", slot); + printf("PCI Func : %02d\n", func); if (hardware->is_pxe_valid == true) { - more_printf("Mac Address : %s\n", hardware->pxe.mac_addr); + printf("Mac Address : %s\n", hardware->pxe.mac_addr); if ((hardware->pxe.pci_device != NULL) && (hardware->pxe.pci_device == pci_device)) - more_printf("PXE : Current boot device\n", - func); + printf("PXE : Current boot device\n"); } } @@ -156,7 +154,7 @@ static void show_pci_devices(int argc __unused, char **argv __unused, char first_line[81]; char second_line[81]; - clear_screen(); + reset_more_printf(); more_printf("%d PCI devices detected\n", hardware->nb_pci_devices); if (hardware->pci_ids_return_code == -ENOPCIIDS) { @@ -216,7 +214,6 @@ static void show_pci_devices(int argc __unused, char **argv __unused, ("%02d: %04x:%04x [%04x:%04x] Kmod:%s\n", i, pci_device->vendor, pci_device->product, pci_device->sub_vendor, - pci_device->sub_product, kernel_modules, pci_device->sub_product, kernel_modules); } } @@ -231,7 +228,7 @@ static void show_pci_irq(int argc __unused, char **argv __unused, struct pci_device *pci_device; bool nopciids = false; - clear_screen(); + reset_more_printf(); more_printf("%d PCI devices detected\n", hardware->nb_pci_devices); more_printf("IRQ : product\n"); more_printf("-------------\n"); @@ -293,20 +290,20 @@ void cli_detect_pci(struct s_hardware *hardware) if (hardware->pci_detection == false) { detect_pci(hardware); if (hardware->pci_ids_return_code == -ENOPCIIDS) { - more_printf + printf ("The pci.ids file is missing, device names can't be computed.\n"); - more_printf("Please put one in same dir as hdt\n"); + printf("Please put one in same dir as hdt\n"); error = true; } if (hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP) { - more_printf + printf ("The modules.pcimap file is missing, device names can't be computed.\n"); - more_printf("Please put one in same dir as hdt\n"); + printf("Please put one in same dir as hdt\n"); error = true; } if (error == true) { char tempbuf[10]; - more_printf("Press enter to continue\n"); + printf("Press enter to continue\n"); fgets(tempbuf, sizeof(tempbuf), stdin); } } diff --git a/com32/hdt/hdt-cli-pxe.c b/com32/hdt/hdt-cli-pxe.c index 601619c..9dd6c84 100644 --- a/com32/hdt/hdt-cli-pxe.c +++ b/com32/hdt/hdt-cli-pxe.c @@ -42,19 +42,19 @@ void main_show_pxe(int argc __unused, char **argv __unused, char buffer[81]; memset(buffer, 0, sizeof(81)); if (hardware->sv->filesystem != SYSLINUX_FS_PXELINUX) { - more_printf("You are not currently using PXELINUX\n"); + printf("You are not currently using PXELINUX\n"); return; } detect_pxe(hardware); - more_printf("PXE\n"); + printf("PXE\n"); if (hardware->is_pxe_valid == false) { - more_printf(" No valid PXE ROM found\n"); + printf(" No valid PXE ROM found\n"); return; } struct s_pxe *p = &hardware->pxe; - more_printf(" PCI device no: %d \n", p->pci_device_pos); + printf(" PCI device no: %d \n", p->pci_device_pos); if (hardware->pci_ids_return_code == -ENOPCIIDS || (p->pci_device == NULL)) { @@ -65,16 +65,16 @@ void main_show_pxe(int argc __unused, char **argv __unused, snprintf(buffer, sizeof(buffer), " PCI Bus pos. : %02x:%02x.%02x\n", p->pci_bus, p->pci_dev, p->pci_func); - more_printf(buffer); + printf(buffer); } else { snprintf(buffer, sizeof(buffer), " Manufacturer : %s \n", p->pci_device->dev_info->vendor_name); - more_printf(buffer); + printf(buffer); snprintf(buffer, sizeof(buffer), " Product : %s \n", p->pci_device->dev_info->product_name); - more_printf(buffer); + printf(buffer); } - more_printf(" Addresses : %d.%d.%d.%d @ %s\n", p->ip_addr[0], + printf(" Addresses : %d.%d.%d.%d @ %s\n", p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3], p->mac_addr); } diff --git a/com32/hdt/hdt-cli-syslinux.c b/com32/hdt/hdt-cli-syslinux.c index 168a3d3..9974182 100644 --- a/com32/hdt/hdt-cli-syslinux.c +++ b/com32/hdt/hdt-cli-syslinux.c @@ -39,12 +39,12 @@ void main_show_syslinux(int argc __unused, char **argv __unused, struct s_hardware *hardware) { - more_printf("SYSLINUX\n"); - more_printf(" Bootloader : %s\n", hardware->syslinux_fs); - more_printf(" Version : %s\n", hardware->sv->version_string + 2); - more_printf(" Version : %u\n", hardware->sv->version); - more_printf(" Max API : %u\n", hardware->sv->max_api); - more_printf(" Copyright : %s\n", hardware->sv->copyright_string + 1); + printf("SYSLINUX\n"); + printf(" Bootloader : %s\n", hardware->syslinux_fs); + printf(" Version : %s\n", hardware->sv->version_string + 2); + printf(" Version : %u\n", hardware->sv->version); + printf(" Max API : %u\n", hardware->sv->max_api); + printf(" Copyright : %s\n", hardware->sv->copyright_string + 1); } struct cli_module_descr syslinux_show_modules = { diff --git a/com32/hdt/hdt-cli-vesa.c b/com32/hdt/hdt-cli-vesa.c index 4234135..1b07351 100644 --- a/com32/hdt/hdt-cli-vesa.c +++ b/com32/hdt/hdt-cli-vesa.c @@ -38,18 +38,18 @@ void main_show_vesa(int argc __unused, char **argv __unused, { detect_vesa(hardware); if (hardware->is_vesa_valid == false) { - more_printf("No VESA BIOS detected\n"); + printf("No VESA BIOS detected\n"); return; } - more_printf("VESA\n"); - more_printf(" Vesa version : %d.%d\n", hardware->vesa.major_version, + printf("VESA\n"); + printf(" Vesa version : %d.%d\n", hardware->vesa.major_version, hardware->vesa.minor_version); - more_printf(" Vendor : %s\n", hardware->vesa.vendor); - more_printf(" Product : %s\n", hardware->vesa.product); - more_printf(" Product rev. : %s\n", hardware->vesa.product_revision); - more_printf(" Software rev.: %s\n", hardware->vesa.software_rev); - more_printf(" Memory (KB) : %d\n", hardware->vesa.total_memory * 64); - more_printf(" Modes : %d\n", hardware->vesa.vmi_count); + printf(" Vendor : %s\n", hardware->vesa.vendor); + printf(" Product : %s\n", hardware->vesa.product); + printf(" Product rev. : %s\n", hardware->vesa.product_revision); + printf(" Software rev.: %d\n", hardware->vesa.software_rev); + printf(" Memory (KB) : %d\n", hardware->vesa.total_memory * 64); + printf(" Modes : %d\n", hardware->vesa.vmi_count); } static void show_vesa_modes(int argc __unused, char **argv __unused, @@ -57,14 +57,12 @@ static void show_vesa_modes(int argc __unused, char **argv __unused, { detect_vesa(hardware); if (hardware->is_vesa_valid == false) { - more_printf("No VESA BIOS detected\n"); + printf("No VESA BIOS detected\n"); return; } - clear_screen(); - more_printf(" ResH. x ResV x Bits : vga= : Vesa Mode\n", - hardware->vesa.vmi_count); - more_printf("----------------------------------------\n", - hardware->vesa.vmi_count); + reset_more_printf(); + printf(" ResH. x ResV x Bits : vga= : Vesa Mode\n"); + printf("----------------------------------------\n"); for (int i = 0; i < hardware->vesa.vmi_count; i++) { struct vesa_mode_info *mi = &hardware->vesa.vmi[i].mi; @@ -73,7 +71,7 @@ static void show_vesa_modes(int argc __unused, char **argv __unused, * We don't need to display that ones. */ if ((mi->h_res == 0) || (mi->v_res == 0)) continue; - more_printf("%5u %5u %3u %3d 0x%04x\n", + printf("%5u %5u %3u %3d 0x%04x\n", mi->h_res, mi->v_res, mi->bpp, hardware->vesa.vmi[i].mode + 0x200, hardware->vesa.vmi[i].mode); diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c index 65d75ac..8700dac 100644 --- a/com32/hdt/hdt-cli.c +++ b/com32/hdt/hdt-cli.c @@ -128,7 +128,7 @@ void set_mode(cli_mode_t mode, struct s_hardware* hardware) break; case PXE_MODE: if (hardware->sv->filesystem != SYSLINUX_FS_PXELINUX) { - more_printf("You are not currently using PXELINUX\n"); + printf("You are not currently using PXELINUX\n"); break; } hdt_cli.mode = mode; @@ -170,7 +170,7 @@ void set_mode(cli_mode_t mode, struct s_hardware* hardware) case DMI_MODE: detect_dmi(hardware); if (!hardware->is_dmi_valid) { - more_printf("No valid DMI table found, exiting.\n"); + printf("No valid DMI table found, exiting.\n"); break; } hdt_cli.mode = mode; @@ -179,16 +179,16 @@ void set_mode(cli_mode_t mode, struct s_hardware* hardware) break; default: /* Invalid mode */ - more_printf("Unknown mode, please choose among:\n"); + printf("Unknown mode, please choose among:\n"); for (i = 0; i < MAX_MODES; i++) - more_printf("\t%s\n", list_modes[i]->name); + printf("\t%s\n", list_modes[i]->name); } find_cli_mode_descr(hdt_cli.mode, ¤t_mode); /* There is not cli_mode_descr struct for the exit mode */ if (current_mode == NULL && hdt_cli.mode != EXIT_MODE) { /* Shouldn't get here... */ - more_printf("!!! BUG: Mode '%d' unknown.\n", hdt_cli.mode); + printf("!!! BUG: Mode '%d' unknown.\n", hdt_cli.mode); } } @@ -445,11 +445,11 @@ static void autocomplete_command(char *command) /* First take care of the two special commands: 'show' and 'set' */ if (strncmp(CLI_SHOW, command, strlen(command)) == 0) { - more_printf("%s\n", CLI_SHOW); + printf("%s\n", CLI_SHOW); autocomplete_add_token_to_list(CLI_SHOW); } if (strncmp(CLI_SET, command, strlen(command)) == 0) { - more_printf("%s\n", CLI_SET); + printf("%s\n", CLI_SET); autocomplete_add_token_to_list(CLI_SET); } @@ -459,7 +459,7 @@ static void autocomplete_command(char *command) */ for (j = 0; j < MAX_MODES; j++) { if (strncmp(list_modes[j]->name, command, strlen(command)) == 0) { - more_printf("%s\n", list_modes[j]->name); + printf("%s\n", list_modes[j]->name); autocomplete_add_token_to_list(list_modes[j]->name); } } @@ -472,7 +472,7 @@ static void autocomplete_command(char *command) if (strncmp(current_mode->default_modules->modules[j].name, command, strlen(command)) == 0) { - more_printf("%s\n", + printf("%s\n", current_mode->default_modules->modules[j].name); autocomplete_add_token_to_list(current_mode->default_modules->modules[j].name); } @@ -500,7 +500,7 @@ static void autocomplete_command(char *command) strncmp(command, hdt_mode.default_modules->modules[j].name, strlen(command)) == 0) { - more_printf("%s\n", + printf("%s\n", hdt_mode.default_modules->modules[j].name); autocomplete_add_token_to_list(hdt_mode.default_modules->modules[j].name); } @@ -527,7 +527,7 @@ static void autocomplete_module(char *command, char* module) if (strncmp(current_mode->show_modules->modules[j].name, module, strlen(module)) == 0) { - more_printf("%s\n", + printf("%s\n", current_mode->show_modules->modules[j].name); sprintf(autocomplete_full_line, "%s %s", CLI_SHOW, current_mode->show_modules->modules[j].name); @@ -539,7 +539,7 @@ static void autocomplete_module(char *command, char* module) if (strncmp(current_mode->set_modules->modules[j].name, module, strlen(module)) == 0) { - more_printf("%s\n", + printf("%s\n", current_mode->set_modules->modules[j].name); sprintf(autocomplete_full_line, "%s %s", CLI_SET, current_mode->set_modules->modules[j].name); @@ -642,7 +642,7 @@ static void exec_command(char *line, return current_module->exec(argc, argv, hardware); } - more_printf("unknown command: '%s'\n", command); + printf("unknown command: '%s'\n", command); return; } @@ -672,7 +672,7 @@ static void exec_command(char *line, return current_module->exec(argc, argv, hardware); } - more_printf("unknown module: '%s'\n", module); + printf("unknown module: '%s'\n", module); return; } else if (!strncmp(command, CLI_SET, sizeof(CLI_SET) - 1)) { @@ -689,12 +689,12 @@ static void exec_command(char *line, return current_module->exec(argc, argv, hardware); } - more_printf("unknown module: '%s'\n", module); + printf("unknown module: '%s'\n", module); return; } - more_printf("I don't understand: '%s'. Try 'help'.\n", line); + printf("I don't understand: '%s'. Try 'help'.\n", line); /* Let's not forget to clean ourselves */ free(command); @@ -708,7 +708,7 @@ static void reset_prompt() { /* No need to display the prompt if we exit */ if (hdt_cli.mode != EXIT_MODE) { - more_printf("%s", hdt_cli.prompt); + printf("%s", hdt_cli.prompt); /* Reset the line */ memset(hdt_cli.input, '\0', MAX_LINE_SIZE); hdt_cli.cursor_pos = 0; @@ -734,11 +734,11 @@ void start_cli_mode(struct s_hardware *hardware) find_cli_mode_descr(hdt_cli.mode, ¤t_mode); if (current_mode == NULL) { /* Shouldn't get here... */ - more_printf("!!! BUG: Mode '%d' unknown.\n", hdt_cli.mode); + printf("!!! BUG: Mode '%d' unknown.\n", hdt_cli.mode); return; } - more_printf("Entering CLI mode\n"); + printf("Entering CLI mode\n"); /* Display the cursor */ display_cursor(true); @@ -764,7 +764,7 @@ void start_cli_mode(struct s_hardware *hardware) break; case KEY_CTRL('c'): - more_printf("\n"); + printf("\n"); reset_prompt(); break; @@ -877,16 +877,16 @@ void start_cli_mode(struct s_hardware *hardware) if (autocomplete_last_seen == NULL) autocomplete_last_seen = autocomplete_head; } else { - more_printf("\n"); + printf("\n"); autocomplete(skip_spaces(hdt_cli.input)); autocomplete_last_seen = autocomplete_head; - more_printf("%s%s", hdt_cli.prompt, hdt_cli.input); + printf("%s%s", hdt_cli.prompt, hdt_cli.input); } break; case KEY_ENTER: - more_printf("\n"); + printf("\n"); if (strlen(remove_spaces(hdt_cli.input)) < 1) { reset_prompt(); break; @@ -953,7 +953,7 @@ void start_cli_mode(struct s_hardware *hardware) break; case KEY_F1: - more_printf("\n"); + printf("\n"); exec_command(CLI_HELP, hardware); reset_prompt(); break; diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c index 388b17c..cb53f9e 100644 --- a/com32/hdt/hdt-common.c +++ b/com32/hdt/hdt-common.c @@ -453,7 +453,7 @@ void clear_screen(void) set_us_g0_charset(); display_cursor(false); clear_entire_screen(); - display_line_nb = 0; + reset_more_printf(); } /* remove begining spaces */ -- 2.7.4