hdt: remove extra LF
authorPierre-Alexandre Meyer <pierre@mouraf.org>
Mon, 7 Sep 2009 21:50:52 +0000 (14:50 -0700)
committerPierre-Alexandre Meyer <pierre@mouraf.org>
Mon, 7 Sep 2009 21:50:52 +0000 (14:50 -0700)
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 <pierre@mouraf.org>
com32/hdt/hdt-common.c
com32/hdt/hdt-common.h
com32/hdt/hdt-menu-kernel.c
com32/hdt/hdt-menu-pci.c
com32/hdt/hdt-menu-summary.c
com32/hdt/hdt-menu-syslinux.c

index 5afb309..8d9cd70 100644 (file)
@@ -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*/
index 8e768f5..0253077 100644 (file)
@@ -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);
index 7e2d6ca..81b44db 100644 (file)
@@ -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,
index 4e0d588..d4a6b7e 100644 (file)
@@ -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,
index 6401221..e8e2fc6 100644 (file)
@@ -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,
index 4c874d0..758274f 100644 (file)
@@ -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++;