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>
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*/
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);
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,
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,
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,
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++;