diff options
author | Sam Ravnborg <sam@mars.ravnborg.org> | 2005-01-05 01:03:52 +0100 |
---|---|---|
committer | Sam Ravnborg <sam@mars.ravnborg.org> | 2005-01-05 01:03:52 +0100 |
commit | a47cfae130bede1a3e7e12715871e95626458f64 (patch) | |
tree | 018b1dea6c40a74dd53c1c4e695a8f706b243062 /scripts | |
parent | 4adf8a9292326a48f39b67cc164168e7301b32fe (diff) | |
download | history-a47cfae130bede1a3e7e12715871e95626458f64.tar.gz |
kconfig: Include more info when selecting help for a symbol in menuconfig
When selecting help on a symbol include information below help text
displaying relevant info that kconf has stored.
The info printed is the same info obtained when searching for a symbol
and the same methods are resued.
Sample (help for "System V IPC"):
-----------------------------------------------------------------------
CONFIG_SYSIPC:
Inter Process Communcation ...
Symbol: SYSVIPC [=y]
Prompt: System V IPC
Defined at init/Kconfig:82
Depends on: MMU
Location:
-> General setup
-----------------------------------------------------------------------
Idea-from: Cal Peake <cp@absolutedigital.net>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/kconfig/mconf.c | 84 |
1 files changed, 45 insertions, 39 deletions
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 9c7742df9bf50f..52af9e1dc890cc 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -260,40 +260,44 @@ static void get_prompt_str(struct gstr *r, struct property *prop) } } +static void get_symbol_str(struct gstr *r, struct symbol *sym) +{ + bool hit; + struct property *prop; + + str_printf(r, "Symbol: %s [=%s]\n", sym->name, + sym_get_string_value(sym)); + for_all_prompts(sym, prop) + get_prompt_str(r, prop); + hit = false; + for_all_properties(sym, prop, P_SELECT) { + if (!hit) { + str_append(r, " Selects: "); + hit = true; + } else + str_printf(r, " && "); + expr_gstr_print(prop->expr, r); + } + if (hit) + str_append(r, "\n"); + if (sym->rev_dep.expr) { + str_append(r, " Selected by: "); + expr_gstr_print(sym->rev_dep.expr, r); + str_append(r, "\n"); + } + str_append(r, "\n\n"); +} + static struct gstr get_relations_str(struct symbol **sym_arr) { struct symbol *sym; - struct property *prop; struct gstr res = str_new(); - struct gstr *r = &res; - bool hit; int i; - for (i = 0; sym_arr && (sym = sym_arr[i]); i++) { - str_printf(&res, "Symbol: %s [=%s]\n", sym->name, - sym_get_string_value(sym)); - for_all_prompts(sym, prop) - get_prompt_str(r, prop); - hit = false; - for_all_properties(sym, prop, P_SELECT) { - if (!hit) { - str_append(r, " Selects: "); - hit = true; - } else - str_printf(r, " && "); - expr_gstr_print(prop->expr, r); - } - if (hit) - str_append(r, "\n"); - if (sym->rev_dep.expr) { - str_append(r, " Selected by: "); - expr_gstr_print(sym->rev_dep.expr, r); - str_append(r, "\n"); - } - str_append(r, "\n\n"); - } + for (i = 0; sym_arr && (sym = sym_arr[i]); i++) + get_symbol_str(&res, sym); if (!i) - str_append(r, "No matches found.\n"); + str_append(&res, "No matches found.\n"); return res; } @@ -705,20 +709,22 @@ static void show_helptext(const char *title, const char *text) static void show_help(struct menu *menu) { - const char *help; - char *helptext; + struct gstr help = str_new(); struct symbol *sym = menu->sym; - help = sym->help; - if (!help) - help = nohelp_text; - if (sym->name) { - helptext = malloc(strlen(sym->name) + strlen(help) + 16); - sprintf(helptext, "CONFIG_%s:\n\n%s", sym->name, help); - show_helptext(menu_get_prompt(menu), helptext); - free(helptext); - } else - show_helptext(menu_get_prompt(menu), help); + if (sym->help) + { + if (sym->name) { + str_printf(&help, "CONFIG_%s:\n\n", sym->name); + str_append(&help, sym->help); + str_append(&help, "\n"); + } + } else { + str_append(&help, nohelp_text); + } + get_symbol_str(&help, sym); + show_helptext(menu_get_prompt(menu), str_get(&help)); + str_free(&help); } static void show_readme(void) |