Menuconfig patch for sound menu

William E. Roadcap (roadcapw@cfw.com)
Wed, 6 Mar 1996 12:42:31 -0500 (EST)


The following patch is for menuconfig in kernel 1.3.71. It will hopefully
help those who are getting a blank menu when trying to configure sound.

The problem was caused by configuration prompts that were too long for
lxdialog to fit on the menu.

For any maintainers who care, menuconfig will now just chop of the ends of
prompts that are too long.

Sorry for any inconvenience this has caused.
___
William E. Roadcap mailto://roadcapw@cfw.com
TITUS Software ftp://titus.cfw.com/pub
Waynesboro, Va (USA) http://www.cfw.com/~roadcapw
............................................................................
--- linux/scripts/lxdialog/menubox.c.orig Wed Mar 6 10:50:21 1996
+++ linux/scripts/lxdialog/menubox.c Wed Mar 6 12:35:31 1996
@@ -30,8 +30,11 @@
print_item (WINDOW * win, const char *item, int choice, int selected, int hotkey)
{
int i, j;
+ char menu_item[menu_width+1];

- j = first_alpha(item);
+ strncpy(menu_item, item, menu_width);
+ menu_item[menu_width] = 0;
+ j = first_alpha(menu_item);

/* Clear 'residue' of last item */
wattrset (win, menubox_attr);
@@ -39,10 +42,10 @@
for (i = 0; i < menu_width; i++)
waddch (win, ' ');
wattrset (win, selected ? item_selected_attr : item_attr);
- mvwaddstr (win, choice, item_x, (char *)item);
+ mvwaddstr (win, choice, item_x, menu_item);
if (hotkey) {
wattrset (win, selected ? tag_key_selected_attr : tag_key_attr);
- mvwaddch(win, choice, item_x+j, item[j]);
+ mvwaddch(win, choice, item_x+j, menu_item[j]);
}
}

@@ -169,7 +172,7 @@
*/
item_x = 0;
for (i = 0; i < item_no; i++) {
- item_x = MAX (item_x, strlen (items[i * 2 + 1]) + 2);
+ item_x = MAX (item_x, MIN(menu_width, strlen (items[i * 2 + 1]) + 2));
if (strcmp(current, items[i*2]) == 0) choice = i;
}