From: Randy Dunlap <rdunlap@xenotime.net>

Add '\' search mode to menuconfig.  This is the verbose CONFIG
symbol search mode; '/' is the quieter search mode.
The verbose mode includes this info that the quiet mode drops:
- Selects: or Selected by: lines of output;
- Location of the symbol in the config tree.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
---
 scripts/kconfig/lxdialog/lxdialog.c |   17 +++++++++++++++++
 scripts/kconfig/lxdialog/menubox.c  |    3 +++
 scripts/kconfig/mconf.c             |   32 ++++++++++++++++++++++----------
 3 files changed, 42 insertions(+), 10 deletions(-)

--- linux-2617-rc1.orig/scripts/kconfig/mconf.c
+++ linux-2617-rc1/scripts/kconfig/mconf.c
@@ -176,7 +176,8 @@ menu_instructions[] = N_(
 	"<Enter> selects submenus --->.  "
 	"Highlighted letters are hotkeys.  "
 	"Pressing <Y> includes, <N> excludes, <M> modularizes features.  "
-	"Press <Esc><Esc> to exit, <?> for Help, </> for Search.  "
+	"Press <Esc><Esc> to exit, <?> for Help, <\\> for full Search, "
+	"</> for less verbose Search.  "
 	"Legend: [*] built-in  [ ] excluded  <M> module  < > module capable"),
 radiolist_instructions[] = N_(
 	"Use the arrow keys to navigate this window or "
@@ -255,6 +256,7 @@ search_help[] = N_(
 	"  is located\n"
 	"    A location followed by a [=y] indicate that this is a selectable\n"
 	"    menu item - and current value is displayed inside brackets.\n"
+	"* The following lines are only displayed when using verbose search:\n"
 	"o The 'Selects:' line tell what symbol will be automatically\n"
 	"  selected if this symbol is selected (y or m)\n"
 	"o The 'Selected by' line tell what symbol has selected this symbol\n"
@@ -377,7 +379,7 @@ static int cprint(const char *fmt, ...)
 	return res;
 }
 
-static void get_prompt_str(struct gstr *r, struct property *prop)
+static void get_prompt_str(struct gstr *r, struct property *prop, int verbose)
 {
 	int i, j;
 	struct menu *submenu[8], *menu;
@@ -390,6 +392,9 @@ static void get_prompt_str(struct gstr *
 		expr_gstr_print(prop->visible.expr, r);
 		str_append(r, "\n");
 	}
+	if (!verbose)
+		return;
+
 	menu = prop->menu->parent;
 	for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent)
 		submenu[i++] = menu;
@@ -408,7 +413,7 @@ static void get_prompt_str(struct gstr *
 	}
 }
 
-static void get_symbol_str(struct gstr *r, struct symbol *sym)
+static void get_symbol_str(struct gstr *r, struct symbol *sym, int verbose)
 {
 	bool hit;
 	struct property *prop;
@@ -416,7 +421,10 @@ static void get_symbol_str(struct gstr *
 	str_printf(r, "Symbol: %s [=%s]\n", sym->name,
 	                               sym_get_string_value(sym));
 	for_all_prompts(sym, prop)
-		get_prompt_str(r, prop);
+		get_prompt_str(r, prop, verbose);
+	if (!verbose)
+		goto done;
+
 	hit = false;
 	for_all_properties(sym, prop, P_SELECT) {
 		if (!hit) {
@@ -433,17 +441,18 @@ static void get_symbol_str(struct gstr *
 		expr_gstr_print(sym->rev_dep.expr, r);
 		str_append(r, "\n");
 	}
+done:
 	str_append(r, "\n\n");
 }
 
-static struct gstr get_relations_str(struct symbol **sym_arr)
+static struct gstr get_relations_str(struct symbol **sym_arr, int verbose)
 {
 	struct symbol *sym;
 	struct gstr res = str_new();
 	int i;
 
 	for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
-		get_symbol_str(&res, sym);
+		get_symbol_str(&res, sym, verbose);
 	if (!i)
 		str_append(&res, "No matches found.\n");
 	return res;
@@ -532,7 +541,7 @@ static int exec_conf(void)
 	return WEXITSTATUS(stat);
 }
 
-static void search_conf(void)
+static void search_conf(int verbose)
 {
 	struct symbol **sym_arr;
 	int stat;
@@ -561,7 +570,7 @@ again:
 	}
 
 	sym_arr = sym_re_search(input_buf);
-	res = get_relations_str(sym_arr);
+	res = get_relations_str(sym_arr, verbose);
 	free(sym_arr);
 	show_textbox(_("Search Results"), str_get(&res), 0, 0);
 	str_free(&res);
@@ -833,7 +842,10 @@ static void conf(struct menu *menu)
 				conf(submenu);
 			break;
 		case 7:
-			search_conf();
+			search_conf(0); /* /search is not verbose */
+			break;
+		case 8:
+			search_conf(1); /* \search is verbose */
 			break;
 		}
 	}
@@ -870,7 +882,7 @@ static void show_help(struct menu *menu)
 	} else {
 		str_append(&help, nohelp_text);
 	}
-	get_symbol_str(&help, sym);
+	get_symbol_str(&help, sym, 0);
 	show_helptext(menu_get_prompt(menu), str_get(&help));
 	str_free(&help);
 }
--- linux-2617-rc1.orig/scripts/kconfig/lxdialog/lxdialog.c
+++ linux-2617-rc1/scripts/kconfig/lxdialog/lxdialog.c
@@ -55,6 +55,10 @@ int main(int argc, const char *const *ar
 {
 	int offset = 0, opt_clear = 0, end_common_opts = 0, retval;
 	const char *title = NULL;
+#undef DEBUG
+#ifdef DEBUG
+	FILE *log;
+#endif
 
 #ifdef LOCALE
 	(void)setlocale(LC_ALL, "");
@@ -68,6 +72,16 @@ int main(int argc, const char *const *ar
 		exit(-1);
 	}
 
+#ifdef DEBUG
+	{
+	int ix;
+	log = fopen("lxd.out", "a");
+	for (ix = 0; ix < argc; ix++)
+		fprintf(log, "%s ", argv[ix]);
+	fprintf(log, "\n");
+	}
+#endif
+
 	while (offset < argc - 1 && !end_common_opts) {	/* Common options */
 		if (!strcmp(argv[offset + 1], "--title")) {
 			if (argc - offset < 3 || title != NULL) {
@@ -128,6 +142,9 @@ int main(int argc, const char *const *ar
 	}
 	end_dialog();
 
+#ifdef DEBUG
+	fprintf(log, "lxd: retval = %d\n", retval);
+#endif
 	exit(retval);
 }
 
--- linux-2617-rc1.orig/scripts/kconfig/lxdialog/menubox.c
+++ linux-2617-rc1/scripts/kconfig/lxdialog/menubox.c
@@ -373,6 +373,7 @@ int dialog_menu(const char *title, const
 		case 'n':
 		case 'm':
 		case '/':
+		case '\\':
 			/* save scroll info */
 			if ((f = fopen("lxdialog.scrltmp", "w")) != NULL) {
 				fprintf(f, "%d\n", scroll);
@@ -393,6 +394,8 @@ int dialog_menu(const char *title, const
 				return 6;
 			case '/':
 				return 7;
+			case '\\':
+				return 8;
 			}
 			return 0;
 		case 'h':
