Skip to contentSkip to conversation

Kconfig choice menu help text is not working in -test8

PATCH New Rob Landley 2 participants 5 messages Oct 25, 2003 – Oct 26, 2003 Kconfig

lore
Share & tools
lore
#0 lore raw

I'm banging away on the bzip patch, adding a choice menu to kconfig for bzip/gzip/uncompressed, and I notice that the help text isn't working right.

To see this bug in action, go to "processor type and features", and descend into the "subarchitecture menu" at the top of it. Pull up the help text on anything, it'll say there's no help available.

Now look at arch/i386/Kconfig, and note that there IS help text for all those menu choices. It's just not displaying it...

Rob

#1 lore raw
Quoted 2 lines · Rob Landley

I'm banging away on the bzip patch, adding a choice menu to kconfig for bzip/gzip/uncompressed, and I notice that the help text isn't working right.

Anders Gustafsson <[email protected]> posted this patch some time ago. I never came around testing it.

Sam

[email protected], 2003-08-24 22:22:55+02:00, [email protected]
Make menuconfig display helptext in "choice" menus.

 kconfig/mconf.c      |   20 ++++++++++++++++----
 lxdialog/checklist.c |    3 ++-
 2 files changed, 18 insertions(+), 5 deletions(-)
scripts/kconfig/mconf.c +16 -4
diff -Nru a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
@@ -607,6 +607,7 @@
 	struct symbol *active;
 	int stat;
 
+	active = sym_get_choice_value(menu->sym);
 	while (1) {
 		cprint_init();
 		cprint("--title");
@@ -618,13 +619,18 @@
 		cprint("6");
 
 		current_menu = menu;
-		active = sym_get_choice_value(menu->sym);
 		for (child = menu->list; child; child = child->next) {
 			if (!menu_is_visible(child))
 				continue;
 			cprint("%p", child);
 			cprint("%s", menu_get_prompt(child));
-			cprint(child->sym == active ? "ON" : "OFF");
+			if (sym_get_choice_value(menu->sym) == child->sym) {
+				cprint("ON");
+			}else if (active== child->sym) {
+				cprint("SELECTED");
+			}else{
+				cprint("OFF");
+			}
 		}
 
 		stat = exec_conf();
@@ -634,9 +640,15 @@
 				break;
 			sym_set_tristate_value(menu->sym, yes);
 			return;
-		case 1:
-			show_help(menu);
+		case 1: {
+			struct menu *tmp;
+			if (sscanf(input_buf, "%p", &tmp) == 1) {
+				show_help(tmp);
+				active=tmp->sym;
+			} else
+				show_help(menu);
 			break;
+		}
 		case 255:
 			return;
 		}
scripts/lxdialog/checklist.c +2 -1
diff -Nru a/scripts/lxdialog/checklist.c b/scripts/lxdialog/checklist.c
@@ -138,7 +138,7 @@
     /* Initializes status */
     for (i = 0; i < item_no; i++) {
 	status[i] = !strcasecmp (items[i * 3 + 2], "on");
-	if (!choice && status[i])
+	if ((!choice && status[i]) || (!strcasecmp (items[i * 3 + 2], "selected")))
             choice = i;
     }
 
@@ -302,6 +302,7 @@
 	case 'H':
 	case 'h':
 	case '?':
+	    fprintf (stderr, "%s", items[(scroll + choice) * 3]);
 	    delwin (dialog);
 	    free (status);
 	    return 1;
#2 lore raw
Quoted 9 lines · Sam Ravnborg
Quoted 3 lines · Rob Landley

I'm banging away on the bzip patch, adding a choice menu to kconfig for bzip/gzip/uncompressed, and I notice that the help text isn't working right.

Anders Gustafsson <[email protected]> posted this patch some time ago. I never came around testing it.

Sam

I just tested it. No effect on this problem, maybe it fixes something else...

(Looking at the patch, it prints stuff to stderr, adds adds a "selected" case to something that was previously on/off... I don't think it's really addressing this issue...)

Rob

#3 lore raw
Quoted 9 lines · Rob Landley
Quoted 8 lines · Sam Ravnborg
Quoted 3 lines · Rob Landley

I'm banging away on the bzip patch, adding a choice menu to kconfig for bzip/gzip/uncompressed, and I notice that the help text isn't working right.

Anders Gustafsson <[email protected]> posted this patch some time ago. I never came around testing it.

Quoted 7 lines
Quoted 1 line

Sam

I just tested it. No effect on this problem, maybe it fixes something else...

(Looking at the patch, it prints stuff to stderr, adds adds a "selected" case to something that was previously on/off... I don't think it's really addressing this issue...)

That explains why Roman Zippel did not apply it - thanks for the testing.

Sam

#4 lore raw

PATCH 1/1 make Kconfig choice menu help text work in -test8

Quoted 7 lines
Quoted 3 lines

(Looking at the patch, it prints stuff to stderr, adds adds a "selected" case to something that was previously on/off... I don't think it's really addressing this issue...)

That explains why Roman Zippel did not apply it - thanks for the testing.

Sam

I had a spare couple of hours this evening, so I whipped up a patch of my own to actually fix the thing, working from first principles and tracing through yacc and lexx code at one point.

With the benefit of hindsight, it turns out the other patch wasn't actually that far off. I only noticed that just now, I had to figure out how mconf.c was shelling out to lxdialog and getting data back on stderr first to realize that yes, printing stuff to stderr is in fact an important part of getting this to work. :)

Here's the fix. Go to into "processor type and features" from the main menu, then the "subarchitecture" menu at the top of that, and notice the entries in it now have help options.

Rob

scripts/kconfig/mconf.c +3 -1
diff -ru linux-2.6.0-test8/scripts/kconfig/mconf.c linux-test8-new/scripts/kconfig/mconf.c
@@ -635,7 +635,9 @@
 			sym_set_tristate_value(menu->sym, yes);
 			return;
 		case 1:
-			show_help(menu);
+			if(sscanf(input_buf, "%p", &child) != 1)
+				break;
+			show_help(child);
 			break;
 		case 255:
 			return;
scripts/lxdialog/checklist.c +8 -7
diff -ru linux-2.6.0-test8/scripts/lxdialog/checklist.c linux-test8-new/scripts/lxdialog/checklist.c
@@ -299,12 +299,6 @@
 	    continue;		/* wait for another key press */
 	}
 	switch (key) {
-	case 'H':
-	case 'h':
-	case '?':
-	    delwin (dialog);
-	    free (status);
-	    return 1;
 	case TAB:
 	case KEY_LEFT:
 	case KEY_RIGHT:
@@ -314,6 +308,11 @@
 	    print_buttons(dialog, height, width, button);
 	    wrefresh (dialog);
 	    break;
+	case 'H':
+	case 'h':
+	case '?':
+	    button=1;
+	    /* Fall through */
 	case 'S':
 	case 's':
 	case ' ':
@@ -347,7 +346,9 @@
 
 		    }
 		}
-            }
+            } else {
+		fprintf(stderr,"%s",items[choice * 3]);
+	    }
 	    delwin (dialog);
 	    free (status);
 	    return button;