From 8e7362ec8fcd84b5c1c95580663bcaf210c3b4ed Mon Sep 17 00:00:00 2001 From: Pierre-Alexandre Meyer Date: Mon, 7 Sep 2009 14:50:52 -0700 Subject: [PATCH] hdt: remove extra LF In a few places, extra LFs cause the menu to scroll ('\n' in the status bar). Remove them (they are not needed anyway). Signed-off-by: Pierre-Alexandre Meyer --- com32/hdt/hdt-common.c | 14 ++++++++++++++ com32/hdt/hdt-common.h | 1 + com32/hdt/hdt-menu-kernel.c | 2 +- com32/hdt/hdt-menu-pci.c | 2 +- com32/hdt/hdt-menu-summary.c | 2 +- com32/hdt/hdt-menu-syslinux.c | 3 ++- 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c index 5afb309..8d9cd70 100644 --- a/com32/hdt/hdt-common.c +++ b/com32/hdt/hdt-common.c @@ -533,6 +533,20 @@ char *remove_spaces(char *p) return p; } +/* remove trailing LF */ +char *remove_trailing_lf(char *p) +{ + char *save=p; + p+=strlen(p)-1; + while (*p && *p == 10) { + *p='\0'; + p--; + } + p=save; + + return p; +} + /* delete multiple spaces, one is enough */ char *del_multi_spaces(char *p) { /* Saving the original pointer*/ diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h index 8e768f5..0253077 100644 --- a/com32/hdt/hdt-common.h +++ b/com32/hdt/hdt-common.h @@ -147,6 +147,7 @@ struct s_hardware { void reset_more_printf(); const char *find_argument(const char **argv, const char *argument); char *remove_spaces(char *p); +char *remove_trailing_lf(char *p); char *skip_spaces(char *p); char *del_multi_spaces(char *p); int detect_dmi(struct s_hardware *hardware); diff --git a/com32/hdt/hdt-menu-kernel.c b/com32/hdt/hdt-menu-kernel.c index 7e2d6ca..81b44db 100644 --- a/com32/hdt/hdt-menu-kernel.c +++ b/com32/hdt/hdt-menu-kernel.c @@ -75,7 +75,7 @@ void compute_kernel(struct s_my_menu *menu, struct s_hardware *hardware) kernel_modules, pci_device->dev_info->class_name); snprintf(infobar, sizeof infobar, - "%04x:%04x %s : %s\n", + "%04x:%04x %s : %s", pci_device->vendor, pci_device->product, pci_device->dev_info->vendor_name, diff --git a/com32/hdt/hdt-menu-pci.c b/com32/hdt/hdt-menu-pci.c index 4e0d588..d4a6b7e 100644 --- a/com32/hdt/hdt-menu-pci.c +++ b/com32/hdt/hdt-menu-pci.c @@ -167,7 +167,7 @@ int compute_PCI(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware) pci_device->dev_info->vendor_name, pci_device->dev_info->product_name); snprintf(infobar[i], STATLEN, - "%02x:%02x.%01x # %s # ID:%04x:%04x[%04x:%04x] # Kmod:%s\n", + "%02x:%02x.%01x # %s # ID:%04x:%04x[%04x:%04x] # Kmod:%s", __pci_bus, __pci_slot, __pci_func, pci_device->dev_info->class_name, pci_device->vendor, pci_device->product, pci_device->sub_vendor, diff --git a/com32/hdt/hdt-menu-summary.c b/com32/hdt/hdt-menu-summary.c index 6401221..e8e2fc6 100644 --- a/com32/hdt/hdt-menu-summary.c +++ b/com32/hdt/hdt-menu-summary.c @@ -189,7 +189,7 @@ void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware) kernel_modules, pci_device->dev_info->class_name); snprintf(statbuffer, sizeof statbuffer, - "%04x:%04x %s : %s\n", + "%04x:%04x %s : %s", pci_device->vendor, pci_device->product, pci_device->dev_info->vendor_name, diff --git a/com32/hdt/hdt-menu-syslinux.c b/com32/hdt/hdt-menu-syslinux.c index 4c874d0..758274f 100644 --- a/com32/hdt/hdt-menu-syslinux.c +++ b/com32/hdt/hdt-menu-syslinux.c @@ -76,8 +76,9 @@ void compute_syslinuxmenu(struct s_my_menu *menu, struct s_hardware *hardware) snprintf(buffer, sizeof buffer, "%s", hardware->sv->copyright_string + 1); + /* Remove the trailing LF in the copyright string to avoid scrolling */ snprintf(statbuffer, sizeof statbuffer, "%s", - hardware->sv->copyright_string + 1); + remove_trailing_lf(hardware->sv->copyright_string + 1)); add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0); menu->items_count++; -- 2.7.4